麒麟V10P2安装gaussdb3.0.3(cm一主两备)及扩容和缩容节点操作笔记

2023年 8月 15日 47.7k 0

仅供参考

openGauss集群管理组件(CM)浅析
https://opengauss.org/zh/blogs/wangshanshan/openGauss%E9%9B%86%E7%BE%A4%E7%AE%A1%E7%90%86%E7%BB%84%E4%BB%B6%EF%BC%88CM%EF%BC%89%E6%B5%85%E6%9E%90.html

openGauss1.1.0主备集群节点的添加和删除
https://opengauss.org/zh/blogs/jiajunfeng/openGauss1-1-0%E4%B8%BB%E5%A4%87%E9%9B%86%E7%BE%A4%E8%8A%82%E7%82%B9%E7%9A%84%E6%B7%BB%E5%8A%A0%E5%92%8C%E5%88%A0%E9%99%A4.html

操作系统镜像版本
Kylin-Server-10-SP2-x86-Release-Build09-20210524.iso

opengauss版本
openGauss-3.0.3-openEuler-64bit-all.tar.gz

5台虚拟机,每台虚拟机内存3G swap 8G

database password : Gauss_123
root password: gass_123
omm password: gass_123

主机ip 主机名
192.168.0.61 gsdb01
192.168.0.62 gsdb02
192.168.0.63 gsdb03
192.168.0.64 gsdb04 #配置好后关机
192.168.0.65 gsdb05 #配置好后关机

系统安装、参数、防火墙、时钟同步等配置参考请参考官方或其它文档

lsb_release -a
LSB Version: :core-5.0-amd64:core-5.0-noarch
Distributor ID: KylinAdvancedServer
Description: Kylin Linux Advanced Server release V10 (Sword)
Release: V10
Codename: Sword

[omm@gsdb01 ~]$ cat /etc/kylin-release
Kylin Linux Advanced Server release V10 (Sword)

uname -r
4.19.90-24.4.v2101.ky10.x86_64

mount /dev/sr0 /mnt
yum install -y expect #本工具需要安装一下,做互信时使用

mkdir /gauss
mkdir -p /gauss/{gaussdb,archive,scripts,backup,soft}

用户需要手动建一下,文件系统需要改一下权限,否则gs_preinstall时报错
groupadd dbgrp
useradd -g dbgrp omm
echo "gass_123" |passwd --stdin omm

chown omm:dbgrp -R /gauss

