From 26b5dc7cd477609865aefc1abc87a80bffb521e9 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Thu, 23 May 2024 11:04:08 +0800 Subject: [PATCH] update --- plugins/mariadb/index.py | 14 +++++++++++++- plugins/mariadb/install.sh | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/mariadb/index.py b/plugins/mariadb/index.py index a7d44280f..15e34f4b6 100755 --- a/plugins/mariadb/index.py +++ b/plugins/mariadb/index.py @@ -2677,13 +2677,25 @@ def doFullSyncUser(version=''): writeDbSyncStatus({'code': 0, 'msg': '开始同步...', 'progress': 0}) writeDbSyncStatus({'code': 1, 'msg': '远程导出数据...', 'progress': 10}) + find_run_dump = mw.execShell('ps -ef | grep mariadb-dump | grep -v grep') + if find_run_dump[0] != "": + print("正在远程导出数据中,别着急...") + writeDbSyncStatus({'code': 3.1, 'msg': '正在远程导出数据中,别着急...', 'progress': 39}) + return False + if not os.path.exists(bak_file): # https://mariadb.com/kb/zh-cn/mariadb-dump/ - dump_sql_data = getServerDir() + "/bin/mariadb-dump -f --default-character-set=utf8 --single-transaction -h" + ip + " -P" + \ + dump_sql_data = getServerDir() + "/bin/mariadb-dump -f --default-character-set=utf8 --single-transaction --compress -q -h" + ip + " -P" + \ port + " -u" + user + " -p'" + apass + "' " + sync_db + ">" + bak_file print(dump_sql_data) mw.execShell(dump_sql_data) + find_run_import = mw.execShell('ps -ef | grep mariadb| grep '+ bak_file +' | grep -v grep') + if find_run_import[0] != "": + print("正在导入数据中,别着急...") + writeDbSyncStatus({'code': 4.1, 'msg': '正在导入数据中,别着急...', 'progress': 99}) + return False + writeDbSyncStatus({'code': 2, 'msg': '本地导入数据...', 'progress': 40}) if os.path.exists(bak_file): pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root') diff --git a/plugins/mariadb/install.sh b/plugins/mariadb/install.sh index 75e693ed7..71d46ea25 100755 --- a/plugins/mariadb/install.sh +++ b/plugins/mariadb/install.sh @@ -7,6 +7,12 @@ rootPath=$(dirname "$curPath") rootPath=$(dirname "$rootPath") serverPath=$(dirname "$rootPath") +# cd /www/server/mdserver-web/plugins/maridb && bash install.sh install 8.2 +# cd /www/server/mdserver-web && source bin/activate && python3 plugins/maridb/index.py try_slave_sync_bugfix {} +# cd /www/server/mdserver-web && source bin/activate && python3 plugins/maridb/index.py do_full_sync {"db":"xxx","sign":"","begin":1} +# cd /www/server/mdserver-web && source bin/activate && python3 plugins/maridb/index.py sync_database_repair {"db":"xxx","sign":""} +# cd /www/server/mdserver-web && source bin/activate && python3 plugins/maridb/index.py init_slave_status +# cd /www/server/mdserver-web && source bin/activate && python3 plugins/maridb/index.py install_pre_inspection install_tmp=${rootPath}/tmp/mw_install.pl