opengauss数据库主从搭建

周琦放2021-12-31 14:14:38

环境说明

主机信息 IP地址 主机名 Linux 版本
主节点 192.168.56.227 ogpri Centos7.6
从节点 192.168.56.228 ogsta

软件下载

Opengauss 下载地址:https://opengauss.org/zh/download.html

环境准备

关闭 SELINUX

修改 /etc/selinux/config文件中的“SELINUX”值为“disabled

[root@ogpri openGauss]# more /etc/selinux/config # This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=disabled# SELINUXTYPE= can take one of three values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected.# mls - Multi Level Security protection.SELINUXTYPE=targeted

关闭防火墙并禁止开机重启

systemctl disable firewalld.servicesystemctl stop firewalld.service

设置root用户远程登陆

将PermitRootLogin改为yes。

vim /etc/ssh/sshd_config PermitRootLogin yes

修改后生效

systemctl restart sshd.service

关闭透明大页

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

数据库安装包依赖

root 用户下执行,所有的节点都要安装,建议配置本地yum源

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

Python3依赖包

yum install bzip2-devel db4-devel gdbm-devel libpcap-devel openssl openssl-devel sqlite-devel tk-devel xz-devel zlib* gcc*

安装python3

tar -xvf Python-3.6.8.tar.xzcd Python-3.6.8/./configure --prefix=/usr/local/python3 --enable-shared CFLAGS=-fPICmake && make install

设置python3 软连接

ln -s /usr/local/Python3/bin/python3 /usr/bin/python3ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

设置python3环境变量

vi /etc/profile export PYTHON_HOME=/usr/local/python3.6.8export PATH=PATH:PATH:PATH:PYTHON_HOME/bin:wq Source /etc/profile

验证安装结果

[root@ogpri ~]# python3Python 3.6.8 (default, Dec 27 2021, 21:52:53)[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linuxType “help”, “copyright”, “credits” or “license” for more information.>>>

安装opengaussdb 数据库软件

数据库软件安装,如没有特殊说明,均在主节点执行,执行用户为root

创建数据库软件目录

mkdir -p /opt/software/openGausschmod 755 -R /opt/software

创建XML配置文件

如果是验证安装测试使用,建议修改其中的ip地址和hostname,加粗部分

vi /opt/software/openGauss/cluster_config.xml