mysql-apt添加主从同步功能

This commit is contained in:
midoks
2023-01-01 20:43:00 +08:00
parent 403660c980
commit d9d81ded3d
5 changed files with 591 additions and 15 deletions
+18 -2
View File
@@ -2137,8 +2137,6 @@ def getSlaveList(version=''):
db = pMysqlDb()
dlist = db.query('show slave status')
# print(dlist)
ret = []
for x in range(0, len(dlist)):
tmp = {}
@@ -2148,6 +2146,24 @@ def getSlaveList(version=''):
tmp['Master_Log_File'] = dlist[x]["Master_Log_File"]
tmp['Slave_IO_Running'] = dlist[x]["Slave_IO_Running"]
tmp['Slave_SQL_Running'] = dlist[x]["Slave_SQL_Running"]
tmp['Last_Error'] = dlist[x]["Last_Error"]
tmp['Last_IO_Error'] = dlist[x]["Last_IO_Error"]
tmp['Last_SQL_Error'] = dlist[x]["Last_SQL_Error"]
tmp['Slave_SQL_Running_State'] = dlist[x]["Slave_SQL_Running_State"]
tmp['Error'] = ''
if tmp['Last_Error'] != '':
tmp['Error'] = tmp['Last_Error']
if tmp['Last_IO_Error'] != '':
tmp['Error'] = tmp['Last_IO_Error']
if tmp['Last_SQL_Error'] != '':
tmp['Error'] = tmp['Last_SQL_Error']
if tmp['Error'] == '':
tmp['Error'] = tmp['Slave_SQL_Running_State']
ret.append(tmp)
data = {}
data['data'] = ret