1、系统环境准备
1.1、操作系统安装
要求以“开发工作站”模式安装,必须保留swap
1.2、磁盘阵列
做Raid50/ Raid5
1.3、关闭SELINUX
# vi /etc/selinux/config
修改SELINUX=disabled
重启生效,检查
# sestatus
1.4、关闭防火墙
# systemctl stop firewalld
# systemctl disable firewalld
检查防火墙
# systemctl status firewalld
1.5、创建gbase用户并创建密码
useradd gbase
passwd gbase
2、Gbase 8a MPP安装
2.1、解压
使用gbase用户解压
$ su - gbase
$ tar xfj GBase8a_MPP_Cluster-License-9.5.3.19-redhat7.3-x86_64.tar.bz2
2.2、使用8a自带脚本配置系统环境
进入安装目录
# cd gcinstall/
# 如果需要日志切割模式,安装完数据库之后,再次执行这个命令
# ./SetSysEnv.py --dbaUser=gbase --installPrefix=<安装路径>
注意:需要在root用户下执行该命令,需要在每个安装节点都执行该命令
2.3、修改配置文件
$ vi demo.options
主要修改IP地址和gbase密码
# 注:考虑到未来在应用端,可能会存在一些生僻字,可把characterSet改成characterSet=utf8mb4
installPrefix= /data
coordinateHost = 192.168.1.239,192.168.1.242,192.168.1.244
coordinateHostNodeID = 1239,1242,1244
dataHost = 192.168.1.239,192.168.1.242,192.168.1.244
#existCoordinateHost = 192.168.200.131,192.168.200.132
#existDataHost = 192.168.200.131,192.168.200.132
#existGcwareHost= 192.168.200.131,192.168.200.132
gcwareHost = 192.168.1.239,192.168.1.242,192.168.1.244
gcwareHostNodeID = 1239,1242,1244
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'Gb@se20200901'
rootPwd = ''
#rootPwdFile = rootPwd.json
#characterSet = utf8
#dbPort = 5258
#sshPort = 22
2.3、安装数据库【管理节点执行安装】
获取指纹文件(保存好gbase用户下的 .ssh 文件)
在gcinstall目录执行 getesn.py --silent=demo.options
运行后会生成ESN格式为:DD-XXXXXXXX-XXXXXXXX-…-XXXXXXXX-S
$ ./gcinstall.py --license_file=license文件路径 --silent=demo.options
安装检查
$ gcadmin
2.4、数据分布策略初始化
$ gcadmin distribution gcChangeInfo.xml p 1 d 1 pattern 1
#gcChangeInfo.xml:生成distribution 的gnode 节点信息文件。p :每个数据节点存放的分片数量,必须小于每个rack内的节点数(1<=p<rack内节点数,p*节点数<=65535)。d:每个分片的备份数量,取值为0,1 或2。默认为1。pattern :(缺省为1) 指明distribution 所使用模式,1为负载均衡,2为高可用
查看分布情况:
$ gcadmin showdistribution node
2.5、数据库初始化
(1)登录数据库,初始密码为空
# root的默认密码:Admin2O11O531 或者 (默认为空)
# gbase的默认密码:GBase2O11O531 或者 gbase20110531
$ gccli -u root -p
(2)执行初始化命令
gbase> initnodedatamap;
(3)修改密码
gbase> set password for root = password(‘’);
2.6、数据库启停命令
$ gcware_services all start/stop/info
$ gcluster_services all start/stop/info
3、执行SQL
3.1、建表语句
create table <table_name> () DISTRIBUTED BY (‘<列名>’)|REPLICATED, COMPRESS (数值_type,字符_type)
3.2、加载数据
load data infile ‘file://IP/路径/文件名(可以用*)’ into table <table_name> CHARACTER SET utf8 fields terminated by ‘\t(空格)’;
3.3、后台执行任务
nohup gccli -hlocalhost -u<用户名> -p<密码> -D<选择数据库> -e “语句1;语句2;” > <输出文件> &2>1 &
4、续费许可
# 导入许可
[gbase@keep-gbase8a-node1 gcinstall]$ ./License
Usage: License <-n nodes | --hosts=demo.hosts> <-f license_file> <-u username> <-p password>
License: error: not enough arguments.
注意事项:
1)、报错 host number : 3 is different with host md5 number : 1
# 如果机器是克隆出来的,机器目录下的/etc/ssh/ssh_host_rsa_key.pub 的md5是一样的。需要重新生成该文件
GBase8a MPP identifys a machine by /etc/ssh/ssh_host_rsa_key.pub file, if this file is NOT qualified, it is a security problem.
The function CheckLicenseHostNum is to check whether /etc/ssh/ssh_host_rsa_key.pub is qualified for identifying a machine.
There are cases that if a VM is a hard copy/clone of another one, but the /etc/ssh/ssh_host_rsa_key.pub is NOT regenerated.
To fix the error, locate the conflict machine,just rm /etc/ssh_host_* and reboot it, rerun gcinstall.py will probably work.
解决方法:
mkdir /etc/ssh/bak
mv /etc/ssh/ssh_host_* /etc/ssh/bak
systemctl restart sshd
2)、安装完数据库,遇到节点close情况
安装完数据库,节点一个open,一个close,查看防火墙和sexlinux
3)、获取esn码,报权限错误
(1)检查gbase的.ssh文件
(2) 检查demo.options文件中的密码
# 获取esn码
[gbase@keep-gbase8a-node1 ~]$./getesn.py --silent=demo.options
# root用户没有python环境变量,使用gbase用户执行
[root@keep-gbase8a-node1:~/gcinstall]# ./getesn.py --silent=demo.options
Traceback (most recent call last):
File "./getesn.py", line 3, in <module>
from rmt import *
ImportError: No module named rmt
# 如果还是报错,将rmt.py 复制到gcinstall目录
4)、需要安装bizp2的rpm包
依赖包在gcinstall目录下的dependRpms中
5)、安装完数据库,节点处于offline
检查安装时的demo.options文件中的ssh端口
6)、报错 /etc/ssh/ssh_host_rsa.key 没权限
chmod 775 /etc/ssh/ssh_host_rsa.key
7)、资源管理cgroup 包
yum install libcgroup-tools -y
8)、GBase8a报错 invalid literal for int() with base 10: ‘’
具体信息:Error: getesn.py(line 134) – 192.168.140.90:invalid literal for int() with base 10: ‘’
# 通过ssh gbase@127.0.0.1 检查ssh登录显示信息
# 登录前显示信息文件:/etc/issue.net
# 登录后显示信息文件:/etc/motd
(1) 第一种情况 /etc/issue.net
[gbase@kylin gcinstall]$ ./getesn.py --silent=demo.options
Error: getesn.py(line 134) -- 192.168.140.90:invalid literal for int() with base 10: ''
[gbase@kylin gcinstall]$ ssh gbase@127.0.0.1
###########################################
# test:192.168.140.90
###########################################
Authorized users only. All activities may be monitored and reported.
gbase@127.0.0.1's password:
Authorized users only. All activities may be monitored and reported.
Web console: https://kylin:9090/
Last login: Tue Apr 9 10:34:15 2024 from 127.0.0.1
(2) 第二种情况 /etc/motd
[gbase@kylin gcinstall]$ ./getesn.py --silent=demo.options
Error: getesn.py(line 134) -- 192.168.140.90:invalid literal for int() with base 10: ''
[gbase@kylin gcinstall]$ ssh gbase@127.0.0.1
Authorized users only. All activities may be monitored and reported.
gbase@127.0.0.1's password:
############################################
# test:127.0.0.1
#############################################
Authorized users only. All activities may be monitored and reported.
Web console: https://kylin:9090/
Last login: Tue Apr 9 10:35:43 2024 from 192.168.140.90
解决方案:
1、把/etc/issue.net和/etc/motd的 '####' 删除
2、测试过超过3个'#'符号,就会报错