1 环境说明
1.1 主机信息
我们这里用了 3 台 32C128G 的服务器来安装,操作系统 CentOS 7.6.
[dave@www.cndba.cn ~]$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[dave@www.cndba.cn ~]$ free -g
total used free shared buff/cache available
Mem: 125 19 43 12 62 88
Swap: 0 0 0
1.2 组件说明
GBase 8c 分布式数据库涉及如下五个组件:
- GHA Server:高可用管理器,用来管理整个集群各节点的高可用状态, 类似于patroni,可以配置为主备高可用架构,主备之间可以配置同步或异步方式
- DCS : 集群状态管理器,存储各个节点的高可用状态,负责在故障情况下判断集群各个节点状态。采用Raft的复制协议 。
- GTM :全局事务管理器(Global Transaction Manager) ,负责生成并维护全局时间戳,保证集群数据一致性。 可以配置为主备高可用架构,主备之间可以配置同步或异步方式。
- CN/Coordinator:协调器,对外提供接口,负责进行SQL解析和优化、生成执行计划,并协调数据节点进行数据查询和写入。 采用完全对等的部署方式
- DN/Datanode :数据节点,用于处理存储本节点相关的元数据以及所在的业务数据的分片。 可以配置为主备高可用架构,主备之间可以配置同步或异步方式。
1.3 组件规划
因为服务器数量有限,我们这里这里采用混合部署的架构。 具体规划如下表:
节点类型 | 节点名称 | 机器 | PORT | 角色 |
---|---|---|---|---|
gha_server | gha_server1 | node1 | 20001 | 主 |
dcs | —— | node1 | 2379 | —— |
—— | node2 | 2379 | —— | |
—— | node3 | 2379 | —— | |
gtm | gtm1 | node1 | 6666 | 主 |
gtm2 | node2 | 6666 | 备 | |
coordinator | cn1 | node1 | 5432 | —— |
cn2 | node2 | 5432 | —— | |
datanode | dn1_1 | node1 | 15432 | 主 |
dn1_2 | node2 | 20010 | 主 | |
dn1_3 | node3 | 20010 | 备 |
注意这里的 DCS 实际就是一套 ETCD 集群,因为这个分布式有 2 个集群,DB 集群和 etcd 集群。
2 准备工作(所有节点)
数据库的准备工作都差不多,主要如下。
2.1 检查并修改主机hostname
检查主机名:hostname
linux 6 可以直接修改/etc/hostname文件,linux 7 中有点区别,具体参考我之前的博客:
Linux 7.2 修改主机名
https://www.cndba.cn/dave/article/1795
2.2 关闭防火墙
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
2.3 关闭SELINUX
sestatus
修改/etc/selinux/config文件,设置SELINUX=disabled。
setenforce 0
2.4 配置内核参数
echo “kernel.sem = 40960 2048000 40960 20480” >> /etc/sysctl.conf
sysctl -p
sysctl -w kernel.sem=”40960 2048000 40960 20480”
2.5 安装依赖包
安装依赖包:
yum install bison flex libaio-devel lsb_release patch ncurses-devel bzip2 -y
2.6 配置gbase用户权限
创建gbase用户组和用户:
groupadd gbase
useradd -m -d /home/gbase gbase -g gbase
echo “https://www.cndba.cn“ | passwd —stdin gbase
root 用户编辑sudo配置文件,执行命令:visudo,然后添加如下内容:
gbase ALL=(ALL) NOPASSWD:ALL
后续操作均以gbase身份进行。
2.7 配置gbase免密互信(gbase 用户操作)
创建ssh目录并授权
mkdir ~/.ssh
chmod 700 ~/.ssh
生成密钥文件
ssh-keygen -t rsa
将密钥上传至所有节点,包括本节点
ssh-copy-id gbase@hostip
ssh-copy-id gbase@192.168.56.106
ssh-copy-id gbase@192.168.56.107
ssh-copy-id gbase@192.168.56.108
这里会提示输入 gbase 用户密码。
检验是否完成互信免密(不需要输入密码,就是配置成功)
ssh gbase@hostip
[dave@www.cndba.cn_01 ~]$ ssh gbase@192.168.56.106 date;ssh gbase@192.168.56.107 date;ssh gbase@192.168.56.108 date;
2023年 08月 09日 星期三 18:26:15 CST
2023年 08月 09日 星期三 18:25:30 CST
2023年 08月 09日 星期三 18:25:40 CST
2.8 配置NTP同步
Linux 6 中一般采用 NTP,linux 7 中一般采用 chrony,具体配置步骤参考我之前的博客:
Linux 时间同步配置
http://cndba.cn/Dave/article/702Linux 7 chrony 时间同步服务配置
https://www.cndba.cn/cndba/dave/article/1820
我们这里服务器已经配置过 chrony,所以这里忽略。
3 开始安装
安装只需要在一个节点执行,目录也不需要单独创建,安装脚本会自动创建。
3.1 下载并解压安装文件
分布式情况下一般选GTM主节点作为部署机,所以我们这里只需要在 node1 上下载并解压缩即可。
这个压缩包包了 3 层,有点反人类,逐个解压缩吧:
[dave@www.cndba.cn software]$ unzip GBase8cV5S3.0.0分布式版_x86_64.zip
[dave@www.cndba.cn software]$ tar xzvf GBase8cV5_S3.0.0B78_centos7.8_x86_64.tar.gz
GBase8cV5_S3.0.0B78_CentOS_x86_64_om.sha256
GBase8cV5_S3.0.0B78_CentOS_x86_64_om.tar.gz
GBase8cV5_S3.0.0B78_CentOS_x86_64_pgpool.tar.gz
GBase8cV5_S3.0.0B78_CentOS_x86_64.sha256
GBase8cV5_S3.0.0B78_CentOS_x86_64.tar.bz2
[dave@www.cndba.cn software]$
将压缩包传到目录后继续解压缩:/home/gbase/gbase_package
注意这里会解压缩生成软件目录,所以这里必须单独创建一个目录来存放相关软件。
[dave@www.cndba.cn software]$ mkdir /home/gbase/gbase_package
[dave@www.cndba.cn software]$ cp GBase8cV5_S3.0.0B78_CentOS_x86_64_om.tar.gz /home/gbase/gbase_package/
[dave@www.cndba.cn software]$ cp GBase8cV5_S3.0.0B78_CentOS_x86_64.tar.bz2 /home/gbase/gbase_package/
进入目录继续解压缩:
[dave@www.cndba.cn gbase_package]$ pwd
/home/gbase/gbase_package
[dave@www.cndba.cn gbase_package]$ ll
total 261984
-rw-rw-r-- 1 gbase gbase 103810486 Mar 6 2023 GBase8cV5_S3.0.0B78_CentOS_x86_64_om.tar.gz
-rw-rw-r-- 1 gbase gbase 164458080 Sep 17 10:29 GBase8cV5_S3.0.0B78_CentOS_x86_64.tar.bz2
[dave@www.cndba.cn gbase_package]$
[dave@www.cndba.cn gbase_package]$ tar xzvf GBase8cV5_S3.0.0B78_CentOS_x86_64_om.tar.gz
[dave@www.cndba.cn gbase_package]$ tar -jxvf GBase8cV5_S3.0.0B78_CentOS_x86_64.tar.bz2
解压之后的目录结构如下:
[dave@www.cndba.cn gbase_package]$ pwd
/home/gbase/gbase_package
[dave@www.cndba.cn gbase_package]$ ll
total 263048
drwxrwxr-x 3 gbase gbase 4096 Mar 6 2023 bin
drwxrwxr-x 5 gbase gbase 165 Mar 6 2023 dependency
drwxrwxr-x 3 gbase gbase 22 Mar 6 2023 etc
-rw-rw-r-- 1 gbase gbase 65 Sep 17 10:40 GBase8cV5_S3.0.0B78_CentOS_x86_64_om.sha256
-rw-rw-r-- 1 gbase gbase 103810486 Sep 17 10:40 GBase8cV5_S3.0.0B78_CentOS_x86_64_om.tar.gz
-rw-rw-r-- 1 gbase gbase 1035963 Sep 17 10:40 GBase8cV5_S3.0.0B78_CentOS_x86_64_pgpool.tar.gz
-rw-rw-r-- 1 gbase gbase 65 Sep 17 10:40 GBase8cV5_S3.0.0B78_CentOS_x86_64.sha256
-rw-rw-r-- 1 gbase gbase 164458080 Sep 17 10:40 GBase8cV5_S3.0.0B78_CentOS_x86_64.tar.bz2
-rw-rw-r-- 1 gbase gbase 2570 Mar 6 2023 gbase.yml
drwxrwxr-x 11 gbase gbase 4096 Mar 6 2023 gha
-rw-rw-r-- 1 gbase gbase 188 Mar 6 2023 gha_ctl.ini
drwxrwxr-x 3 gbase gbase 24 Mar 6 2023 include
drwxrwxr-x 4 gbase gbase 95 Mar 6 2023 jre
drwxrwxr-x 5 gbase gbase 8192 Mar 6 2023 lib
-rw-rw-r-- 1 gbase gbase 750 Mar 6 2023 package_info.json
drwxrwxr-x 7 gbase gbase 67 Mar 6 2023 pgpool
drwxr-xr-x 4 gbase gbase 28 Mar 16 2021 python3.8
drwxrwxr-x 10 gbase gbase 4096 Mar 6 2023 script
drwxrwxr-x 5 gbase gbase 53 Mar 6 2023 share
drwxrwxr-x 2 gbase gbase 330 Mar 6 2023 simpleInstall
-rw-rw-r-- 1 gbase gbase 118 Mar 6 2023 ubuntu_version.json
drwx------ 6 gbase gbase 87 Jul 2 2022 venv
-rw-rw-r-- 1 gbase gbase 32 Mar 6 2023 version.cfg
[dave@www.cndba.cn gbase_package]$
3.2 编辑配置文件(很重要,能替换就别修改)
根据组件的规划,修改配置文件:vim /home/gbase/gbase_package/gbase.yml
最终修改后的配置文件如下:
[dave@www.cndba.cn gbase_package]$ cat /home/gbase/gbase_package/gbase.yml
gha_server:
- gha_server1:
host: 10.103.241.83
port: 20001
dcs:
- host: 10.103.241.83
port: 2379
- host: 10.103.241.84
port: 2379
- host: 10.103.241.85
port: 2379
gtm:
- gtm1:
host: 10.103.241.83
agent_host: 10.103.241.83
role: primary
port: 6666
agent_port: 8001
work_dir: /home/gbase/data/gtm/gtm1
- gtm2:
host: 10.103.241.84
agent_host: 10.103.241.84
role: standby
port: 6666
agent_port: 8002
work_dir: /home/gbase/data/gtm/gtm2
coordinator:
- cn1:
host: 10.103.241.83
agent_host: 10.103.241.83
role: primary
port: 5432
agent_port: 8003
work_dir: /home/gbase/data/coord/cn1
- cn2:
host: 10.103.241.84
agent_host: 10.103.241.84
role: primary
port: 5432
agent_port: 8004
work_dir: /home/gbase/data/coord/cn2
datanode:
- dn1:
- dn1_1:
host: 10.103.241.83
agent_host: 10.103.241.83
role: primary
port: 15432
agent_port: 8005
work_dir: /home/gbase/data/dn1/dn1_1
- dn2:
- dn2_1:
host: 10.103.241.84
agent_host: 10.103.241.84
role: primary
port: 20010
agent_port: 8007
work_dir: /home/gbase/data/dn2/dn2_1
# numa:
# cpu_node_bind: 0,1
# mem_node_bind: 0,1
- dn2_2:
host: 10.103.241.85
agent_host: 10.103.241.85
role: standby
port: 20010
agent_port: 8008
work_dir: /home/gbase/data/dn2/dn2_2
# numa:
# cpu_node_bind: 2
# mem_node_bind: 2
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.0B78
user: gbase
port: 22
# constant:
# virtual_ip: 100.0.1.254/24
[dave@www.cndba.cn gbase_package]$
注意我们这里因为 Datanode 节点不够,所以我们配置了 2 组,一组只有主库,一组有主备。
注意: 配置文件中的 IP 地址建议在 vim 用 %s 替换,不要手工修改,否则可能会出现如下错误:
[dave@www.cndba.cn script]$ ./gha_ctl install -c gbase -p /home/gbase/gbase_package
{
"ret":-1,
"msg":"'NoneType' object has no attribute 'group'"
}
GBase 8c 分布式 集群 安装 object has no attribute group 错误 解决方法
https://www.cndba.cn/dave/article/131449
3.3 执行安装
[dave@www.cndba.cn gbase_package]$ cd script/
[dave@www.cndba.cn script]$ cd script/
[dave@www.cndba.cn script]$ ll
total 456
drwxrwxr-x 2 gbase gbase 124 Mar 6 2023 base_diff
drwxrwxr-x 7 gbase gbase 95 Mar 6 2023 base_utils
drwxrwxr-x 2 gbase gbase 53 Mar 6 2023 config
drwxrwxr-x 7 gbase gbase 119 Mar 6 2023 domain_utils
-rwxrwxr-x 1 gbase gbase 113 Mar 6 2023 gha_agent
-rwxrwxr-x 1 gbase gbase 386 Mar 6 2023 gha_ctl
-rwxrwxr-x 1 gbase gbase 114 Mar 6 2023 gha_server
-rwxrwxr-x 1 gbase gbase 8916 Mar 6 2023 gs_backup
-rwxrwxr-x 1 gbase gbase 64836 Mar 6 2023 gs_check
-rwxrwxr-x 1 gbase gbase 60769 Mar 6 2023 gs_checkos
-rwxrwxr-x 1 gbase gbase 10802 Mar 6 2023 gs_checkperf
-rwxrwxr-x 1 gbase gbase 16485 Mar 6 2023 gs_collector
-rwxrwxr-x 1 gbase gbase 7250 Mar 6 2023 gs_deploy
-rwxrwxr-x 1 gbase gbase 18112 Mar 6 2023 gs_dropnode
-rwxrwxr-x 1 gbase gbase 28497 Mar 6 2023 gs_expansion
-rwxrwxr-x 1 gbase gbase 12735 Mar 6 2023 gs_install
-rwxrwxr-x 1 gbase gbase 33116 Mar 6 2023 gs_om
-rwxrwxr-x 1 gbase gbase 15724 Mar 6 2023 gs_postuninstall
-rwxrwxr-x 1 gbase gbase 19588 Mar 6 2023 gs_preinstall
drwxrwxr-x 11 gbase gbase 150 Mar 6 2023 gspylib
-rwxrwxr-x 1 gbase gbase 11088 Mar 6 2023 gs_restorenode
-rwxrwxr-x 1 gbase gbase 9048 Mar 6 2023 gs_ssh
-rwxrwxr-x 1 gbase gbase 57267 Mar 6 2023 gs_sshexkey
-rwxrwxr-x 1 gbase gbase 6347 Mar 6 2023 gs_uninstall
-rwxrwxr-x 1 gbase gbase 13305 Mar 6 2023 gs_upgradectl
drwxrwxr-x 14 gbase gbase 215 Mar 6 2023 impl
-rwxrwxr-x 1 gbase gbase 0 Mar 6 2023 __init__.py
-rwxrwxr-x 1 gbase gbase 6110 Mar 6 2023 killall
drwxrwxr-x 2 gbase gbase 4096 Mar 6 2023 local
drwxrwxr-x 2 gbase gbase 181 Mar 6 2023 os_platform
-rwxrwxr-x 1 gbase gbase 3853 Mar 6 2023 py_pstree.py
-rwxrwxr-x 1 gbase gbase 6603 Mar 6 2023 transfer.py
-rwxrwxr-x 1 gbase gbase 145 Mar 6 2023 xlog_parse
[dave@www.cndba.cn script]$
查看命令帮助:
[dave@www.cndba.cn script]$ ./gha_ctl install --help
Usage: gha_ctl.py install [OPTIONS]
Install package
Options:
-p, --config TEXT config yaml file path [required]
-c, --cluster TEXT cluster name
-f, --force_install / -F, --no-force_install
Force install cluster without checking old
cluster exists
--help Show this message and exit.
[dave@www.cndba.cn script]$
开始安装(3 分钟左右):
[dave@www.cndba.cn_01 script]$ ./gha_ctl install -c gbase -p /home/gbase/gbase_package/
{
"ret":0,
"msg":"Success"
}
[dave@www.cndba.cn_01 script]$
[dave@www.cndba.cn_01 script]$ gha_ctl monitor -l http://192.168.56.106:2379 -H
+----+-------------+----------------+-------+---------+--------+
| No | name | host | port | state | leader |
+----+-------------+----------------+-------+---------+--------+
| 0 | gha_server1 | 192.168.56.106 | 20001 | running | True |
+----+-------------+----------------+-------+---------+--------+
+----+------+----------------+------+---------------------------+---------+---------+
| No | name | host | port | work_dir | state | role |
+----+------+----------------+------+---------------------------+---------+---------+
| 0 | gtm1 | 192.168.56.106 | 6666 | /home/gbase/data/gtm/gtm1 | running | primary |
+----+------+----------------+------+---------------------------+---------+---------+
+----+------+----------------+------+----------------------------+---------+---------+
| No | name | host | port | work_dir | state | role |
+----+------+----------------+------+----------------------------+---------+---------+
| 0 | cn1 | 192.168.56.107 | 5432 | /home/gbase/data/coord/cn1 | running | primary |
| 1 | cn2 | 192.168.56.108 | 5432 | /home/gbase/data/coord/cn2 | running | primary |
+----+------+----------------+------+----------------------------+---------+---------+
+----+-------+-------+----------------+-------+----------------------------+---------+---------+
| No | group | name | host | port | work_dir | state | role |
+----+-------+-------+----------------+-------+----------------------------+---------+---------+
| 0 | dn1 | dn1_1 | 192.168.56.107 | 15432 | /home/gbase/data/dn1/dn1_1 | running | primary |
| 1 | dn2 | dn2_1 | 192.168.56.108 | 20010 | /home/gbase/data/dn2/dn2_1 | running | primary |
+----+-------+-------+----------------+-------+----------------------------+---------+---------+
+----+----------------------------+--------+---------+----------+
| No | url | name | state | isLeader |
+----+----------------------------+--------+---------+----------+
| 0 | http://192.168.56.107:2379 | node_1 | healthy | False |
| 1 | http://192.168.56.106:2379 | node_0 | healthy | True |
| 2 | http://192.168.56.108:2379 | node_2 | healthy | False |
+----+----------------------------+--------+---------+----------+
[dave@www.cndba.cn_01 script]$
查看日志:
[dave@www.cndba.cn_01 ~]$ tail -f /tmp/gha_ctl/gha_ctl.log
2023-09-22 20:55:37 command_util.py execute 269 DEBUG 31102 cmd:ssh -E /dev/null -p 22 gbase@192.168.56.107 "tar xf /home/gbase/gbase_package/GBase8cV5_S3.0.0B98_centos7.8_x86_64.tar.gz -C /home/gbase/gbase_db/om; find /home/gbase/gbase_db/om -name '*_om.tar.gz' | xargs -I {} tar zxf {} -C /home/gbase/gbase_db/om;sudo chown -R gbase: /home/gbase/gbase_db/om/*", status:0, output:
2023-09-22 20:55:37 command_util.py execute 269 DEBUG 31102 cmd:ssh -E /dev/null -p 22 gbase@192.168.56.108 "tar xf /home/gbase/gbase_package/GBase8cV5_S3.0.0B98_centos7.8_x86_64.tar.gz -C /home/gbase/gbase_db/om; find /home/gbase/gbase_db/om -name '*_om.tar.gz' | xargs -I {} tar zxf {} -C /home/gbase/gbase_db/om;sudo chown -R gbase: /home/gbase/gbase_db/om/*", status:0, output:
2023-09-22 20:55:37 command_util.py execute 269 DEBUG 31102 cmd:ssh -E /dev/null -p 22 gbase@192.168.56.107 "sed -n '3p' /home/gbase/gbase_db/om/version.cfg", status:0, output:fac297bb
……
4 集群操作
其实这里的操作和 openGauss 保持一致,我们先了解几个常用命令。
4.1 连接 cn 数据库
[dave@www.cndba.cn_02:~]# su - gbase
[dave@www.cndba.cn_02 ~]$ gsql -d postgres
gsql ((multiple_nodes GBase8cV5 3.0.0B98 build fac297bb) compiled at 2023-06-29 14:35:35 commit 0 last mr 1428 )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
postgres=# show dbs;
ERROR: unrecognized configuration parameter "dbs"
postgres=# /d
List of relations
Schema | Name | Type | Owner | Storage
--------+------+------+-------+---------
public | dual | view | gbase |
4.2 停止数据库
[dave@www.cndba.cn_02 ~]$ gha_ctl stop all -l http://192.168.56.106:2379
{
"ret":0,
"msg":"Success"
}
4.3 查看集群状态
[dave@www.cndba.cn_02 ~]$ gha_ctl monitor -l http://192.168.56.106:2379 -H
+----+-------------+----------------+-------+---------+--------+
| No | name | host | port | state | leader |
+----+-------------+----------------+-------+---------+--------+
| 0 | gha_server1 | 192.168.56.106 | 20001 | stopped | False |
+----+-------------+----------------+-------+---------+--------+
+----+------+----------------+------+---------------------------+---------+---------+
| No | name | host | port | work_dir | state | role |
+----+------+----------------+------+---------------------------+---------+---------+
| 0 | gtm1 | 192.168.56.106 | 6666 | /home/gbase/data/gtm/gtm1 | stopped | primary |
+----+------+----------------+------+---------------------------+---------+---------+
+----+------+----------------+------+----------------------------+---------+---------+
| No | name | host | port | work_dir | state | role |
+----+------+----------------+------+----------------------------+---------+---------+
| 0 | cn1 | 192.168.56.107 | 5432 | /home/gbase/data/coord/cn1 | stopped | primary |
| 1 | cn2 | 192.168.56.108 | 5432 | /home/gbase/data/coord/cn2 | stopped | primary |
+----+------+----------------+------+----------------------------+---------+---------+
+----+-------+-------+----------------+-------+----------------------------+---------+---------+
| No | group | name | host | port | work_dir | state | role |
+----+-------+-------+----------------+-------+----------------------------+---------+---------+
| 0 | dn1 | dn1_1 | 192.168.56.107 | 15432 | /home/gbase/data/dn1/dn1_1 | stopped | primary |
| 1 | dn2 | dn2_1 | 192.168.56.108 | 20010 | /home/gbase/data/dn2/dn2_1 | stopped | primary |
+----+-------+-------+----------------+-------+----------------------------+---------+---------+
+----+----------------------------+--------+---------+----------+
| No | url | name | state | isLeader |
+----+----------------------------+--------+---------+----------+
| 0 | http://192.168.56.107:2379 | node_1 | healthy | False |
| 1 | http://192.168.56.106:2379 | node_0 | healthy | True |
| 2 | http://192.168.56.108:2379 | node_2 | healthy | False |
+----+----------------------------+--------+---------+----------+
4.4 启动数据库
[dave@www.cndba.cn_02 ~]$ gha_ctl start all -l http://192.168.56.106:2379
{
"ret":0,
"msg":"Success"
}
[dave@www.cndba.cn_02 ~]$ gha_ctl monitor -l http://192.168.56.106:2379 -H
+----+-------------+----------------+-------+---------+--------+
| No | name | host | port | state | leader |
+----+-------------+----------------+-------+---------+--------+
| 0 | gha_server1 | 192.168.56.106 | 20001 | running | True |
+----+-------------+----------------+-------+---------+--------+
+----+------+----------------+------+---------------------------+---------+---------+
| No | name | host | port | work_dir | state | role |
+----+------+----------------+------+---------------------------+---------+---------+
| 0 | gtm1 | 192.168.56.106 | 6666 | /home/gbase/data/gtm/gtm1 | running | primary |
+----+------+----------------+------+---------------------------+---------+---------+
+----+------+----------------+------+----------------------------+---------+---------+
| No | name | host | port | work_dir | state | role |
+----+------+----------------+------+----------------------------+---------+---------+
| 0 | cn1 | 192.168.56.107 | 5432 | /home/gbase/data/coord/cn1 | running | primary |
| 1 | cn2 | 192.168.56.108 | 5432 | /home/gbase/data/coord/cn2 | running | primary |
+----+------+----------------+------+----------------------------+---------+---------+
+----+-------+-------+----------------+-------+----------------------------+---------+---------+
| No | group | name | host | port | work_dir | state | role |
+----+-------+-------+----------------+-------+----------------------------+---------+---------+
| 0 | dn1 | dn1_1 | 192.168.56.107 | 15432 | /home/gbase/data/dn1/dn1_1 | running | primary |
| 1 | dn2 | dn2_1 | 192.168.56.108 | 20010 | /home/gbase/data/dn2/dn2_1 | running | primary |
+----+-------+-------+----------------+-------+----------------------------+---------+---------+
+----+----------------------------+--------+---------+----------+
| No | url | name | state | isLeader |
+----+----------------------------+--------+---------+----------+
| 0 | http://192.168.56.107:2379 | node_1 | healthy | False |
| 1 | http://192.168.56.106:2379 | node_0 | healthy | True |
| 2 | http://192.168.56.108:2379 | node_2 | healthy | False |
+----+----------------------------+--------+---------+----------+
[dave@www.cndba.cn_02 ~]$
5 卸载集群
在主节点(192.168.56.106)执行以下命令。
5.1 停止所有节点的集群服务
[dave@www.cndba.cn_01 ~]$ gha_ctl stop all -l http://192.168.56.106:2379
{
"ret":0,
"msg":"Success"
}
[dave@www.cndba.cn_01 ~]$
5.2 DB集群卸载
因为整个集群有 2 个集群,所以要分开分别卸载,先卸载 DB 集群:
[dave@www.cndba.cn_01 ~]$ gha_ctl uninstall -l http://192.168.56.106:2379
{
"ret":0,
"msg":"Success"
}
[dave@www.cndba.cn_01 ~]$
这里主要是删除相关的文件。
5.3 删掉dcs集群
在卸载 DB 集群的时候,相关环境变量和文件以上删除,所以要进入目录,才能继续执行 gha_ctl 命令。
[dave@www.cndba.cn_01 script]$ pwd
/home/gbase/gbase_package/script
[dave@www.cndba.cn_01 script]$ ./gha_ctl destroy dcs -l http://192.168.56.106:2379
{
"ret":0,
"msg":"Success"
}
[dave@www.cndba.cn_01 script]$
5.4 确认进程
卸载之后确认进程是否存在,存在就 kill 掉:
[dave@www.cndba.cn_01 ~]$ ps -ef|grep gbase
版权声明:本文为博主原创文章,未经博主允许不得转载。