[Linux OS] Introduction to installation and use of Huawei's openEuler operating system and openGauss database

1. Software download

1.1、openEuler

EulerOS is a server operating system independently developed by Huawei. It supports six processor architectures: x86, Arm, RISC-V, LoongArch, SW64 and Power, and can meet the needs of customers from traditional IT infrastructure to cloud computing services.
openEuler is the open source community version of EulerOS.

Official OS image download address: https://www.openeuler.org/zh/download/
Insert image description here
It is recommended to download the LTS version. The latest version is: openEuler 22.03 LTS SP2.

1.2、openGauss

GaussDB is a distributed relational database independently developed and developed by Huawei. This product supports distributed transactions, deployment across AZs in the same city, zero data loss, scalability to 1,000+ nodes, and PB-level mass storage. At the same time, it has key capabilities such as high availability, high reliability, high security, elastic scaling, one-click deployment, fast backup and recovery, and monitoring and alarming on the cloud. It can provide enterprises with an enterprise-level database with comprehensive functions, stability, reliability, strong scalability, and superior performance. Serve.

openGauss is a comprehensive, friendly and open enterprise-level open source relational database built with partners. openGauss is released under the Mulan loose license v2, providing ultimate performance for multi-core architecture, full-link services, data security, AI-based tuning and efficient operation and maintenance capabilities. openGauss deeply integrates Huawei's many years of research and development experience in the database field, combined with the needs of enterprise-level scenarios, to continue to build competitive features. At the same time, openGauss is also an open source, free database platform that encourages community contributions and cooperation.

Both OpenGauss and GaussDB are based on PostgreSQL code. At the same time, they are built on a distributed architecture, support multiple nodes, and can be expanded horizontally to improve the concurrency and scalability of services. GaussDB adds additional proprietary functions and technical support based on OpenGauss, including more powerful performance optimization, higher security and reliability, etc., and is suitable for enterprise-level application scenarios with higher requirements.

Official website installation package download address: https://opengauss.org/zh/download/
Insert image description here
Note: This introductory tutorial does not download the openGauss installation package separately, but installs it using the built-in commands of the openEuler system.

1.3、Data Studio

Data Studio is the official client tool of openGauss. It is an integrated development environment (IDE) that helps database developers easily build applications and provides key database features in the form of a graphical interface. Data Studio also provides SQL Assistant for executing various queries/procedures/functions in "SQL Terminal" and "PL/SQLViewer".

Official website download address: https://opengauss.obs.cn-south-1.myhuaweicloud.com/1.0.1/DataStudio_win_64.zip

Note: The openGauss database can also be accessed using client tools such as Navicat and DBeaver. Data Studio comes with very detailed help tutorials and sample scripts.

2. System installation

2.1. Create a virtual machine

Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here

2.2. Install operating system

Insert image description here
Insert image description here
Insert image description here
Insert image description here
Start the virtual machine and enter the system installation.
Insert image description here
Click the mouse on the screen, then use the direction key "↑" to select the first item, and press Enter to enter the installation program.
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
After the installation is completed, restart the system.

2.3. Log in to the system

Insert image description here
Insert image description here
Insert image description here
Insert image description here
XShell remote login
Insert image description hereInsert image description here

3. Database installation and settings

3.1. Database installation

openEuler 22.03 has built-in openGauss. If it is not checked during system installation, you can also use the following command to install a stand-alone database instance of openGauss with one click:

yum install opengauss -y

3.2. Database management

(1) Switch to opengauss user
openGauss The management user of the database process is opengauss. Common operations on the database need to be switched to this user.

[root@localhost ~]# su - opengauss

Insert image description here
(2) Log in to the database

[opengauss@localhost ~]$ gsql -d postgres -r

Insert image description here
(3) Display existing database

openGauss=# \l

Insert image description here
Note: You need to modify the opengauss account password before you can perform other operations.

openGauss=# ALTER ROLE opengauss PASSWORD 'xxxxxxx';

Insert image description here
Insert image description here
(4) Exit the database
Ctrl+D or \q
Insert image description here
(5) Return to the root user
Ctrl+D
Insert image description here
(6) Create daily operation account xlevon

openGauss=# CREATE USER xlevon PASSWORD 'xlevon@123';
NOTICE:  The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE
openGauss=# alter user xlevon sysadmin;
ALTER ROLE

3.3. Database settings

(1) Set up the IP whitelist.
Edit the data/pg_hba.conf file and add the allowed IP records:
host all all 0.0.0.0/0 md5

[root@localhost ~]# su - opengauss
[opengauss@localhost ~]$ cd data/
[opengauss@localhost data]$ vim pg_hba.conf

Insert image description here
(2) Modify the encryption method and monitoring IP and
edit the data/postgresql.conf file

[opengauss@localhost data]$ vim postgresql.conf

Insert image description here
Insert image description here
(3) Restart the database

[opengauss@localhost data]$ gs_ctl stop
[opengauss@localhost data]$ gs_ctl restart

Insert image description here
Insert image description here
(4) Query and open server ports

[root@localhost ~]# netstat -antp
[root@localhost ~]# sudo firewall-cmd --permanent --add-port=7654/tcp
[root@localhost ~]# sudo systemctl reload firewalld

Insert image description here

4. Database access

4.1. Navicat accesses openGauss

Insert image description here
Insert image description here

4.2. DATA Studio access openGauss

Insert image description here
Insert image description here

5. Summary

The above is the process of building a stand-alone instance of the openGauss database. You can further learn it by combining it with Data Studio. Its SQL syntax is similar to that of other relational databases.

Original article, please indicate the source when reprinting - X-Files

Guess you like

Origin blog.csdn.net/XLevon/article/details/131500151