opengauss5.1.0一主一备一级联安装配置手册

2023年 12月 15日 55.5k 0

测试环境

操作系统版本:openEuler-22.03-LTS-SP2-x86_64

硬件配置:          4c/8G/40GB 
       

节点信息:    [主节点]  172.20.XX.101

                    [备节点]  172.20.XX.102

                    [级联备]  172.20.XX.103

操作步骤

1.    从openGauss开源社区下载对应平台的安装包。

a.通过https://opengauss.org/zh/download/登录openGauss开源社区,选择对应平台的企业版安装包。

b.单击“下载”。  

2.    检查安装包。

主节点解压安装包,检查安装目录及文件是否齐全。在安装包所在目录执行以下命令:

tar -zxvf openGauss-x.x.x-openEuler-64bit-all.tar.gz

ls -lb

执行ls命令,显示类似如下信息:

total 91M

-rw-r--r--  1 root root       65 Dec  25  11:03 openGauss-x.x.x-openEuler-64bit-om.sha256

-rw-r--r--  1 root root 12910775 Dec  25  11:03 openGauss-x.x.x-openEuler-64bit-om.tar.gz

-rw-r--r--  1 root root    13474 Dec  25  11:03 upgrade_sql.tar.gz

-rw-r--r--  1 root root       65 Dec  25  11:03 upgrade_sql.sha256

-rw-r--r--  1 root root       65 Dec  25  11:03 openGauss-x.x.x-openEuler-64bit.sha256

-rw-r--r--  1 root root 73334256 Dec  25  11:03 openGauss-x.x.x-openEuler-64bit.tar.bz2

opengauss  5.1.0企业版安装指南

https://docs-opengauss.osinfra.cn/zh/docs/5.1.0/docs/InstallationGuide/%E4%BC%81%E4%B8%9A%E7%89%88%E5%AE%89%E8%A3%85.html

一、所有服务器运行环境初始化

示例脚本如下[仅供参考]:

vi   /root/initenv.sh

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

#!/bin/bash

 

## 1.关闭 firewalld service

systemctl disable firewalld.service

systemctl stop firewalld.service

echo "Firewalld " `systemctl status firewalld|grep Active`

echo "1.Disable firewalld service completed."

echo -e "\n"

 

## 2. 关闭SELINUX

sed -i '/^SELINUX=/d' /etc/selinux/config

echo "SELINUX=disabled"  >> /etc/selinux/config

cat /etc/selinux/config|grep "SELINUX=disabled"

echo "2.Disable SELINUX completed."

echo -e "\n"

 

 

## 3.配置Configure encoding

echo "LANG=en_US.UTF-8" >> /etc/profile

source /etc/profile

echo $LANG

echo "3.Configure encoding completed."

echo -e "\n"

 

## 4. 配置Configure Timezone

rm -fr /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime

date -R

hwclock

echo "4.Configure Timezone completed."

echo -e "\n"

 

## 5. 关闭 SWAP分区

sed -i '/swap/s/^/#/' /etc/fstab

swapoff -a

free -m

echo "5.Close swap partition completed."

echo -e "\n"

 

## 6. 配置 SSH Service

sed -i '/Banner/s/^/#/'  /etc/ssh/sshd_config

sed -i '/PermitRootLogin/s/^/#/'  /etc/ssh/sshd_config

echo -e "\n"  /etc/ssh/sshd_config

echo "Banner none "   >> /etc/ssh/sshd_config

echo "PermitRootLogin yes" >>  /etc/ssh/sshd_config

cat /etc/ssh/sshd_config |grep -v ^#|grep -E 'PermitRoot|Banner'

echo "6.Configure SSH Service completed."

echo -e "\n"

 

## 7. 安装依赖包(上网安装也可以配置本地)

mkdir /etc/yum.repos.d/bak

