How to Install OpenGauss on OpenEuler (ARM Architecture)

How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)

System Version Introduction

The openGauss installation in this case is based on the openEuler-20.03-LTS version. The current best compatible Python versions for openGauss are Python 3.6 and Python 3.7. The openEuler version used in this experiment comes with Python 3.7.4 pre-installed, so no additional installation is required.

How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)

Modify System Configuration

(Both primary and standby need configuration)

1. Change Default Python Version

(Default is 2.x, change to 3.x)

First, use the following command to check the current system’s default Python version and the version of Python3 installed on the system. The command python -V shows the default Python version. If it is not 3.x, you need to change the default Python to the Python 3.x version.

python -V

python3 -V

How to Install OpenGauss on OpenEuler (ARM Architecture)

Execute the following commands to change the default Python version to Python 3.x:

mv /usr/bin/python /usr/bin/python.bak

ln -s /usr/bin/python3 /usr/bin/python

How to Install OpenGauss on OpenEuler (ARM Architecture)

Check if the current default Python version has switched from Python 2.x to Python 3.x.

2. Disable SELINUX, set status to disabled

(Requires a system reboot to take effect)

SELINUX stands for Security Enhanced Linux, which provides more granular settings for system security levels. Due to the strict configuration of SELinux, it may conflict with the features required by CM.

vi /etc/selinux/config

How to Install OpenGauss on OpenEuler (ARM Architecture)

3. Turn Off Firewall

The installation process needs to be completed with the firewall turned off.

systemctl stop firewalld

systemctl disable firewalld

How to Install OpenGauss on OpenEuler (ARM Architecture)

4. Disable Swap Memory

Disabling swap memory is to avoid data being swapped to disk, which can affect performance.

swapoff -a

5. Change Character Set to UTF-8

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

6. Set Timezone and Time

Use the date command to check if the time across all nodes is consistent. If they are consistent, there is no need to change; if not, they need to be configured to be the same.

How to Install OpenGauss on OpenEuler (ARM Architecture)

Use the following commands to configure the timezone and time:

rm -fr /etc/localtime

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

date -R

hwclock

7. Disable RemoveIPC

By default, RemoveIPC=yes means that when a user exits, the user’s shared memory segments and semaphores will be deleted.

echo RemoveIPC=no >> /etc/systemd/logind.conf

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

Restart the service to refresh the configuration (after making changes, a server reboot is required, so you can skip restarting the service).

systemctl daemon-reload

systemctl restart systemd-logind

8. Comment Out Welcome Message

Set to allow root remote login. In openEuler 20.3, the default setting is PermitRootLogin=yes, so no change is needed. Modify the Banner configuration to remove the welcome message displayed upon connecting to the system. The welcome message can interfere with the return results of remote operations during installation, affecting the normal execution of the installation.

vi /etc/ssh/sshd_config

How to Install OpenGauss on OpenEuler (ARM Architecture)

Restart the service to refresh the configuration (after making changes, a server reboot is required, so you can skip restarting the service).

systemctl restart sshd.service

9. Disable THP Service

The THP (Transparent Huge Pages) feature can degrade the I/O performance of the operating system and requires certain CPU resources to manage huge page fragmentation.

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

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

echo ‘echo never >> /sys/kernel/mm/transparent_hugepage/defrag’ >> /etc/rc.d/rc.local

echo ‘echo never >> /sys/kernel/mm/transparent_hugepage/enabled’ >> /etc/rc.d/rc.local

sh /etc/rc.d/rc.local

10. Reboot the Operating System

Changes to SELINUX and THP services require a reboot of the operating system to take effect.

reboot

How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)

Configure YUM Source and Download Missing Dependencies

(Both primary and standby need configuration)

Edit the YUM source configuration file:

cd /etc/yum.repos.d/

vi openEuler_x86_64.repo

Add the following content to the end of the repo file:

[openEuler]

name=openEuler

baseurl=https://repo.openeuler.org/openEuler-20.03-LTS/everything/x86_64

enabled=1

gpgcheck=1

gpgkey=https://repo.openeuler.org/openEuler-20.03-LTS/everything/x86_64

The current experimental source system environment does not include the expect dependency package, which needs to be installed manually:

yum -y install expect –nogpgcheck

The –nogpgcheck parameter is used to avoid GPG checks, which can prevent installation failures due to source key errors.

How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)

Prepare Installation Package

(Only needs to be executed on the primary node)

1. Create Installation Directory

mkdir -p /opt/software/openGauss

2. Unzip all and om compressed packages

Download the installation package (the one corresponding to the ARM architecture) from the openGauss community at https://www.opengauss.org/zh/

