scheduler打印状态到日志

编辑脚本和目录

# 如下步骤每个proxysql节点都需要操作

[root@ss30 opt]# mkdir -p /opt/proxysql/log
[root@ss30 opt]# vim /opt/proxysql/log/status.sh
#!/bin/bash
DATE=`date "+%Y-%m-%d %H:%M:%S"`
echo "{\"dateTime\":\"$DATE\",\"status\":\"running\"}" >> /opt/proxysql/log/status_log
 
 
[root@ss30 opt]# chmod 777 /opt/proxysql/log/status.sh

输入scheduler信息

mysql> insert into scheduler(active,interval_ms,filename) values (1,60000,'/opt/proxysql/log/status.sh');
Query OK, 1 row affected (0.00 sec)
 
 
mysql> LOAD SCHEDULER TO RUNTIME;
Query OK, 0 rows affected (0.00 sec)
 
 
mysql> SAVE SCHEDULER TO DISK;
Query OK, 0 rows affected (0.01 sec)
 
 
mysql>  select * from global_variables where variable_name LIKE 'admin-web%' or variable_name LIKE 'admin-stats%';
+----------------------------------------+----------------+
| variable_name                          | variable_value |
+----------------------------------------+----------------+
| admin-stats_credentials                | stats:stats    |
| admin-stats_mysql_connections          | 60             |
| admin-stats_mysql_connection_pool      | 60             |
| admin-stats_mysql_query_cache          | 60             |
| admin-stats_mysql_query_digest_to_disk | 0              |
| admin-stats_system_cpu                 | 60             |
| admin-stats_system_memory              | 60             |
| admin-web_enabled                      | true           |
| admin-web_port                         | 6080           |
+----------------------------------------+----------------+
9 rows in set (0.01 sec)

查看日志:

[root@ss30 log]# tail -f status_log
{"dateTime":"2020-04-05 00:07:40","status":"running"}
{"dateTime":"2020-04-05 00:08:41","status":"running"}
{"dateTime":"2020-04-05 00:10:52","status":"running"}
posted @ 2022-06-21 10:17  哈喽哈喽111111  阅读(105)  评论(0编辑  收藏  举报