标签:最小值 style header default 图片 com weight 1.2 hid
scheduler特性是在ProxySQL v1.2.0引入的。
scheduler是一个类似cron的调度器,已经被集成到ProxySQL中了,粒度可以达到毫秒级。通过admin即可配置:目前不支持配置文件配置,将来也没这个打算
scheduler可以以规定的间隔执行你自定义的脚本,其主要目的是这个脚本能够监控到外部异常事件的发生从而能够重新配置ProxySQL
通过两个表来实现这个功能
1 Admin> SHOW TABLES LIKE ‘%scheduler%‘; 2 +-------------------+ 3 | tables | 4 +-------------------+ 5 | scheduler | 6 | runtime_scheduler | 7 +-------------------+ 8 2 rows in set (0.00 sec)
具体细节:
scheduler表结构:
1 Admin> SHOW CREATE TABLE scheduler\G 2 *************************** 1. row *************************** 3 table: scheduler 4 Create Table: CREATE TABLE scheduler ( 5 id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 6 active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1, 7 interval_ms INTEGER CHECK (interval_ms>=100 AND interval_ms<=100000000) NOT NULL, 8 filename VARCHAR NOT NULL, 9 arg1 VARCHAR, 10 arg2 VARCHAR, 11 arg3 VARCHAR, 12 arg4 VARCHAR, 13 arg5 VARCHAR, 14 comment VARCHAR NOT NULL DEFAULT ‘‘) 15 1 row in set (0.00 sec)
字段描述:
runtime_scheduler有着相同的表结构:
1 Admin> SHOW CREATE TABLE runtime_scheduler\G 2 *************************** 1. row *************************** 3 table: runtime_scheduler 4 Create Table: CREATE TABLE runtime_scheduler ( 5 id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 6 active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 1, 7 interval_ms INTEGER CHECK (interval_ms>=100 AND interval_ms<=100000000) NOT NULL, 8 filename VARCHAR NOT NULL, 9 arg1 VARCHAR, 10 arg2 VARCHAR, 11 arg3 VARCHAR, 12 arg4 VARCHAR, 13 arg5 VARCHAR, 14 comment VARCHAR NOT NULL DEFAULT ‘‘) 15 1 row in set (0.00 sec)
至于其他的配置表,配置后都需要load到runtime或者持久化到磁盘,所以针对schedule也有一些新命令:
LOAD SCHEDULER TO RUNTIME
或者 LOAD SCHEDULER FROM MEMORY
: load the configuration from main
.scheduler
to runtime, and becomes effective;LOAD SCHEDULER TO MEMORY
或者 LOAD SCHEDULER FROM DISK
:load the configuration from disk
.scheduler
to main
.scheduler
;SAVE SCHEDULER FROM RUNTIME
或者 SAVE SCHEDULER TO MEMORY
: save the configuration from runtime to main
.scheduler
;SAVE SCHEDULER FROM MEMORY
或者SAVE SCHEDULER TO DISK
:save the configuration from main
.scheduler
to disk
.scheduler
, and becomes persistent across restart.调度器是通过调用fork(),然后调用execve()来实现的,如果执行execve()失败,错误日志将会记录到error log中。
标签:最小值 style header default 图片 com weight 1.2 hid
原文地址:https://www.cnblogs.com/geek-ace/p/9567311.html