原文链接:https://www.gbase.cn/community/post/4977
更多精彩内容尽在南大通用GBase技术社区,南大通用致力于成为用户最信赖的数据库产品供应商。
GBase 8a集群运维常用命令
查看集群是否正常
1、查看集群状态
gcadmin
2、查看集群数据不一致情况。[number]为可选的数字,是显示event数量,默认16个
gcadmin showdmlevent [number]
gcadmin showddlevent [number]
gcadmin showdmlstorageevent [number]
3、指定表分片和IP
gcadmin showXXXevent dbname.tablename nX IP
比如 :
gcadmin showdmlevent testdb.t1 n1 192.168.0.11
4、 重启集群服务 V8 在操作系统root下:
service gcware start/stop/restart
V9 在dba用户下,一般是:
gcluster_services all start/stop/restart
5、在dba用户下调用集群命令行,用于执行SQL命令
交互模式
gccli -uUsername -pPassword -hIP
简单执行命令
gccli -uUsername -pPassword -hIP -e"show processlist"
批量执行文件中SQL命令
gccli -uUsername -pPassword -hIP < allSQL.txt
查看集群运行的SQL
1、查看指定节点下运行的SQL:
show [full|detail] processlist
2、查看所有调度节点下运行的SQL:
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、所有数据节点运行的SQL:
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;
导出数据
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'
加载数据
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’
1、加载数据中日期数据类型精度到毫秒
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’
2、查看当前加载进度
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;
3、查看历史加载结果
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;
查看表、存储过程、函数
show tables; show tables like '%XXX%' ; show function status; show procedure status;
查看表、函数、存储过程结构
show create table mytablename; show create procedure myProc; show create function myFunc;
查看变量
show variables like '%XXXX%';
查看状态
show status like '%meminfo%';
查看某个表占用的空间
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';
服务+进程名字 及对应日志位置
1、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
2、gcluster gclusterd :
启停日志 :
/gcluster/log/gcluster/system.log
引擎日志:
/gcluster/log/gcluster/express.log
通用日志,记录可执行的SQL命令
/gcluster/log/gcluster/gclusterd.log
审计日志,记录所有命令执行结果
/gcluster/log/gcluster/gclusterd-audit.log
3、gnode gbased :
启停日志
/gnode/log/gbase/system.log
引擎日志
/gnode/log/gbase/express.log
4、syncserver gc_sync_server :
服务日志
/gnode/log/gbase/syncserver.log
客户端日志
/gnode/log/gbase/ syncclient_XXXX.log
5、gcrecover :
调度日志
/gclusger/log/gcluster/ gc_recover.log
同步记录
/gclusger/log/gcluster/gcrecover_taskrecord.log
启停日志
/gclusger/log/gcluster/gcrecover_system.log
6、gcmonit
进程监控日志
/gclusger/log/gcluster/gcmonit.log
7、gcmmonit
进程监控的监控日志
/gclusger/log/gcluster/gcmmonit.log
原文链接:https://www.gbase.cn/community/post/4977
更多精彩内容尽在南大通用GBase技术社区,南大通用致力于成为用户最信赖的数据库产品供应商。