2.1.20 flow_control 命令
2.1.20.1 查询流量控制当前配置状态
mysql> flow_control @@show;
+-------------------+-------------------------+------------------------+
| FLOW_CONTROL_TYPE | FLOW_CONTROL_HIGH_LEVEL | FLOW_CONTROL_LOW_LEVEL |
+-------------------+-------------------------+------------------------+
| FRONT_END | 4194304 | 262144 |
| dbGroup1-hostM1 | 4194304 | 262144 |
| dbGroup2-hostM2 | 4194304 | 262144 |
+-------------------+-------------------------+------------------------+
1 row in set (0.00 sec)
列描述:
- FLOW_CONTROL_TYPE 流量控制的类型,前端连接为固定值“FRONT_END”;后段连接为所在的实例名,格式为:组名-实例名
- FLOW_CONTROL_HIGH_LEVEL 流量控制的高水位线,积压队列的字节数到达此位置开始控制流量
- FLOW_CONTROL_LOW_LEVEL 流量控制低水位线,积压队列的字节数低于此位置不再控制流量
2.1.20.2 修改流量控制当前配置状态
flow_control @@set [enableFlowControl = true/false] [flowControlHighLevel = ?] [flowControlLowLevel = ?]
MySQL [(none)]> flow_control @@set enableFlowControl = true flowControlHighLevel= 100000 flowControlLowLevel = 30000;
Query OK, 0 rows affected (0.02 sec)
通过此命令可以修改对应内存中生效的值,同时会变更文件bootstrap.dynamic.cnf
将其固化,对应关系如下:
- enableFlowControl: bootstrap.cnf中enableFlowControl参数
- flowControlHighLevel:bootstrap.cnf中flowControlHighLevel参数
- flowControlLowLevel:bootstrap.cnf中flowControlLowLevel参数
注:以上命令三个参数顺序不可变更
2.1.20.3 查看当前连接的流量控制状态
MySQL [(none)]> flow_control @@list;
+------------------+---------------+---------------------------------------+---------------------+---------------------+-----------------+
| CONNECTION_TYPE | CONNECTION_ID | CONNECTION_INFO | WRITING_QUEUE_BYTES | READING_QUEUE_BYTES | FLOW_CONTROLLED |
+------------------+---------------+---------------------------------------+---------------------+---------------------+-----------------+
| ServerConnection | 1 | 127.0.0.1:50817/schema1 user = root | 464594 | NULL | false |
| MySQLConnection | 8 | 10.186.65.86:3307/db2 mysqlId = 1287 | 0 | 0 | false |
| MySQLConnection | 12 | 10.186.65.86:3308/db1 mysqlId = 1557 | 0 | 0 | false |
| MySQLConnection | 6 | 10.186.65.86:3307/db1 mysqlId = 1285 | 0 | 86172 | false |
| MySQLConnection | 15 | 10.186.65.86:3308/db2 mysqlId = 1559 | 0 | 0 | false |
+------------------+---------------+---------------------------------------+---------------------+---------------------+-----------------+
列描述:
- CONNECTION_TYPE 连接的类型,固定为MySQLConnection/ServerConnection其中之一
- CONNECTION_ID 连接在dble中的ID信息,可以通过ID查找日志
- CONNECTION_INFO 连接详细信息,使用端口,IP地址,用户,MySQL中的连接ID等
- WRITING_QUEUE_BYTES 当前连接的准备写出的队列里积压的字节数
- READING_QUEUE_BYTES 当前连接的已经读取的队列里积压的字节数,前端连接不支持此功能,恒为null
- FLOW_CONTROLLED 当前连接是否处于被流控的状态
如果需要过滤结果集,可以使用dble_information.dble_flow_control 来过滤