全局processlist视图
简介
greatdb_global_processlists是一个greatdb引擎注册的information_schema表,该表显示集群中所有活跃的SQLNODE的show processlist信息。该功能增加时的版本为5.0.8.
详细介绍
表信息
| 字段名 | 类型 | 说明 |
|---|---|---|
| sqlnode | varchar(193) | sqlnode的ip和port。如果是在本sqlnode上执行的查询,则显示local;如果是其他sqlnode的信息,则显示ip:port,例如:172.16.70.226:3308 |
| Processlist_ID | bigint unsigned | 用户登录MySQL时,系统分配的"connection_id",可以使用函数connection_id()查看 |
| User | varchar(32) | 显示当前用户 |
| Host | varchar(261) | 显示这个SQL语句是从哪个ip的哪个端口上发的,用来跟踪出现问题语句的用户 |
| Db | varchar(64) | 显示这个进程目前连接的是哪个数据库 |
| Command | varchar(16) | 显示当前连接的执行的命令,一般取值为休眠(sleep),查询(query),连接(connect)等 |
| Time | int | 显示这个状态持续的时间,单位是秒 |
| State | varchar(64) | 显示使用当前连接的sql语句的状态。state描述的是语句执行中的某一个状态。一个sql语句,以查询为例,可能需要经过copying to tmp table、sorting result、sending data等状态才可以完成 |
| Info | varchar(65535) | 显示执行的sql语句 |
| Time_ms | bigint | 显示这个状态持续的时间,单位是毫秒 |
| Rows_sent | bigint unsigned | 返回给当前线程的记录数 |
| Rows_examined | bigint unsigned | 扫描的记录数 |
使用方式
查询
select * from information_schema.greatdb_global_processlists;示例
GreatDB Cluster> select * from information_schema.greatdb_global_processlists \G; *************************** 1. row *************************** sqlnode: local Processlist_ID: 5 User: event_scheduler Host: localhost Db: NULL Command: Daemon Time: 369 State: Waiting on empty queue Info: NULL Time_ms: 368593 Rows_sent: 0 Rows_examined: 0 *************************** 2. row *************************** sqlnode: local Processlist_ID: 8 User: root Host: localhost:42762 Db: test Command: Query Time: 0 State: executing Info: select * from information_schema.greatdb_global_processlists Time_ms: 3 Rows_sent: 0 Rows_examined: 0 *************************** 3. row *************************** sqlnode: local Processlist_ID: 11 User: system user Host: Db: NULL Command: Connect Time: 20 State: waiting for handler commit Info: Group replication applier module Time_ms: 20038 Rows_sent: 0 Rows_examined: 0 *************************** 4. row *************************** sqlnode: local Processlist_ID: 14 User: system user Host: Db: NULL Command: Query Time: 20 State: Slave has read all relay log; waiting for more updates Info: NULL Time_ms: 9430 Rows_sent: 0 Rows_examined: 0 *************************** 5. row *************************** sqlnode: local Processlist_ID: 47 User: root Host: localhost:42766 Db: NULL Command: Query Time: 0 State: init Info: show processlist Time_ms: 0 Rows_sent: 0 Rows_examined: 0 *************************** 6. row *************************** sqlnode: 172.16.70.226:3308 Processlist_ID: 5 User: event_scheduler Host: localhost Db: NULL Command: Daemon Time: 114 State: Waiting on empty queue Info: NULL Time_ms: 114390 Rows_sent: 0 Rows_examined: 0 *************************** 7. row *************************** sqlnode: 172.16.70.226:3308 Processlist_ID: 12 User: system user Host: Db: NULL Command: Connect Time: 12 State: waiting for handler commit Info: Group replication applier module Time_ms: 11739 Rows_sent: 0 Rows_examined: 0 *************************** 8. row *************************** sqlnode: 172.16.70.226:3308 Processlist_ID: 15 User: system user Host: Db: NULL Command: Query Time: 7 State: Slave has read all relay log; waiting for more updates Info: NULL Time_ms: 7058 Rows_sent: 0 Rows_examined: 0 *************************** 9. row *************************** sqlnode: 172.16.70.226:3308 Processlist_ID: 30 User: root Host: localhost:59098 Db: NULL Command: Query Time: 0 State: init Info: show processlist Time_ms: 0 Rows_sent: 0 Rows_examined: 0 9 rows in set (0.00 sec)安装升级
在升级后,先在所有sqlnode节点上检查是否已经安装了
information_schema.greatdb_global_processlists,如果没有则执行如下命令安装:INSTALL PLUGIN GREATDB_GLOBAL_PROCESSLISTS SONAME 'ha_greatdb.so';
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




