签到成功

知道了

CNDBA社区CNDBA社区

openGauss 5.0 一主两从 复制环境 搭建手册

2023-04-07 13:49 1177 0 原创 openGauss
作者: dave

在之前的博客我们了解了单机版的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配置文件有些不同。http://www.cndba.cn/dave/article/116528

1环境信息

[root@www.cndba.cn ~]# 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
[root@www.cndba.cn ~]#

安装依赖包:

http://www.cndba.cn/dave/article/116528
http://www.cndba.cn/dave/article/116528

yum -y install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel python3 expecthttp://www.cndba.cn/dave/article/116528http://www.cndba.cn/dave/article/116528

http://www.cndba.cn/dave/article/116528

注意这里需要保证所有节点时间同步,否认会报如下错误:

openGauss cm_ctl: SSL verify certificate failed 错误 解决方法
https://www.cndba.cn/dave/article/116527

2配置XML 文件

[root@www.cndba.cn 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>

[root@www.cndba.cn software]#

3初始化安装环境(root)

https://docs.opengauss.org/zh/docs/5.0.0/docs/InstallationGuide/%E5%88%9D%E5%A7%8B%E5%8C%96%E5%AE%89%E8%A3%85%E7%8E%AF%E5%A2%83.html

以下在节点1 操作即可。http://www.cndba.cn/dave/article/116528

解压安装文件:

tar -zxvf openGauss-5.0.0-CentOS-64bit-all.tar.gz
tar -zxvf openGauss-5.0.0-CentOS-64bit-om.tar.gzhttp://www.cndba.cn/dave/article/116528http://www.cndba.cn/dave/article/116528

进入script执行:

http://www.cndba.cn/dave/article/116528

[root@www.cndba.cn 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.
[root@www.cndba.cn script]#

4执行安装(omm)

[omm@www.cndba.cn ~]$ 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 验证

[omm@www.cndba.cn ~]$ 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
[omm@www.cndba.cn ~]$

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
dave

dave

关注

人的一生应该是这样度过的:当他回首往事的时候,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞耻;这样,在临死的时候,他就能够说:“我的整个生命和全部精力,都已经献给世界上最壮丽的事业....."

  • 2261
    原创
  • 3
    翻译
  • 578
    转载
  • 191
    评论
  • 访问:7970514次
  • 积分:4346
  • 等级:核心会员
  • 排名:第1名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