Panweidb single-node server of panweidb is installed in centos7.9 (development environment)

1. System environment optimization

1.1 Close SELINUX

# modify the configuration file
cat /etc/selinux/config | grep -i SELINUX
SELINUX=disabled

# Close SELINUX
setenforce 0

1.2 Kernel parameter optimization

vi /etc/sysctl.conf add

#panweidb
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.ipv4.tcp_synack_retries = 5
net.ipv4.tcp_retries2 = 12
vm.overcommit_memory = 0
net.ipv4.tcp_rmem = 8192 250000 16777216
net.ipv4.tcp_wmem = 8192 250000 16777216
net.core.wmem_max = 21299200
net.core.rmem_max = 21299200
net.core.wmem_default=21299200
net.core.rmem_default=21299200
net.ipv4.ip_local_port_range = 26000 65535
kernel.sem = 250 6400000 1000 25600
net.core.somaxconn=65535
net.ipv4.tcp_syncookies = 1
net.core.netdev_max_backlog=65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_fin_timeout = 60
kernel.shmall = 1073741824
kernel.shmmax = 751619276800
net.ipv4.tcp_sack = 1
net.ipv4.tcp_timestamps = 1
vm.extfrag_threshold = 500
vm.overcommit_ratio = 90
vm.swappiness = 0

# take effect
sysctl -p
Precautions: 

1.3 Configure resource limits

vi /etc/security/limits.conf add

#panweidb
* soft nofile 1000000
* hard nofile 1000000
* soft nproc 655360
* hard nproc 655360
* soft memlock unlimited
* hard memlock unlimited
* soft core unlimited
* hard core unlimited
* soft stack unlimited
* hard stack unlimited

1.4 Create user omm and group dbgrp

groupadd -g 1101 dbgrp
useradd -g dbgrp -u 1101 -m omm
echo 'O2********1!'|passwd --stdin omm

Create a directory
mkdir -p /opt/panweidb

1.5 Install database dependency package

Notes:
1) The libnsl package needs to be installed in the BCLinux8.2 system. Centos7 environment and BC-Linux7.6, BC-Linux7.8 environment do not need to install

yum -y install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel python3 expect* bzip2 libnsl gcc gcc -c + + zlib-devel ncurses-devel expect


1.6 Configure python3 (required for the cluster version, may not be required for the stand-alone version)

check python3
Download address: https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
# Check the python3 version, if it is Python 3.6.9, it meets the requirements, if not, it needs to be compiled and installed
python3 --version

[root@work2 yum.repos.d]# python3 --version
Python 3.6.8
[root@work2 yum.repos.d]#

# Download the installation package from
tar -zxf Python-3.6.9.tgz
cd Python-3.6.9
./configure --prefix=/opt/python/Python-3.6.9 --enable-shared --enable-optimizations --with-ssl
make -j 12 & amp; & amp; make install
ln -s /opt/python/Python-3.6.9/bin/python3 /usr/bin/python3
ln -s /opt/python/Python-3.6.9/bin/python3.6-config /usr/bin/python3-config
cp /opt/python/Python-3.6.9/lib/libpython3.6m.so.1.0 /usr/lib64
chmod -R 755 /usr/lib64/libpython3.6m.so.1.0
ln -s /usr/lib64/libpython3.6m.so.1.0 /usr/lib64/libpython3.6m.so

cat >> /etc/profile <<-EOF
export PYTHON_HOME=/opt/python/Python-3.6.9
export PATH=$PYTHON_HOME/bin:$PATH
EOF

source /etc/profile

