Installation practice of openGauss database on CentOS

This article is shared from Huawei Cloud Community " Installation Practice of openGauss Database on CentOS ", author: Gauss Squirrel.

1. Preparation before installation

Before installing the database, the server + database installation package of centOS 7.6 must be installed.

First, find a small partner to apply for the Huawei Cloud ECS server and install the OS. Here we use x86_64+centos.

 Huawei cloud server is very cost-effective now, and the installation is also very convenient.

[root@pekphisprb70593 ~]# cat /etc/os-release

NAME="CentOS Linux"

VERSION="7 (Core)"

ID="centos"

ID_LIKE="rhel fedora"

VERSION_ID="7"

PRETTY_NAME="CentOS Linux 7 (Core)"

ANSI_COLOR="0;31"

CPE_NAME="cpe:/o:centos:centos:7"

HOME_URL="https://www.centos.org/"

BUG_REPORT_URL="https://bugs.centos.org/"



CENTOS_MANTISBT_PROJECT="CentOS-7"

CENTOS_MANTISBT_PROJECT_VERSION="7"

REDHAT_SUPPORT_PRODUCT="centos"

REDHAT_SUPPORT_PRODUCT_VERSION="7"

Log in to the openGauss open source community through Software Package | openGauss, and select the installation package corresponding to the platform enterprise version of version 3.0.0. I use centos_x86_64, and the installation package is downloaded locally. File name: openGauss-3.0.0-CentOS-64bit-all.tar.gz.

cke_119.png

2. python3 preparation

The python that comes with centos is python2, which does not meet the requirements of the official documentation. (In fact, it does not support the installation of openGauss, I have tried it)

cke_120.png

Moreover, the official document only writes that python3 is required, and does not explain in detail how to install it, so it is not very friendly to some novices.

centos requires that python can only be 3.6.X, not above, that is, 3.7 cannot be used. I use 3.6.15 here. Python3 installation also depends on zlib. Therefore, no matter online or offline installation, you need to complete the zlib related installation first.

If the server can be directly connected to the Internet yum source or the yum source of your own company, you can refer to the online version for installation. Otherwise use offline installation. 

2.1 Online version installation

Here it is required that the server can be directly connected to the Internet using yum or wget, or configured with a proxy.

  • Install dependent packages, some may come with the system, it doesn't matter.
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

After completion, it will prompt "Complete!"

  • Download the python installation package.
wget https://www.python.org/downloads/release/python-3615/

Because the download is very slow, you can also go to the python official website  Python Release Python 3.6.15 | Python.org to download a new version locally and then upload it to the server.

Unzip and install python3.6. Make compile time is relatively long, wait patiently, the full screen output will accompany you.

tar -zxvf Python-3.6.15.tgz

cd Python-3.6.15/

./configure --prefix=/usr/local/python3 --enable-shared

make

make install

Finally, the prompt Successfully means that the installation is successful.

cke_121.png

However, note that you also need to set the soft connection of python on the OS at this time. Among them, /usr/local/python3/ needs to be replaced with the actual path of your own python installation package, which is the path of ./configure above.

If it is done according to my guidance, there is no need to change it.

ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3

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

ln -s /usr/local/python3/lib/libpython3.6m.so.1.0 /usr/lib64/

export LD_LIBRARY_PATH=/usr/local/python3/lib:$LD_LIBRARY_PATH

At this point, installing python3.6 on centos is complete.

2.2 Offline version installation

Because sometimes it needs to be installed on the company's intranet, it is inconvenient to download directly from the server, and yum and wget are all unavailable. You can only go to the official website to download the software to windows and then upload it to linux and install it.

[root@pekphisprb70593 software]# rpm -qa|grep zlib

zlib-1.2.7-18.el7.x86_64

So my machine comes with version 1.2.7, and I need to install version 1.2.7 of zlib-devel. Search for a corresponding version and upload it to the server.

rpm -ivh zlib-devel-1.2.7-18.el7.x86_64.rpm

cke_122.png

The rest is to follow the instructions in the online version, download the python installation package locally and upload it, and perform the same installation and configuration actions as the online version.

3. Modify the operating system configuration

Currently only supports installation with the firewall turned off.

Modify the value of "SELINUX" in the /etc/selinux/config file to "disabled". Open the config file with VIM.

vi /etc/selinux/config

Check whether the value of "SELINUX" is "disabled". If yes, go directly to the next step. If not, modify the value "disabled" of "SELINUX", execute: wq to save and exit the modification, and then reboot to restart.

cke_123.png

Check that the firewall is turned off. If the firewall status is displayed as inactive (dead), go to the next step directly.

systemctl status firewalld

If the firewall status is displayed as active (running), it means that the firewall is not closed, please close the firewall.

systemctl disable firewalld.service

systemctl stop firewalld.service

To set the character set of each database node to the same character set, you can add "export LANG=en_US.UTF-8" to the /etc/profile file (it can also be set to GBK, depending on what you are used to).

Use the swapoff -a command to disable swap memory.

Modify the value "no" of "RemoveIPC" in /etc/systemd/logind.conf, and delete the # in front.

    

cke_124.png

Reload parameters and check.

[root@pekphisprb70594 ~]# systemctl daemon-reload

[root@pekphisprb70594 ~]# systemctl restart systemd-logind

Run the ifconfig command to query the network card name of the server. The default is generally correct.

As shown in the figure below, the server IP is 10.244.53.173, and the network card name of the server is eth0. For X86, the official document MTU value recommends 1500.

cke_125.png

Set root user remote login

  1. vim opens the configuration file /etc/ssh/sshd_config.
  2. Check whether the PermitRootLogin configuration is yes, which means that the user is allowed to log in remotely.
  3. Add # in front of Banner XXX to comment out the greeting.
  4. Restart the sshd service.