How to Install OpenGauss on OpenEuler (ARM Architecture)

Then upload the installation package to the server. Execute the following command in the path where the installation package is stored to unzip the package into the /opt/software/openGauss directory:

tar zxf openGauss-3.0.0-openEuler-64bit-all.tar.gz -C /opt/software/openGauss

cd /opt/software/openGauss

tar zxf openGauss-3.0.0-openEuler-64bit-om.tar.gz

3. Change Directory Permissions

chmod -R 775 /opt/software

chmod -R 777 /opt/software/openGauss

4. Prepare Configuration File clusterconfig.xml (in /opt/software/openGauss directory)

vi clusterconfig.xml

1. Make sure to assign the nodeNames to the hostnames where the database is installed, backIp1s should correspond to the IP of the host. 2. The dataNode1 parameter needs to configure the data directory for node 2 as well. 3. Each node needs to add the relevant configuration for cm.

<?xml version=”1.0″ encoding=”UTF-8″?>

<ROOT>

<!– openGauss overall information –>

<CLUSTER>

<!– Database Name–>

<PARAM name=”clusterName” value=”dbCluster” />

<!– Database Node Name(hostname) –>

<PARAM name=”nodeNames” value=”node1,node2,node3″ />

<!– Database Installation Directory–>

<PARAM name=”gaussdbAppPath” value=”/opt/software/install/app” />

<!– Log Directory–>

<PARAM name=”gaussdbLogPath” value=”/opt/software/log/omm” />

<!– Temporary File Directory–>

<PARAM name=”tmpMppdbPath” value=”/opt/software/tmp” />

<!– Database Tool Directory–>

<PARAM name=”gaussdbToolPath” value=”/opt/software/om” />

<!– Database Core File Directory–>

<PARAM name=”corePath” value=”/opt/software/corefile” />

<!– NodeIP, corresponds one-to-one with the database node name list –>

<PARAM name=”backIp1s” value=”192.168.0.27,192.168.0.235,192.168.0.246″/>

</CLUSTER>

<!– Deployment Information on Each Server’s Node–>

<DEVICELIST>

<!– Deployment Information on Node1 –>

<DEVICE sn=”node1″>

<!– Hostname of Node1 –>

<PARAM name=”name” value=”node1″/>

<!– Node1AZ and AZ Priority –>

<PARAM name=”azName” value=”AZ1″/>

<PARAM name=”azPriority” value=”1″/>

<!– Node1IP, if the server has only one available network card, configurebackIp1 andsshIp1 to the sameIP –>

<PARAM name=”backIp1″ value=”192.168.0.27″/>

<PARAM name=”sshIp1″ value=”192.168.0.27″/>

<!–dbnode–>

<PARAM name=”dataNum” value=”1″/>

<PARAM name=”dataPortBase” value=”8000″/>

<PARAM name=”dataNode1″ value=”/opt/software/install/data/dn, node2,/opt/software/install/data/dn,node3,/opt/software/install/data/dn”/>

<PARAM name=”dataNode1_syncNum” value=”0″/>

<!–cm–>

<PARAM name=”cmDir” value=”/opt/software/data/cmserver” />

<PARAM name=”cmServerPortBase” value=”15000″ />

<PARAM name=”cmsNum” value=”1″ />

<PARAM name=”cmServerlevel” value=”1″ />

<PARAM name=”cmServerListenIp1″ value=”192.168.1.112,192.168.1.113,192.168.1.114″ />

<PARAM name=”cmServerRelation” value=”node1,node2,node3″ />

</DEVICE>

<!– Deployment Information on Node2 where “name” is configured to the hostname –>

<DEVICE sn=”node2″>

<!– Hostname of Node2 –>

<PARAM name=”name” value=”node2″/>

<!– Node2AZ and AZ Priority –>

<PARAM name=”azName” value=”AZ1″/>

<PARAM name=”azPriority” value=”1″/>

<!– IP of Node2, if the server has only one available network card, configurebackIp1 andsshIp1 to the sameIP –>

<PARAM name=”backIp1″ value=”192.168.0.235″/>

<PARAM name=”sshIp1″ value=”192.168.0.235″/>

<!– cm configuration –>

<PARAM name=”cmDir” value=”/opt/software/data/cmserver” />

<PARAM name=”cmServerPortBase” value=”15000″ />

</DEVICE>

<!– Deployment Information on Node3 where “name” is configured to the hostname –>

<DEVICE sn=”node3″>

<!– Hostname of Node3 –>

<PARAM name=”name” value=”node3″/>

