Skip to content

Commit

Permalink
Merge pull request #642 from midoks/dev
Browse files Browse the repository at this point in the history
相关更新
  • Loading branch information
midoks authored Dec 14, 2024
2 parents de351c7 + 16c9029 commit 6c84be1
Show file tree
Hide file tree
Showing 24 changed files with 384 additions and 38 deletions.
3 changes: 3 additions & 0 deletions plugins/dynamic-tracking/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Install_App()
fi
# FlameGraph end

# apt install linux-tools-$(uname -r) linux-tools-generic -y
# apt install linux-tools-$(uname -r) linux-tools-generic -y --fix-missing



shell_file=${curPath}/versions/${OSNAME}.sh
Expand Down
103 changes: 103 additions & 0 deletions plugins/mysql-apt/conf/my9.1.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
[client]
user = root
#password = your_password
port = 33206
socket = {$SERVER_APP_PATH}/mysql.sock
default-character-set = UTF8MB4

[mysqld]
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf

authentication_policy=caching_sha2_password
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
user = mysql
port = 33206
mysqlx_port = 33260
socket = {$SERVER_APP_PATH}/mysql.sock
datadir = {$SERVER_APP_PATH}/data
log-error = {$SERVER_APP_PATH}/data/error.log
server-id = {$SERVER_ID}

default_storage_engine = InnoDB

key_buffer_size = 8M
table_open_cache = 32
sort_buffer_size = 256K
net_buffer_length = 4K
read_buffer_size = 128K
read_rnd_buffer_size = 256K
myisam_sort_buffer_size = 4M
thread_cache_size = 4
lower_case_table_names=1
tmp_table_size = 8M
character-set-server = UTF8MB4

max_connections = 500
max_connect_errors = 100
open_files_limit = 2560
max_allowed_packet = 128M

#skip-external-locking
#skip-grant-tables
#loose-skip-innodb
#skip-networking
#skip-name-resolve

log-bin=mysql-bin
slow_query_log=1
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
long_query_time=3
#log_queries_not_using_indexes=on

relay-log=mdserver
relay-log-index=mdserver

#master
#sync_binlog=1

#binlog-do-db
binlog-ignore-db = test
binlog-ignore-db = mysql
binlog-ignore-db = information_schema
binlog-ignore-db = performance_schema

#slave
log_replica_updates
#replicate-do-db
replica_skip_errors=1062,1396
replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema
replicate-ignore-db = mysql
replicate-ignore-db = test

default_storage_engine = InnoDB
innodb_data_home_dir = {$SERVER_APP_PATH}/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
innodb_buffer_pool_size = 16M
innodb_redo_log_capacity=10485760
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 120
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 1
innodb_write_io_threads = 1
innodb_file_per_table=1
binlog_expire_logs_seconds=2592000

secure-file-priv={$SERVER_APP_PATH}/tmp

[mysqldump]
quick

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout
12 changes: 7 additions & 5 deletions plugins/mysql-apt/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def getShowLogFile():
return tmp.groups()[0].strip()

def getMdb8Ver():
return ['8.0','8.1','8.2','8.3','8.4','9.0']
return ['8.0','8.1','8.2','8.3','8.4','9.0','9.1']

def pGetDbUser():
if mw.isAppleSystem():
Expand All @@ -419,8 +419,8 @@ def initMysql57Data():
cmd = serverdir + '/bin/usr/sbin/mysqld --basedir=' + serverdir + '/bin/usr --datadir=' + \
datadir + ' --initialize-insecure --explicit_defaults_for_timestamp'
data = mw.execShell(cmd)
# print(cmd)
# print(data)
if data[1].lower().find('error') != -1:
exit("Init MySQL5.7 Data Error:"+data[1])

if not mw.isAppleSystem():
mw.execShell('chown -R mysql:mysql ' + datadir)
Expand All @@ -447,8 +447,10 @@ def initMysql8Data():
cmd = serverdir + '/bin/usr/sbin/mysqld --basedir=' + serverdir + '/bin/usr --datadir=' + datadir + \
' --initialize-insecure --lower-case-table-names=1'
data = mw.execShell(cmd)
if data[1].find('ERROR') != -1:
exit("Init MySQL{} Data Error".format(8))
if data[1].lower().find('error') != -1:
exit("Init MySQL8+ Data Error:"+data[1])
if data[1].lower().find('not found') != -1:
exit("Init MySQL8+ Data Error:"+data[1])