[root@pekphisprb70596 openGauss]# systemctl restart sshd.service

Perform the above steps on other servers.

4. Configuration file cluster_config.xml preparation

From the example in the installation document, replace the hostname pekphisprb70593 and IP 10.xxx with the values ​​you actually use. Save to a file named cluster_config.xml.

Below is the modified content. Pay attention to the encoding format, I can see that the encoding format is UTF-8 with notepad++. For beginners, it is recommended to upload to the server after modification on Windows.

<?xml version="1.0" encoding="UTF-8"?>

<ROOT>

<!-- openGauss整体信息 -->

<CLUSTER>

<PARAM name="clusterName" value="opengSingle" />

<PARAM name="nodeNames" value="pekphisprb70593" />

<PARAM name="gaussdbAppPath" value="/opt/huawei/install/app" />

<PARAM name="gaussdbLogPath" value="/var/log/omm" />

<PARAM name="tmpMppdbPath" value="/opt/huawei/tmp" />

<PARAM name="gaussdbToolPath" value="/opt/huawei/install/om" />

<PARAM name="corePath" value="/opt/huawei/corefile" />

<PARAM name="backIp1s" value="10.x.x.x"/>



</CLUSTER>

<!-- 每台服务器上的节点部署信息 -->

<DEVICELIST>

<!-- node1上的节点部署信息 -->

<DEVICE sn="pekphisprb70593">

<PARAM name="name" value="pekphisprb70593"/>

<PARAM name="azName" value="AZ1"/>

<PARAM name="azPriority" value="1"/>

<!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->

<PARAM name="backIp1" value="10.x.x.x"/>

<PARAM name="sshIp1" value="10.x.x.x"/>



<!--dbnode-->

<PARAM name="dataNum" value="1"/>

<PARAM name="dataPortBase" value="15400"/>

<PARAM name="dataNode1" value="/opt/huawei/install/data/dn"/>

<PARAM name="dataNode1_syncNum" value="0"/>

</DEVICE>

</DEVICELIST>

</ROOT>

5. Installation and verification

This step is basically installed according to the product documentation, there is nothing to say.

Log in to any host where openGauss is to be installed as the root user, and create a directory for storing the installation package as planned.

mkdir -p /opt/software/openGauss

chmod 755 -R /opt/software

Put the installation package "openGauss-3.0.0-CentOS-64bit-all.tar.gz" and the configuration file "cluster_config.xml" into the /opt/software/openGauss directory created in the previous step.

Unzip the installation package.

cd /opt/software/openGauss

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

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

Enter the script to execute the pre-installation command. I use interactive, so I need to enter the password when prompted in the middle. The installation takes about a minute or two.

[root@opengauss1 openGauss]# cd script/

[root@opengauss1 script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_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

...

...

Fixing server package owner.

Setting finish flag.

Successfully set finish flag.

Preinstallation succeeded.

Switch to the omm user and use gs_install to install openGauss. In the middle, enter the database password to be set according to the prompt, about two or three minutes.

[root@pekphisprb70593 script]# su - omm

Last login: Wed Jul 6 09:17:01 CST 2022

[omm@pekphisprb70593 ~]$ gs_install -X /opt/software/openGauss/cluster_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.

...

Please enter password for database:

Please repeat for database:

...

Configuration is completed.

Successfully started cluster.

Successfully installed application.

end deploy..

Check the status of the database, if the state is Normal.

[omm@opengauss1 dn]$ gs_om -t status --detail

Try connecting now.

[omm@opengauss1 om]$ gsql -d postgres -p 15400

gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:19 commit 0 last mr )

Non-SSL connection (SSL connection is recommended when requiring high-security)

Type "help" for help.



openGauss=# CREATE DATABASE mydb WITH ENCODING 'GBK' template = template0;

CREATE DATABASE

openGauss=#

openGauss=# \q

This concludes the installation.

6. Possible problems

Python安装 make install提示zipimport.ZipImportError:can't decompress data;zlib not available。

tar -zxvf Python-3.6.15.tgz

cd Python-3.6.15/

./configure prefix=/usr/local/python3

make

make install

Then an error is reported here, indicating that there is no zlib, and the data cannot be decompressed.

cke_126.png

This is generally not installed zlib-devel. You can use yum to execute yum -y install zlib-devel to install it.

If it can only be installed offline, follow the offline version installation section of this article to solve it.

PS: I searched a lot of information here, because yum is not configured, so it can only be installed offline. I started to install and then compile according to zlib-xxx.tar.gz. As a result, the installation of python kept prompting the above error. I thought it was the wrong configuration of zlib. Later, I tried other versions of zlib-devel. People who encounter the same problem avoid this pit.

OpenGauss executes ./preinstall and reports an error message "Unable to import module: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory." It is because the python configuration is not done properly.

Solution:

Find this file and write it to the python configuration file.

[root@pekphisprb70593 script]# find / -name libpython3.6m.so.1.0

/usr/local/python3/lib/libpython3.6m.so.1.0

/opt/Python-3.6.15/libpython3.6m.so.1.0

[root@pekphisprb70593 script]# cd /etc/ld.so.conf.d/

Create a new python3.conf under this path, and write it into the upper directory of libpython3.6m.so.1.0. I found two here, just write one, such as /usr/local/python3/lib, then save and exit .

Perform the following reload.

[root@pekphisprb70593 ld.so.conf.d]# ldconfig

Then re-execute the command of step 4 ./gs_preinstall.

Click to follow and learn about Huawei Cloud's fresh technologies for the first time~

Guess you like

Origin blog.csdn.net/devcloud/article/details/132225187