openGauss 5.0 一主两从 复制环境 搭建手册
2023-04-07 13:49850原创openGauss 本文链接:https://www.cndba.cn/dave/article/116528在之前的博客我们了解了单机版的openGauss安装。
Linux 7.6 平台 openGauss 3.1.1 单机版 安装手册
https://www.cndba.cn/dave/article/116448
openGauss 修改 IP 地址 操作步骤
https://www.cndba.cn/dave/article/116525
本篇我们看下主从复制环境的搭建过程。基本操作是一样的的差不多的,就是xml配置文件有些不同。
1环境信息
[[email protected] ~]# cat /etc/hosts
127.0.0.1 localhost
192.168.56.105 oracle
192.168.56.106 oracle2
192.168.56.107 oracle3
127.0.0.1 localhost #Gauss OM IP Hosts Mapping
[[email protected] ~]#
安装依赖包:
yum -y install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel python3 expect
注意这里需要保证所有节点时间同步,否认会报如下错误:
openGauss cm_ctl: SSL verify certificate failed 错误 解决方法
https://www.cndba.cn/dave/article/116527
2配置XML 文件
[[email protected] software]# cat rep_config.xml
<?xml version="1.0" encoding="UTF-8"?> :
<ROOT>
<!-- openGauss整体信息 -->
<CLUSTER>
<PARAM name="clusterName" value="Cluster_template" />
<PARAM name="nodeNames" value="oracle,oracle2,oracle3" />
<PARAM name="gaussdbAppPath" value="/data/openGauss/install/app" />
<PARAM name="gaussdbLogPath" value="/var/log/omm" />
<PARAM name="tmpMppdbPath" value="/data/openGauss/tmp"/>
<PARAM name="gaussdbToolPath" value="/data/openGauss/install/om" />
<PARAM name="corePath" value="/data/openGauss/corefile"/>
<PARAM name="backIp1s" value="192.168.56.105,192.168.56.106,192.168.56.107"/>
</CLUSTER>
<!-- 每台服务器上的节点部署信息 -->
<DEVICELIST>
<!-- node1上的节点部署信息 -->
<DEVICE sn="oracle">
<PARAM name="name" value="oracle"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
<PARAM name="backIp1" value="192.168.56.105"/>
<PARAM name="sshIp1" value="192.168.56.105"/>
<!--CM节点部署信息-->
<PARAM name="cmsNum" value="1"/>
<PARAM name="cmServerPortBase" value="15000"/>
<PARAM name="cmServerListenIp1" value="192.168.56.105,192.168.56.106,192.168.56.107"/>
<PARAM name="cmServerHaIp1" value="192.168.56.105,192.168.56.106,192.168.56.107"/>
<PARAM name="cmServerlevel" value="1"/>
<PARAM name="cmServerRelation" value="oracle,oracle2,oracle3"/>
<PARAM name="cmDir" value="/data/openGauss/data/cmserver"/>
<!--dn-->
<PARAM name="dataNum" value="1"/>
<PARAM name="dataPortBase" value="15500"/>
<PARAM name="dataNode1" value="/data/openGauss/install/data/dn,oracle2,/data/openGauss/install/data/dn,oracle3,/data/openGauss/install/data/dn"/>
<PARAM name="dataNode1_syncNum" value="0"/>
</DEVICE>
<!-- node2上的节点部署信息,其中“name”的值配置为主机名称 -->
<DEVICE sn="oracle2">
<PARAM name="name" value="oracle2"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
<PARAM name="backIp1" value="192.168.56.106"/>
<PARAM name="sshIp1" value="192.168.56.106"/>
<!-- cm -->
<PARAM name="cmServerPortStandby" value="15000"/>
<PARAM name="cmDir" value="/data/openGauss/data/cmserver"/>
</DEVICE>
<!-- node3上的节点部署信息,其中“name”的值配置为主机名称 -->
<DEVICE sn="oracle3">
<PARAM name="name" value="oracle3"/>
<PARAM name="azName" value="AZ1"/>
<PARAM name="azPriority" value="1"/>
<!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
<PARAM name="backIp1" value="192.168.56.107"/>
<PARAM name="sshIp1" value="192.168.56.107"/>
<!-- cm -->
<PARAM name="cmServerPortStandby" value="15000"/>
<PARAM name="cmDir" value="/data/openGauss/data/cmserver"/>
</DEVICE>
</DEVICELIST>
</ROOT>
[[email protected] software]#
3初始化安装环境(root)
以下在节点1 操作即可。
解压安装文件:
tar -zxvf openGauss-5.0.0-CentOS-64bit-all.tar.gz
tar -zxvf openGauss-5.0.0-CentOS-64bit-om.tar.gz
进入script执行:
[[email protected] script]# ./gs_preinstall -U omm -G dbgrp -X /software/rep_config.xml
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 "/software/script/gs_checkos -i A -h oracle,oracle2,oracle3 --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.
[[email protected] script]#
4执行安装(omm)
[[email protected] ~]$ gs_install -X /software/rep_config.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy..
Installing the cluster.
begin prepare Install Cluster..
Checking the installation environment on all nodes.
begin install Cluster..
Installing applications on all nodes.
Successfully installed APP.
begin init Instance..
encrypt cipher and rand files for database.
Please enter password for database:
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /data/openGauss/install/app/share/sslcert/om
Create CA files for cm beginning.
Create CA files on directory [/data/openGauss/install/app_a07d57c3/share/sslcert/cm]. file list: ['cacert.pem', 'server.key', 'server.crt', 'client.key', 'client.crt', 'server.key.cipher', 'server.key.rand', 'client.key.cipher', 'client.key.rand']
Non-dss_ssl_enable, no need to create CA for DSS
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Successful check consistence of memCheck and coresCheck on all nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
Starting cluster.
……
5 验证
[[email protected] ~]$ gs_om -t status --detail
[ CMServer State ]
node node_ip instance state
-------------------------------------------------------------------------------
1 oracle 192.168.56.105 1 /data/openGauss/data/cmserver/cm_server Primary
2 oracle2 192.168.56.106 2 /data/openGauss/data/cmserver/cm_server Standby
3 oracle3 192.168.56.107 3 /data/openGauss/data/cmserver/cm_server Standby
[ Cluster State ]
cluster_state : Normal
redistributing : No
balanced : No
current_az : AZ_ALL
[ Datanode State ]
node node_ip instance state
---------------------------------------------------------------------------------
1 oracle 192.168.56.105 6001 /data/openGauss/install/data/dn P Standby Normal
2 oracle2 192.168.56.106 6002 /data/openGauss/install/data/dn S Primary Normal
3 oracle3 192.168.56.107 6003 /data/openGauss/install/data/dn S Standby Normal
[[email protected] ~]$
标签:5.0,node,www,Successfully,cndba,一主,openGauss,data
From: https://www.cnblogs.com/yaoyangding/p/17378973.html