mv /etc/yum.repos.d/*.repo  /etc/yum.repos.d/bak/

wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/openeuler_x86_64.repo

yum clean all

yum install -y bzip2 python3 expect tar ##需要安装expect包否则会报错

yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel

echo "7.Configure YUM and Install Packages completed."

echo -e "\n"

 

## 8. Close transparent_hugepage openeuler不需要配置

################Only for CentOS [Close transparent_hugepage]#####################

cat /etc/rc.d/rc.local /sys/kernel/mm/transparent_hugepage/enabled

fi

if test -f /sys/kernel/mm/transparent_hugepage/defrag; then

   echo never >> /sys/kernel/mm/transparent_hugepage/defrag

fi

EOF

chmod +x /etc/rc.d/rc.local

echo "8.Close transparent_hugepage completed."

echo -e "\n"

################################################################################

 

## 9. 配置操作系统参数 Parameter

cat  /etc/sysctl.conf   /etc/systemd/logind.conf

echo "RemoveIPC=no" >>   /usr/lib/systemd/system/systemd-logind.service

systemctl daemon-reload

systemctl restart systemd-logind

loginctl show-session | grep RemoveIPC

systemctl show systemd-logind | grep RemoveIPC

echo "10.Disable RemoveIPC completed."

echo -e "\n"

echo -e "\n"

##########################################################################

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

sh /root/initenv.sh    ## 执行初始化脚本

关闭HISTORY记录(可以不关闭)

步骤 1 修改根目录下/etc/profile文件。

vim /etc/profile

步骤 2 设置HISTSIZE值为0。例如,系统中HISTSIZE默认值为1000,将其修改为0。

HISTSIZE=0

步骤 3 保存/etc/profile。

:wq

步骤 4 设置/etc/profile生效。

source
/etc/profile

 

二、一主一备一级联配置

1、配置XML文件

# mkdir –p /opt/software/openGauss

chmod 755 -R /opt/software

 

# vi /opt/software/openGauss/cluster_config.xml

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

   

   

       

       

        

       

       

       

       

       

      

   

   

        

       

           

           

           

           

           

           

           

       

            

            

            

           

            

            

            

            

            

                  

      

        

           

           

       

       

       

       

           

           

           

           

           

           

            

            

            

         

       

       

           

           

           

           

           

           

           

           

            

            

       

    

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

2、一执行预安装gs_preinstall

1. 解压软件包

主节点操作

cd /opt/software/openGauss

tar -zxvf openGauss-2.0.0-CentOS-64bit-all.tar.gz

tar -zxvf openGauss-2.0.0-CentOS-64bit-om.tar.gz

tar -jxf openGauss-x.x.x-openEuler-64bit.tar.bz2 -C
/opt/software/openGauss

tar -zxvf openGauss-5.1.0-openEuler-64bit-cm.tar.gz

groupadd dbgrp

useradd -g dbgrp
-m omm -d /home/omm  ##应该不用提前创建用户,官网手册也没有提前创建

echo "XX" |passwd --stdin omm

chown –R omm:dbgrp /opt

2. 执行预安装

[root@prod ~]# cd /opt/software/openGauss/script

[root@opengaussdb1 script]# python3 gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config_template.xml

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


-- 根据输出提示,使用gs_checkos工具检查操作预安装结果

[root@opengaussdb1 script]# /opt/software/openGauss/script/gs_checkos -i A -h opengaussdb1,opengaussdb2,opengaussdb3 --detail     

三、执行安装gs_install

[root@prod ~]# su – omm

[omm@opengaussdb1 ~]$ gs_install -X /opt/software/openGauss/cluster_config_template.xml

注:[GAUSS-51806] : The cluster has been installed.
执行vi ~/.bashrc查看环境变量,将GAUSS_ENV=2改为GAUSS_ENV=1,重新执行安装命令即可。

四、检查主备信息

## 查询集群健康状态

[omm@opengaussdb1 ~]$ gs_om -t status

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

cluster_state             : Normal

redistributing            : No

balanced                  : Yes 

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

## 查询主备同步信息

[omm@opengaussdb1 ~]$ gs_ctl query -D /opt/huawei/install/data/dn

[2023-12-15 15:45:57.577][138274][][gs_ctl]: gs_ctl query ,datadir is /opt/huawei/install/data/dn

HA state:

        local_role                     : Primary

        static_connections             : 2

        db_state                       : Normal

        detail_information             : Normal 

Senders info:

        sender_pid                     : 135221

        local_role                     : Primary

        peer_role                      : Standby

        peer_state                     : Normal

        state                          : Streaming

        sender_sent_location           : 0/5000308

       sender_write_location          : 0/5000308

        sender_flush_location          : 0/5000308

        sender_replay_location         : 0/5000308

        receiver_received_location     : 0/5000308

        receiver_write_location        : 0/5000308

        receiver_flush_location        : 0/5000308

        receiver_replay_location       : 0/5000308

        sync_percent                   : 100%

        sync_state                     : Quorum

        sync_priority                  : 1

        sync_most_available            : Off

        channel                        : 172.20.XX.101:26001-->172.20.XX.102:55552

 

Receiver info:

No information

## 查询集群节点配置信息

[omm@opengaussdb1 ~]$ gs_om -t view

NodeHeader:

version:301

time:1702626147

nodeCount:3

node:1

============================================================

azName:AZ1

azPriority:1

node :1

nodeName:opengaussdb1

ssh channel :

sshChannel 1:172.20.XX.101

datanodeCount :1

datanodeInstanceType :primary

datanode 1:

datanodeLocalDataPath :/opt/huawei/install/data/dn

datanodeXlogPath :

datanodeListenIP 1:172.20.XX.101

datanodePort :26000

datanodeLocalHAIP 1:172.20.XX.101

datanodeLocalHAPort :26001

dn_replication_num: 3

datanodePeer0DataPath :/opt/huawei/install/data/dn

datanodePeer0HAIP 1:172.20.XX.102

datanodePeer0HAPort :26001

datanodePeer1DataPath :/opt/huawei/install/data/dn

datanodePeer1HAIP 1:172.20.XX.103

datanodePeer1HAPort :26001

============================================================

azName:AZ1

azPriority:1

node :2

nodeName:opengaussdb2

ssh channel :

sshChannel 1:172.20.XX.102

datanodeCount :1

datanodeInstanceType :standby

datanode 1:

datanodeLocalDataPath :/opt/huawei/install/data/dn

datanodeXlogPath :

datanodeListenIP 1:172.20.XX.102

datanodePort :26000

datanodeLocalHAIP 1:172.20.XX.102

datanodeLocalHAPort :26001

dn_replication_num: 3

datanodePeer0DataPath :/opt/huawei/install/data/dn

datanodePeer0HAIP 1:172.20.XX.101

datanodePeer0HAPort :26001

datanodePeer1DataPath :/opt/huawei/install/data/dn

datanodePeer1HAIP 1:172.20.XX.103

datanodePeer1HAPort :26001

============================================================

azName:AZ1

azPriority:1

node :3

nodeName:opengaussdb3

ssh channel :

sshChannel 1:172.20.XX.103

datanodeCount :1

datanodeInstanceType :cascade_standby

datanode 1:

datanodeLocalDataPath :/opt/huawei/install/data/dn

datanodeXlogPath :

datanodeListenIP 1:172.20.XX.103

datanodePort :26000

datanodeLocalHAIP 1:172.20.XX.103

datanodeLocalHAPort :26001

dn_replication_num: 3

datanodePeer0DataPath :/opt/huawei/install/data/dn

datanodePeer0HAIP 1:172.20.XX.101

datanodePeer0HAPort :26001

datanodePeer1DataPath :/opt/huawei/install/data/dn

datanodePeer1HAIP 1:172.20.XX.102

datanodePeer1HAPort :26001

============================================================安装配置完成

相关文章

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

发布评论