CHANGE DRAINER
CHANGE DRAINER
语句用于修改集群中 Drainer 的状态信息。
示例
SHOW DRAINER STATUS;
+----------|----------------|--------|--------------------|---------------------|
| NodeID | Address | State | Max_Commit_Ts | Update_Time |
+----------|----------------|--------|--------------------|---------------------|
| drainer1 | 127.0.0.3:8249 | Online | 408553768673342532 | 2019-04-30 00:00:03 |
+----------|----------------|--------|--------------------|---------------------|
| drainer2 | 127.0.0.4:8249 | Online | 408553768673345531 | 2019-05-01 00:00:04 |
+----------|----------------|--------|--------------------|---------------------|
2 rows in set (0.00 sec)
可以看出 drainer1
已经超过一天没有更新状态,该 Drainer 处于异常状态,但是 State 仍然为 Online
,使用 CHANGE DRAINER
将该 Drainer 状态修改为 paused
:
CHANGE DRAINER TO NODE_STATE ='paused' FOR NODE_ID 'drainer1';
Query OK, 0 rows affected (0.01 sec)
SHOW DRAINER STATUS;
+----------|----------------|--------|--------------------|---------------------|
| NodeID | Address | State | Max_Commit_Ts | Update_Time |
+----------|----------------|--------|--------------------|---------------------|
| drainer1 | 127.0.0.3:8249 | Paused | 408553768673342532 | 2019-04-30 00:00:03 |
+----------|----------------|--------|--------------------|---------------------|
| drainer2 | 127.0.0.4:8249 | Online | 408553768673345531 | 2019-05-01 00:00:04 |
+----------|----------------|--------|--------------------|---------------------|
2 rows in set (0.00 sec)
MySQL 兼容性
该语句是 TiDB 对 MySQL 语法的扩展。