GBase8a兼容改造多VC模式实施指导步骤(项目现场版)
变更前提:
1)请提前申请该集群管理节点和故障数据节点的root、gbase系统账号ID
2)请替换本操作步骤中的XXX为gbase数据库用户的密码
3)结果不可逆,即不能从多VC模式变更成兼容模式
变更内容:
1)将集群模式由 兼容模式 改造为 多VC模式
核心步骤:
1)按兼容模式扩容数据节点步骤,新装一个数据节点(也可以把其中一台管理节点作为数据节点使用,即该节点作为复合节点);
2)将新装的节点rmnodes变更为FreeNode;
3)将FreeNode节点作为一个新的VC2创建,集群其他节点会归至名称为vcname000001的虚拟集群;
4)调整名称为vcname000001的虚拟集群的名称为 实际需要VC名称;
5)将创建的虚拟集群VC2中新增的节点进行移除变为FreeNode;
6)卸载新装的数据节点(如果是管理节点,即将复合节点调回至管理节点)。
环境信息
1)管理节点:
10.174.68.10
10.174.68.11
10.174.68.12
2)数据节点1:
10.174.68.196
10.174.68.197
10.174.68.198
10.174.68.199
#### 一、集群环境状况检查
## 1.1 业务应用关停确认
[root@D10CDRAPCTLF01 ~]# su - gbase
[gbase@D10CDRAPCTLF01 ~]$ sh ~/showprocesslist.sh c all
[gbase@D10CDRAPCTLF01 ~]$ sh ~/showprocesslist.sh n all
## 1.2 集群状态及event检查
[gbase@D10CDRAPCTLF01 ~]$ gcadmin showcluster;
[gbase@D10CDRAPCTLF01 ~]$ gcadmin showddlevent | grep count; gcadmin showdmlevent | grep count; gcadmin showdmlstorageevent | grep count
## 1.3 扩容节点信息登记
[gbase@D10CDRAPCTLF01 ~]$ echo -e "10.174.68.12" > /opt/gbase_workspace/scripts/config/new.list
[gbase@D10CDRAPCTLF01 ~]$ echo -e "10.174.68.12" > /opt/gbase_workspace/scripts/config/node.list
#### 二、新增节点参数配置(无需执行,借用现有集群管理节点)
## 2.1 root用户互信配置 (root用户执行)
[root@D10CDRAPCTLF01 ~]# cd /opt/gbase_workspace/scripts/autossh
[root@D10CDRAPCTLF01 autossh]# cat /opt/gbase_workspace/scripts/config/new.list >> ip.list
[root@D10CDRAPCTLF01 autossh]# cat ip.list
[root@D10CDRAPCTLF01 autossh]# read -s -p "rootPwd: " rootPwd; echo -e "\r"; expect autossh_par.sh ip.list root $rootPwd
## 2.2 C3工具参数配置 (root用户执行)
[root@D10CDRAPCTLF01 autossh]# ips=''; for ip in $(cat /opt/gbase_workspace/scripts/config/new.list); do ips=$ips$ip"\n\t"; done;
[root@D10CDRAPCTLF01 autossh]# echo -e "cluster new {\n\t10.174.68.10:127.0.0.1\n\tdead remove-index-00\n\t$ips}" >> /etc/c3.conf
[root@D10CDRAPCTLF01 autossh]# cexec -p new: 'hostname'
## 2.3 hotst文件更新 (root用户执行)
[root@GBASEMA01 autossh]# cpush new: '/etc/hosts /tmp'
[root@GBASEMA01 autossh]# cexec new: 'cat /tmp/hosts |tail -n +3 >> /etc/hosts'
[root@GBASEMA01 autossh]# cexec new: 'cat /etc/hosts'
## 2.4 必要RPM包安装 (root用户执行)
[root@D10CDRAPCTLF01 autossh]# cexec new: 'yum install -y bc bzip2 *cgroup* rsync lsof gdb numactl'
## 2.5 创建gbase用户 (root用户执行)
[root@D10CDRAPCTLF01 autossh]# cexec new: 'useradd gbase'
[root@D10CDRAPCTLF01 autossh]# cexec new: 'echo gbase:GGG|chpasswd'
[root@D10CDRAPCTLF01 autossh]# cexec new: 'chown -R gbase:gbase /opt'
[root@D10CDRAPCTLF01 autossh]# cexec new: 'chage -M 9999 gbase'
## 2.6 环境检查 (root用户执行)
[root@D10CDRAPCTLF01 autossh]# cexec new: 'cat /proc/version'
[root@D10CDRAPCTLF01 autossh]# cexec new: 'cat /etc/system-release'
[root@D10CDRAPCTLF01 autossh]# cexec new: 'df -h|grep opt'
[root@D10CDRAPCTLF01 autossh]# cexec new: 'ip a|grep inet'
[root@D10CDRAPCTLF01 autossh]# cexec -p new: 'cat /proc/cpuinfo |grep "model name" | head -n1'
[root@D10CDRAPCTLF01 autossh]# cexec -p new: 'grep "model name" /proc/cpuinfo|wc -l'
[root@D10CDRAPCTLF01 autossh]# cexec -p new: 'grep "physical id" /proc/cpuinfo|sort|uniq|wc -l'
[root@D10CDRAPCTLF01 autossh]# cexec -p new: 'grep "cpu cores" /proc/cpuinfo|sort|uniq'
[root@D10CDRAPCTLF01 autossh]# cexec -p new: 'free -g'
[root@D10CDRAPCTLF01 autossh]# cexec -p new: 'hostname'
## 2.7 磁盘性能测试(选做)(root用户执行)
[root@D10CDRAPCTLF01 ~]# cpush new: /opt/gbase_workspace/tools/dd.sh /opt/
[root@D10CDRAPCTLF01 ~]# cexec new: 'sh /opt/dd.sh > /opt/dd.log'
[root@D10CDRAPCTLF01 ~]# cexec new: 'cat /opt/dd.log'
[root@D10CDRAPCTLF01 ~]# cexec new: 'rm -rf /opt/write.data'
## 2.8 环境初始化 (root用户执行)
[root@D10CDRAPCTLF01 gcinstall]# cpush new: /opt/gbase_workspace/setup/gcinstall/SetSysEnv.py /tmp
[root@D10CDRAPCTLF01 gcinstall]# cexec new: 'sed -i "s/^.*net.ipv4.tcp_timestamps.*$/#&/g; s/^.*net.ipv4.tcp_tw_recycle.*$/#&/g; s/^.*net.ipv4.tcp_tw_reuse.*$/#&/g" /tmp/SetSysEnv.py'
[root@D10CDRAPCTLF01 gcinstall]# cexec new: 'python /tmp/SetSysEnv.py --installPrefix=/opt --dbaUser=gbase --cgroup'
[root@D10CDRAPCTLF01 gcinstall]# su - gbase
## 2.9 gbase用户互信配置 (gbase用户执行)
[gbase@D10CDRAPCTLF01 ~]$ cd /opt/gbase_workspace/scripts/autossh
[gbase@D10CDRAPCTLF01 autossh]$ cat ip.list
[gbase@D10CDRAPCTLF01 autossh]$ read -s -p "gbasePwd: " gbasePwd; echo -e "\r"; expect autossh_par.sh ip.list gbase $gbasePwd
[gbase@D10CDRAPCTLF01 autossh]$ cexec -p new: 'hostname'
## 2.10 集群有效参数备份 (gbase用户执行)
[gbase@D10CDRAPCTLF01 ~]$ cd /opt/gbase_workspace/scripts/check_variables
[gbase@D10CDRAPCTLF01 check_variables]$ mkdir -p old_var/$(date +%Y%m%d); mv -t old_var/$(date +%Y%m%d) *.log *.list 2>/dev/null
[gbase@D10CDRAPCTLF01 check_variables]$ sh variables.sh; ll
## 2.11 集群版本检查 (gbase用户执行)
[gbase@D10CDRAPCTLF01 ~]$ cat /opt/gbase_workspace/setup/gcinstall/BUILDINFO
[gbase@D10CDRAPCTLF01 ~]$ gccli -V
[gbase@D10CDRAPCTLF01 ~]$ gccli -ugbase -p -e "select @@version"
#### 三、集群模式改造实施(数据节点扩容&缩容)
# 3.1 修改安装文件 (gbase用户执行)
[gbase@D10CDRAPCTLF01 ~]$ cd /opt/gbase_workspace/setup/gcinstall
[gbase@D10CDRAPCTLF01 gcinstall]$ mkdir -p old_demo; cp demo.options old_demo/demo_$(date +%Y%m%d).options
[gbase@D10CDRAPCTLF01 gcinstall]$ vim demo.options
installPrefix= /opt
dataHost = 10.174.68.12
existCoordinateHost = 10.174.68.10,10.174.68.11,10.174.68.12
existDataHost = 10.174.68.196,10.174.68.197,10.174.68.198,10.174.68.199
existGcwareHost= 10.174.68.10,10.174.68.11,10.174.68.12
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'GGG'
rootPwd = ''
#characterSet = utf8
#coordinateHost =
#coordinateHostNodeID =
#gcwareHost =
#gcwareHostNodeID =
#dbRootPwd = ''
#rootPwdFile = rootPwd.json
#sshPort = 22
[gbase@D10CDRAPCTLF01 gcinstall]$ cat demo.options
## 3.2 安装集群 (gbase用户执行)
[gbase@D10CDRAPCTLF01 gcinstall]$ python gcinstall.py --silent=demo.options -i
[gbase@D10CDRAPCTLF01 gcinstall]$ exit
[root@D10CDRAPCTLF01 ~]# cexec all: 'python /tmp/SetSysEnv.py --installPrefix=/opt --dbaUser=gbase --cgroup'
[root@D10CDRAPCTLF01 ~]# su - gbase
#确保新增节点状态为OPEN,否则不执行后续操作
[gbase@D10CDRAPCTLF01 ~]$ gcadmin
## 3.3 节点变更为FreeNode
[gbase@D10CDRAPCTLF01 ~]$ cd /opt/gbase_workspace/setup/gcinstall
[gbase@D10CDRAPCTLF01 gcinstall]$ vim gcChangeInfo_tmpdata.xml
<?xml version="1.0" encoding="utf-8"?>
<servers>
<rack>
<node ip="10.174.68.12"/>
</rack>
</servers>
[gbase@D10CDRAPCTLF01 gcinstall]$ cat gcChangeInfo_tmpdata.xml
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin rmnodes gcChangeInfo_tmpdata.xml single_vc_rm_to_rc
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin
## 3.4 数据节点变更VC模式 (gbase用户执行)
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin createvc e create_vc2.xml
[gbase@D10CDRAPCTLF01 gcinstall]$ vim create_vc2.xml
<?xml version="1.0" encoding="utf-8"?>
<servers>
<rack>
<node ip="10.174.68.12"/>
</rack>
<vc_name name="vc2"/>
<comment message="vc2 comment"/>
</servers>
[gbase@D10CDRAPCTLF01 gcinstall]$ cat create_vc2.xml
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin createvc create_vc2.xml
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin showcluster vc vc2
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin showcluster vc vcname000001
## 3.5 默认VC名称变更 (gbase用户执行)
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin renamevc vcname000001 vc1
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin showcluster vc vc1
## 3.6 新增节点移除VC (gbase用户执行)
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin rmnodes gcChangeInfo_tmpdata.xml vc2
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin rmnodes gcChangeInfo_tmpdata.xml
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin rmvc vc2
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin
## 3.7 集群服务停止 (gbase用户执行)
[gbase@GBASEMA01 ~]$ cexec all: 'gcluster_services all stop'
[gbase@GBASEMA01 ~]$ cexec all: 'gcluster_services all info'
[gbase@GBASEMA01 ~]$ cexec coor: 'gcware_services all stop'
[gbase@GBASEMA01 ~]$ cexec coor: 'gcware_services all info'
[gbase@GBASEMA01 ~]$ cexec all: 'ps -ef|grep -Ei "gclusterd|gbased|gcware" | grep -v grep'
## 3.8 卸载虚拟节点 (gbase用户执行)
[gbase@D10CDRAPCTLF01 gcinstall]$ cp demo.options demoUn.options
[gbase@D10CDRAPCTLF01 gcinstall]$ vim demoUn.options
installPrefix= /opt
#coordinateHost =
#coordinateHostNodeID =
dataHost = 10.174.68.12
existCoordinateHost = 10.174.68.10,10.174.68.11,10.174.68.12
existDataHost = 10.174.68.196,10.174.68.197,10.174.68.198,10.174.68.199
existGcwareHost= 10.174.68.10,10.174.68.11,10.174.68.12
#gcwareHost =
#gcwareHostNodeID =
dbaUser = gbase
dbaGroup = gbase
dbaPwd = 'XXX'
rootPwd = ''
#dbRootPwd = ''
#rootPwdFile = rootPwd.json
#characterSet = utf8
#sshPort = 22
[gbase@D10CDRAPCTLF01 gcinstall]$ cat demoUn.options
[gbase@D10CDRAPCTLF01 gcinstall]$ python unInstall.py --silent=demoUn.options
[gbase@D10CDRAPCTLF01 gcinstall]$ gcadmin
## 3.9 指定现有用户默认VC (gbase用户执行)
[gbase@GBASEMA01 ~]# gccli -ugbase -p -e "select user,default_vc from gbase.user where user not in ('root','gbase','dbperf','dbmon')"
[gbase@GBASEMA01 ~]# gccli -ugbase -p
# dbUser调整为实际数据库用户名
set default_vc for dbUser=vc1;
## 3.10 修改config文件 (gbase用户执行)
[gbase@GBASEMA01 gcinstall]$ cd /opt/gbase_workspace/scripts/config
[gbase@GBASEMA01 config]$ sed -i 's/GBaseMode=2/GBaseMode=1/g' config
[gbase@GBASEMA01 config]$ cat config | grep GBaseMode
[gbase@GBASEMA01 config]$ sh create_config.sh
## 3.11 修改C3配置文件 (root用户执行)
[root@GBASEMA01 ~]# sed -i 's/cluster data/cluster vc1/g' /etc/c3.conf
[root@GBASEMA01 ~]# vim /etc/c3.conf
[root@GBASEMA01 ~]# cexec -p vc1: 'hostname'
## 3.12 登记信息清理
[root@D10CDRAPCTLF01 ~]# echo > /opt/gbase_workspace/scripts/config/new.list
[root@D10CDRAPCTLF01 ~]# echo > /opt/gbase_workspace/scripts/config/node.list
******************************************************* 验证步骤 *******************************************************
## 1.1 变更后集群模式
[gbase@D10CDRAPCTLF01 ~]$ gcadmin
[gbase@D10CDRAPCTLF01 ~]$ gcadmin showcluster vc vc1
[gbase@D10CDRAPCTLF01 ~]$ gcadmin showdistribution vc vc1
[gbase@D10CDRAPCTLF01 ~]$ gcadmin showddlevent vc vc1 |grep count; gcadmin showdmlevent vc vc1 |grep count; gcadmin showdmlstorageevent vc vc1 |grep count;
******************************************************* 回退步骤 *******************************************************
## 实施步骤结果不可逆,实施完成后无回退步骤
******************************************************* 应急步骤 *******************************************************
## 1.1 更改root用户密码 (root用户执行)
# 此处的RRR更换为root用户密码
[root@GBASEMA01 ~]# cexec new: 'echo root:RRR|chpasswd'
[root@GBASEMA01 ~]# cexec all: 'echo root:RRR|chpasswd'
## 1.2 更改gbase用户密码 (root用户执行)
# 此处的GGG更换为gbase用户密码
[root@GBASEMA01 ~]# cexec new: 'echo gbase:GGG|chpasswd'
[root@GBASEMA01 ~]# cexec all: 'echo gbase:GGG|chpasswd'
## 1.3 重启集群服务 (gbase用户)
[gbase@GBASEMA01 ~]$ sh ~/showprocesslist.sh c all;
[gbase@GBASEMA01 ~]$ sh ~/showprocesslist.sh n all;
[gbase@GBASEMA01 ~]$ cexec all: 'gcluster_services all stop'
[gbase@GBASEMA01 ~]$ cexec all: 'gcluster_services all start'
[gbase@GBASEMA01 ~]$ cexec coor: 'gcware_services all stop'
[gbase@GBASEMA01 ~]$ cexec coor: 'gcware_services all start'
[gbase@GBASEMA01 ~]$ cexec all: 'ps -ef|grep -Ei "gcware|gclusterd|gbased" | grep -v grep'
热门帖子
- 12025-12-01浏览数:182759
- 22023-05-09浏览数:25044
- 42023-09-25浏览数:18519
- 52020-05-11浏览数:17526