if not mw.isAppleSystem():
mw.execShell('chown -R mysql:mysql ' + datadir)
Expand Down
12 changes: 6 additions & 6 deletions plugins/mysql-apt/init.d/mysql5.7.service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
Description=MySQL Community Server
After=network.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql
Type=forking
Type=simple
PermissionsStartOnly=true
#ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf --daemonize
#ExecStartPre={$SERVER_PATH}/mysql-apt/bin/usr/share/mysql/mysql-systemd-start pre
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=600
LimitNOFILE = 5000
Restart=on-failure
RestartPreventExitStatus=1
RuntimeDirectory=mysqld
RuntimeDirectoryMode=755

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion plugins/mysql-apt/init.d/mysql8.0.service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Group=mysql
Type=notify
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=0
TimeoutSec=600
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql-apt/init.d/mysql8.1.service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Group=mysql
Type=notify
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=0
TimeoutSec=600
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql-apt/init.d/mysql8.2.service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Group=mysql
Type=notify
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=0
TimeoutSec=600
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql-apt/init.d/mysql8.3.service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Group=mysql
Type=notify
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=0
TimeoutSec=600
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql-apt/init.d/mysql8.4.service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ User=mysql
Group=mysql
Type=notify
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=0
TimeoutSec=600
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql-apt/init.d/mysql9.0.service.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ User=mysql
Group=mysql
Type=notify
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=0
TimeoutSec=600
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
Expand Down
49 changes: 49 additions & 0 deletions plugins/mysql-apt/init.d/mysql9.1.service.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright (c) 2015, 2022, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

# MySQL systemd service file

[Unit]
Description=MySQL Community Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql
Type=notify
ExecStart={$SERVER_PATH}/mysql-apt/bin/usr/sbin/mysqld --defaults-file={$SERVER_PATH}/mysql-apt/etc/my.cnf
TimeoutSec=600
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1

# Always restart when mysqld exits with exit code of 16. This special exit code
# is used by mysqld for RESTART SQL.
RestartForceExitStatus=16

# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
Environment=MYSQLD_PARENT_PID=1
3 changes: 3 additions & 0 deletions plugins/mysql-apt/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ serverPath=$(dirname "$rootPath")

# https://downloads.mysql.com/archives/community/

# /www/server/mysql-apt/bin/usr/sbin/mysqld --basedir=/www/server/mysql-apt/bin/usr --datadir=/www/server/mysql-apt/data --initialize-insecure --explicit_defaults_for_timestamp


# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh uninstall 8.0
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 5.7
Expand Down
4 changes: 3 additions & 1 deletion plugins/mysql-apt/versions/5.7/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ export DEBIAN_FRONTEND=noninteractive
# https://downloads.mysql.com/archives/community/

# debug
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 5.7
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 5.7
# /www/server/mysql-apt/bin/usr/sbin/mysqld --defaults-file=/www/server/mysql-apt/etc/my.cnf --daemonize
# /www/server/mysql-apt/bin/usr/bin/mysql -S /www/server/mysql-apt/mysql.sock -uroot -p

curPath=`pwd`
rootPath=$(dirname "$curPath")
Expand Down
1 change: 1 addition & 0 deletions plugins/mysql-apt/versions/8.0/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`

# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 8.0

# 暂时debian12没有标准版,先用11使用
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
Expand Down
13 changes: 6 additions & 7 deletions plugins/mysql-apt/versions/8.4/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`

# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.4
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 8.4

# 暂时debian12没有标准版,先用11使用
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
# echo "暂时不支持该${OSNAME}${VERSION_ID}"
# exit 1
# fi
if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" -lt '12' ] ;then
VERSION_ID="12"
fi


ARCH="amd64"
Expand Down Expand Up @@ -111,7 +110,7 @@ Install_mysql()
if [ "$?" == "0" ];then
mkdir -p $serverPath/mysql-apt
echo '8.4' > $serverPath/mysql-apt/version.pl
echo '安装完成' >
echo '安装完成'
else
echo '8.4' > $serverPath/mysql-apt/version.pl
echo "暂时不支持该系统"
Expand Down
7 changes: 3 additions & 4 deletions plugins/mysql-apt/versions/9.0/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.0

# 暂时debian12没有标准版,先用11使用
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
# echo "暂时不支持该${OSNAME}${VERSION_ID}"
# exit 1
# fi
if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" -lt '12' ] ;then
VERSION_ID="12"
fi


ARCH="amd64"
Expand Down
22 changes: 14 additions & 8 deletions plugins/mysql-apt/versions/9.1/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`

# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.0
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 9.1
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.1

# 暂时debian12没有标准版,先用11使用
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then
# echo "暂时不支持该${OSNAME}${VERSION_ID}"
# exit 1
# fi
#x-faq
# strings /lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIB

# debian12
if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" -lt '12' ] ;then
VERSION_ID="12"
fi


ARCH="amd64"
Expand Down Expand Up @@ -53,6 +56,9 @@ SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH}

APT_INSTALL()
{

cd ${rootPath}/plugins/php/lib && /bin/bash openssl_30.sh

########
mkdir -p $myDir
mkdir -p $serverPath/mysql-apt/bin
Expand Down Expand Up @@ -110,10 +116,10 @@ Install_mysql()

if [ "$?" == "0" ];then
mkdir -p $serverPath/mysql-apt
echo '9.0' > $serverPath/mysql-apt/version.pl
echo '9.1' > $serverPath/mysql-apt/version.pl
echo '安装完成'
else
echo '9.0' > $serverPath/mysql-apt/version.pl
echo '9.1' > $serverPath/mysql-apt/version.pl
echo "暂时不支持该系统"
fi
}
Expand Down
Loading

0 comments on commit 6c84be1

Please sign in to comment.