<!– Node3AZ and AZ Priority –>

<PARAM name=”azName” value=”AZ1″/>

<PARAM name=”azPriority” value=”1″/>

<!– IP of Node3, if the server has only one available network card, configurebackIp1 andsshIp1 to the sameIP –>

<PARAM name=”backIp1″ value=”192.168.0.246″/>

<PARAM name=”sshIp1″ value=”192.168.0.246″/>

<!– cm configuration –>

<PARAM name=”cmDir” value=”/opt/software/data/cmserver” />

<PARAM name=”cmServerPortBase” value=”15000″ />

</DEVICE>

</DEVICELIST>

</ROOT>

How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)

Initialize Installation Environment gs_preinstall

(Only needs to be executed on the primary node)

1. Change Directory Permissions

chmod -R 775 /opt/software

chmod -R 777 /opt/software/openGauss

2. Initialize Installation Environment

Enter the script directory obtained after decompressing om:

cd /opt/software/openGauss/script

./gs_preinstall -U omm -G dbgrp -X ../clusterconfig.xml

How to Install OpenGauss on OpenEuler (ARM Architecture)

Note that the omm user does not exist. If the user exists, it needs to be initialized; otherwise, an error will occur during installation. Successful installation is shown in the following image:

How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)

Install gs_install

(Only needs to be executed on the primary node)

1. Change Directory Permissions

After initialization, the database installation path permissions will be reset to only allow root user access. You need to change the directory permissions again (both primary and standby node directories need to change permissions).

chmod -R 775 /opt/software

chmod -R 777 /opt/software/openGauss

2. Switch to System User omm and Install Using omm

su omm

cd /opt/software/openGauss/script

./gs_install -X ../clusterconfig.xml

Configure the password for logging into the database (the user is the omm set by preinstall -U).

How to Install OpenGauss on OpenEuler (ARM Architecture)

If the following error occurs, it is because the physical machine’s memory is too small to install; you need to reconfigure the memory.

How to Install OpenGauss on OpenEuler (ARM Architecture)

Successful installation is shown in the image below (the service will automatically start after installation is complete):

How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)

Using openGauss

1. Use OM Module to Manage Cluster

(1) Start Service

gs_om -t start

How to Install OpenGauss on OpenEuler (ARM Architecture)

(2) Check Service Status

gs_om -t status –detail

How to Install OpenGauss on OpenEuler (ARM Architecture)

Results of the query when the service is stopped:

How to Install OpenGauss on OpenEuler (ARM Architecture)

(3) Stop Service

gs_om -t stop

How to Install OpenGauss on OpenEuler (ARM Architecture)

(4) Primary-Standby Switch

gs_ctl switchover -D /opt/software/install/data/dn

gs_ctl failover -D /opt/software/install/data/dn

How to Install OpenGauss on OpenEuler (ARM Architecture)

Check the status after the switch:

How to Install OpenGauss on OpenEuler (ARM Architecture)

2. Use CM Module to Manage Cluster

(1) Start Service

cm_ctl start

How to Install OpenGauss on OpenEuler (ARM Architecture)

(2) Check Service Status

cm_ctl query -Cv

How to Install OpenGauss on OpenEuler (ARM Architecture)

Results of the query when the service is stopped:

How to Install OpenGauss on OpenEuler (ARM Architecture)

(3) Stop Service

cm_ctl stop

How to Install OpenGauss on OpenEuler (ARM Architecture)

cm_ctl stop -n 1 -D /opt/software/install/data/dn

-n: Node ID -D: Instance Node Data Directory

(4) Primary-Standby Switch

cm_ctl switchover -n 1 -D /opt/software/install/data/dn

cm_ctl failover -n 1 -D /opt/software/install/data/dn

How to Install OpenGauss on OpenEuler (ARM Architecture)

Check the status after the switch:

How to Install OpenGauss on OpenEuler (ARM Architecture)

Restore to the initial primary-standby relationship:

cm_ctl switchover -a

3. Set Standby Machine to Readable (Optional, default is enabled)

On all nodes, find the postgresql.conf configuration file and configure it in the file:

wal_level=hot_standby; # default is configured

hot_standby = on; # default is configured

# Set on the primary end to prevent VACUUM from removing recently dead tuples, which can cause table bloat on the primary database

# Set on the standby end to prevent query cancellation conflicts caused by record clearance on the primary end

hot_standby_feedback = on;

How to Install OpenGauss on OpenEuler (ARM Architecture)How to Install OpenGauss on OpenEuler (ARM Architecture)

END

How to Install OpenGauss on OpenEuler (ARM Architecture)

Leave a Comment