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 = {}