This commit is contained in:
parent
6a3df8a8c7
commit
656d9b6d89
|
|
@ -1,2 +1,4 @@
|
|||
[mysqld]
|
||||
# SHOW GLOBAL VARIABLES LIKE '%gtid%'
|
||||
gtid_mode=ON
|
||||
enforce_gtid_consistency=ON
|
||||
enforce_gtid_consistency=ON
|
||||
|
|
@ -1403,6 +1403,10 @@ def getDbrunMode(version=''):
|
|||
|
||||
|
||||
def setDbrunMode(version=''):
|
||||
|
||||
if version == '5.5':
|
||||
return mw.returnJson(False, "不支持切换")
|
||||
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['mode', 'reload'])
|
||||
if not data[0]:
|
||||
|
|
@ -1422,6 +1426,28 @@ def setDbrunMode(version=''):
|
|||
con = re.sub(rep, rep_after, con)
|
||||
mw.writeFile(path, con)
|
||||
|
||||
db = pMysqlDb()
|
||||
|
||||
# The value of @@GLOBAL.GTID_MODE can only be changed one step at a
|
||||
# time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that
|
||||
# this value must be stepped up or down simultaneously on all servers.
|
||||
# See the Manual for instructions.
|
||||
if mode == 'classic':
|
||||
db.query('set global enforce_gtid_consistency=off')
|
||||
db.query('set global gtid_mode=on')
|
||||
db.query('set global gtid_mode=on_permissive')
|
||||
db.query('set global gtid_mode=off_permissive')
|
||||
db.query('set global gtid_mode=off')
|
||||
elif mode == 'gtid':
|
||||
db.query('set global enforce_gtid_consistency=on')
|
||||
db.query('set global gtid_mode=off')
|
||||
db.query('set global gtid_mode=off_permissive')
|
||||
db.query('set global gtid_mode=on_permissive')
|
||||
db.query('set global gtid_mode=on')
|
||||
|
||||
if dbreload == "yes":
|
||||
restart(version)
|
||||
|
||||
return mw.returnJson(True, "切换成功!")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue