合 在同一台主机快速搭建GBase 8c集群环境
环境准备
1 2 3 4 5 6 7 8 9 10 | docker rm -f gbase8c docker run -itd --name gbase8c -h gbase8c \ -p 65330:5432 \ -v /sys/fs/cgroup:/sys/fs/cgroup \ --privileged=true \ lhrbest/lhrcentos76:9.0 \ /usr/sbin/init docker cp GBase8cV5_S3.0.0B76_centos7.8_x86_64.tar.gz gbase8c:/soft/ docker cp sshUserSetup.sh gbase8c:/soft/ |
安装依赖包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | yum install -y libaio-devel flex bison ncurses-devel \ glibc-devel patch readline-devel bzip2 firewalld \ crontabs net-tools openssh-server openssh-clients which sshpass \ ntp chrony systemctl disable firewalld systemctl stop firewalld systemctl status firewalld -- 重启OS sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config setenforce 0 getenforce -- 安装 ntp 组件或 chronyd 组件,确保集群各个节点之间的时间同步 systemctl unmask ntpd systemctl enable ntpd systemctl start ntpd systemctl status ntpd systemctl status ntpd systemctl disable chronyd systemctl stop chronyd systemctl status chronyd |
修改内核参数
1 2 3 4 5 6 7 8 9 | cat >> /etc/sysctl.conf <<"EOF" kernel.shmmax = 4398046511104 kernel.shmmni = 4096 kernel.shmall = 4000000000 kernel.sem = 32000 1024000000 500 32000 EOF sysctl -p |
创建用户
1 2 3 4 5 6 7 8 9 10 11 12 13 | useradd gbase echo "gbase:lhr" | chpasswd echo "gbase ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers cat >> /etc/sysctl.conf <<"EOF" kernel.shmmax = 4398046511104 kernel.shmmni = 4096 kernel.shmall = 4000000000 kernel.sem = 32000 1024000000 500 32000 EOF sysctl -p |
配置互信
1 2 | ./sshUserSetup.sh -user gbase -hosts "gbase8c gbase8c" -advanced exverify –confirm chmod 600 /home/gbase/.ssh/config |
解压安装包
解压安装包 GBase8cV5_S3.0.0B76_centos7.8_x86_64.tar.gz
:
1 2 3 4 5 6 | su - gbase mkdir -p /home/gbase/gbase_package cp /soft/GBase8cV5_S3.0.0B76_centos7.8_x86_64.tar.gz /home/gbase/gbase_package cd /home/gbase/gbase_package tar -zxvf GBase8cV5_S3.0.0B76_centos7.8_x86_64.tar.gz tar zxf GBase8cV5_S3.0.0B76_CentOS_x86_64_om.tar.gz |
开始安装
配置gbase8c.yml文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | cat > /home/gbase/gbase_package/gbase.yml <<"EOF" gha_server: - gha_server1: host: 127.0.0.1 port: 20001 dcs: - host: 127.0.0.1 port: 2379 gtm: - gtm1: host: 127.0.0.1 agent_host: 127.0.0.1 role: primary port: 6666 agent_port: 8001 work_dir: /home/gbase/data/gtm/gtm1 coordinator: - cn1: host: 127.0.0.1 agent_host: 127.0.0.1 role: primary port: 5432 agent_port: 8003 work_dir: /home/gbase/data/coord/cn1 datanode: - dn1: - dn1_1: host: 127.0.0.1 agent_host: 127.0.0.1 role: primary port: 15432 agent_port: 8005 work_dir: /home/gbase/data/dn1/dn1_1 - dn2: - dn2_1: host: 127.0.0.1 agent_host: 127.0.0.1 role: primary port: 20010 agent_port: 8007 work_dir: /home/gbase/data/dn2/dn2_1 env: # cluster_type allowed values: multiple-nodes, single-inst, default is multiple-nodes cluster_type: multiple-nodes pkg_path: /home/gbase/gbase_package # 安装包所在路径 prefix: /home/gbase/gbase_db # 运行目录 version: V5_S3.0.0B76 # 与安装包版本一致 GBase8cV5_S3.0.0B76 user: gbase port: 22 # constant: # virtual_ip: 172.72.3.36/24 EOF |
执行安装脚本
1 2 3 | su - gbase cd /home/gbase/gbase_package/script ./gha_ctl install -c gbase -p /home/gbase/gbase_package -f |
注释:
-c 参数:数据库名称,默认 gbase
-p 参数:配置文件路径,默认 /home/gbase-f参数:若集群已存在,可以强制安装
安装日志位置
1 2 3 | tailf /tmp/gha_ctl/gha_ctl.log cd /home/gbase/gbase_db/log/om/ |
执行时间约 5 分钟,安装结束后,脚本会提示:
1 2 3 4 | { "ret":0, "msg":"Success" } |
集群安装成功!
状态检查
执行
1 2 | /home/gbase/gbase_package/script/gha_ctl monitor -l http://127.0.0.1:2379 /home/gbase/gbase_package/script/gha_ctl monitor -l http://127.0.0.1:2379 -H |
结果如下,说明集群安装正常,数据服务启动中