GBase 8a数据库集群运维巡检维护常用命令简化版

GBase 8a数据库集群,提供了多种运维监控用的命令,用来查看当前集群运行状态是否异常。也提供了简单的导入和导出方案。本文汇总了在现场运维人员最经常使用的命令汇总。

参考

GBase 8a运维管理用自定义存储过程汇总

GBase 8a集群运维常用命令简化版

最新版本 https://www.gbase8.cn/657

GBase 8a集群运维常用命令简化版
============================================
最新版本 https://www.gbase8.cn/657
============================================
1、查看集群是否正常
1.1 查看集群状态
gcadmin
1.2 查看集群数据不一致情况,后面可选的数字,是显示event数量,默认16个
gcadmin showdmlevent [number]
gcadmin showddlevent [number]
gcadmin showdmlstorageevent [number]
指定表分片和IP
gcadmin showXXXevent dbname.tablename nX IP
比如
gcadmin showdmlevent testdb.t1 n1 192.168.0.11
1.2 重启集群服务
V8 在操作系统root下: service gcware start/stop/restart
V9 在dba用户下,一般是gbase: gcluster_services all start/stop/restart
2、集群命令行,用于执行SQL命令
su - gbase
交互模式 gccli -uUsername -pPassword -hIP
简单执行 gccli -uUsername -pPassword -hIP -e"show processlist"
批量文件 gccli -uUsername -pPassword -hIP < allSQL.txt
3、查看集群运行的SQL
3.1 指定节点
简单 show processlist
完整 show full processlist
详细 show detail processlist
3.2 所有调度节点
select COORDINATOR_NAME, ID, user, host, command, start_time, time, state, substring(info,0,100) info from information_schema.COORDINATORS_TASK_INFORMATION where command='query' and time >=0 order by time desc limit 10;
3.3 所有数据节点
select NODE_NAME, ID, user, host, command, start_time, time, state, substring(info,0,100) info from information_schema.GNODES_TASK_INFORMATION where command='query' and info is not null and info not like '%information_schema.processlist%' order by time desc limit 10;
4、导出数据
rmt:select * from ac08 where btime between '2020-01-01' and '2020-02-01' into outfile '/opt/ac08.txt' fields terminated by ',' ENCLOSED BY '"' null_value '\N'
5、加载数据
load data infile 'ftp://gbase:gbase@192.168.0.100//opt/ac08.txt' into table ac08 NULL_VALUE '\N' fields terminated by ',' ENCLOSED BY '"' DATETIME FORMAT ‘%Y-%m-%d %H:%i:%s’
带毫秒的日期
load data infile 'ftp://gbase:gbase@192.168.0.100//opt/ac08.txt' into table ac08 NULL_VALUE '\N' fields terminated by ',' ENCLOSED BY '"' DATETIME FORMAT ‘%Y-%m-%d %H:%i:%s.%f’
6、查看当前加载进度
select db_name,tb_name,IP,state,start_time,progress,total_size,loaded_size,loaded_records,skipped_records from information_schema.load_status order by db_name,tb_name;
7、查看历史加载结果
select task_id,db_name,tb_name,user,HOST_IP,start_time,end_time,elapsed_time,total_size,loaded_records,skipped_records from information_schema.load_result where start_time>'2020-07-26' order by start_time;
8、查看表、存储过程、函数
show tables;
show tables like '%XXX%' ;
show function status;
show procedure status;
9、查看表、函数、存储过程结构
show create table mytablename;
show create procedure myProc;
show create function myFunc;
10、查看变量
show variables like '%XXXX%';
查看状态
show status like '%meminfo%';
12、查看某个表占用的空间
select * from information_schema.cluster_tables a where table_schema='testdb' and table_name='t1';
查看每个分片的空间
select * from information_schema.CLUSTER_TABLE_SEGMENTS a where table_schema='testdb' and table_name='t1';
13、各种日志位置
服务 进程名字 默认日志位置
gcware corosync
服务启停日志,只有启动和停止信息
V8版本 安装目录/gcluster/log/gcluster/corosync_system.log
V9版本 安装目录/gcluster/log/gcluster/gcware_system.log
服务详细日志,详细的启动停止信息
V8版本 /var/log/corosync.log
V9版本 安装目录/gcware/log/gcware.log
gcadmin命令执行日志
V8版本 /var/log/gcware/gcware_XXXX.log
V9版本 安装目录/gcware/liblog/gcware.log
gcluster gclusterd
安装目录/gcluster/log/gcluster/system.log 启停日志
安装目录/gcluster/log/gcluster/express.log 引擎日志
安装目录/gcluster/log/gcluster/gclusterd.log 通用日志,记录可执行的SQL命令
安装目录/gcluster/log/gcluster/gclusterd-audit.log 审计日志,记录所有命令执行结果
gnode gbased 安装目录/gnode/log/gbase/system.log启停日志
安装目录/gnode/log/gbase/express.log引擎日志
syncserver gc_sync_server
安装目录/gnode/log/gbase/syncserver.log 服务日志
安装目录/gnode/log/gbase/ syncclient_XXXX.log 客户端日志
gcrecover
安装目录/gclusger/log/gcluster/ gc_recover.log 调度日志
安装目录/gclusger/log/gcluster/gcrecover_taskrecord.log 同步记录
安装目录/gclusger/log/gcluster/gcrecover_system.log 启停日志
gcmonit 安装目录/gclusger/log/gcluster/gcmonit.log 进程监控
gcmmonit 安装目录/gclusger/log/gcluster/gcmmonit.log 进程监控的监控

GBase 8a数据库集群运维巡检维护常用命令简化版》有1条评论

评论已关闭。