rm -rf /gauss/{archive,backup,gaussdb}/* #第一次不用执行,安装失败时可能用到,比如某个目录不为空报错

=============================一主两备集群安装=============================================

一主两备配置文件准备

[root@gsdb01 ~]# vim /gauss/soft/cluster_config_gsdb.xml

gsdb01节点执行参数等初始化配置
[root@gsdb01 script]# ./gs_preinstall -U omm -G dbgrp -X /gauss/soft/cluster_config_gsdb.xml
Warnging version of python doesnot meet the expection, maybe third-party libs need to be compiled by yourself #这里只是警告不影响部署,可以忽略
Warnging version of python doesnot meet the expection, maybe third-party libs need to be compiled by yourself
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Are you sure you want to create trust for root (yes/no)?yes
Please enter password for root
Password:
Successfully created SSH trust for the root permission user.
Setting host ip env
Successfully set host ip env.
Distributing package.
Begin to distribute package to tool path.
Successfully distribute package to tool path.
Begin to distribute package to package path.
Successfully distribute package to package path.
Successfully distributed package.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Preparing SSH service.
Successfully prepared SSH service.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking hostname mapping.
Successfully checked hostname mapping.
Creating SSH trust for [omm] user.
Please enter password for current user[omm].
Password:
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Distributing trust keys file to all node successfully.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for [omm] user.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster's path.
Successfully created cluster's path.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/gauss/soft/script/gs_checkos -i A -h gsdb01,gsdb02,gsdb03,gsdb04,gsdb05 --detail".
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Setting Cgroup.
Successfully set Cgroup.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.

集群安装
database password : Gauss_123
$su - omm
$ gs_install -X /gauss/soft/cluster_config_gsdb.xml

更新omm密码
gsql -d postgres -p 15400 -r

ALTER USER omm WITH password 'Gauss_12345';
\q
gsql -h 127.0.0.1 -p 15400 -U omm -d postgres -r

查看集群状态
gs_om -t status --detail

访问控制
gsql -h 127.0.0.1 -p 15400 -U omm -d postgres -r
Gauss_12345

创建数据库testdb和用户test并授权
create user test with password 'test_123';
CREATE DATABASE testdb OWNER test;
GRANT ALL PRIVILEGES ON all tables in schema public TO test;
GRANT ALL PRIVILEGES ON DATABASE testdb TO test;
GRANT ALL PRIVILEGES TO test;

=========新增 gsdb04,gsdb05两个节点(gsdb04、gsdb05开机,确保时间和前3台同步)========================
我笔记本只有16GB,所以把5台虚拟机分别配置为: gsdb01 3GB gsdb02、03 内存2GB gsdb04/05内存临时改为6GB 。安装完成后关机都改回2GB即可

[omm@gsdb02 ~]$ cm_ctl query -Cvid
[ CMServer State ]

node node_ip instance state
------------------------------------------------------------------------
1 gsdb01 192.168.0.61 1 /gauss/gaussdb/cmserver/cm_server Standby
2 gsdb02 192.168.0.62 2 /gauss/gaussdb/cmserver/cm_server Standby
3 gsdb03 192.168.0.63 3 /gauss/gaussdb/cmserver/cm_server Primary

[ Cluster State ]

cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL

[ Datanode State ]

node node_ip instance state | node node_ip instance state | node node_ip instance state
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 gsdb01 192.168.0.61 6001 /gauss/gaussdb/data/dn P Primary Normal | 2 gsdb02 192.168.0.62 6002 /gauss/gaussdb/data/dn S Standby Normal | 3 gsdb03 192.168.0.63 6003 /gauss/gaussdb/data/dn S Standby Normal
[omm@gsdb02 ~]$
[omm@gsdb02 ~]$
[omm@gsdb02 ~]$
[omm@gsdb02 ~]$
[omm@gsdb02 ~]$ gs_om -t status --detail
[ CMServer State ]

node node_ip instance state
------------------------------------------------------------------------
1 gsdb01 192.168.0.61 1 /gauss/gaussdb/cmserver/cm_server Standby
2 gsdb02 192.168.0.62 2 /gauss/gaussdb/cmserver/cm_server Standby
3 gsdb03 192.168.0.63 3 /gauss/gaussdb/cmserver/cm_server Primary

[ Cluster State ]

cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL

[ Datanode State ]

node node_ip instance state
-----------------------------------------------------------------------
1 gsdb01 192.168.0.61 6001 /gauss/gaussdb/data/dn P Primary Normal
2 gsdb02 192.168.0.62 6002 /gauss/gaussdb/data/dn S Standby Normal
3 gsdb03 192.168.0.63 6003 /gauss/gaussdb/data/dn S Standby Normal

[root@gsdb01 ~]# . ~omm/.bashrc
[root@gsdb01 ~]# echo $GAUSSHOME
/gauss/gaussdb/app

xml文件配置(新增gsdb04、gsdb05)

[root@gsdb01 ~]# cd /gauss/soft/
[root@gsdb01 soft]# cp cluster_config_gsdb.xml cluster_config_gsdb.xml20230814.xml
[root@gsdb01 soft]# >cluster_config_gsdb.xml

[root@gsdb01 soft]# vim cluster_config_gsdb.xml

gsdb04和gsdb05初始化参数配置及新建用户、文件系统等

mkdir /gauss
mkdir -p /gauss/{gaussdb,archive,scripts,backup,soft}

groupadd dbgrp
useradd -g dbgrp omm
echo "gass_123" |passwd --stdin omm

chown omm:dbgrp -R /gauss

主节点操作
互信配置(root和omm都做)
[root@gsdb01 script]# cd /gauss/soft/script
[root@gsdb01 script]# vi hostfile
192.168.0.61
192.168.0.62
192.168.0.63
192.168.0.64
192.168.0.65

[root@gsdb01 script]# ./gs_sshexkey -f hostfile

[root@gsdb01 script]# chown omm. -R /gauss/soft
[root@gsdb01 script]# su - omm
[omm@gsdb01 script]$ cd /gauss/soft/script/
[omm@gsdb01 script]$ ./gs_sshexkey -f hostfile

新增节点配置(gsdb04,gsdb05)
[root@gsdb04 ~]# vim /etc/profile #配置后登录可以自动加载环境变量,安装节点GAUSSHOME需要配置一下,否则安装失败
#export LANG=en_US.UTF8
#export PS1="[`whoami`@`hostname`:"'$PWD]$'
export GAUSSHOME=/gauss/gaussdb/app
export LD_LIBRARY_PATH=/gauss/gaussdb/app/lib
export PATH=/gauss/gaussdb/app/bin:$PATH:$HOME/.local/bin:$HOME/bin

. ~omm/.bashrc

gsdb01主库执行扩容节点操作

执行
[root@gsdb01 ~]#. ~omm/.bashrc
[root@gsdb01 ~]# echo $GAUSSHOME
[root@gsdb01 ~]#cd /gauss/soft/script
/gauss/gaussdb/app
[root@gsdb01 script]# ./gs_expansion -U omm -G dbgrp -X /gauss/soft/cluster_config_gsdb.xml -h 192.168.0.64
Start expansion with cluster manager component.
Start to send soft to each standby nodes.
End to send soft to each standby nodes.
Success to send XML to new nodes
Start to perform perinstall on nodes: ['gsdb04']
Preinstall command is: /tmp/gs_expansion_2023-08-15_09_39_12_919836/pkg/script/gs_preinstall -U omm -G dbgrp -X /gauss/soft/cluster_config_gsdb.xml -L --non-interactive 2>&1
Success to perform perinstall on nodes ['gsdb04']
Success to change user to [omm]
Installing applications on all new nodes.
Install on new node output: [SUCCESS] gsdb04:
Using omm:dbgrp to install database.
Using installation program path : /gauss/gaussdb/app
Command for creating symbolic link: ln -snf /gauss/gaussdb/app_46134f73 /gauss/gaussdb/app.
Decompressing bin file.
Decompress CM package command: export LD_LIBRARY_PATH=$GPHOME/script/gspylib/clib:$LD_LIBRARY_PATH && tar -zxf "/gauss/gaussdb/om/openGauss-3.0.3-openEuler-64bit-cm.tar.gz" -C "/gauss/gaussdb/app"
Decompress CM package successfully.
Successfully decompressed bin file.
Modifying Alarm configuration.
Modifying user's environmental variable $GAUSS_ENV.
Successfully modified user's environmental variable $GAUSS_ENV.
Fixing file permission.
Set Cgroup config file to appPath.
Successfully Set Cgroup.

Successfully installed APP on nodes ['gsdb04'].
success to send all CA file.
Success to change user to [omm]
Process Process-2:
Traceback (most recent call last):
File "/usr/lib64/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/lib64/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/gauss/soft/script/impl/expansion/expansion_impl_with_cm.py", line 461, in do_config
self._set_om_monitor_cron()
File "/gauss/soft/script/impl/expansion/expansion_impl_with_cm.py", line 229, in _set_om_monitor_cron
host_list=ExpansionImplWithCm.get_node_names(self.new_nodes))
File "/gauss/soft/script/base_utils/executor/cmd_executor.py", line 80, in execCommandWithMode
g_ssh_tool.executeCommand(cmd, ConstantsBase.SUCCESS, host_list, mpprc_file)
File "/gauss/soft/script/gspylib/threads/SshTool.py", line 481, in executeCommand
raise Exception(SensitiveMask.mask_pwd(outputCollect))
Exception: [FAILURE] gsdb04:
Checking parameters for configuring DNs.
[GAUSS-50201] : The log path of designated user [omm] does not exist.

第一次报错,重跑了第二次成功。
[root@gsdb01 script]# ./gs_expansion -U omm -G dbgrp -X /gauss/soft/cluster_config_gsdb.xml -h 192.168.0.64
Start expansion with cluster manager component.
Start to send soft to each standby nodes.
End to send soft to each standby nodes.
Success to send XML to new nodes
Start to perform perinstall on nodes: ['gsdb04']
Preinstall command is: /tmp/gs_expansion_2023-08-15_09_49_08_811796/pkg/script/gs_preinstall -U omm -G dbgrp -X /gauss/soft/cluster_config_gsdb.xml -L --non-interactive 2>&1
Success to perform perinstall on nodes ['gsdb04']
Success to change user to [omm]
Installing applications on all new nodes.
Install on new node output: [SUCCESS] gsdb04:
Using omm:dbgrp to install database.
Using installation program path : /gauss/gaussdb/app_46134f73
$GAUSSHOME points to /gauss/gaussdb/app_46134f73, no need to create symbolic link.
Decompressing bin file.
Decompress CM package command: export LD_LIBRARY_PATH=$GPHOME/script/gspylib/clib:$LD_LIBRARY_PATH && tar -zxf "/gauss/gaussdb/om/openGauss-3.0.3-openEuler-64bit-cm.tar.gz" -C "/gauss/gaussdb/app_46134f73"
Decompress CM package successfully.
Successfully decompressed bin file.
Modifying Alarm configuration.
Modifying user's environmental variable $GAUSS_ENV.
Successfully modified user's environmental variable $GAUSS_ENV.
Fixing file permission.
Set Cgroup config file to appPath.
Successfully Set Cgroup.

Successfully installed APP on nodes ['gsdb04'].
success to send all CA file.
Success to change user to [omm]
Success to init instance on nodes ['gsdb04']
Start to generate and send cluster static file.
End to generate and send cluster static file.

Ready to perform command on node [gsdb04]. Command is : source /home/omm/.bashrc;gs_guc set -D /gauss/gaussdb/data/dn -h 'host all omm 192.168.0.64/32 trust' -h 'host all all 192.168.0.64/32 sha256'
Successfully set hba on all nodes.
Success to change user to [omm]
Remove dynamic_config_file and CM metadata directory on all nodes.
Expansion results:
192.168.0.64: Success

检查集群状态
[omm@gsdb01 ~]$ cm_ctl query -Cv
[ CMServer State ]

node instance state
--------------------------
1 gsdb01 1 Standby
2 gsdb02 2 Standby
3 gsdb03 3 Primary
4 gsdb04 4 Standby

[ Cluster State ]

cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL

[ Datanode State ]

node instance state | node instance state | node instance state | node instance state
--------------------------------------------------------------------------------------------------------------------------------------------------------
1 gsdb01 6001 P Primary Normal | 2 gsdb02 6002 S Standby Normal | 3 gsdb03 6003 S Standby Normal | 4 gsdb04 6004 S Standby Normal

[omm@gsdb01 ~]$ gs_om -t status --detail
[ CMServer State ]

node node_ip instance state
------------------------------------------------------------------------
1 gsdb01 192.168.0.61 1 /gauss/gaussdb/cmserver/cm_server Standby
2 gsdb02 192.168.0.62 2 /gauss/gaussdb/cmserver/cm_server Standby
3 gsdb03 192.168.0.63 3 /gauss/gaussdb/cmserver/cm_server Primary
4 gsdb04 192.168.0.64 4 /gauss/gaussdb/cmserver/cm_server Standby

[ Cluster State ]

cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL

[ Datanode State ]

node node_ip instance state
-----------------------------------------------------------------------
1 gsdb01 192.168.0.61 6001 /gauss/gaussdb/data/dn P Primary Normal
2 gsdb02 192.168.0.62 6002 /gauss/gaussdb/data/dn S Standby Normal
3 gsdb03 192.168.0.63 6003 /gauss/gaussdb/data/dn S Standby Normal
4 gsdb04 192.168.0.64 6004 /gauss/gaussdb/data/dn S Standby Normal
[omm@gsdb01 ~]$ gs_om -t status --all
-----------------------------------------------------------------------

cluster_state : Normal
redistributing : No
balanced : Yes

-----------------------------------------------------------------------

node : 1
node_name : gsdb01

node : 1
instance_id : 1
node_ip : 192.168.0.61
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 1
instance_id : 6001
node_ip : 192.168.0.61
data_path : /gauss/gaussdb/data/dn
type : Datanode
instance_state : Primary
static_connections : 3
HA_state : Normal
reason : Normal
standby_node :
standby_data_path :
standby_node :
standby_data_path :
standby_state : Standby
sender_sent_location : 0/8000808
sender_write_location : 0/8000808
sender_flush_location : 0/8000808
sender_replay_location : 0/8000808
receiver_received_location: 0/8000808
receiver_write_location : 0/8000808
receiver_flush_location : 0/8000808
receiver_replay_location : 0/8000808
sync_state : Quorum
secondary_state : Unknown
sender_sent_location : 0/0
sender_write_location : 0/0
sender_flush_location : 0/0
sender_replay_location : 0/0
receiver_received_location: 0/0
receiver_write_location : 0/0
receiver_flush_location : 0/0
receiver_replay_location : 0/0
sync_state : Unknown

node : 1
node_name : gsdb01

node : 1
instance_id : 1
node_ip : 192.168.0.61
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 1
node_ip : 192.168.0.61
type : Fenced UDF
state : Normal

-----------------------------------------------------------------------

node : 2
node_name : gsdb02

node : 2
instance_id : 2
node_ip : 192.168.0.62
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 2
instance_id : 6002
node_ip : 192.168.0.62
data_path : /gauss/gaussdb/data/dn
type : Datanode
instance_state : Standby
dcf_role : FOLLOWER
static_connections : 3
HA_state : Normal
reason : Normal
sender_sent_location : 0/8000808
sender_write_location : 0/8000808
sender_flush_location : 0/8000808
sender_replay_location : 0/8000808
receiver_received_location: 0/8000808
receiver_write_location : 0/8000808
receiver_flush_location : 0/8000808
receiver_replay_location : 0/8000808
sync_state : Async

node : 2
node_name : gsdb02

node : 2
instance_id : 2
node_ip : 192.168.0.62
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 2
node_ip : 192.168.0.62
type : Fenced UDF
state : Normal

-----------------------------------------------------------------------

node : 3
node_name : gsdb03

node : 3
instance_id : 3
node_ip : 192.168.0.63
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Primary

node : 3
instance_id : 6003
node_ip : 192.168.0.63
data_path : /gauss/gaussdb/data/dn
type : Datanode
instance_state : Standby
dcf_role : FOLLOWER
static_connections : 3
HA_state : Normal
reason : Normal
sender_sent_location : 0/8000808
sender_write_location : 0/8000808
sender_flush_location : 0/8000808
sender_replay_location : 0/8000808
receiver_received_location: 0/8000808
receiver_write_location : 0/8000808
receiver_flush_location : 0/8000808
receiver_replay_location : 0/8000808
sync_state : Async

node : 3
node_name : gsdb03

node : 3
instance_id : 3
node_ip : 192.168.0.63
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Primary

node : 3
node_ip : 192.168.0.63
type : Fenced UDF
state : Normal

-----------------------------------------------------------------------

node : 4
node_name : gsdb04

node : 4
instance_id : 4
node_ip : 192.168.0.64
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 4
instance_id : 6004
node_ip : 192.168.0.64
data_path : /gauss/gaussdb/data/dn
type : Datanode
instance_state : Standby
dcf_role : FOLLOWER
static_connections : 3
HA_state : Normal
reason : Normal
sender_sent_location : 0/8000808
sender_write_location : 0/8000808
sender_flush_location : 0/8000808
sender_replay_location : 0/8000808
receiver_received_location: 0/8000808
receiver_write_location : 0/8000808
receiver_flush_location : 0/8000808
receiver_replay_location : 0/8000808
sync_state : Async

node : 4
node_name : gsdb04

node : 4
instance_id : 4
node_ip : 192.168.0.64
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 4
node_ip : 192.168.0.64
type : Fenced UDF
state : Normal

-----------------------------------------------------------------------

[root@gsdb01 script]# ./gs_expansion -U omm -G dbgrp -X /gauss/soft/cluster_config_gsdb.xml -h 192.168.0.65
Start expansion with cluster manager component.
Start to send soft to each standby nodes.
End to send soft to each standby nodes.
Success to send XML to new nodes
Start to perform perinstall on nodes: ['gsdb05']
Preinstall command is: /tmp/gs_expansion_2023-08-15_10_18_46_211642/pkg/script/gs_preinstall -U omm -G dbgrp -X /gauss/soft/cluster_config_gsdb.xml -L --non-interactive 2>&1
Success to perform perinstall on nodes ['gsdb05']
Success to change user to [omm]
Installing applications on all new nodes.
Install on new node output: [SUCCESS] gsdb05:
Using omm:dbgrp to install database.
Using installation program path : /gauss/gaussdb/app
Command for creating symbolic link: ln -snf /gauss/gaussdb/app_46134f73 /gauss/gaussdb/app.
Decompressing bin file.
Decompress CM package command: export LD_LIBRARY_PATH=$GPHOME/script/gspylib/clib:$LD_LIBRARY_PATH && tar -zxf "/gauss/gaussdb/om/openGauss-3.0.3-openEuler-64bit-cm.tar.gz" -C "/gauss/gaussdb/app"
Decompress CM package successfully.
Successfully decompressed bin file.
Modifying Alarm configuration.
Modifying user's environmental variable $GAUSS_ENV.
Successfully modified user's environmental variable $GAUSS_ENV.
Fixing file permission.
Set Cgroup config file to appPath.
Successfully Set Cgroup.

Successfully installed APP on nodes ['gsdb05'].
success to send all CA file.
Success to change user to [omm]
Success to init instance on nodes ['gsdb05']
Start to generate and send cluster static file.
End to generate and send cluster static file.

Ready to perform command on node [gsdb05]. Command is : source /home/omm/.bashrc;gs_guc set -D /gauss/gaussdb/data/dn -h 'host all omm 192.168.0.65/32 trust' -h 'host all all 192.168.0.65/32 sha256'
Successfully set hba on all nodes.
Success to change user to [omm]
Remove dynamic_config_file and CM metadata directory on all nodes.
Expansion results:
192.168.0.65: Success

[root@gsdb01 script]# su - omm
Last login: Tue Aug 15 10:28:01 CST 2023 on pts/0
[omm@gsdb01 ~]$ cm_ctl query -Cv
[ CMServer State ]

node instance state
--------------------------
1 gsdb01 1 Standby
2 gsdb02 2 Primary
3 gsdb03 3 Standby
4 gsdb04 4 Standby
5 gsdb05 5 Standby

[ Cluster State ]

cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL

[ Datanode State ]

node instance state | node instance state | node instance state | node instance state | node instance state
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 gsdb01 6001 P Primary Normal | 2 gsdb02 6002 S Standby Normal | 3 gsdb03 6003 S Standby Normal | 4 gsdb04 6004 S Standby Normal | 5 gsdb05 6005 S Standby Normal

[omm@gsdb01 ~]$ gs_om -t status --all
-----------------------------------------------------------------------

cluster_state : Normal
redistributing : No
balanced : Yes

-----------------------------------------------------------------------

node : 1
node_name : gsdb01

node : 1
instance_id : 1
node_ip : 192.168.0.61
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 1
instance_id : 6001
node_ip : 192.168.0.61
data_path : /gauss/gaussdb/data/dn
type : Datanode
instance_state : Primary
static_connections : 4
HA_state : Normal
reason : Normal
standby_node :
standby_data_path :
standby_node :
standby_data_path :
standby_state : Standby
sender_sent_location : 0/A000FE8
sender_write_location : 0/A000FE8
sender_flush_location : 0/A000FE8
sender_replay_location : 0/A000FE8
receiver_received_location: 0/A000FE8
receiver_write_location : 0/A000FE8
receiver_flush_location : 0/A000FE8
receiver_replay_location : 0/A000EF8
sync_state : Quorum
secondary_state : Unknown
sender_sent_location : 0/0
sender_write_location : 0/0
sender_flush_location : 0/0
sender_replay_location : 0/0
receiver_received_location: 0/0
receiver_write_location : 0/0
receiver_flush_location : 0/0
receiver_replay_location : 0/0
sync_state : Unknown

node : 1
node_name : gsdb01

node : 1
instance_id : 1
node_ip : 192.168.0.61
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 1
node_ip : 192.168.0.61
type : Fenced UDF
state : Normal

-----------------------------------------------------------------------

node : 2
node_name : gsdb02

node : 2
instance_id : 2
node_ip : 192.168.0.62
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Primary

node : 2
instance_id : 6002
node_ip : 192.168.0.62
data_path : /gauss/gaussdb/data/dn
type : Datanode
instance_state : Standby
dcf_role : FOLLOWER
static_connections : 4
HA_state : Normal
reason : Normal
sender_sent_location : 0/A000FE8
sender_write_location : 0/A000FE8
sender_flush_location : 0/A000FE8
sender_replay_location : 0/A000FE8
receiver_received_location: 0/A000FE8
receiver_write_location : 0/A000FE8
receiver_flush_location : 0/A000FE8
receiver_replay_location : 0/A000EF8
sync_state : Async

node : 2
node_name : gsdb02

node : 2
instance_id : 2
node_ip : 192.168.0.62
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Primary

node : 2
node_ip : 192.168.0.62
type : Fenced UDF
state : Normal

-----------------------------------------------------------------------

node : 3
node_name : gsdb03

node : 3
instance_id : 3
node_ip : 192.168.0.63
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 3
instance_id : 6003
node_ip : 192.168.0.63
data_path : /gauss/gaussdb/data/dn
type : Datanode
instance_state : Standby
dcf_role : FOLLOWER
static_connections : 4
HA_state : Normal
reason : Normal
sender_sent_location : 0/A000FE8
sender_write_location : 0/A000FE8
sender_flush_location : 0/A000FE8
sender_replay_location : 0/A000FE8
receiver_received_location: 0/A000FE8
receiver_write_location : 0/A000FE8
receiver_flush_location : 0/A000FE8
receiver_replay_location : 0/A000EF8
sync_state : Async

node : 3
node_name : gsdb03

node : 3
instance_id : 3
node_ip : 192.168.0.63
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 3
node_ip : 192.168.0.63
type : Fenced UDF
state : Normal

-----------------------------------------------------------------------

node : 4
node_name : gsdb04

node : 4
instance_id : 4
node_ip : 192.168.0.64
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 4
instance_id : 6004
node_ip : 192.168.0.64
data_path : /gauss/gaussdb/data/dn
type : Datanode
instance_state : Standby
dcf_role : FOLLOWER
static_connections : 4
HA_state : Normal
reason : Normal
sender_sent_location : 0/A000FE8
sender_write_location : 0/A000FE8
sender_flush_location : 0/A000FE8
sender_replay_location : 0/A000FE8
receiver_received_location: 0/A000FE8
receiver_write_location : 0/A000FE8
receiver_flush_location : 0/A000FE8
receiver_replay_location : 0/A000FE8
sync_state : Async

node : 4
node_name : gsdb04

node : 4
instance_id : 4
node_ip : 192.168.0.64
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 4
node_ip : 192.168.0.64
type : Fenced UDF
state : Normal

-----------------------------------------------------------------------

node : 5
node_name : gsdb05

node : 5
instance_id : 5
node_ip : 192.168.0.65
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 5
instance_id : 6005
node_ip : 192.168.0.65
data_path : /gauss/gaussdb/data/dn
type : Datanode
instance_state : Standby
dcf_role : FOLLOWER
static_connections : 4
HA_state : Normal
reason : Normal
sender_sent_location : 0/A000FE8
sender_write_location : 0/A000FE8
sender_flush_location : 0/A000FE8
sender_replay_location : 0/A000FE8
receiver_received_location: 0/A000FE8
receiver_write_location : 0/A000FE8
receiver_flush_location : 0/A000FE8
receiver_replay_location : 0/A000FE8
sync_state : Async

node : 5
node_name : gsdb05

node : 5
instance_id : 5
node_ip : 192.168.0.65
data_path : /gauss/gaussdb/cmserver/cm_server
type : CMServer
instance_state : Standby

node : 5
node_ip : 192.168.0.65
type : Fenced UDF
state : Normal

-----------------------------------------------------------------------

[omm@gsdb01 ~]$ gs_om -t status --detail
[ CMServer State ]

node node_ip instance state
------------------------------------------------------------------------
1 gsdb01 192.168.0.61 1 /gauss/gaussdb/cmserver/cm_server Standby
2 gsdb02 192.168.0.62 2 /gauss/gaussdb/cmserver/cm_server Primary
3 gsdb03 192.168.0.63 3 /gauss/gaussdb/cmserver/cm_server Standby
4 gsdb04 192.168.0.64 4 /gauss/gaussdb/cmserver/cm_server Standby
5 gsdb05 192.168.0.65 5 /gauss/gaussdb/cmserver/cm_server Standby

[ Cluster State ]

cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL

[ Datanode State ]

node node_ip instance state
-----------------------------------------------------------------------
1 gsdb01 192.168.0.61 6001 /gauss/gaussdb/data/dn P Primary Normal
2 gsdb02 192.168.0.62 6002 /gauss/gaussdb/data/dn S Standby Normal
3 gsdb03 192.168.0.63 6003 /gauss/gaussdb/data/dn S Standby Normal
4 gsdb04 192.168.0.64 6004 /gauss/gaussdb/data/dn S Standby Normal
5 gsdb05 192.168.0.65 6005 /gauss/gaussdb/data/dn S Standby Normal

[omm@gsdb01 ~]$ cm_ctl -z ALL query -Cvi
[ CMServer State ]

node node_ip instance state
----------------------------------------------
AZ1 1 gsdb01 192.168.0.61 1 Standby
AZ1 2 gsdb02 192.168.0.62 2 Primary
AZ1 3 gsdb03 192.168.0.63 3 Standby
AZ1 4 gsdb04 192.168.0.64 4 Standby
AZ1 5 gsdb05 192.168.0.65 5 Standby

[ Cluster State ]

cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL

[ Datanode State ]

node node_ip instance state | node node_ip instance state | node node_ip instance state | node node_ip instance state | node node_ip instance state
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AZ1 1 gsdb01 192.168.0.61 6001 P Primary Normal | AZ1 2 gsdb02 192.168.0.62 6002 S Standby Normal | AZ1 3 gsdb03 192.168.0.63 6003 S Standby Normal | AZ1 4 gsdb04 192.168.0.64 6004 S Standby Normal | AZ1 5 gsdb05 192.168.0.65 6005 S Standby Normal

================================================集群节点缩容===================================

将gsdb05卸载掉
[root@gsdb01 script]# su - omm
[omm@gsdb01 script]$ ./gs_dropnode -U omm -G dbgrp -h 192.168.0.65 #同样的方式卸载gsdb04
The target node to be dropped is (['gsdb05'])
Do you want to continue to drop the target node (yes/no)?yes
Drop node start with CM node.
Drop node with CM node is running.
[gs_dropnode]Start to drop nodes of the cluster.
[gs_dropnode]Start to stop the target node gsdb05.
[gs_dropnode]End of stop the target node gsdb05.
[gs_dropnode]Start to backup parameter config file on gsdb01.
[gs_dropnode]End to backup parameter config file on gsdb01.
[gs_dropnode]The backup file of gsdb01 is /gauss/gaussdb/tmp/gs_dropnode_backup20230815111631/parameter_gsdb01.tar
[gs_dropnode]Start to parse parameter config file on gsdb01.
[gs_dropnode]End to parse parameter config file on gsdb01.
[gs_dropnode]Start to parse backup parameter config file on gsdb01.
[gs_dropnode]End to parse backup parameter config file gsdb01.
[gs_dropnode]Start to set openGauss config file on gsdb01.
[gs_dropnode]End of set openGauss config file on gsdb01.
[gs_dropnode]Start to backup parameter config file on gsdb02.
[gs_dropnode]End to backup parameter config file on gsdb02.
[gs_dropnode]The backup file of gsdb02 is /gauss/gaussdb/tmp/gs_dropnode_backup20230815111636/parameter_gsdb02.tar
[gs_dropnode]Start to parse parameter config file on gsdb02.
[gs_dropnode]End to parse parameter config file on gsdb02.
[gs_dropnode]Start to parse backup parameter config file on gsdb02.
[gs_dropnode]End to parse backup parameter config file gsdb02.
[gs_dropnode]Start to set openGauss config file on gsdb02.
[gs_dropnode]End of set openGauss config file on gsdb02.
[gs_dropnode]Start to backup parameter config file on gsdb03.
[gs_dropnode]End to backup parameter config file on gsdb03.
[gs_dropnode]The backup file of gsdb03 is /gauss/gaussdb/tmp/gs_dropnode_backup20230815111648/parameter_gsdb03.tar
[gs_dropnode]Start to parse parameter config file on gsdb03.
[gs_dropnode]End to parse parameter config file on gsdb03.
[gs_dropnode]Start to parse backup parameter config file on gsdb03.
[gs_dropnode]End to parse backup parameter config file gsdb03.
[gs_dropnode]Start to set openGauss config file on gsdb03.
[gs_dropnode]End of set openGauss config file on gsdb03.
[gs_dropnode]Start to backup parameter config file on gsdb04.
[gs_dropnode]End to backup parameter config file on gsdb04.
[gs_dropnode]The backup file of gsdb04 is /gauss/gaussdb/tmp/gs_dropnode_backup20230815111703/parameter_gsdb04.tar
[gs_dropnode]Start to parse parameter config file on gsdb04.
[gs_dropnode]End to parse parameter config file on gsdb04.
[gs_dropnode]Start to parse backup parameter config file on gsdb04.
[gs_dropnode]End to parse backup parameter config file gsdb04.
[gs_dropnode]Start to set openGauss config file on gsdb04.
[gs_dropnode]End of set openGauss config file on gsdb04.
[gs_dropnode]Start of set pg_hba config file on gsdb01.
[gs_dropnode]End of set pg_hba config file on gsdb01.
[gs_dropnode]Start of set pg_hba config file on gsdb02.
[gs_dropnode]End of set pg_hba config file on gsdb02.
[gs_dropnode]Start of set pg_hba config file on gsdb03.
[gs_dropnode]End of set pg_hba config file on gsdb03.
[gs_dropnode]Start of set pg_hba config file on gsdb04.
[gs_dropnode]End of set pg_hba config file on gsdb04.
[gs_dropnode]Start to set repl slot on gsdb01.
[gs_dropnode]Start to get repl slot on gsdb01.
[gs_dropnode]End of set repl slot on gsdb01.
Stopping node.
=========================================
Successfully stopped node.
=========================================
End stop node.
Generate drop flag file on drop node gsdb05 successfully.
[gs_dropnode]Start to modify the cluster static conf.
[gs_dropnode]End of modify the cluster static conf.
Restarting cm_server cluster ...
Remove dynamic_config_file and CM metadata directory on all nodes.
[gs_dropnode] Success to drop the target nodes.

集群状态查看

[omm@gsdb01 script]$ gs_om -t status --detail
[ CMServer State ]

node node_ip instance state
------------------------------------------------------------------------
1 gsdb01 192.168.0.61 1 /gauss/gaussdb/cmserver/cm_server Standby
2 gsdb02 192.168.0.62 2 /gauss/gaussdb/cmserver/cm_server Primary
3 gsdb03 192.168.0.63 3 /gauss/gaussdb/cmserver/cm_server Standby
4 gsdb04 192.168.0.64 4 /gauss/gaussdb/cmserver/cm_server Standby

[ Cluster State ]

cluster_state : Normal
redistributing : No
balanced : Yes
current_az : AZ_ALL

[ Datanode State ]

node node_ip instance state
-----------------------------------------------------------------------
1 gsdb01 192.168.0.61 6001 /gauss/gaussdb/data/dn P Primary Normal
2 gsdb02 192.168.0.62 6002 /gauss/gaussdb/data/dn S Standby Normal
3 gsdb03 192.168.0.63 6003 /gauss/gaussdb/data/dn S Standby Normal
4 gsdb04 192.168.0.64 6004 /gauss/gaussdb/data/dn S Standby Normal

##连接访问相关参数
gs_guc set -I all -N all -c "listen_addresses = '*'"
##客户端白名单
gs_guc set -I all -N all -h "host all all 0.0.0.0/0 md5"

完成

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论