|
|
|
@ -543,7 +543,7 @@ def runInfo(version): |
|
|
|
|
return mw.getJson(result) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def myDbStatus(): |
|
|
|
|
def myDbStatus(version): |
|
|
|
|
result = {} |
|
|
|
|
db = pMysqlDb() |
|
|
|
|
data = db.query('show variables') |
|
|
|
@ -553,19 +553,30 @@ def myDbStatus(): |
|
|
|
|
|
|
|
|
|
gets = ['table_open_cache', 'thread_cache_size', 'key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', |
|
|
|
|
'innodb_additional_mem_pool_size', 'innodb_log_buffer_size', 'max_connections', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] |
|
|
|
|
|
|
|
|
|
if version != "8.0": |
|
|
|
|
gets.append('query_cache_size') |
|
|
|
|
|
|
|
|
|
result['mem'] = {} |
|
|
|
|
for d in data: |
|
|
|
|
vname = d['Variable_name'] |
|
|
|
|
for g in gets: |
|
|
|
|
if d[0] == g: |
|
|
|
|
result['mem'][g] = d[1] |
|
|
|
|
# if result['mem']['query_cache_type'] != 'ON': |
|
|
|
|
# result['mem']['query_cache_size'] = '0' |
|
|
|
|
# print(g) |
|
|
|
|
if vname == g: |
|
|
|
|
result['mem'][g] = d["Value"] |
|
|
|
|
return mw.getJson(result) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setDbStatus(): |
|
|
|
|
def setDbStatus(version): |
|
|
|
|
gets = ['key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_log_buffer_size', 'max_connections', |
|
|
|
|
'table_open_cache', 'thread_cache_size', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] |
|
|
|
|
|
|
|
|
|
if version != "8.0": |
|
|
|
|
# gets.append('query_cache_size') |
|
|
|
|
gets = ['key_buffer_size', 'query_cache_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', 'innodb_log_buffer_size', 'max_connections', |
|
|
|
|
'table_open_cache', 'thread_cache_size', 'sort_buffer_size', 'read_buffer_size', 'read_rnd_buffer_size', 'join_buffer_size', 'thread_stack', 'binlog_cache_size'] |
|
|
|
|
|
|
|
|
|
# print(gets) |
|
|
|
|
emptys = ['max_connections', 'thread_cache_size', 'table_open_cache'] |
|
|
|
|
args = getArgs() |
|
|
|
|
conFile = getConf() |
|
|
|
@ -1872,11 +1883,11 @@ if __name__ == "__main__": |
|
|
|
|
elif func == 'initd_uninstall': |
|
|
|
|
print(initdUinstall()) |
|
|
|
|
elif func == 'run_info': |
|
|
|
|
print(runInfo()) |
|
|
|
|
print(runInfo(version)) |
|
|
|
|
elif func == 'db_status': |
|
|
|
|
print(myDbStatus()) |
|
|
|
|
print(myDbStatus(version)) |
|
|
|
|
elif func == 'set_db_status': |
|
|
|
|
print(setDbStatus()) |
|
|
|
|
print(setDbStatus(version)) |
|
|
|
|
elif func == 'conf': |
|
|
|
|
print(getConf()) |
|
|
|
|
elif func == 'bin_log': |
|
|
|
|