SHOW TRAFFIC JOBS
TiDB v9.0.0 introduces the SHOW TRAFFIC JOBS syntax, which is used to show all traffic capture or replay jobs executed by TiProxy in the cluster. In the output, each row represents a job of a TiProxy instance. Each TiProxy instance stores up to 10 most recent jobs.
The shown results vary depending on the privileges the current user has.
- A user with the
TRAFFIC_CAPTURE_ADMINprivilege can view traffic capture jobs. - A user with the
TRAFFIC_REPLAY_ADMINprivilege can view traffic replay jobs. - A user with the
SUPERprivilege or both preceding privileges can view both traffic capture and traffic replay jobs at the same time.
The SHOW TRAFFIC JOBS statement returns the following columns:
Synopsis
- TrafficStmt
TrafficStmt ::=
"SHOW" "TRAFFIC" "JOBS"
Examples
Show the traffic capture or replay jobs:
SHOW TRAFFIC JOBS;
The following output example shows that two TiProxy instances are capturing traffic, and the progress is 45% for both:
+----------------------------+----------+----------------+---------+----------+---------+-------------+----------------------------------------------------------------------------+
| START_TIME | END_TIME | INSTANCE | TYPE | PROGRESS | STATUS | FAIL_REASON | PARAMS |
+----------------------------+----------+----------------+---------+----------+---------+-------------+----------------------------------------------------------------------------+
| 2024-12-17 10:54:41.000000 | | 10.1.0.10:3080 | capture | 45% | running | | OUTPUT="/tmp/traffic", DURATION="90m", COMPRESS=true, ENCRYPTION_METHOD="" |
| 2024-12-17 10:54:41.000000 | | 10.1.0.11:3080 | capture | 45% | running | | OUTPUT="/tmp/traffic", DURATION="90m", COMPRESS=true, ENCRYPTION_METHOD="" |
+----------------------------+----------+----------------+---------+----------+---------+-------------+----------------------------------------------------------------------------+
2 rows in set (0.01 sec)
The following output example shows that the traffic replay jobs of two TiProxy instances are manually canceled:
+----------------------------+----------------------------+----------------+--------+----------+----------+------------------+--------------------------------------------------------------------+
| START_TIME | END_TIME | INSTANCE | TYPE | PROGRESS | STATUS | FAIL_REASON | PARAMS |
+----------------------------+----------------------------+----------------+--------+----------+----------+------------------+--------------------------------------------------------------------+
| 2024-12-17 10:54:41.000000 | 2024-12-17 11:34:42.000000 | 10.1.0.10:3080 | replay | 70% | canceled | manually stopped | INPUT="/tmp/traffic", USER="root", SPEED=0.000000, READ_ONLY=false |
| 2024-12-17 10:54:41.000000 | 2024-12-17 11:34:43.000000 | 10.1.0.11:3080 | replay | 69% | canceled | manually stopped | INPUT="/tmp/traffic", USER="root", SPEED=0.000000, READ_ONLY=false |
+----------------------------+----------------------------+----------------+--------+----------+----------+------------------+--------------------------------------------------------------------+
2 rows in set (0.01 sec)
MySQL compatibility
This statement is a TiDB extension to MySQL syntax.