暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

openGauss数据库安装手册

原创 于天文 2020-09-08
3999

安装环境:
服务器配置
CPU:>=16核 2.0GHz

内存:>=32G

硬盘:
用于安装openGauss的硬盘需最少满足如下要求:
至少1GB用于安装openGauss的应用程序包。
每个主机需大约300MB用于元数据存储。
预留70%以上的磁盘剩余空间用于数据存储。
建议系统盘配置为Raid1,数据盘配置为Raid5,且规划4组Raid5数据盘用于安装openGauss。
openGauss支持使用SSD盘作为数据库的主存储设备,支持SAS接口和NVME协议的SSD盘,以RAID的方式部署使用。
建议容量:>=1T
网络要求: 300兆以上以太网, 建议网卡设置为双网卡冗余bond
也可以根据自己的条件进行相关调整
CentOS 7.6 或openEuler

  1. CentOS 7.6:http://mirrors.sohu.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
  2. openEuler:https://repo.openeuler.org/openEuler-20.03-LTS/ISO/aarch64/openEuler-20.03-LTS-aarch64-dvd.iso

打开https://opengauss.org/zh/download.html 可以找到openGauss安装包的下载链接
阅读参考
openGauss官方网站:https://opengauss.org/zh
openGauss官方文档:https://opengauss.org/zh/docs/1.0.0/docs/Quickstart/Quickstart.html
安装流程

设置主机名
设置主机名,单机使用gaussdb,集群使用gaussdb1,2…
hostnamectl set-hostname gaussdb.sugon.com
安装其他软件包
有Internet网络时,可以添加外部yum源
没有Internet网络时,可以自己在虚拟机上最小化安装一个Centos7.6的系统,注意一定要最小化安装,需要安装的只有Python3和一个bzip2

制作本地yum源和挂载可以借鉴一下链接
制作yum源:https://www.jianshu.com/p/286fcef565ab
下面是需要下载的相关依赖包:
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc bzip2 make
挂载:
https://blog.csdn.net/qq_27882063/article/details/74936131?locationNum=4&fps=1

安装Python 3

  1. CentOS 7.6安装Python 3.6。建议使用3.6.8和3.6.10版本
    由于下载之后需要编译说以下最主要的问题
    python 3 安装 产生 libpython3.6m 等问题

./configure --prefix=/usr/local/python3 --enable-shared CFLAGS=-fPIC
make && make install
生成 (/usr/local/python3) libpython3.6m.so和

libpython3.6m.so.1.0这个文件很重要,如果缺失了在安装的时候就会报错

./configure --prefix=/usr/local/python3 --enable-optimizations --with-ssl
make && make install
生成 (/usr/local/python3) libpython3.6m.a
ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
如果 python3 -V
报错 python3: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
解决方案
cp /usr/local/python3/lib/libpython3.6m.so.1.0 /usr/lib64/
卸载python3
rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps 卸载pyhton3
whereis python3 |xargs rm -frv 删除所有残余文件
成功卸载!
whereis python 查看现有安装的python

  1. openEuler 20.3安装Python 3.7:openEuler 20.3自带python3.7,输入python3命令即可进入,默认python命令指向python2.7修改默认路径就可以,不需要自己在安装Python 3.7
    修改操作系统配置
    1.1 关闭防火墙

systemctl stop firewalld

1.2 禁用selinux
/etc/selinux/config文件中的“SELINUX”值设为“disabled”

vi /etc/selinux/config

SELINUX=disabled

重启生效

reboot now

1.3 统一字符集
例如:

vi /etc/profile

export LANG=en_US.UTF-8
1.4 统一时区及时间

timedatectl set-timezone Asia/Shanghai

有单独的ntp服务器可以添加contab定期同步时间
1.5 关闭交换内存

swapoff -a

或者将文件/etc/fstab交换分区那行删除
1.6 设置网卡MTU
推荐设置MTU为8192

vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

增加如下内容
MTU=“8192”

systemctl restart network

1.7 允许root用户远程SSH

vi /etc/ssh/sshd_config

PermitRootLogin yes

systemctl restart sshd

第二章 安装OpenGauss集群
openGauss_1.0.0_PACKAGES_RELEASE_CentOS.tar.gz

将安装文件上传至/opt/software/openGauss
2.1 创建xml配置文件
根据你的IP修改地址

mkdir -p /opt/software/openGauss

chmod 755 -R /opt/software

vi /opt/software/openGauss/clusterconfig.xml

2.2 预安装
配置root用户ssh互信
每个节点都执行

ssh-keygen -t rsa

ssh-copy-id -i .ssh/id_rsa.pub root@opengauss

ssh-copy-id -i .ssh/id_rsa.pub root@opengauss2

配置omm用户ssh互信

su - omm

$ ssh-keygen -t rsa
$ ssh-copy-id -i .ssh/id_rsa.pub omm@opengauss
$ ssh-copy-id -i .ssh/id_rsa.pub omm@opengauss2

cd /opt/software/openGauss

tar -zxvf openGauss_1.0.0_PACKAGES_RELEASE_CentOS.tar.gz

tar -zxvf openGauss-1.0.0-CentOS-64bit.tar.gz

cd /opt/software/openGauss/script

./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml --non-interactive

Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Setting pssh path
Successfully set core path.
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.
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.
Checking OS version.
Successfully checked OS version.
Creating cluster’s path.
Successfully created cluster’s path.
Setting SCTP service.
Successfully set SCTP service.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by “/opt/software/openGauss/script/gs_checkos -i A -h opengauss,opengauss2”.
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.
Set ARM Optimization.
Successfully set ARM Optimization.
Preinstalling secbox.
No need to install secbox.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.
2.3 安装

cd /opt/software/openGauss/script

chmod -R 755 /opt/software/openGauss/script

chown -R omm:dbgrp /opt/software/openGauss/script

su - omm

gs_install \

-X /opt/software/openGauss/clusterconfig.xml
安装时会让你设置密码,要求有大写字母和特殊符号切大于8位的密码
设置错误两次会退出安装
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 ciper 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 /opt/gaussdb/app/share/sslcert/om
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 DN nodes.
Successful check consistence of memCheck and coresCheck on all nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
Successfully started cluster.
Successfully installed application.
end deploy…
2.4 设置备库可读
在开启备机可读之后,备机将支持读操作,并满足数据一致性要求。

1.关闭主备上的数据库实例
[omm@opengauss ~]$ gs_ctl stop -D /gaussdb/data/db1/
[2020-06-24 20:24:13.972][27953][][gs_ctl]: gs_ctl stopped ,datadir is -D “/gaussdb/data/db1”
waiting for server to shut down… done
server stopped

[omm@opengauss2 ~]$ gs_ctl stop -D /gaussdb/data/db1/
[2020-06-24 20:24:29.238][21556][][gs_ctl]: gs_ctl stopped ,datadir is -D “/gaussdb/data/db1”
waiting for server to shut down… done
server stopped

  1. 修改主备postgresql.conf文件
    vi /gaussdb/data/db1/postgresql.conf
    wal_level=hot_standby
    hot_standby = on
    hot_standby_feedback = on

3.启动主备上的数据库实例
$ gs_ctl start -D /gaussdb/data/db1/

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论