DEV Community

leo
leo

Posted on • Updated on

Installation steps of openGauss2.0.1

OpenGauss installation, test environment: OS version: CentOS7.6 x86_64, hardware configuration: 1 2C4G, server name: kafka1.wuyi.com, IP address: 172.16.32.5.

1 Turn off firewall and turn off SELinux

systemctl disable firewalld

systemctl stop firewalld

sed -is/SELINUX=.*/SELINUX=disabled/ /etc/selinux/config

cat /etc/selinux/config

getenforce

setenforce 0

getenforce

2 Set the operating system character set encoding and set the operating system time zone
Enter fullscreen mode Exit fullscreen mode

echo $LANG

3 Close the SWAP partition [For devices with 2G memory, it is recommended to open SWAP after the installation is completed to indirectly "expand the memory capacity"]

4 Configure the SSH service, close the Banner, and allow root to log in remotely
Enter fullscreen mode Exit fullscreen mode

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'

5 Configure YUM source, install dependency packages, and modify the default Python3 version
Enter fullscreen mode Exit fullscreen mode

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/CentOS-7-reg.repo

yum clean all

yum install -y bzip2 python3

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

mv /usr/bin/python /usr/bin/python2_bak

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

python -V

6 Configure sysctl.conf and performance.sh
Enter fullscreen mode Exit fullscreen mode

cat >> /etc/sysctl.conf << EOF

net.ipv4.tcp_retries1 = 5

net.ipv4.tcp_syn_retries = 5

net.sctp.path_max_retrans = 10

net.sctp.max_init_retransmits = 10

EOF

sysctl -p

7 Configure Resource Limits
Enter fullscreen mode Exit fullscreen mode

echo "* soft stack 3072" >> /etc/security/limits.conf

echo "* hard stack 3072" >> /etc/security/limits.conf

echo "* soft nofile 1000000" >> /etc/security/limits.conf

echo "* hard nofile 1000000" >> /etc/security/limits.conf

echo "* soft nproc unlimited" >> /etc/security/limits.d/90-nproc.conf

tail -n 4 /etc/security/limits.conf

tail -n 1 /etc/security/limits.d/90-nproc.conf

8 Turn off transparent huge pages [Only for CentOS]
Enter fullscreen mode Exit fullscreen mode

cat >>/etc/rc.d/rc.local<<EOF

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

echo never > /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

/usr/bin/sh /etc/rc.d/rc.local

cat /sys/kernel/mm/transparent_hugepage/enabled

cat /sys/kernel/mm/transparent_hugepage/defrag


9 Download the openGauss package
Enter fullscreen mode Exit fullscreen mode

mkdir -p /soft/

cd /soft/

wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/2.0.1/x86/openGauss-2.0.1-CentOS-64bit-all.tar.gz

/soft/clusterconfig.xml

10 Configuration XML file
Enter fullscreen mode Exit fullscreen mode

cat >> /soft/clusterconfig.xml <<EOF

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

<!-- openGauss overall information-->

<CLUSTER>

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

    <PARAM name="nodeNames" value="kafka1.wuyi.com" />

    <PARAM name="backIp1s" value="172.16.32.5"/>

    <PARAM name="gaussdbAppPath" value="/gaussdb/app" />

    <PARAM name="gaussdbLogPath" value="/gaussdb/log" />

    <PARAM name="gaussdbToolPath" value="/gaussdb/om" />

    <PARAM name="corePath" value="/gaussdb/corefile"/>

    <PARAM name="clusterType" value="single-inst"/>

</CLUSTER>

<!-- Node deployment information on each server-->

<DEVICELIST>

    <!-- Node deployment information on node1-->

    <DEVICE sn="1000001">

        <PARAM name="name" value="kafka1.wuyi.com"/>

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

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

        <!-- If the server has only one network card available, configure backIP1 and sshIP1 to the same IP -->

        <PARAM name="backIp1" value="172.16.32.5"/>

        <PARAM name="sshIp1" value="172.16.32.5"/>



         <!--dbnode-->

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

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

         <PARAM name="dataNode1" value="/gaussdb/data/db1"/>

    </DEVICE>

</DEVICELIST>
Enter fullscreen mode Exit fullscreen mode

EOF

cat /soft/clusterconfig.xml

11 Unzip the installation package and modify the directory permissions
Enter fullscreen mode Exit fullscreen mode

cd /soft

tar -zxvf *all.tar.gz

tar -zxvf *om.tar.gz

chmod -R 777*

12 Execute gs_preinstall
Enter fullscreen mode Exit fullscreen mode

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

???

13 Check the preinstallation environment
Enter fullscreen mode Exit fullscreen mode

/soft/script/gs_checkos -i A -h kafka1.wuyi.com --detail

14 Execute gs_install
Enter fullscreen mode Exit fullscreen mode

touch /home/omm/install_db

cat >> /home/omm/install_db <<EOF

source ~/.bashrc

gs_install -X /soft/clusterconfig.xml --gsinit-parameter="--encoding=UTF8" --dn-guc="max_process_memory=3GB" --dn-guc="shared_buffers=128MB" --dn-guc= "cstore_buffers=16MB"

EOF

chown -R omm:dbgrp /home/omm/install_db

su - omm -c "sh /home/omm/install_db"

su - omm

gsql -d postgres -p 26000 -r

gs_om -t status --detail

15 To uninstall if you do not want to use openGauss:
Enter fullscreen mode Exit fullscreen mode

gs_uninstall --delete-data

One-click environment cleanup

After the uninstall of openGauss is complete, you can run the script if you do not need to redeploy openGauss on the environment

gs_postuninstall cleans up the environment information on the openGauss server. openGauss environment cleanup is the answer to the ring

Cleanup of settings made by the environment preparation script gs_preinstall.

Preconditions

(1) The uninstallation of openGauss was executed successfully.

(2) Only the root user can execute the gs_postuninstall command.

Log in to the openGauss server as the root user. Enter the decompressed directory: /soft/script path.

./gs_postuninstall -U omm -X /soft /clusterconfig.xml --delete-user --delete-group

Image description

Image description

Top comments (0)