GBase 8a MPP使用时 数据库基础问题之一

2.1.1 指定用户登录的默认数据库
问题现象
如何指定用户登录的默认数据库?
处理方法
登录集群时可以指定登录后默认的数据库,使用 -D 参数即可。
$ gccli -uroot -Dvc1.test
GBase client 9.5.2.20.117651. Copyright (c) 2004-2020, GBase. All Rights
Reserved.
gbase> SELECT DATABASE();
+------------+
| database() |
+------------+
| test |
+------------+
1 row in set (Elapsed: 00:00:00.00)
2.1.2 express 日志中部分信息解释
问题现象
express.log 日志中部分信息解释。
处理方法
2017-04-10 11:55:39.258 [CPOOL1][WARN ][S:900][Q:15808]:There's no need
to commit in local connection.
这个警告是因为没有数据进行 commit 。如: set autocommit=0 ; commit ; 就会有
以上警告。
2017-04-10 12:18:02.404 [CPOOL2][WARN ][S:1877][Q:35207]:---Can't ping the
node, the socket is shutdown and the conn is deleted. Host:172.172.172.29; DB:
xjdm.
Cause: GBase server has gone away
套接字或者链接断了,原因是可能 29 节点的 gbased 宕机,也有可能 29 节点的网
络断掉,要查看 29 节点的 gnode 层的 system 日志。
2.1.3 express 日志中报 “ Got error 28 from storage
engine ” 错误
问题现象
express 日志中报 “Got error 28 from storage engine” 错误。
处理方法
说明临时空间满了,请配置临时空间的参数(缺省是 /tmp 目录下)。
[gbased]
tmpdir = /opt/tmp
2.1.4 审计日志高可用方案
问题现象
审计日志高可用方案。
处理方法
步骤 1
开启日志(最好放在各 g cluster 配置文件中,否则重启后开关会被重置)。
set global audit_log = 1;
set long_query_time = 0;
set global long_query_time = 0;
set global log_output = 'table';
set global _t_gcluster_monitor_optimie=1;
步骤 2
创建表。
use gclusterdb;
drop table if exists audit_log_express;
create table audit_log_express(hostname varchar(512),thread_id
int,taskid bigint,start_time datetime,end_time datetime,user_host
text,user text,host_ip text,query_time time,rows bigint,db
varchar(512),table_list text,sql_text text,sql_type text,sql_command
text,algorithms text,status text,conn_type text);
说明
以上 SQL 需要在集群环境中所有 gcluster 节点上执行一遍。
步骤 3
修改 gcluster 配置文件,增加以下项:
audit_log = 1;
long_query_time = 0;
log_output = 'table';
_t_gcluster_monitor_optimize = 1;
步骤 4
手动导入处理,需要自行修改导入和导出路径。
use gclusterdb;
select @@hostname as
hostname,thread_id,taskid,start_time,end_time,user_host,user,host_ip,q
uery_time,rows,db,table_list,sql_text,sql_type,sql_command,algorithm
s,status,conn_type from gbase.audit_log into outfile
'/home/gbase/ftp/audit_log_tables.tbl' fields terminated by '|\t' lines
terminated by '||\r\n' writemode by overwrites;
truncate gbase.audit_log;
load data infile
'ftp://gbase:gbase@192.168.6.77/ftp/audit_log_tables.tbl' into table
audit_log_express fields terminated by '|\t' lines terminated by '||\r\n'
time format '%H:%i:%s.%f';
步骤 5
创建定时导入事件。
use gclusterdb;
drop event if exists import_audit_log;
delimiter |
create event import_audit_log on schedule every 10 minute
do
begin
drop self table if exists gbase.audit_log_bak1;
drop self table if exists gbase.audit_log_bak2;
create self table gbase.audit_log_bak2 like gbase.audit_log;
rename self table gbase.audit_log to gbase.audit_log_bak1,
gbase.audit_log_bak2 to gbase.audit_log;
-- 将 gbase.audit_log_bak1 表导入到 audit_log_express 后删

select @@_gbase_query_path into @old_query_path;
if @old_query_path = 0 then
set global _gbase_query_path = on;
end if;
insert into audit_log_express select @@hostname as
hostname,thread_id,taskid,start_time,end_time,user_host,user,host_ip,q
uery_time,rows,db,table_list,substr(sql_text,0,10922),sql_type,sql_com
mand,algorithms,status,conn_type from gbase.audit_log_bak1;
if @old_query_path = 0 then
set global _gbase_query_path = off;
end if;
drop self table gbase.audit_log_bak1;
end |
delimiter ;
说明
以上 SQL 需要在集群环境中所有 gcluster 节点上执行一遍。
2.1.5 服务器重启后 gcware 服务未启动
问题现象
服务器重启后 gcware 服务未启动。
现场环境为: os:centos 6.5 ;集群版本: GBase8a_MPP_Cluster-NoLicense-8.6.2.18-
R2-redhat6.2-x86_64 。
处理方法
调高数据库启动级别,具体操作如下:
vi /etc/rc.d/init.d/gcware
# chkconfig: 35 99 10
改为
# chkconfig: 35 90 10
然后执行:
chkconfig --del gcware
chkconfig --add gcware
————————————————
版权声明:本文为CSDN博主「m0_49291452」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/m0_49291452/article/details/121953861

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值