openEuler operating system and openGauss database

1. openEuler operating system

  • Mirror download address

https://www.openeuler.org/zh/downloadChoose a download
insert image description here

  • Installation
    Follow the prompts to install. Pay attention to the selection when installing the server. 安装服务器
    If necessary openGauss数据库, you can choose it. I chose it here for the experience.

  • turn off firewall

systemctl stop firewalld.service
systemctl disable firewalld.service
  • close selinux

modify file /etc/selinux/config

SELINUX=disabled

Perform setenforce 0a temporary shutdown after modification, or find time to restart the service later.

  • The su command switches the root user

Modify /etc/pam.d/suthe file and comment out the next two lines.

#auth           sufficient      pam_wheel.so trust use_uid
#auth           required        pam_wheel.so use_uid

2. openGauss database

2.1 The system comes with its own library

If you chose to install the openGauss database when you installed the operating system just now, you can use it directly here.

2.1.1 Allow all addresses to access the port

The configuration file here is actually postgres, and even the name has not been changed.

  • Modify the configuration file/var/lib/opengauss/data/postgresql.conf
listen_addresses = '*'
local_bind_address = '0.0.0.0'
password_encryption_type = 0
  • modify /var/lib/opengauss/data/pg_hba.conffile
host all all 0.0.0.0/0 md5
  • Restart the database
systemctl restart opengauss.service
  • View Results
[root@localhost ~]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:7655            0.0.0.0:*               LISTEN      2224/gaussdb
tcp        0      0 0.0.0.0:7654            0.0.0.0:*               LISTEN      2224/gaussdb
tcp6       0      0 :::7655                 :::*                    LISTEN      2224/gaussdb
tcp6       0      0 :::7654                 :::*                    LISTEN      2224/gaussdb

2.1.2 Create a remote login user

  • switch to opengaussuser
 su - opengauss
  • login database
gsql

sql can use the postgres sql command.

  • Set a password for the initializing user
ALTER ROLE openGauss PASSWORD 'liubei@161';
  • Create a remote login user
CREATE USER liubei WITH PASSWORD 'liubei@161';
  • Grant the changed user admin privileges
ALTER USER liubei sysadmin;
  • Then openGausslog in locally with the command
gsql -d postgres -W 'liubei@161'
  • Commands to log in as liubeia user locally
gsql -d postgres -U liubei -W 'liubei@161'
  • Remote login test
    insert image description here

2.2 Install version 5.0

2.2.1 Download

Pay attention to the choice of architecture and operating system
insert image description here

  • Copy to the corresponding server

2.2.2 Installation

  • Create a normal user and change the compressed package owner to this user

The program prohibits the root user from installing

  • switch to normal user
  • Unzip the installation package
  • The files in the installation package are as follows
[liubei@localhost openGauss-5.0.0]$ ll
总用量 40
drwxr-x--- 2 liubei liubei 4096  329 03:46 bin
drwx------ 3 liubei liubei 4096  620 19:07 data
drwxr-x--- 3 liubei liubei 4096  329 03:46 etc
drwxr-x--- 3 liubei liubei 4096  329 03:46 include
drwxr-x--- 4 liubei liubei 4096  329 03:46 jre
drwxr-x--- 5 liubei liubei 4096  329 03:46 lib
drwx------ 2 liubei liubei 4096  620 19:07 logs
drwxr-x--- 5 liubei liubei 4096  329 03:46 share
drwxr-x--- 2 liubei liubei 4096  620 19:08 simpleInstall
-rw-r----- 1 liubei liubei   32  329 03:46 version.cfg
  • enter simpleInstalldirectory
[liubei@localhost openGauss-5.0.0]$ cd simpleInstall
[liubei@localhost simpleInstall]$ ll
总用量 64
-rw-r----- 1 liubei liubei 10827  329 03:46 finance.sql
-rw-r----- 1 liubei liubei 13009  329 03:46 install.sh
-rw-r--r-- 1 liubei liubei  4489  620 19:08 load.log
-rw-r----- 1 liubei liubei  5056  329 03:46 README.md
-rw-r----- 1 liubei liubei 19713  329 03:46 school.sql
[liubei@localhost simpleInstall]$

  • Execute the installation command
[liubei@localhost simpleInstall]$ sh install.sh -w liubei@161

The output is as follows:

[step 1]: check parameter
[step 2]: check install env and os setting
[step 3]: change_gausshome_owner
[step 4]: set environment variables

[step 6]: init datanode
The files belonging to this database system will be owned by user "liubei".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

creating directory /home/liubei/openGauss-5.0.0/data/single_node ... ok
creating subdirectories ... in ordinary occasionok
creating configuration files ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1024MB
Begin init undo subsystem meta.
[INIT UNDO] Init undo subsystem meta successfully.
creating template1 database in /home/liubei/openGauss-5.0.0/data/single_node/base/1 ... The core dump path is an invalid directory
2023-06-20 19:07:42.215 [unknown] [unknown] localhost 140505899286464 0[0:0#0]  [BACKEND] WARNING:  macAddr is 21076/3325712, sysidentifier is 1381236786/3205528920, randomNum is 1041071448
ok
initializing pg_authid ... ok
setting password ... ok
initializing dependencies ... ok
loading PL/pgSQL server-side language ... ok
creating system views ... ok
creating performance views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
initialize global configure for bucketmap length ... ok
creating information schema ... ok
loading foreign-data wrapper for distfs access ... ok
loading foreign-data wrapper for log access ... ok
loading hstore extension ... ok
loading foreign-data wrapper for MOT access ... ok
loading security plugin ... ok
update system tables ... ok
creating snapshots catalog ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
freezing database template0 ... ok
freezing database template1 ... ok
freezing database postgres ... ok
......
Success. You can now start the database server of single node using:

    gaussdb -D /home/liubei/openGauss-5.0.0/data/single_node --single_node
or
    gs_ctl start -D /home/liubei/openGauss-5.0.0/data/single_node -Z single_node -l logfile

[step 7]: start datanode
[2023-06-20 19:07:56.190][15116][][gs_ctl]: gs_ctl started,datadir is /home/liubei/openGauss-5.0.0/data/single_node
[2023-06-20 19:07:56.217][15116][][gs_ctl]: waiting for server to start...
.0 LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.
......

From the above output, we can know the start/stop command, and then switch to liubeiuser execution:

gs_ctl start|stop|restart -D $GAUSSHOME/data/single_node -Z single_node
  • open remote access

Press 2.1 系统自带库to operate.

2.2.3 Testing

Press 2.1 系统自带库to operate.


insert image description here

Guess you like

Origin blog.csdn.net/xingzuo_1840/article/details/131305982