|
|
@ -681,14 +681,13 @@ def setMyPort(): |
|
|
|
return mw.returnJson(True, '编辑成功!') |
|
|
|
return mw.returnJson(True, '编辑成功!') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def runInfo(): |
|
|
|
def runInfo(version): |
|
|
|
|
|
|
|
|
|
|
|
if status(version) == 'stop': |
|
|
|
if status(version) == 'stop': |
|
|
|
return mw.returnJson(False, 'MySQL未启动', []) |
|
|
|
return mw.returnJson(False, 'MySQL未启动', []) |
|
|
|
|
|
|
|
|
|
|
|
db = pMysqlDb() |
|
|
|
db = pMysqlDb() |
|
|
|
data = db.query('show global status') |
|
|
|
data = db.query('show global status') |
|
|
|
gets = ['Max_used_connections', 'Com_commit', 'Com_rollback', 'Questions', 'Innodb_buffer_pool_reads', 'Innodb_buffer_pool_read_requests', 'Key_reads', 'Key_read_requests', 'Key_writes', |
|
|
|
gets = ['Max_used_connections', 'Com_commit', 'Com_select', 'Com_rollback', 'Questions', 'Innodb_buffer_pool_reads', 'Innodb_buffer_pool_read_requests', 'Key_reads', 'Key_read_requests', 'Key_writes', |
|
|
|
'Key_write_requests', 'Qcache_hits', 'Qcache_inserts', 'Bytes_received', 'Bytes_sent', 'Aborted_clients', 'Aborted_connects', |
|
|
|
'Key_write_requests', 'Qcache_hits', 'Qcache_inserts', 'Bytes_received', 'Bytes_sent', 'Aborted_clients', 'Aborted_connects', |
|
|
|
'Created_tmp_disk_tables', 'Created_tmp_tables', 'Innodb_buffer_pool_pages_dirty', 'Opened_files', 'Open_tables', 'Opened_tables', 'Select_full_join', |
|
|
|
'Created_tmp_disk_tables', 'Created_tmp_tables', 'Innodb_buffer_pool_pages_dirty', 'Opened_files', 'Open_tables', 'Opened_tables', 'Select_full_join', |
|
|
|
'Select_range_check', 'Sort_merge_passes', 'Table_locks_waited', 'Threads_cached', 'Threads_connected', 'Threads_created', 'Threads_running', 'Connections', 'Uptime'] |
|
|
|
'Select_range_check', 'Sort_merge_passes', 'Table_locks_waited', 'Threads_cached', 'Threads_connected', 'Threads_created', 'Threads_running', 'Connections', 'Uptime'] |
|
|
@ -713,7 +712,7 @@ def runInfo(): |
|
|
|
return mw.getJson(result) |
|
|
|
return mw.getJson(result) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def myDbStatus(): |
|
|
|
def myDbStatus(version): |
|
|
|
result = {} |
|
|
|
result = {} |
|
|
|
db = pMysqlDb() |
|
|
|
db = pMysqlDb() |
|
|
|
data = db.query('show variables') |
|
|
|
data = db.query('show variables') |
|
|
@ -723,6 +722,10 @@ def myDbStatus(): |
|
|
|
|
|
|
|
|
|
|
|
gets = ['table_open_cache', 'thread_cache_size', 'key_buffer_size', 'tmp_table_size', 'max_heap_table_size', 'innodb_buffer_pool_size', |
|
|
|
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'] |
|
|
|
'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'] = {} |
|
|
|
result['mem'] = {} |
|
|
|
for d in data: |
|
|
|
for d in data: |
|
|
|
vname = d['Variable_name'] |
|
|
|
vname = d['Variable_name'] |
|
|
@ -733,9 +736,16 @@ def myDbStatus(): |
|
|
|
return mw.getJson(result) |
|
|
|
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', |
|
|
|
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'] |
|
|
|
'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'] |
|
|
|
emptys = ['max_connections', 'thread_cache_size', 'table_open_cache'] |
|
|
|
args = getArgs() |
|
|
|
args = getArgs() |
|
|
|
conFile = getConf() |
|
|
|
conFile = getConf() |
|
|
@ -2496,11 +2506,11 @@ if __name__ == "__main__": |
|
|
|
elif func == 'uninstall_pre_inspection': |
|
|
|
elif func == 'uninstall_pre_inspection': |
|
|
|
print(uninstallPreInspection(version)) |
|
|
|
print(uninstallPreInspection(version)) |
|
|
|
elif func == 'run_info': |
|
|
|
elif func == 'run_info': |
|
|
|
print(runInfo()) |
|
|
|
print(runInfo(version)) |
|
|
|
elif func == 'db_status': |
|
|
|
elif func == 'db_status': |
|
|
|
print(myDbStatus()) |
|
|
|
print(myDbStatus(version)) |
|
|
|
elif func == 'set_db_status': |
|
|
|
elif func == 'set_db_status': |
|
|
|
print(setDbStatus()) |
|
|
|
print(setDbStatus(version)) |
|
|
|
elif func == 'conf': |
|
|
|
elif func == 'conf': |
|
|
|
print(getConf()) |
|
|
|
print(getConf()) |
|
|
|
elif func == 'bin_log': |
|
|
|
elif func == 'bin_log': |
|
|
|