【CentOS7.6 安装openGauss5.0.0 实践】

CentOS7.6 安装openGauss5.0.0 实践

1.登录机器查看版本

【如不是CentOS7.6可以手动修改版本号】

[root@hosts-vm99 ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@hosts-vm99 ~]# 
[root@hosts-vm99 ~]# vi /etc/redhat-release 
[root@hosts-vm99 ~]# 
[root@hosts-vm99 ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core)
[root@hosts-vm99 ~]# 

2.上传安装包openGauss-5.0.0-CentOS-64bit.tar.bz2并解压

2.1【注意:需要安装bzip2】

[root@hosts-vm99 ~]# ll
total 131632
drwxr-xr-x 7 root root     4096 Dec 18  2020 benchmarksql5.0-for-mysql
-rw-r--r-- 1 root root 36175872 Dec  5 11:23 openGauss-5.0.0-CentOS-64bit.tar.bz2
[root@hosts-vm99 ~]# 
[root@hosts-vm99 ~]# 
[root@hosts-vm99 ~]# tar -xjf openGauss-5.0.0-CentOS-64bit.tar.bz2 
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
[root@hosts-vm99 ~]# 
[root@hosts-vm99 ~]# bzip2
-bash: bzip2: command not found
[root@hosts-vm99 ~]# 
[root@hosts-vm99 ~]# yum list bzip2
[root@hosts-vm99 ~]# rpm -qa|grep bzip2
bzip2-1.0.6-13.el7.x86_64
bzip2-libs-1.0.6-13.el7.x86_64
[root@hosts-vm99 run]# 

2.2 【注意:需要手动创建目标路径,并赋权】

[root@hosts-vm99 ~]# tar -jxf openGauss-5.0.0-CentOS-64bit.tar.bz2 -C /opt/software/openGauss
tar: /opt/software/openGauss: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
[root@hosts-vm99 ~]# 
[root@hosts-vm99 ~]# mkdir -p /opt/software/openGauss
[root@hosts-vm99 ~]# 
[root@hosts-vm99 ~]# tar -jxf openGauss-5.0.0-CentOS-64bit.tar.bz2 -C /opt/software/openGauss
[root@hosts-vm99 ~]# chown -R opengauss:opengauss /opt/software/openGauss
[root@hosts-vm99 ~]# 

2.3 【注意:需要手动安装依赖】

libaio-devel 建议版本:0.3.109-13
readline-devel 建议版本:7.0-13
[root@hosts-vm99 opengauss]# rpm -qa|grep readline-devel
readline-devel-6.2-11.el7.x86_64
[root@hosts-vm99 opengauss]# 
[root@hosts-vm99 opengauss]# rpm -qa|grep libaio
libaio-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.x86_64

3.创建opengauss用户,并切换

[root@hosts-vm99 simpleInstall]# useradd -m opengauss -d /home/opengauss -s /bin/bash
[root@hosts-vm99 simpleInstall]# chown -R opengauss:opengauss /opt/software/openGauss
[root@hosts-vm99 simpleInstall]# 
[root@hosts-vm99 simpleInstall]# ll
total 56
-rw-r----- 1 opengauss opengauss 10827 Mar 29  2023 finance.sql
-rw-r----- 1 opengauss opengauss 13009 Mar 29  2023 install.sh
-rw-r----- 1 opengauss opengauss  5056 Mar 29  2023 README.md
-rw-r----- 1 opengauss opengauss 19713 Mar 29  2023 school.sql
[root@hosts-vm99 simpleInstall]# 
[root@hosts-vm99 simpleInstall]# su - opengauss

3.进入解压后目录下的simpleInstall

[opengauss@hosts-vm99 ~]$ cd /opt/software/openGauss/
[opengauss@hosts-vm99 openGauss]$ ll
total 32
drwxr-x--- 2 opengauss opengauss 4096 Mar 29  2023 bin
drwxr-x--- 3 opengauss opengauss 4096 Mar 29  2023 etc
drwxr-x--- 3 opengauss opengauss 4096 Mar 29  2023 include
drwxr-x--- 4 opengauss opengauss 4096 Mar 29  2023 jre
drwxr-x--- 5 opengauss opengauss 4096 Mar 29  2023 lib
drwxr-x--- 5 opengauss opengauss 4096 Mar 29  2023 share
drwxr-x--- 2 opengauss opengauss 4096 Mar 29  2023 simpleInstall
-rw-r----- 1 opengauss opengauss   32 Mar 29  2023 version.cfg
[opengauss@hosts-vm99 openGauss]$ cd simpleInstall/
[opengauss@hosts-vm99 simpleInstall]$ ll
total 56
-rw-r----- 1 opengauss opengauss 10827 Mar 29  2023 finance.sql
-rw-r----- 1 opengauss opengauss 13009 Mar 29  2023 install.sh
-rw-r----- 1 opengauss opengauss  5056 Mar 29  2023 README.md
-rw-r----- 1 opengauss opengauss 19713 Mar 29  2023 school.sql
[opengauss@hosts-vm99 simpleInstall]$ 
[opengauss@hosts-vm99 simpleInstall]$ chmod 755 *
[opengauss@hosts-vm99 simpleInstall]$ 
[opengauss@hosts-vm99 simpleInstall]$ ./install.sh  -w "Test@1234" &&source ~/.bashrc
[step 1]: check parameter
[step 2]: check install env and os setting
On systemwide basis, the maximum number of SEMMNI is not correct. the current SEMMNI value is: 128. Please check it.
The required value should be greater than 321. You can modify it in file '/etc/sysctl.conf'.
[opengauss@hosts-vm99 simpleInstall]$ 
[opengauss@hosts-vm99 simpleInstall]$ 

