Session Management #
SphereEx-DBPlusEngine supports session management. You can view the current session or kill the session through the SQL of the native database.
Currently, this function is only available when the storage node is MySQL. MySQL SHOW PROCESSLIST
and KILL
commands are supported.
Usage #
View Session #
Different associated databases support different methods for viewing sessions. The show processlist
command can be used to view sessions for associated MySQL databases.
SphereEx-DBPlusEngine will automatically generate a unique UUID ID as the ID and store the SQL execution information in each instance.
When this command is executed, SphereEx-DBPlusEngine will collect and synchronize the SQL execution information of each computing node through the governance center, and then summarize and return it to the user.
mysql> show processlist;
+----------------------------------+------+-----------+-------------+---------+------+---------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----------------------------------+------+-----------+-------------+---------+------+---------------+------------------+
| 05ede3bd584fd4a429dcaac382be2973 | root | 127.0.0.1 | sharding_db | Execute | 2 | Executing 0/1 | select sleep(10) |
| f9e5c97431567415fe10badc5fa46378 | root | 127.0.0.1 | sharding_db | Sleep | 690 | | |
+----------------------------------+------+-----------+-------------+---------+------+---------------+------------------+
Output Description
Here it simulates the output of native MySQL, but the
Id
field is a special random string.
Kill Session #
The user determines whether the KILL
statement needs to be executed according to the results returned by SHOW PROCESSLIST
. SphereEx-DBPlusEngine will cancel the SQL in execution according to the ID in the KILL
statement.
mysql> kill 05ede3bd584fd4a429dcaac382be2973;
Query OK, 0 rows affected (0.04 sec)
mysql> show processlist;
Empty set (0.02 sec)