pull/149/head
midoks 3 years ago
parent bb5ee60932
commit 42d8d828c5
  1. 3
      plugins/mysql/conf/my.cnf
  2. 3
      plugins/mysql/conf/my5.7.cnf
  3. 3
      plugins/mysql/conf/my8.0.cnf
  4. 33
      plugins/mysql/index.py

@ -66,7 +66,8 @@ binlog-ignore-db = information_schema
binlog-ignore-db = performance_schema
#slave
log-slave-updates
log-slave-updates = 1
skip-slave-start = 1
#replicate-do-db
replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema

@ -66,7 +66,8 @@ binlog-ignore-db = information_schema
binlog-ignore-db = performance_schema
#slave
log-slave-updates
log-slave-updates = 1
skip-slave-start = 1
#replicate-do-db
replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema

@ -68,7 +68,8 @@ binlog-ignore-db = information_schema
binlog-ignore-db = performance_schema
#slave
log_replica_updates
log_replica_updates = 1
skip-slave-start = 1
#replicate-do-db
replicate-ignore-db = information_schema
replicate-ignore-db = performance_schema

@ -1777,18 +1777,31 @@ def getMasterRepSlaveUserCmd(version):
if len(mstatus) == 0:
return mw.returnJson(False, '未开启!')
sql = "CHANGE MASTER TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
clist[0]['username'] + "', MASTER_PASSWORD='" + \
clist[0]['password'] + \
"', MASTER_LOG_FILE='" + mstatus[0]["File"] + \
"',MASTER_LOG_POS=" + str(mstatus[0]["Position"])
mode = recognizeDbMode()
if version == "8.0":
sql = "CHANGE REPLICATION SOURCE TO SOURCE_HOST='" + ip + "', SOURCE_PORT=" + port + ", SOURCE_USER='" + \
clist[0]['username'] + "', SOURCE_PASSWORD='" + \
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"
if version == '8.0':
sql = "CHANGE REPLICATION SOURCE TO SOURCE_HOST='" + ip + "', SOURCE_PORT=" + port + ", SOURCE_USER='" + \
clist[0]['username'] + "', SOURCE_PASSWORD='" + \
clist[0]['password'] + \
"', MASTER_AUTO_POSITION=1"
else:
sql = "CHANGE MASTER TO MASTER_HOST='" + ip + "', MASTER_PORT=" + port + ", MASTER_USER='" + \
clist[0]['username'] + "', MASTER_PASSWORD='" + \
clist[0]['password'] + \
"', SOURCE_LOG_FILE='" + mstatus[0]["File"] + \
"',SOURCE_LOG_POS=" + str(mstatus[0]["Position"])
"', MASTER_LOG_FILE='" + mstatus[0]["File"] + \
"',MASTER_LOG_POS=" + str(mstatus[0]["Position"])
if version == "8.0":
sql = "CHANGE REPLICATION SOURCE TO SOURCE_HOST='" + ip + "', SOURCE_PORT=" + port + ", SOURCE_USER='" + \
clist[0]['username'] + "', SOURCE_PASSWORD='" + \
clist[0]['password'] + \
"', SOURCE_LOG_FILE='" + mstatus[0]["File"] + \
"',SOURCE_LOG_POS=" + str(mstatus[0]["Position"])
data = {}
data['cmd'] = sql

Loading…
Cancel
Save