安装部署

su - opengauss

cd /opengauss/soft/

tar zxvf openGauss-3.0.0-CentOS-64bit-all.tar.gz

tar jxvf openGauss-3.0.0-CentOS-64bit.tar.bz2 -C /opengauss/opengaussdb/

cd /opengauss/opengaussdb/simpleInstall

sh install.sh -w Opengauss_123


#报如下错误的话需要加一个参数:

echo "kernel.sem = 250 32000 100 999" >> /etc/sysctl.conf

sysctl -p

[opengauss@opengauss1:/opengauss/opengaussdb/simpleInstall]$sh install.sh -w Opengauss_123

[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@opengauss1:/opengauss/opengaussdb/simpleInstall]$sh install.sh -w Opengauss_123

[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 /opengauss/opengaussdb/data/single_node ... ok

creating subdirectories ... ok

selecting default max_connections ... 100

selecting default shared_buffers ... 32MB

creating configuration files ... ok

Begin init undo subsystem meta.

[INIT UNDO] Init undo subsystem meta successfully.

creating template1 database in /opengauss/opengaussdb/data/single_node/base/1 ... The core dump path is an invalid directory

2022-05-30 23:00:57.343 [unknown] [unknown] localhost 140360800500800 0[0:0#0] [BACKEND] WARNING: macAddr is 80/1446819469, sysidentifier is 5264956/3062758452, randomNum is 3473144884

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 hdfs 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 /opengauss/opengaussdb/data/single_node --single_node

or

gs_ctl start -D /opengauss/opengaussdb/data/single_node -Z single_node -l logfile

[step 7]: start datanode

[2022-05-30 23:01:18.283][2560][][gs_ctl]: gs_ctl started,datadir is /opengauss/opengaussdb/data/single_node

[2022-05-30 23:01:18.360][2560][][gs_ctl]: waiting for server to start...

.0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG: [Alarm Module]Host Name: opengauss1

..0 LOG: [Alarm Module]Host IP: 192.168.75.61

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.

The core dump path is an invalid directory

2022-05-30 23:01:20.539 [unknown] [unknown] localhost 140180292623424 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.2022-05-30 23:01:20.547 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.

2022-05-30 23:01:20.547 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Host Name: opengauss1

..2022-05-30 23:01:22.555 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Host IP: 192.168.75.61

2022-05-30 23:01:22.555 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Cluster Name: dbCluster

2022-05-30 23:01:22.556 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57

2022-05-30 23:01:22.558 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: loaded library "security_plugin"

2022-05-30 23:01:22.559 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets

2022-05-30 23:01:22.559 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets

2022-05-30 23:01:22.561 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] WARNING: No explicit IP is configured for listen_addresses GUC.

2022-05-30 23:01:22.561 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.

2022-05-30 23:01:22.561 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: reserved memory for backend threads is: 220 MB

2022-05-30 23:01:22.561 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: reserved memory for WAL buffers is: 128 MB

2022-05-30 23:01:22.561 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: Set max backend reserve memory is: 348 MB, max dynamic memory is: 11065 MB

2022-05-30 23:01:22.561 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: shared memory 362 Mbytes, memory context 11413 Mbytes, max process memory 12288 Mbytes

2022-05-30 23:01:22.592 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [CACHE] LOG: set data cache size(402653184)

2022-05-30 23:01:22.608 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [CACHE] LOG: set metadata cache size(134217728)

2022-05-30 23:01:22.643 [unknown] [unknown] localhost 140180292623424 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

2022-05-30 23:01:22.671 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: gaussdb: fsync file "/opengauss/opengaussdb/data/single_node/gaussdb.state.temp" success

2022-05-30 23:01:22.671 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: create gaussdb state file success: db state(STARTING_STATE), server mode(Normal), connection index(1)

2022-05-30 23:01:22.705 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: max_safe_fds = 976, usable_fds = 1000, already_open = 14

The core dump path is an invalid directory

2022-05-30 23:01:23.166 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: user configure file is not found, it will be created.

2022-05-30 23:01:23.242 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: the configure file /opengauss/opengaussdb/etc/gscgroup_opengauss.cfg doesn't exist or the size of configure file has changed. Please create it by root user!

2022-05-30 23:01:23.242 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [BACKEND] LOG: Failed to parse cgroup config file.

2022-05-30 23:01:23.370 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!

2022-05-30 23:01:23.370 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A

2022-05-30 23:01:23.370 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.

2022-05-30 23:01:23.370 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.

2022-05-30 23:01:23.371 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!

2022-05-30 23:01:23.371 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A

2022-05-30 23:01:23.371 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.

2022-05-30 23:01:23.371 [unknown] [unknown] localhost 140180292623424 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.

.

[2022-05-30 23:01:26.201][2560][][gs_ctl]: done

[2022-05-30 23:01:26.201][2560][][gs_ctl]: server started (/opengauss/opengaussdb/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

[opengauss@opengauss1:/opengauss/opengaussdb/simpleInstall]$

:::


#查看状态:

gs_ctl query -D /opengauss/opengaussdb/data/single_node -Z single_node

:::

openGauss单机单节点数据库安装部署_重启

#登录

gsql -d postgres -p 5432

:::

openGauss单机单节点数据库安装部署_sql_02

#通过IP地址用户密码登录

gsql -d postgres -p 5432 -h 127.0.0.1 -U opengauss

#明文密码登录

gsql -d postgres -p 5432 -h 127.0.0.1 -U opengauss -W Opengauss_123

:::

openGauss单机单节点数据库安装部署_sql_03

openGauss单机单节点数据库安装部署_sql_04

创建用户和数据库

create user pengpai with password 'pengpai_123';

CREATE DATABASE pengpaidb OWNER pengpai;

GRANT ALL PRIVILEGES ON all tables in schema public TO pengpai;

GRANT ALL PRIVILEGES ON DATABASE pengpaidb TO pengpai;

GRANT ALL PRIVILEGES TO pengpai;

:::

修改参数listen_addresses


openGauss=# show listen_addresses;

listen_addresses



localhost

(1 row)

openGauss=# alter system set listen_addresses = '0.0.0.0';

NOTICE: please restart the database for the POSTMASTER level parameter to take effect.

ALTER SYSTEM SET

openGauss=#

修改pg_hba.conf

#添加

host pengpaidb pengpai 192.168.75.0/24 sha256

#注意单节点方式安装的不支持gs_guc命令修改配置

gs_guc reload -I all -N all -h "host pengpaidb pengpai 192.168.75.0/24 sha256"

openGauss单机单节点数据库安装部署_sql_05

#修改pg_hba.conf需要reload生效如:

[opengauss@opengauss1:/opengauss/opengaussdb/data/single_node]$gs_ctl reload -D /opengauss/opengaussdb/data/single_node

[2022-05-31 11:24:21.997][10582][][gs_ctl]: gs_ctl reload ,datadir is /opengauss/opengaussdb/data/single_node

server signaled

[opengauss@opengauss1:/opengauss/opengaussdb/data/single_node]$

#上面修改的其他参数需要重启生效

重启数据库

gs_ctl restart -D $GAUSSHOME/data/single_node -Z single_node

登录验证

gsql -d pengpaidb -p 5432 -h 192.168.75.61 -U pengpai -W pengpai_123

openGauss单机单节点数据库安装部署_重启_06

:::