From a68a5e6c8bdad2bad1ab35903fb9c9c3634f8a1d Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 10 Jun 2024 17:08:18 +0800 Subject: [PATCH] update --- plugins/mysql-yum/index.py | 11 ++++++++++- plugins/mysql/index.py | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/mysql-yum/index.py b/plugins/mysql-yum/index.py index a84f86cd3..3d4fdf08e 100755 --- a/plugins/mysql-yum/index.py +++ b/plugins/mysql-yum/index.py @@ -2478,8 +2478,17 @@ def updateSlaveSSH(version=''): def getSlaveList(version=''): + if status(version) == 'stop': + return mw.returnJson(False, 'MySQL未启动', []) + + + query_status_cmd = 'show slave status' + mdb8 = ['8.0','8.1','8.2','8.3','8.4'] + if mw.inArray(mdb8, version): + query_status_cmd = 'show replica status' + db = pMysqlDb() - dlist = db.query('show slave status') + dlist = db.query(query_status_cmd) data = {} data['data'] = dlist return mw.getJson(data) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 6904a3ab9..bea542d7a 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -2689,11 +2689,17 @@ def updateSlaveSSH(version=''): def getSlaveList(version=''): + + query_status_cmd = 'show slave status' + mdb8 = ['8.0','8.1','8.2','8.3','8.4'] + if mw.inArray(mdb8, version): + query_status_cmd = 'show replica status' + if status(version) == 'stop': return mw.returnJson(False, 'MySQL未启动', []) db = pMysqlDb() - dlist = db.query('show slave status') + dlist = db.query(query_status_cmd) # print(dlist) data = {}