天天看点

openGauss单机主备数据库安装部署

安装部署

安装步骤

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 --multinode      

安装演示

[opengauss@opengauss1:/opengauss/opengaussdb/simpleInstall]$sh install.sh -w Opengauss_123 --multinode
[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
[init primary 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 text search configuration will be set to "english".

creating directory /opengauss/opengaussdb/data/master ... 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/master/base/1 ... The core dump path is an invalid directory
2022-05-31 15:58:20.400 [unknown] [unknown] localhost 139828113423424 0[0:0#0]  [BACKEND] WARNING:  macAddr is 80/1446819469, sysidentifier is 5264956/3062714982, randomNum is 3425260134
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/master --single_node
or
    gs_ctl start -D /opengauss/opengaussdb/data/master -Z single_node -l logfile

[init slave 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 text search configuration will be set to "english".

creating directory /opengauss/opengaussdb/data/slave ... 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/slave/base/1 ... The core dump path is an invalid directory
2022-05-31 15:58:45.306 [unknown] [unknown] localhost 139822218837056 0[0:0#0]  [BACKEND] WARNING:  macAddr is 80/1446819469, sysidentifier is 5264956/3062698477, randomNum is 1619857901
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/slave --single_node
or
    gs_ctl start -D /opengauss/opengaussdb/data/slave -Z single_node -l logfile

[config datanode.]
remote_read_mode = non_authentication
host    all             all             192.168.75.61/32            trust
[start primary datanode.]
[2022-05-31 15:59:03.476][2509][][gs_ctl]: gs_ctl started,datadir is /opengauss/opengaussdb/data/master 
[2022-05-31 15:59:03.563][2509][][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-31 15:59:03.846 [unknown] [unknown] localhost 139955554487360 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-31 15:59:03.891 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.

2022-05-31 15:59:03.891 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host Name: opengauss1 

2022-05-31 15:59:03.916 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host IP: 192.168.75.61 

2022-05-31 15:59:03.916 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Cluster Name: dbCluster 

2022-05-31 15:59:03.916 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57

2022-05-31 15:59:03.919 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  loaded library "security_plugin"
2022-05-31 15:59:03.920 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2022-05-31 15:59:03.922 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2022-05-31 15:59:03.922 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for backend threads is: 220 MB
2022-05-31 15:59:03.922 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for WAL buffers is: 128 MB
2022-05-31 15:59:03.922 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  Set max backend reserve memory is: 348 MB, max dynamic memory is: 11065 MB
2022-05-31 15:59:03.922 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  shared memory 362 Mbytes, memory context 11413 Mbytes, max process memory 12288 Mbytes
2022-05-31 15:59:03.949 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [CACHE] LOG:  set data cache  size(402653184)
2022-05-31 15:59:03.966 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [CACHE] LOG:  set metadata cache  size(134217728)
2022-05-31 15:59:04.004 [unknown] [unknown] localhost 139955554487360 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-31 15:59:04.036 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  gaussdb: fsync file "/opengauss/opengaussdb/data/master/gaussdb.state.temp" success
2022-05-31 15:59:04.037 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  create gaussdb state file success: db state(STARTING_STATE), server mode(Primary), connection index(1)
2022-05-31 15:59:04.063 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  max_safe_fds = 974, usable_fds = 1000, already_open = 16
The core dump path is an invalid directory
2022-05-31 15:59:04.065 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  user configure file is not found, it will be created.
2022-05-31 15:59:04.074 [unknown] [unknown] localhost 139955554487360 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-31 15:59:04.074 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [BACKEND] LOG:  Failed to parse cgroup config file.
2022-05-31 15:59:04.169 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2022-05-31 15:59:04.169 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2022-05-31 15:59:04.169 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2022-05-31 15:59:04.169 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.
2022-05-31 15:59:04.186 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2022-05-31 15:59:04.186 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2022-05-31 15:59:04.186 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2022-05-31 15:59:04.186 [unknown] [unknown] localhost 139955554487360 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.
.
[2022-05-31 15:59:08.227][2509][][gs_ctl]:  done
[2022-05-31 15:59:08.227][2509][][gs_ctl]: server started (/opengauss/opengaussdb/data/master)
[build and start slave datanode.]
[2022-05-31 15:59:08.271][2585][][gs_ctl]: gs_ctl full build ,datadir is /opengauss/opengaussdb/data/slave
[2022-05-31 15:59:08.272][2585][][gs_ctl]: stop failed, killing gaussdb by force ...
[2022-05-31 15:59:08.272][2585][][gs_ctl]: command [ps c -eo pid,euid,cmd | grep gaussdb | grep -v grep | awk '{if($2 == curuid && $1!="-n") print "/proc/"$1"/cwd"}' curuid=`id -u`| xargs ls -l | awk '{if ($NF=="/opengauss/opengaussdb/data/slave")  print $(NF-2)}' | awk -F/ '{print $3 }' | xargs kill -9 >/dev/null 2>&1 ] path: [/opengauss/opengaussdb/data/slave] 
[2022-05-31 15:59:08.356][2585][][gs_ctl]: server stopped
[2022-05-31 15:59:08.356][2585][][gs_ctl]: current workdir is (/opengauss/opengaussdb/simpleInstall).
[2022-05-31 15:59:08.357][2585][][gs_ctl]: fopen build pid file "/opengauss/opengaussdb/data/slave/gs_build.pid" success
[2022-05-31 15:59:08.357][2585][][gs_ctl]: fprintf build pid file "/opengauss/opengaussdb/data/slave/gs_build.pid" success
[2022-05-31 15:59:08.357][2585][][gs_ctl]: fsync build pid file "/opengauss/opengaussdb/data/slave/gs_build.pid" success
[2022-05-31 15:59:08.357][2585][][gs_ctl]: set gaussdb state file when full build build:db state(BUILDING_STATE), server mode(STANDBY_MODE), build mode(FULL_BUILD).
[2022-05-31 15:59:08.431][2585][datanode2][gs_ctl]: build try host(192.168.75.61) port(5433) success
[2022-05-31 15:59:08.431][2585][datanode2][gs_ctl]: connect to server success, build started.
[2022-05-31 15:59:08.432][2585][datanode2][gs_ctl]: create build tag file success
[2022-05-31 15:59:08.474][2585][datanode2][gs_ctl]: clear old target dir success
[2022-05-31 15:59:08.474][2585][datanode2][gs_ctl]: create build tag file again success
[2022-05-31 15:59:08.474][2585][datanode2][gs_ctl]: get system identifier success
[2022-05-31 15:59:08.475][2585][datanode2][gs_ctl]: receiving and unpacking files...
[2022-05-31 15:59:08.475][2585][datanode2][gs_ctl]: create backup label success
INFO:  The starting position of the xlog copy of the full build is: 0/23DE0F0. The slot minimum LSN is: 0/0.
[2022-05-31 15:59:08.579][2585][datanode2][gs_ctl]: xlog start point: 0/23DE0F0
[2022-05-31 15:59:08.579][2585][datanode2][gs_ctl]: begin build tablespace list
[2022-05-31 15:59:08.579][2585][datanode2][gs_ctl]: finish build tablespace list
[2022-05-31 15:59:08.579][2585][datanode2][gs_ctl]: begin get xlog by xlogstream
[2022-05-31 15:59:08.579][2585][datanode2][gs_ctl]: starting background WAL receiver
[2022-05-31 15:59:08.579][2585][datanode2][gs_ctl]: starting walreceiver
[2022-05-31 15:59:08.579][2585][datanode2][gs_ctl]: begin receive tar files
[2022-05-31 15:59:08.579][2585][datanode2][gs_ctl]: receiving and unpacking files...
[2022-05-31 15:59:08.599][2585][datanode2][gs_ctl]: build try host(192.168.75.61) port(5433) success
[2022-05-31 15:59:08.600][2585][datanode2][gs_ctl]: check identify system success
[2022-05-31 15:59:08.602][2585][datanode2][gs_ctl]: send START_REPLICATION 0/2000000 success
[2022-05-31 15:59:14.827][2585][datanode2][gs_ctl]: finish receive tar files
[2022-05-31 15:59:14.827][2585][datanode2][gs_ctl]: xlog end point: 0/3000058
[2022-05-31 15:59:14.827][2585][datanode2][gs_ctl]: fetching MOT checkpoint
gs_ctl: no mot checkpoint exists
[2022-05-31 15:59:14.828][2585][datanode2][gs_ctl]: waiting for background process to finish streaming...
[2022-05-31 15:59:20.684][2585][datanode2][gs_ctl]: starting fsync all files come from source.
[2022-05-31 15:59:21.216][2585][datanode2][gs_ctl]: finish fsync all files.
[2022-05-31 15:59:21.217][2585][datanode2][gs_ctl]: build dummy dw file success
[2022-05-31 15:59:21.217][2585][datanode2][gs_ctl]: rename build status file success
[2022-05-31 15:59:21.220][2585][datanode2][gs_ctl]: full build build completed(/opengauss/opengaussdb/data/slave).
[2022-05-31 15:59:21.332][2585][datanode2][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-31 15:59:21.623 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  when starting as multi_standby mode, we couldn't support data replicaton.
2022-05-31 15:59:21.629 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.

2022-05-31 15:59:21.629 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host Name: opengauss1 

2022-05-31 15:59:21.646 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host IP: 192.168.75.61 

2022-05-31 15:59:21.646 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Cluster Name: dbCluster 

2022-05-31 15:59:21.646 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57

2022-05-31 15:59:21.649 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  loaded library "security_plugin"
2022-05-31 15:59:21.650 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2022-05-31 15:59:21.651 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2022-05-31 15:59:21.651 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for backend threads is: 220 MB
2022-05-31 15:59:21.651 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for WAL buffers is: 128 MB
2022-05-31 15:59:21.651 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  Set max backend reserve memory is: 348 MB, max dynamic memory is: 11065 MB
2022-05-31 15:59:21.651 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  shared memory 362 Mbytes, memory context 11413 Mbytes, max process memory 12288 Mbytes
2022-05-31 15:59:21.774 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [CACHE] LOG:  set data cache  size(402653184)
2022-05-31 15:59:22.014 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [CACHE] LOG:  set metadata cache  size(134217728)
2022-05-31 15:59:22.372 [unknown] [unknown] localhost 140440267811904 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-31 15:59:23.692 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  gaussdb: fsync file "/opengauss/opengaussdb/data/slave/gaussdb.state.temp" success
2022-05-31 15:59:23.692 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  create gaussdb state file success: db state(STARTING_STATE), server mode(Standby), connection index(1)
2022-05-31 15:59:23.717 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  max_safe_fds = 972, usable_fds = 1000, already_open = 18
The core dump path is an invalid directory
2022-05-31 15:59:23.769 [unknown] [unknown] localhost 140440267811904 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-31 15:59:23.769 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [BACKEND] LOG:  Failed to parse cgroup config file.
2022-05-31 15:59:24.983 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2022-05-31 15:59:24.983 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2022-05-31 15:59:24.983 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2022-05-31 15:59:24.983 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.
2022-05-31 15:59:25.004 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2022-05-31 15:59:25.004 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2022-05-31 15:59:25.004 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2022-05-31 15:59:25.004 [unknown] [unknown] localhost 140440267811904 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.
...
[2022-05-31 15:59:33.026][2585][datanode2][gs_ctl]:  done
[2022-05-31 15:59:33.026][2585][datanode2][gs_ctl]: server started (/opengauss/opengaussdb/data/slave)
[2022-05-31 15:59:33.027][2585][datanode2][gs_ctl]: fopen build pid file "/opengauss/opengaussdb/data/slave/gs_build.pid" success
[2022-05-31 15:59:33.027][2585][datanode2][gs_ctl]: fprintf build pid file "/opengauss/opengaussdb/data/slave/gs_build.pid" success
[2022-05-31 15:59:33.042][2585][datanode2][gs_ctl]: fsync build pid file "/opengauss/opengaussdb/data/slave/gs_build.pid" success
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:
    primary: gs_ctl start|stop|restart -D $GAUSSHOME/data/master -M primary
    standby: gs_ctl start|stop|restart -D $GAUSSHOME/data/slave -M standby      

查看状态

gs_ctl query -D $GAUSSHOME/data/master -M primary
gs_ctl query -D $GAUSSHOME/data/master -M standby

[opengauss@opengauss1:/home/opengauss]$gs_ctl query -D $GAUSSHOME/data/master -M primary
[2022-05-31 16:17:41.185][4232][][gs_ctl]: gs_ctl query ,datadir is /opengauss/opengaussdb/data/master 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
        sender_pid                     : 2655
        local_role                     : Primary
        peer_role                      : Standby
        peer_state                     : Normal
        state                          : Streaming
        sender_sent_location           : 0/403BCE8
        sender_write_location          : 0/403BCE8
        sender_flush_location          : 0/403BCE8
        sender_replay_location         : 0/403BCE8
        receiver_received_location     : 0/403BCE8
        receiver_write_location        : 0/403BCE8
        receiver_flush_location        : 0/403BCE8
        receiver_replay_location       : 0/403BCE8
        sync_percent                   : 100%
        sync_state                     : Sync
        sync_priority                  : 1
        sync_most_available            : Off
        channel                        : 192.168.75.61:5433-->192.168.75.61:31538

 Receiver info:      
No information 
[opengauss@opengauss1:/home/opengauss]$gs_ctl query -D $GAUSSHOME/data/slave -M standby
[2022-05-31 16:18:12.652][4249][][gs_ctl]: gs_ctl query ,datadir is /opengauss/opengaussdb/data/slave 
 HA state:           
        local_role                     : Standby
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
        receiver_pid                   : 2654
        local_role                     : Standby
        peer_role                      : Primary
        peer_state                     : Normal
        state                          : Normal
        sender_sent_location           : 0/403BE08
        sender_write_location          : 0/403BE08
        sender_flush_location          : 0/403BE08
        sender_replay_location         : 0/403BE08
        receiver_received_location     : 0/403BE08
        receiver_write_location        : 0/403BE08
        receiver_flush_location        : 0/403BE08
        receiver_replay_location       : 0/403BE08
        sync_percent                   : 100%
        channel                        : 192.168.75.61:31538<--192.168.75.61:5433

[opengauss@opengauss1:/home/opengauss]$      

服务启停

primary: gs_ctl start|stop|restart -D $GAUSSHOME/data/master -M primary
standby: gs_ctl start|stop|restart -D $GAUSSHOME/data/slave -M standby      

登录验证

[opengauss@opengauss1:/home/opengauss]$gsql -d postgres -p 5432
gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

openGauss=# \l
                                   List of databases
   Name    |   Owner   | Encoding |   Collate   |    Ctype    |    Access privileges    
-----------+-----------+----------+-------------+-------------+-------------------------
 finance   | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 school    | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/opengauss           +
           |           |          |             |             | opengauss=CTc/opengauss
 template1 | opengauss | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/opengauss           +
           |           |          |             |             | opengauss=CTc/opengauss
(5 rows)

openGauss=#      

gsql登录时加上 -r ,可以支持命令上翻下翻以及回退不用按着ctrl

[opengauss@opengauss1:/home/opengauss]$gsql -d postgres -p 5432 -r
gsql ((openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

openGauss=# \c school;
Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "school" as user "opengauss".
school=# select * from class;
 cla_id |  cla_name  | cla_teacher 
--------+------------+-------------
      1 | 计算机     |           1
      2 | 自动化     |           3
      3 | 飞行器设计 |           5
      4 | 大学物理   |           7
      5 | 高等数学   |           9
      6 | 大学化学   |          12
      7 | 表演       |          14
      8 | 服装设计   |          16
      9 | 工业设计   |          18
     10 | 金融学     |          21
     11 | 医学       |          23
     12 | 土木工程   |          25
     13 | 机械       |          27
     14 | 建筑学     |          29
     15 | 经济学     |          32
     16 | 财务管理   |          34
     17 | 人力资源   |          36
     18 | 力学       |          38
     19 | 人工智能   |          41
     20 | 会计       |          45
(20 rows)

school=#