openGauss學(xué)習(xí)筆記-04 openGauss極簡版單機(jī)主備安裝部署4.1 獲取安裝包4.1.1 下載對應(yīng)平臺的安裝包4.1.2 解壓安裝包4.1.3 查看目錄結(jié)構(gòu)4.2 準(zhǔn)備軟硬件安裝環(huán)境4.2.1 硬件環(huán)境要求4.2.2 軟件環(huán)境要求4.2.3 軟件依賴要求4.3 單機(jī)主備安裝部署4.3.1 安裝前準(zhǔn)備4.3.2 單機(jī)主備安裝4.3.3 安裝后檢查4.3.4 服務(wù)啟停
openGauss學(xué)習(xí)筆記-04 openGauss極簡版單機(jī)主備安裝部署
4.1 獲取安裝包
4.1.1 下載對應(yīng)平臺的安裝包
從openGauss開源社區(qū)下載對應(yīng)平臺的安裝包
- 登錄openGauss開源社區(qū),選擇對應(yīng)平臺的最新安裝包下載。對于個人開發(fā)者或非企業(yè)級環(huán)境,下載極簡安裝包(不安裝OM等組件)即可。
[圖片上傳失敗...(image-db56a2-1688867859629)]
- 單擊“立即下載”。
[圖片上傳失敗...(image-dd8b03-1688867859629)]
4.1.2 解壓安裝包
解壓安裝包,檢查安裝目錄及文件是否齊全。在安裝包所在目錄執(zhí)行以下命令:
[root@localhost ~]# cd /opt
[root@localhost opt]# mkdir openGauss
[root@localhost opt]# ls
openGauss openGauss-3.1.1-openEuler-64bit.tar.bz2 patch_workspace
[root@localhost opt]# tar -jxf openGauss-3.1.1-openEuler-64bit.tar.bz2 -C openGauss/
4.1.3 查看目錄結(jié)構(gòu)
執(zhí)行tree命令,顯示類似如下信息:
[root@localhost opt]# tree -d openGauss
openGauss
├── bin
├── etc
│ └── kerberos
├── include
│ └── postgresql
│ └── server
│ ├── access
│ │ ├── obs
│ │ ├── parallel_recovery
│ │ └── ustore
│ │ └── undo
│ ├── alarm
│ ├── bulkload
│ ├── catalog
│ ├── cjson
│ ├── client_logic
│ ├── cm
│ ├── commands
│ ├── communication
│ ├── datatype
│ ├── db4ai
│ ├── executor
│ │ └── exec
│ ├── fmgr
│ ├── foreign
│ ├── gssignal
│ ├── gstrace
│ ├── gtm
│ ├── hotpatch
│ ├── instruments
│ ├── knl
│ │ └── knl_guc
│ ├── lib
│ ├── libcomm
│ ├── libpq
│ ├── mb
│ ├── nodes
│ ├── optimizer
│ ├── parser
│ ├── pgxc
│ ├── port
│ ├── portability
│ ├── postmaster
│ ├── replication
│ ├── rewrite
│ ├── ssl
│ ├── storage
│ │ ├── buf
│ │ ├── cstore
│ │ ├── item
│ │ ├── lock
│ │ ├── mot
│ │ └── smgr
│ ├── streaming
│ ├── tcop
│ ├── tde_key_management
│ ├── threadpool
│ ├── utils
│ ├── vecexecutor
│ └── workload
├── jre
│ ├── bin
│ └── lib
│ ├── amd64
│ │ ├── jli
│ │ └── server
│ ├── cmm
│ ├── ext
│ ├── images
│ │ └── cursors
│ ├── jfr
│ ├── management
│ └── security
│ └── policy
│ ├── limited
│ └── unlimited
├── lib
│ ├── krb5
│ │ └── plugins
│ │ └── kdb
│ ├── libsimsearch
│ └── postgresql
│ ├── java
│ ├── pg_plugin
│ ├── pgxs
│ │ ├── config
│ │ └── src
│ │ └── makefiles
│ └── proc_srclib
├── share
│ ├── llvmir
│ ├── postgresql
│ │ ├── db4ai
│ │ │ └── snapshots
│ │ ├── extension
│ │ ├── timezone
│ │ │ ├── Africa
│ │ │ ├── America
│ │ │ │ ├── Argentina
│ │ │ │ ├── Indiana
│ │ │ │ ├── Kentucky
│ │ │ │ └── North_Dakota
│ │ │ ├── Antarctica
│ │ │ ├── Arctic
│ │ │ ├── Asia
│ │ │ ├── Atlantic
│ │ │ ├── Australia
│ │ │ ├── Brazil
│ │ │ ├── Canada
│ │ │ ├── Chile
│ │ │ ├── Etc
│ │ │ ├── Europe
│ │ │ ├── Indian
│ │ │ ├── Mexico
│ │ │ ├── Mideast
│ │ │ ├── Pacific
│ │ │ └── US
│ │ ├── timezonesets
│ │ ├── tmp
│ │ └── tsearch_data
│ └── sslcert
│ ├── gsql
│ └── om
└── simpleInstall
124 directories
[root@localhost opt]#
4.2 準(zhǔn)備軟硬件安裝環(huán)境
本節(jié)描述安裝前需要進(jìn)行的環(huán)境準(zhǔn)備。建議部署openGauss的各服務(wù)器具有等價的軟硬件配置。
4.2.1 硬件環(huán)境要求
下面列出了openGauss服務(wù)器應(yīng)具備的最低硬件要求。在實(shí)際產(chǎn)品中,硬件配置的規(guī)劃需考慮數(shù)據(jù)規(guī)模及所期望的數(shù)據(jù)庫響應(yīng)速度。請根據(jù)實(shí)際情況進(jìn)行規(guī)劃。
- 內(nèi)存
功能調(diào)試建議32GB以上。性能測試和商業(yè)部署時,單實(shí)例部署建議128GB以上。復(fù)雜的查詢對內(nèi)存的需求量比較高,在高并發(fā)場景下,可能出現(xiàn)內(nèi)存不足。此時建議使用大內(nèi)存的機(jī)器,或使用負(fù)載管理限制系統(tǒng)的并發(fā)。
- CPU
功能調(diào)試最小1×8 核 2.0GHz。性能測試和商業(yè)部署時,建議1×16核 2.0GHz。CPU超線程和非超線程兩種模式都支持。說明:個人開發(fā)者最低配置2核4G, 推薦配置4核8G。目前,openGauss僅支持ARM服務(wù)器和基于X86_64通用PC服務(wù)器的CPU。
- 硬盤
用于安裝openGauss的硬盤需最少滿足如下要求:至少1GB用于安裝openGauss的應(yīng)用程序。每個主機(jī)需大約300MB用于元數(shù)據(jù)存儲。預(yù)留70%以上的磁盤剩余空間用于數(shù)據(jù)存儲。建議系統(tǒng)盤配置為Raid1,數(shù)據(jù)盤配置為Raid5,且規(guī)劃4組Raid5數(shù)據(jù)盤用于安裝openGauss。有關(guān)Raid的配置方法在本節(jié)中不做介紹。請參考硬件廠家的手冊或互聯(lián)網(wǎng)上的方法進(jìn)行配置,其中Disk Cache Policy一項需要設(shè)置為Disabled,否則機(jī)器異常掉電后有數(shù)據(jù)丟失的風(fēng)險。openGauss支持使用SSD盤作為數(shù)據(jù)庫的主存儲設(shè)備,支持SAS接口和NVME協(xié)議的SSD盤,以RAID的方式部署使用。
- 網(wǎng)絡(luò)要求
300兆以上以太網(wǎng)。建議網(wǎng)卡設(shè)置為雙網(wǎng)卡冗余bond。有關(guān)網(wǎng)卡冗余bond的配置方法在本節(jié)中不做介紹。請參考硬件廠商的手冊或互聯(lián)網(wǎng)上的方法進(jìn)行配置。
4.2.2 軟件環(huán)境要求
- Linux操作系統(tǒng)
- ARM:
openEuler 20.3LTS(推薦采用此操作系統(tǒng))
麒麟V10 Asianux 7.5
- X86:
openEuler 20.3LTS
CentOS 7.6
Asianux 7.6
說明:當(dāng)前安裝包只能在英文操作系統(tǒng)上安裝使用。
-
Linux文件系統(tǒng)
剩余inode個數(shù) > 15億(推薦)
工具
bzip2
4.2.3 軟件依賴要求
openGauss的軟件依賴要求如表1 軟件依賴要求所示。
建議使用上述操作系統(tǒng)安裝光盤或者源中,下列依賴軟件的默認(rèn)安裝包,若不存在下列軟件,可參看軟件對應(yīng)的建議版本。
表 1 軟件依賴要求
| 所需軟件 | 建議版本 |
|---|---|
| libaio-devel | 建議版本:0.3.109-13 |
| flex | 要求版本:2.5.31 以上 |
| bison | 建議版本:2.7-4 |
| ncurses-devel | 建議版本:5.9-13.20130511 |
| glibc-devel | 建議版本:2.17-111 |
| patch | 建議版本:2.7.1-10 |
| redhat-lsb-core | 建議版本:4.1 |
| readline-devel | 建議版本:7.0-13 |
| libnsl(openEuler+x86環(huán)境中) | 建議版本 :2.28-36 |
安裝軟件依賴包;
[root@localhost ~]# yum install -y libaio-devel \
> flex \
> bison \
> ncurses-devel \
> glibc-devel \
> patch \
> redhat-lsb-core \
> readline-devel \
> libnsl
Last metadata expiration check: 0:10:26 ago on 2023年03月17日 星期五 22時02分48秒.
Package flex-2.6.4-3.oe2203.x86_64 is already installed.
Package bison-3.8.2-1.oe2203.x86_64 is already installed.
Package glibc-devel-2.34-70.oe2203.x86_64 is already installed.
Package patch-2.7.6-12.oe2203.x86_64 is already installed.
No match for argument: redhat-lsb-core
Error: Unable to find a match: redhat-lsb-core
[root@localhost ~]#
可以看到,系統(tǒng)提示沒有找到匹配的redhat-lsb-core包。
經(jīng)過在openEuler官方鏡像倉庫查看得知,openEuler不存在這個包,不影響后續(xù)安裝數(shù)據(jù)庫。
4.3 單機(jī)主備安裝部署
4.3.1 安裝前準(zhǔn)備
- 關(guān)閉防火墻并取消開機(jī)自啟動
[圖片上傳失敗...(image-4c68d7-1688867859628)]
說明: 測試環(huán)境下通常會關(guān)閉防火墻以避免部分網(wǎng)絡(luò)因素影響,視實(shí)際需求做配置。
- 停止防火墻
在root權(quán)限下停止防火墻
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]#
- 關(guān)閉防火墻自啟動
在root權(quán)限下關(guān)閉防火墻自啟動
[root@localhost ~]# systemctl disable firewalld
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
[root@localhost ~]#
[圖片上傳失敗...(image-1a6229-1688867859628)]
說明: 執(zhí)行disable命令關(guān)閉防火墻的同時,也取消了開機(jī)自啟動。
- 修改SELINUX為disabled
- 永久關(guān)閉
在root權(quán)限下修改配置文件。
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
[root@localhost ~]#
[root@localhost ~]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost ~]#
[圖片上傳失敗...(image-98a9a4-1688867859628)]
說明:
重啟后生效。
- 臨時關(guān)閉
[root@localhost ~]# setenforce 0
setenforce: SELinux is permissive
[root@localhost ~]#
[圖片上傳失敗...(image-333ff5-1688867859628)]
說明:
即時生效,但重啟后會自動開啟。
- 設(shè)置主機(jī)名及主機(jī)名解析
[root@localhost ~]# hostnamectl set-hostname superman-21
[root@localhost ~]# echo "192.168.1.21 superman-21" >>/etc/hosts
- 創(chuàng)建用戶組dbgroup
[root@localhost ~]# groupadd dbgroup
- 創(chuàng)建omm用戶
創(chuàng)建用戶組dbgroup下的普通用戶omm,并設(shè)置普通用戶omm的密碼,密碼建議設(shè)置為Omm@123。
[root@localhost ~]# useradd -g dbgroup omm
[root@localhost ~]#
[root@localhost ~]# passwd omm
更改用戶 omm 的密碼 。
新的密碼:
無效的密碼: 密碼少于 8 個字符
重新輸入新的密碼:
抱歉,密碼不匹配。
passwd: 鑒定令牌操作錯誤
[root@localhost ~]#
[root@localhost ~]# passwd omm
更改用戶 omm 的密碼 。
新的密碼:
無效的密碼: 密碼少于 8 個字符
重新輸入新的密碼:
passwd:所有的身份驗(yàn)證令牌已經(jīng)成功更新。
[root@localhost ~]#
- 設(shè)置安裝文件屬主屬組
[root@localhost ~]# chown -R omm:dbgroup /opt/openGauss
[root@localhost ~]#
- 配置文件系統(tǒng)描述符
[root@localhost ~]# echo "* soft nofile 1000000" >>/etc/security/limits.conf
[root@localhost ~]# echo "* hard nofile 1000000" >>/etc/security/limits.conf
- 重啟主機(jī)
[root@superman-21 opt]# reboot
4.3.2 單機(jī)主備安裝
- 切換到omm用戶
[root@superman-21 ~]# su - omm
Welcome to 5.10.0-60.18.0.50.oe2203.x86_64
System information as of time: 2023年 03月 20日 星期一 19:41:28 CST
System load: 0.00
Processes: 152
Memory used: 7.1%
Swap used: 0%
Usage On: 8%
IP address: 192.168.1.21
IP address: 192.168.122.1
Users online: 1
To run a command as administrator(user "root"),use "sudo <command>".
[omm@superman-21 ~]$
- 切換進(jìn)入解壓目錄
進(jìn)入解壓后目錄下的simpleInstall
[omm@superman-21 ~]$ cd /opt/openGauss/simpleInstall
[omm@superman-21 simpleInstall]$
- 執(zhí)行install.sh腳本安裝openGauss。
[omm@superman-21 simpleInstall]$ sh install.sh -w Gs.initdb --multinode
[step 1]: check parameter
[step 2]: check install env and os setting
[step 3]: change_gausshome_owner
[step 4]: set environment variables
[init primary datanode.]
The files belonging to this database system will be owned by user "omm".
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 /opt/openGauss/data/master ... 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/openGauss/data/master/base/1 ... The core dump path is an invalid directory
2023-03-20 19:42:24.788 [unknown] [unknown] localhost 140601465792064 0[0:0#0] [BACKEND] WARNING: macAddr is 12/690964518, sysidentifier is 796975/1210464935, randomNum is 1248082599
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/openGauss/data/master --single_node
or
gs_ctl start -D /opt/openGauss/data/master -Z single_node -l logfile
[init slave datanode.]
The files belonging to this database system will be owned by user "omm".
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 /opt/openGauss/data/slave ... 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/openGauss/data/slave/base/1 ... The core dump path is an invalid directory
2023-03-20 19:42:37.247 [unknown] [unknown] localhost 139910719841856 0[0:0#0] [BACKEND] WARNING: macAddr is 12/690964518, sysidentifier is 796975/1210488065, randomNum is 2473628929
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/openGauss/data/slave --single_node
or
gs_ctl start -D /opt/openGauss/data/slave -Z single_node -l logfile
[config datanode.]
remote_read_mode = non_authentication
host all all 192.168.1.21/32 trust
[start primary datanode.]
[2023-03-20 19:42:51.009][2280][][gs_ctl]: gs_ctl started,datadir is /opt/openGauss/data/master
[2023-03-20 19:42:51.033][2280][][gs_ctl]: waiting for server to start...
.0 LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.
0 LOG: [Alarm Module]Host Name: superman-21
0 LOG: [Alarm Module]Host IP: superman-21\. 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.
The core dump path is an invalid directory
2023-03-20 19:42:51.088 [unknown] [unknown] localhost 140032436119104 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-03-20 19:42:51.109 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.
2023-03-20 19:42:51.109 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Host Name: superman-21
2023-03-20 19:42:51.109 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Host IP: superman-21\. Copy hostname directly in case of taking 10s to use 'gethostbyname' when /etc/hosts does not contain <HOST IP>
2023-03-20 19:42:51.109 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Cluster Name: dbCluster
2023-03-20 19:42:51.109 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57
2023-03-20 19:42:51.115 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: loaded library "security_plugin"
2023-03-20 19:42:51.119 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
2023-03-20 19:42:51.119 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2023-03-20 19:42:51.119 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: reserved memory for backend threads is: 220 MB
2023-03-20 19:42:51.120 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: reserved memory for WAL buffers is: 128 MB
2023-03-20 19:42:51.120 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: Set max backend reserve memory is: 348 MB, max dynamic memory is: 8142 MB
2023-03-20 19:42:51.120 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: shared memory 3285 Mbytes, memory context 8490 Mbytes, max process memory 12288 Mbytes
2023-03-20 19:42:51.183 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [CACHE] LOG: set data cache size(402653184)
2023-03-20 19:42:51.237 [unknown] [unknown] localhost 140032436119104 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-03-20 19:42:51.259 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: gaussdb: fsync file "/opt/openGauss/data/master/gaussdb.state.temp" success
2023-03-20 19:42:51.259 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: create gaussdb state file success: db state(STARTING_STATE), server mode(Primary), connection index(1)
2023-03-20 19:42:51.284 [unknown] [unknown] localhost 140032436119104 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
2023-03-20 19:42:51.286 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: user configure file is not found, it will be created.
2023-03-20 19:42:51.296 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: the configure file /opt/openGauss/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. Please create it by root user!
2023-03-20 19:42:51.296 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [BACKEND] LOG: Failed to parse cgroup config file.
2023-03-20 19:42:51.321 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!
2023-03-20 19:42:51.321 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A
2023-03-20 19:42:51.321 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.
2023-03-20 19:42:51.321 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.
2023-03-20 19:42:51.323 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!
2023-03-20 19:42:51.323 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A
2023-03-20 19:42:51.323 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.
2023-03-20 19:42:51.323 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.
2023-03-20 19:42:51.324 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!
2023-03-20 19:42:51.324 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A
2023-03-20 19:42:51.324 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.
2023-03-20 19:42:51.324 [unknown] [unknown] localhost 140032436119104 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.
[2023-03-20 19:42:52.095][2280][][gs_ctl]: done
[2023-03-20 19:42:52.095][2280][][gs_ctl]: server started (/opt/openGauss/data/master)
[build and start slave datanode.]
[2023-03-20 19:42:52.105][2351][][gs_ctl]: gs_ctl full build ,datadir is /opt/openGauss/data/slave
[2023-03-20 19:42:52.105][2351][][gs_ctl]: fopen build pid file "/opt/openGauss/data/slave/gs_build.pid" success
[2023-03-20 19:42:52.105][2351][][gs_ctl]: fprintf build pid file "/opt/openGauss/data/slave/gs_build.pid" success
[2023-03-20 19:42:52.106][2351][][gs_ctl]: fsync build pid file "/opt/openGauss/data/slave/gs_build.pid" success
[2023-03-20 19:42:52.106][2351][][gs_ctl]: stop failed, killing gaussdb by force ...
[2023-03-20 19:42:52.106][2351][][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=="/opt/openGauss/data/slave") print $(NF-2)}' | awk -F/ '{print $3 }' | xargs kill -9 >/dev/null 2>&1 ] path: [/opt/openGauss/data/slave]
[2023-03-20 19:42:52.174][2351][][gs_ctl]: server stopped
[2023-03-20 19:42:52.174][2351][][gs_ctl]: current workdir is (/opt/openGauss/simpleInstall).
[2023-03-20 19:42:52.175][2351][][gs_ctl]: set gaussdb state file when full build build:db state(BUILDING_STATE), server mode(STANDBY_MODE), build mode(FULL_BUILD).
[2023-03-20 19:42:52.176][2351][datanode2][gs_ctl]: Get repl_auth_mode is and repl_uuid is
[2023-03-20 19:42:52.181][2351][datanode2][gs_ctl]: build try host(192.168.1.21) port(5433) success
[2023-03-20 19:42:52.181][2351][datanode2][gs_ctl]: connected to server success, build started.
[2023-03-20 19:42:52.216][2351][datanode2][gs_ctl]: clear old target dir success
[2023-03-20 19:42:52.216][2351][datanode2][gs_ctl]: create build tag file success
[2023-03-20 19:42:52.216][2351][datanode2][gs_ctl]: create build tag file again success
[2023-03-20 19:42:52.217][2351][datanode2][gs_ctl]: get system identifier success
[2023-03-20 19:42:52.217][2351][datanode2][gs_ctl]: receiving and unpacking files...
[2023-03-20 19:42:52.217][2351][datanode2][gs_ctl]: create backup label success
INFO: The starting position of the xlog copy of the full build is: 0/2382388\. The slot minimum LSN is: 0/0\. The disaster slot minimum LSN is: 0/0\. The logical slot minimum LSN is: 0/0.
[2023-03-20 19:42:52.341][2351][datanode2][gs_ctl]: xlog start point: 0/2382388
[2023-03-20 19:42:52.341][2351][datanode2][gs_ctl]: begin build tablespace list
[2023-03-20 19:42:52.341][2351][datanode2][gs_ctl]: finish build tablespace list
[2023-03-20 19:42:52.341][2351][datanode2][gs_ctl]: begin get xlog by xlogstream
[2023-03-20 19:42:52.341][2351][datanode2][gs_ctl]: starting background WAL receiver
[2023-03-20 19:42:52.341][2351][datanode2][gs_ctl]: starting walreceiver
[2023-03-20 19:42:52.342][2351][datanode2][gs_ctl]: begin receive tar files
[2023-03-20 19:42:52.343][2351][datanode2][gs_ctl]: receiving and unpacking files...
[2023-03-20 19:42:52.399][2351][datanode2][gs_ctl]: build try host(192.168.1.21) port(5433) success
[2023-03-20 19:42:52.399][2351][datanode2][gs_ctl]: check identify system success
[2023-03-20 19:42:52.410][2351][datanode2][gs_ctl]: send START_REPLICATION 0/2000000 success
[2023-03-20 19:42:53.481][2351][datanode2][gs_ctl]: finish receive tar files
[2023-03-20 19:42:53.481][2351][datanode2][gs_ctl]: xlog end point: 0/3000058
[2023-03-20 19:42:53.481][2351][datanode2][gs_ctl]: fetching MOT checkpoint
gs_ctl: no mot checkpoint exists
[2023-03-20 19:42:53.481][2351][datanode2][gs_ctl]: waiting for background process to finish streaming...
[2023-03-20 19:42:57.693][2351][datanode2][gs_ctl]: starting fsync all files come from source.
[2023-03-20 19:42:59.077][2351][datanode2][gs_ctl]: finish fsync all files.
[2023-03-20 19:42:59.086][2351][datanode2][gs_ctl]: build dummy dw file success
[2023-03-20 19:42:59.086][2351][datanode2][gs_ctl]: rename build status file success
[2023-03-20 19:42:59.090][2351][datanode2][gs_ctl]: full build build completed(/opt/openGauss/data/slave).
[2023-03-20 19:42:59.114][2351][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: superman-21
0 LOG: [Alarm Module]Host IP: superman-21\. 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.
The core dump path is an invalid directory
2023-03-20 19:42:59.167 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: when starting as multi_standby mode, we couldn't support data replicaton.
2023-03-20 19:42:59.178 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]can not read GAUSS_WARNING_TYPE env.
2023-03-20 19:42:59.178 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Host Name: superman-21
2023-03-20 19:42:59.178 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Host IP: superman-21\. Copy hostname directly in case of taking 10s to use 'gethostbyname' when /etc/hosts does not contain <HOST IP>
2023-03-20 19:42:59.178 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Cluster Name: dbCluster
2023-03-20 19:42:59.178 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 57
2023-03-20 19:42:59.184 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: loaded library "security_plugin"
2023-03-20 19:42:59.186 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets
2023-03-20 19:42:59.187 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2023-03-20 19:42:59.187 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: reserved memory for backend threads is: 220 MB
2023-03-20 19:42:59.187 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: reserved memory for WAL buffers is: 128 MB
2023-03-20 19:42:59.187 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: Set max backend reserve memory is: 348 MB, max dynamic memory is: 8142 MB
2023-03-20 19:42:59.187 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: shared memory 3285 Mbytes, memory context 8490 Mbytes, max process memory 12288 Mbytes
2023-03-20 19:42:59.256 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [CACHE] LOG: set data cache size(402653184)
2023-03-20 19:42:59.667 [unknown] [unknown] localhost 139794361550400 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-03-20 19:43:00.047 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: gaussdb: fsync file "/opt/openGauss/data/slave/gaussdb.state.temp" success
2023-03-20 19:43:00.048 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: create gaussdb state file success: db state(STARTING_STATE), server mode(Standby), connection index(1)
2023-03-20 19:43:00.072 [unknown] [unknown] localhost 139794361550400 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
2023-03-20 19:43:00.102 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: the configure file /opt/openGauss/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. Please create it by root user!
2023-03-20 19:43:00.102 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [BACKEND] LOG: Failed to parse cgroup config file.
2023-03-20 19:43:00.334 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!
2023-03-20 19:43:00.334 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A
2023-03-20 19:43:00.334 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.
2023-03-20 19:43:00.334 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.
2023-03-20 19:43:00.354 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!
2023-03-20 19:43:00.354 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A
2023-03-20 19:43:00.354 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.
2023-03-20 19:43:00.354 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.
2023-03-20 19:43:00.355 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] WARNING: Failed to obtain environment value $GAUSSLOG!
2023-03-20 19:43:00.355 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] DETAIL: N/A
2023-03-20 19:43:00.355 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] CAUSE: Incorrect environment value.
2023-03-20 19:43:00.355 [unknown] [unknown] localhost 139794361550400 0[0:0#0] 0 [EXECUTOR] ACTION: Please refer to backend log for more details.
....
[2023-03-20 19:43:04.844][2351][datanode2][gs_ctl]: done
[2023-03-20 19:43:04.844][2351][datanode2][gs_ctl]: server started (/opt/openGauss/data/slave)
[2023-03-20 19:43:04.844][2351][datanode2][gs_ctl]: fopen build pid file "/opt/openGauss/data/slave/gs_build.pid" success
[2023-03-20 19:43:04.844][2351][datanode2][gs_ctl]: fprintf build pid file "/opt/openGauss/data/slave/gs_build.pid" success
[2023-03-20 19:43:04.850][2351][datanode2][gs_ctl]: fsync build pid file "/opt/openGauss/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
[omm@superman-21 simpleInstall]$
上述命令中:
-w:初始化數(shù)據(jù)庫密碼(Gs.initdb指定),安全需要必須設(shè)置。 -p:指定的openGauss主節(jié)點(diǎn)端口號,默認(rèn)5432。備節(jié)點(diǎn)端口號會使用主端口號+200,默認(rèn)5632。 –multinode:用來區(qū)分是單節(jié)點(diǎn)還是一主一備安裝。
如果安裝報錯:gs_initdb: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory。
解決方法(root用戶執(zhí)行):
[root@superman-21 ~]# cd /usr/lib64
[root@superman-21 lib64]#
[root@superman-21 lib64]# ls libreadline*
libreadline.so.8 libreadline.so.8.1
[root@superman-21 lib64]#
[root@superman-21 lib64]# ln -s libreadline.so.8 libreadline.so.7
[root@superman-21 lib64]#
[root@superman-21 lib64]# ll libreadline*
lrwxrwxrwx. 1 root root 16 3月 17 22:49 libreadline.so.7 -> libreadline.so.8
lrwxrwxrwx. 1 root root 18 11月 27 2021 libreadline.so.8 -> libreadline.so.8.1
-rwxr-xr-x. 1 root root 336K 11月 27 2021 libreadline.so.8.1
[root@superman-21 lib64]#
4.3.3 安裝后檢查
安裝執(zhí)行完成后,使用ps和gs_ctl查看進(jìn)程是否正常。
執(zhí)行ps命令,顯示類似如下信息:
[omm@superman-21 simpleInstall]$ ps ux | grep gaussdb
omm 2283 2.1 23.5 5931644 815648 ? Ssl 19:42 0:16 /opt/openGauss/bin/gaussdb -D /opt/openGauss/data/master -M primary
omm 2372 2.6 17.5 6139468 606204 ? Ssl 19:42 0:20 /opt/openGauss/bin/gaussdb -D /opt/openGauss/data/slave -M standby
omm 3275 0.0 0.0 6608 2228 pts/0 S+ 19:55 0:00 grep --color=auto gaussdb
[omm@superman-21 simpleInstall]$
執(zhí)行g(shù)s_ctl命令,顯示類似如下信息:
[omm@superman-21 simpleInstall]$ gs_ctl query -D $GAUSSHOME/data/master -M primary
[2023-03-21 07:15:10.206][2721][][gs_ctl]: gs_ctl query ,datadir is /opt/openGauss/data/master
HA state:
local_role : Primary
static_connections : 1
db_state : Normal
detail_information : Normal
Senders info:
sender_pid : 2539
local_role : Primary
peer_role : Standby
peer_state : Normal
state : Streaming
sender_sent_location : 0/403BEF8
sender_write_location : 0/403BEF8
sender_flush_location : 0/403BEF8
sender_replay_location : 0/403BEF8
receiver_received_location : 0/403BEF8
receiver_write_location : 0/403BEF8
receiver_flush_location : 0/403BEF8
receiver_replay_location : 0/403BEF8
sync_percent : 100%
sync_state : Sync
sync_priority : 1
sync_most_available : Off
channel : 192.168.1.21:5433-->192.168.1.21:41908
Receiver info:
No information
[omm@superman-21 simpleInstall]$
[omm@superman-21 simpleInstall]$ gs_ctl query -D $GAUSSHOME/data/slave -M standby
[2023-03-21 07:15:17.082][2732][][gs_ctl]: gs_ctl query ,datadir is /opt/openGauss/data/slave
HA state:
local_role : Standby
static_connections : 1
db_state : Normal
detail_information : Normal
Senders info:
No information
Receiver info:
receiver_pid : 2538
local_role : Standby
peer_role : Primary
peer_state : Normal
state : Normal
sender_sent_location : 0/403BEF8
sender_write_location : 0/403BEF8
sender_flush_location : 0/403BEF8
sender_replay_location : 0/403BEF8
receiver_received_location : 0/403BEF8
receiver_write_location : 0/403BEF8
receiver_flush_location : 0/403BEF8
receiver_replay_location : 0/403BEF8
sync_percent : 100%
channel : 192.168.1.21:41908<--192.168.1.21:5433
[omm@superman-21 simpleInstall]$
4.3.4 服務(wù)啟停
- primary
$ gs_ctl start|stop|restart -D $GAUSSHOME/data/master -M primary
- standby
$ gs_ctl start|stop|restart -D $GAUSSHOME/data/slave -M standby
?? 點(diǎn)贊,你的認(rèn)可是我創(chuàng)作的動力!
?? 收藏,你的青睞是我努力的方向!
?? 評論,你的意見是我進(jìn)步的財富!