【注意:安装失败报错,解决办法:使用root用户修改OS配置文件】

[root@hosts-vm99 ~]# sysctl -w kernel.sem="250 85000 250 330" 
kernel.sem = 250 85000 250 330
[root@hosts-vm99 ~]# 

4.重新使用opengauss用户执行安装

[opengauss@hosts-vm99 simpleInstall]$ sh install.sh  -w "Test@1234" &&source ~/.bashrc
[step 1]: check parameter
[step 2]: check install env and os setting
[step 3]: change_gausshome_owner
[step 4]: set environment variables

/home/opengauss/.bashrc: line 16: ulimit: open files: cannot modify limit: Operation not permitted
[step 6]: init datanode
The files belonging to this database system will be owned by user "opengauss".
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 /opt/software/openGauss/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 /opt/software/openGauss/data/single_node/base/1 ... 2023-12-05 11:26:11.978 [unknown] [unknown] localhost 140212300353792 0[0:0#0]  [BACKEND] WARNING:  macAddr is 64022/1046263063, sysidentifier is 4195761756/3038210454, randomNum is 841116054
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

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run gs_initdb.

Success. You can now start the database server of single node using:

    gaussdb -D /opt/software/openGauss/data/single_node --single_node
or
    gs_ctl start -D /opt/software/openGauss/data/single_node -Z single_node -l logfile

[step 7]: start datanode
[2023-12-05 11:26:24.535][2080][][gs_ctl]: gs_ctl started,datadir is /opt/software/openGauss/data/single_node 
[2023-12-05 11:26:24.570][2080][][gs_ctl]: waiting for server to start...
.0 LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.
	
0 LOG:  [Alarm Module]Host Name: hosts-vm99 
	
0 LOG:  [Alarm Module]Host IP: hosts-vm99. Copy hostname directly in case of taking 10s to use 'gethostbyname' when /etc/hosts does not contain <HOST IP>
	
0 LOG:  [Alarm Module]Cluster Name: dbCluster 
	
0 LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57
	
0 WARNING:  failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.
0 WARNING:  failed to parse feature control file: gaussdb.version.
0 WARNING:  Failed to load the product control file, so gaussdb cannot distinguish product version.
2023-12-05 11:26:24.648 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  when starting as multi_standby mode, we couldn't support data replicaton.
gaussdb.state does not exist, and skipt setting since it is optional.2023-12-05 11:26:24.673 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.
	
2023-12-05 11:26:24.673 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host Name: hosts-vm99 
	
2023-12-05 11:26:24.673 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host IP: hosts-vm99. Copy hostname directly in case of taking 10s to use 'gethostbyname' when /etc/hosts does not contain <HOST IP>
	
2023-12-05 11:26:24.673 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Cluster Name: dbCluster 
	
2023-12-05 11:26:24.673 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57
	
2023-12-05 11:26:24.677 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  loaded library "security_plugin"
2023-12-05 11:26:24.677 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-12-05 11:26:24.677 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2023-12-05 11:26:24.682 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2023-12-05 11:26:24.682 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for backend threads is: 220 MB
2023-12-05 11:26:24.682 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for WAL buffers is: 128 MB
2023-12-05 11:26:24.682 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  Set max backend reserve memory is: 348 MB, max dynamic memory is: 8143 MB
2023-12-05 11:26:24.682 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  shared memory 3284 Mbytes, memory context 8491 Mbytes, max process memory 12288 Mbytes
2023-12-05 11:26:24.728 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [CACHE] LOG:  set data cache  size(402653184)
2023-12-05 11:26:24.763 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [SEGMENT_PAGE] LOG:  Segment-page constants: DF_MAP_SIZE: 8156, DF_MAP_BIT_CNT: 65248, DF_MAP_GROUP_EXTENTS: 4175872, IPBLOCK_SIZE: 8168, EXTENTS_PER_IPBLOCK: 1021, IPBLOCK_GROUP_SIZE: 4090, BMT_HEADER_LEVEL0_TOTAL_PAGES: 8323072, BktMapEntryNumberPerBlock: 2038, BktMapBlockNumber: 25, BktBitMaxMapCnt: 512
2023-12-05 11:26:24.785 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  gaussdb: fsync file "/opt/software/openGauss/data/single_node/gaussdb.state.temp" success
2023-12-05 11:26:24.785 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  create gaussdb state file success: db state(STARTING_STATE), server mode(Normal), connection index(1)
2023-12-05 11:26:24.808 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  max_safe_fds = 976, usable_fds = 1000, already_open = 14
2023-12-05 11:26:24.809 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  user configure file is not found, it will be created.
2023-12-05 11:26:24.813 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  the configure file /opt/software/openGauss/etc/gscgroup_opengauss.cfg doesn't exist or the size of configure file has changed. Please create it by root user!
2023-12-05 11:26:24.813 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [BACKEND] LOG:  Failed to parse cgroup config file.
2023-12-05 11:26:24.827 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2023-12-05 11:26:24.827 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2023-12-05 11:26:24.827 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2023-12-05 11:26:24.827 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.
2023-12-05 11:26:24.829 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2023-12-05 11:26:24.829 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2023-12-05 11:26:24.829 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2023-12-05 11:26:24.829 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.
2023-12-05 11:26:24.829 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2023-12-05 11:26:24.829 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2023-12-05 11:26:24.829 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2023-12-05 11:26:24.829 [unknown] [unknown] localhost 140534739304704 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.

[2023-12-05 11:26:25.576][2080][][gs_ctl]:  done
[2023-12-05 11:26:25.576][2080][][gs_ctl]: server started (/opt/software/openGauss/data/single_node)
import sql file
Would you like to create a demo database (yes/no)? yes
Load demoDB [school,finance] success.
[complete successfully]: You can start or stop the database server using:
    gs_ctl start|stop|restart -D $GAUSSHOME/data/single_node -Z single_node

-bash: ulimit: open files: cannot modify limit: Operation not permitted
[opengauss@hosts-vm99 simpleInstall]$ 

5.查看openGauss进程

[opengauss@hosts-vm99 simpleInstall]$ 
[opengauss@hosts-vm99 simpleInstall]$ ps ux | grep gaussdb
opengau+  2083  3.1  5.1 6096464 837320 ?      Ssl  11:26   0:01 /opt/software/openGauss/bin/gaussdb -D /opt/software/openGauss/data/single_node
opengau+  2206  0.0  0.0 110480   904 pts/0    S+   11:27   0:00 grep --color=auto gaussdb
[opengauss@hosts-vm99 simpleInstall]$ 
[opengauss@hosts-vm99 simpleInstall]$ 

6.查看openGauss 监听端口

[opengauss@hosts-vm99 simpleInstall]$ netstat -nlp|grep gauss
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      2083/gaussdb        
tcp        0      0 127.0.0.1:5433          0.0.0.0:*               LISTEN      2083/gaussdb        
tcp6       0      0 ::1:5432                :::*                    LISTEN      2083/gaussdb        
tcp6       0      0 ::1:5433                :::*                    LISTEN      2083/gaussdb        
unix  2      [ ACC ]     STREAM     LISTENING     9812502  2083/gaussdb         /tmp/.s.PGSQL.5432
unix  2      [ ACC ]     STREAM     LISTENING     9812503  2083/gaussdb         /tmp/.s.PGSQL.5433
[opengauss@hosts-vm99 simpleInstall]$ 

7.查看openGauss实例状态

[opengauss@hosts-vm99 simpleInstall]$ gs_ctl query -D /opt/software/openGauss/data/single_node
[2023-12-05 11:27:12.596][2216][][gs_ctl]: 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 
[opengauss@hosts-vm99 simpleInstall]$ 
[opengauss@hosts-vm99 simpleInstall]$ 

8.使用gsql命令行登录数据库

[opengauss@hosts-vm99 simpleInstall]$ gsql -d postgres -p 5432 -r
gsql ((openGauss 5.0.0 build a07d57c3) compiled at 2023-03-29 03:07:56 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

openGauss=# 
openGauss=# create user tpcc with password 'Test@1234';
CREATE ROLE
openGauss=# create database tpcc owner tpcc;
CREATE DATABASE
openGauss=# \q
[opengauss@hosts-vm99 simpleInstall]$ 

9.使用gsql命令行切换用户tpcc登录tpcc库

[opengauss@hosts-vm99 simpleInstall]$ gsql -Utpcc -d tpcc -p 5432 -r
Password for user tpcc: 
gsql ((openGauss 5.0.0 build a07d57c3) compiled at 2023-03-29 03:07:56 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

tpcc=> 
tpcc=> \dn
     List of schemas
      Name       | Owner 
-----------------+-------
 blockchain      | 
 cstore          | 
 db4ai           | 
 dbe_perf        | 
 dbe_pldebugger  | 
 dbe_pldeveloper | 
 dbe_sql_util    | 
 pkg_service     | 
 public          | 
 snapshot        | 
 sqladvisor      | 
(11 rows)

tpcc=> create schema tpcc;
CREATE SCHEMA
tpcc=> \dn
     List of schemas
      Name       | Owner 
-----------------+-------
 blockchain      | 
 cstore          | 
 db4ai           | 
 dbe_perf        | 
 dbe_pldebugger  | 
 dbe_pldeveloper | 
 dbe_sql_util    | 
 pkg_service     | 
 public          | 
 snapshot        | 
 sqladvisor      | 
 tpcc            | tpcc
(12 rows)

tpcc=> \q
[opengauss@hosts-vm99 simpleInstall]$ 
[opengauss@hosts-vm99 simpleInstall]$ 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值