2. Panweidb installation of Panweidb

  1. Log in to the host where the openGauss package is installed as the omm user, and decompress the openGauss package to the installation directory (assuming that the installation directory is /opt/panweidb/soft, please replace it with the actual value).

    tar -xf PanWeiDB_1.0.0_CentOS7_x86.tar.gz
    tar -jxf PanWeiDB-1.0.0-CentOS-64bit.tar.bz2 -C /opt/panweidb/soft
  2. Assuming that the path of the decompressed package is /opt/panweidb/soft, enter simpleInstall in the decompressed directory.

    cd /opt/panweidb/soft/simpleInstall
    
  3. Execute the install.sh script to install openGauss.

    sh install.sh -w "strong password" & amp; & amp; source ~/.bashrc
  4. In the above command, -w refers to the password for initializing the database (specified by gs_initdb), which must be set for security needs.

  5. After the installation is completed, use ps and gs_ctl to check whether the process is normal.

    ps ux | grep gaussdb
    gs_ctl query -D /opt/panweidb/soft/data/single_node

    Execute the ps command to display information similar to the following:

    [omm@work2 simpleInstall]$ ps ux | grep gaussdb
    omm 1576 4.5 2.7 3029804 444624 ? Ssl 11:13 0:04 /opt/panweidb/soft/bin/gaussdb -D /opt/panweidb/soft/data/single_node
    omm 2591 0.0 0.0 110492 904 pts/1 S + 11:15 0:00 grep --color=auto gaussdb
    [omm@work2 simpleInstall]$ gs_ctl query -D /opt/panweidb/soft/data/single_node
    [2023-05-24 11:16:55.542][3360][][gs_ctl]: gs_ctl query ,datadir is /opt/panweidb/soft/data/single_node
     HA state:
            local_role : Normal
            static_connections: 0
            db_state : Normal
            detail_information : Normal
    
     Senders info:
    No information
     Receiver info:
    No information
    [omm@work2 simpleInstall]$
    
    
    Connect to the database
    ?
    [omm@work2 ~]$ gsql -d postgres
    gsql ((PanWeiDB(openGauss) 1.0.0 build 9a7e96bc) compiled at 2022-10-15 20:54:36 commit 0 last mr )
    Non-SSL connection (SSL connection is recommended when requiring high-security)
    Type "help" for help.
    
    PanWeiDB=# 

3. Create and use database

a. Create user USER
CREATE USER testza IDENTIFIED BY 'she********sa';

b. Use the following command to create a new tablespace testzaq_tbs, and authorize the tablespace escspdb_tbs to user testzaq
CREATE TABLESPACE testza_tbs OWNER testza RELATIVE LOCATION 'tablespace/testza_tbs1';

c. Use the following command to create a new database escspdb, and place it in the escspdb_tbs tablespace.
CREATE DATABASE testza WITH TABLESPACE = testza_tbs;

d. Authorize user testza to access database testza
grant all privileges on database testza to testza;

e. Use the following command to set the default schema search path for the database.
ALTER DATABASE testza SET search_path TO pa_catalog, public;

f. Use the following command to modify the database table space
ALTER DATABASE testza SET TABLESPACE testza_tbs;

g. Test database connection
gsql -d testza -U testza -W 'she********sa' -r

4. Enable remote access to the database

4.1 Modify encryption mode

Edit postgresql.conf under the PostgreSQL database directory, modify password_encryption_type to 1, and support md5 and sha256 at the same time

password_encryption_type = 1

4.2 Enable remote access

Change this parameter in the postgresql.conf file under the PostgreSQL database directory, and restart the database to take effect

listen_addresses = '*'

4.3 Open pg_hba.conf firewall, let go of IP

host all all 10.1.161.184/32 sha256

4.4 Use navicat for connection test, the feedback is successful

Reference: Single Node Server Installation Single Node Server Installation Create user group dbgroup. groupadd dbgroup creates the common user omm under the user group dbgroup, and sets the password of the common user omm. The recommended password is omm@123. useradd -g dbgroup omm passwd omm Use the omm user to log in to the host where the openGauss package is installed, and decompress the openGauss package to the installation directory (assuming that the installation directory is /opt/software/openGauss, please replace it with the actual value). tar -jxf openGauss-x.x.x-operating system-64bit.tar.bz2 -C /opt/software/openGauss Assuming that the path of the decompressed package is /opt/software/openGauss, enter the simpleInstall in the decompressed directory. cd /opt/software/openGauss/simpleInstall Execute the install.sh script to install openGauss. sh install.sh -w xxxx In the above command, -w refers to the initialization database password (specified by gs_initdb), which must be set for security needs. After the installation is completed, use ps and gs_ctl to check whether the process is normal. ps ux | grep gaussdb gs_ctl query -D /opt/software/openGauss/data/single_node Execute the ps command and display information similar to the following: omm 24209 11.9 1.0 1852000 355816 pts/0 Sl 01:54 0:33 /opt/software/openGauss /bin/gaussdb -D /opt/software/openGauss/single_node omm 20377 0.0 0.0 119880 1216 pts/0 S + 15:37 0:00 grep –color=auto gaussdb Execute the gs_ctl command and display information similar to the following: gs_ctl query , datadir is /opt/software/openGauss/data/single_node HA state: local_role : Normal static_connections : 0 db_state : Normal detail_information : Normal Senders info: No information Receiver info: No information https://docs.opengauss.org/zh/docs/5.0.0/docs/GettingStarted/Single node server installation .html

The knowledge points of the article match the official knowledge files, and you can further learn relevant knowledge Cloud Native Introduction Skill Tree HomepageOverview 12938 people are studying systematically