From f65d10e1e45b7bf35b371ebb15651c3639b5fc56 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 1 Jan 2023 21:56:45 +0800 Subject: [PATCH] up --- plugins/mariadb/index.py | 8 ++++-- plugins/mariadb/js/mariadb.js | 54 +++++++++++++++++++++++++++++------ 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/plugins/mariadb/index.py b/plugins/mariadb/index.py index cb71eac1e..17886f4aa 100755 --- a/plugins/mariadb/index.py +++ b/plugins/mariadb/index.py @@ -1861,7 +1861,10 @@ def getMasterRepSlaveUserCmd(version): if mode == "gtid": sql = "CHANGE MASTER TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \ clist[0]['username'] + "', MASTER_PASSWORD='" + \ - clist[0]['password'] + "', MASTER_AUTO_POSITION=1" + clist[0]['password'] + "', " + "MASTER_LOG_FILE='" + mstatus[0]["File"] + \ + "',MASTER_LOG_POS=" + \ + str(mstatus[0]["Position"]) + \ + ",MASTER_USE_GTID=slave_pos,MASTER_CONNECT_RETRY=10;" else: sql = "CHANGE MASTER TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \ clist[0]['username'] + "', MASTER_PASSWORD='" + \ @@ -2217,8 +2220,9 @@ def initSlaveStatusSyncUser(version=''): if local_mode != mode_name: return mw.returnJson(False, '同步模式不一致!') + # print(u['cmd']) t = db.query(u['cmd']) - print(t) + # print(t) db.query("start slave user='{}' password='{}';".format( u['user'], u['pass'])) return mw.returnJson(True, '初始化成功!') diff --git a/plugins/mariadb/js/mariadb.js b/plugins/mariadb/js/mariadb.js index 37444c929..10551485b 100755 --- a/plugins/mariadb/js/mariadb.js +++ b/plugins/mariadb/js/mariadb.js @@ -1504,7 +1504,7 @@ function getMasterRepSlaveUserCmd(username, db=''){ title: '同步命令', area: '500px', content:"
\ -
"+cmd+"
\ +
"+cmd+"
\
\ \
\ @@ -1795,11 +1795,27 @@ function addSlaveSSH(ip=''){ } + function delSlaveSSH(ip){ myPost('del_slave_ssh', {ip:ip}, function(rdata){ var rdata = $.parseJSON(rdata.data); - layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2}); - getSlaveSSHPage(); + showMsg(rdata.msg,function(){ + if (rdata.status){ + getSlaveSSHPage(); + } + },{icon: rdata.status ? 1 : 2}, 600); + }); +} + + +function delSlaveSyncUser(ip){ + myPost('del_slave_sync_user', {ip:ip}, function(rdata){ + var rdata = $.parseJSON(rdata.data); + showMsg(rdata.msg,function(){ + if (rdata.status){ + getSlaveSyncUserPage(); + } + },{icon: rdata.status ? 1 : 2}, 600); }); } @@ -1884,7 +1900,7 @@ function addSlaveSyncUser(ip=''){
同步账户
\
同步密码
\
\ - CMD[最好填好]\ + CMD[必填]\
\
\ \ @@ -1909,8 +1925,8 @@ function addSlaveSyncUser(ip=''){ $('input[name="user"]').val(a['MASTER_USER']); $('input[name="pass"]').val(a['MASTER_PASSWORD']); - console.log(a['MASTER_AUTO_POSITION'],typeof(a['MASTER_AUTO_POSITION'])); - if (typeof(a['MASTER_AUTO_POSITION']) != 'undefined' ){ + console.log(a['MASTER_USE_GTID'],typeof(a['MASTER_USE_GTID'])); + if (typeof(a['MASTER_USE_GTID']) != 'undefined' ){ $('input[name="mode"]').val('1'); } }); @@ -2196,7 +2212,7 @@ function masterOrSlaveConf(version=''){ for(i in rdata.data){ var v = rdata.data[i]; - var status = "异常"; + var status = "异常"; if (v['Slave_SQL_Running'] == 'Yes' && v['Slave_IO_Running'] == 'Yes'){ status = "正常"; } @@ -2238,6 +2254,26 @@ function masterOrSlaveConf(version=''){ // 添加\ // $(".table_slave_status_list").html(con); + + $('.db_error').click(function(){ + layer.open({ + type: 1, + title: '同步异常信息', + area: '500px', + content:"\ +
"+v['Error']+"
\ +
\ + \ +
\ + ", + success:function(){ + copyText(v['Error']); + $('.class-copy-db-err').click(function(){ + copyText(v['Error']); + }); + } + }); + }); }); } @@ -2389,10 +2425,10 @@ function masterOrSlaveConf(version=''){ getMasterDbList(); } - if (rdata.slave_status){ + // if (rdata.slave_status){ getAsyncMasterDbList(); getAsyncDataList() - } + // } }); } getMasterStatus();