Query connection sessions on a binlog instance
You can query the connection sessions on a binlog instance. For more information, see SHOW PROCESSLIST Statement.
Syntax
SHOW [FULL] PROCESSLIST FOR INSTANCE instance_name;
Parameters
| Parameter | Description |
|---|---|
| FULL | Optional. If you do not specify this parameter, the SHOW PROCESSLIST statement shows only the former 100 characters of each statement in the Info column. |
| instance_name | The name of the binlog instance to query. |
Examples
Query the connection sessions on the specified binlog instance.
SHOW FULL PROCESSLIST FOR INSTANCE eo46r4f2e8;
The output is as follows:
+-------+------+-----------------+------+---------+------+-------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+------+-----------------+------+---------+------+-------+-----------------------+
| 54286 | OBM | 10.10.10.1:0 | NULL | Query | 0 | Init | SHOW FULL PROCESSLIST |
+-------+------+-----------------+------+---------+------+-------+-----------------------+
The following table describes the columns in the result set.
| Column | Description |
|---|---|
| Id | The ID of the session. |
| User | The user of the session. The user OBM is an internal user of the binlog server. |
| Host | The server of the connection session. |
| db | The default database of the thread. The value NULL indicates that no default database has been selected. |
| Command | The type of the statement executed on the client. The value Sleep indicates that the session is idle. |
| Time | The duration that the thread remains in the current status, in seconds. |
| State | The operation or event being executed by the thread, or the status of the thread. |
| Info | The statement being executed by the thread. The value NULL indicates that no statement is being executed. |
Terminate a connection session on a binlog instance
You can terminate a connection session on a binlog instance. For more information, see KILL Statement.
Syntax
KILL [CONNECTION | QUERY] processlist_id FOR INSTANCE instance_name;
Parameters
| Parameter | Description |
|---|---|
| KILL CONNECTION | Terminates the ongoing statement of the connection, as well as the connection associated with the given processlist_id. |
| KILL QUERY | Terminates the ongoing statement of the connection but retains the connection. |
| processlist_id | The ID of the session, which is the value of Id in the output of the SHOW [FULL] PROCESSLIST statement. |
| instance_name | The name of the binlog instance whose session is to be terminated. |
Examples
Query the sessions on the specified binlog instance.
SHOW PROCESSLIST FOR INSTANCE yfj056ib5w;The output is as follows:
+--------+------+-----------------+------+---------+--------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +--------+------+-----------------+------+---------+--------+-------+------------------+ | 169693 | OBM | 10.10.10.1:0 | NULL | Sleep | 162986 | | | | 184362 | OBM | 10.10.10.1:0 | NULL | Sleep | 147985 | | | | 329035 | OBM | 10.10.10.1:0 | NULL | Query | 0 | Init | SHOW PROCESSLIST | +--------+------+-----------------+------+---------+--------+-------+------------------+Terminate the session with the ID
169693, as well as the connection associated with this ID.KILL CONNECTION 169693 FOR INSTANCE yfj056ib5w;Terminate the session with the ID
184362but retain the connection.KILL QUERY 184362 FOR INSTANCE yfj056ib5w;Query the sessions on this binlog instance again.
SHOW PROCESSLIST FOR INSTANCE yfj056ib5w;The output is as follows:
+--------+------+-----------------+------+---------+------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +--------+------+-----------------+------+---------+------+-------+------------------+ | 184362 | OBM | 10.10.10.1:0 | NULL | Sleep | 1 | | | | 329086 | OBM | 10.10.10.1:0 | NULL | Query | 0 | Init | SHOW PROCESSLIST | +--------+------+-----------------+------+---------+------+-------+------------------+