openEuler搭建openGauss主从集群

一、系统环境


主机名 IP 系统 虚拟机内存 防火墙、selinux
Euler2(主) 10.10.10.2 openEuler release 20.03 (LTS) 4G off
Euler3(从) 10.10.10.3 openEuler release 20.03 (LTS) 4G off

二、环境准备


官网地址:https://opengauss.org/zh/docs/1.0.1/docs/installation/%E8%8E%B7%E5%8F%96%E5%AE%89%E8%A3%85%E5%8C%85.html

1、下载依赖包(两个节点)

[root@Euler2 ~]# yum install -y libaio-devel flex bison ncurses-devel glibc-devel patch readline-devel

2、关闭swap(两个节点)

[root@Euler2 ~]# swapoff -a

3、关闭RemoveIPC(两个节点)

[root@Euler2 ~]# grep "RemoveIPC" /etc/systemd/logind.conf
RemoveIPC=no

[root@Euler2 ~]# systemctl restart systemd-logind
[root@Euler2 ~]# loginctl show-session | grep RemoveIPC
RemoveIPC=no

4、注释掉Banner(两个节点)

[root@Euler3 ~]# grep "#Banner" /etc/ssh/sshd_config
#Banner none
#Banner /etc/issue.net

[root@Euler2 ~]# systemctl restart sshd

5、创建用户(两个节点)

[root@Euler2 ~]# groupadd dbgrp
[root@Euler2 ~]# useradd omm -g dbgrp
[root@Euler2 ~]# id omm
uid=1000(omm) gid=1000(dbgrp) groups=1000(dbgrp)

[root@Euler2 ~]# echo 'omm'|passwd --stdin omm

6、解压包(Euler2)

[root@Euler2 ~]# mkdir -p /opt/software/openGauss
[root@Euler2 ~]# cd /opt/software/openGauss/
[root@Euler2 openGauss]# ls
openGauss-1.0.1-openEuler-64bit.tar.gz

[root@Euler2 openGauss]# chmod 755 -R /opt/software
[root@Euler2 openGauss]# tar xf openGauss-1.0.1-openEuler-64bit.tar.gz

7、修改performance.sh(两个节点)

[root@Euler2 openGauss]# vim /etc/profile.d/performance.sh      ###注释掉
#sysctl -w vm.min_free_kbytes=112640 &> /dev/null

8、配置环境变量(Euler2 )

[root@Euler2 openGauss]# vim /etc/profile
export LD_LIBRARY_PATH=/opt/software/openGauss/script/gspylib/clib:$LD_LIBRARY_PATH

[root@Euler2 openGauss]# . /etc/profile

二、安装openGauss


centos7中安装需要升级python3:./configure --with-ssl --enable-shared CFLAGS=-fPIC

1、创建XML文件(Euler2 )

[root@Euler2 openGauss]# cat /opt/software/openGauss/cluster_config.xml


    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    
    
    
        
        
            
            
            
            
            
            
            
            

            
            
            
            
            
        

        
        
            
            
            
            
            
            
            
            
        
    

2、执行前置脚本(Euler2 )

[root@Euler2 openGauss]# cd /opt/software/openGauss/script
[root@Euler2 script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Are you sure you want to create trust for root (yes/no)? yes
Please enter password for root.
Password:
Creating SSH trust for the root permission user.
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for the root permission user.
Setting pssh path
Successfully set core path.
Distributing package.
Begin to distribute package to tool path.
Successfully distribute package to tool path.
Begin to distribute package to package path.
Successfully distribute package to package path.
Successfully distributed package.
Are you sure you want to create the user[omm] and create trust for it (yes/no)? yes
Preparing SSH service.
Successfully prepared SSH service.
Installing the tools in the cluster.
Successfully installed the tools in the cluster.
Checking hostname mapping.
Successfully checked hostname mapping.
Creating SSH trust for [omm] user.
Please enter password for current user[omm].
Password:
Checking network information.
All nodes in the network are Normal.
Successfully checked network information.
Creating SSH trust.
Creating the local key file.
Successfully created the local key files.
Appending local ID to authorized_keys.
Successfully appended local ID to authorized_keys.
Updating the known_hosts file.
Successfully updated the known_hosts file.
Appending authorized_key on the remote node.
Successfully appended authorized_key on all remote node.
Checking common authentication file content.
Successfully checked common authentication content.
Distributing SSH trust file to all node.
Successfully distributed SSH trust file to all node.
Verifying SSH trust on all hosts.
Successfully verified SSH trust on all hosts.
Successfully created SSH trust.
Successfully created SSH trust for [omm] user.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster's path.
Successfully created cluster's path.
Setting SCTP service.
Successfully set SCTP service.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/openGauss/script/gs_checkos -i A -h Euler2,Euler3 --detail".
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.

3、检测OS 参数

不能有Abnormal状态

[root@Euler2 script]# ./gs_checkos -i A
Checking items:
    A1. [ OS version status ]                                   : Normal
    A2. [ Kernel version status ]                               : Normal
    A3. [ Unicode status ]                                      : Normal
    A4. [ Time zone status ]                                    : Normal
    A5. [ Swap memory status ]                                  : Normal
    A6. [ System control parameters status ]                    : Warning
    A7. [ File system configuration status ]                    : Warning
    A8. [ Disk configuration status ]                           : Normal
    A9. [ Pre-read block size status ]                          : Normal
    A10.[ IO scheduler status ]                                 : Normal
BondMode Null
    A11.[ Network card configuration status ]                   : Warning
    A12.[ Time consistency status ]                             : Warning
    A13.[ Firewall service status ]                             : Normal
    A14.[ THP service status ]                                  : Normal
Total numbers:14. Abnormal numbers:0. Warning numbers:4.

4、测试omm免密

[omm@Euler2 ~]$ ssh [email protected]      ###不输入密码直接连接

5、文件句柄设置(两个节点)

[root@Euler2 ~]# echo "* soft nofile 1000000" >>/etc/security/limits.conf
[root@Euler2 ~]# echo "* hard nofile 1000000" >>/etc/security/limits.conf

6、执行安装

[omm@Euler2 ~]$ gs_install -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Check preinstall on every node.
Successfully checked preinstall on every node.
Creating the backup directory.
Successfully created the backup directory.
begin deploy..
Installing the cluster.
begin prepare Install Cluster..
Checking the installation environment on all nodes.
begin install Cluster..
Installing applications on all nodes.
Successfully installed APP.
begin init Instance..
encrypt cipher and rand files for database.
Please enter password for database:
Please repeat for database:
begin to create CA cert files
The sslcert will be generated in /gauss/install/app/share/sslcert/om
Cluster installation is completed.
Configuring.
Deleting instances from all nodes.
Successfully deleted instances from all nodes.
Checking node configuration on all nodes.
Initializing instances on all nodes.
Updating instance configuration on all nodes.
Check consistence of memCheck and coresCheck on database nodes.
Successful check consistence of memCheck and coresCheck on all nodes.
Configuring pg_hba on all nodes.
Configuration is completed.
[FAILURE] Euler2:
Using omm:dbgrp to install database.
Using installation program path : /gauss/install/app_13b34b53
$GAUSSHOME points to /gauss/install/app_13b34b53, no need to create symbolic link.
Traceback (most recent call last):
  File "/gauss/install/om/script/local/Install.py", line 645, in 
    functionDict[g_opts.action]()
  File "/gauss/install/om/script/local/Install.py", line 588, in startCluster
    dn.start(self.time_out)
  File "/gauss/install/om/script/local/../gspylib/component/Kernel/Kernel.py", line 88, in start
    "failure details." + "\n" + output)
Exception: [GAUSS-51607] : Failed to start instance. Error: Please check the gs_ctl log for failure details.
[2020-12-13 08:24:48.450][43591][][gs_ctl]: gs_ctl started,datadir is -D "/gauss/install/data/dn"
[2020-12-13 08:24:48.497][43591][][gs_ctl]: waiting for server to start...
.0 LOG:  Failed to initialze environment for codegen.
0 [BACKEND] LOG:  Begin to start openGauss Database.
2020-12-13 08:24:48.582 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  Recovery parallelism, cpu count = 1, max = 4, actual = 1
2020-12-13 08:24:48.582 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  ConfigRecoveryParallelism, true_max_recovery_parallelism:4, max_recovery_parallelism:4
2020-12-13 08:24:48.582 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  gaussdb.state does not exist, and skipt setting since it is optional.
2020-12-13 08:24:48.582 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  Transparent encryption disabled.
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (4215 Mbytes) is larger.
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] FATAL:  could not create shared memory segment: Cannot allocate memory
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] DETAIL:  Failed system call was shmget(key=5432001, size=4420542464, 03600).
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space, or exceeded your kernel's SHMALL parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMALL.  To reduce the request size (currently 4420542464 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers.
        The PostgreSQL documentation contains more information about shared memory configuration.
2020-12-13 08:24:48.906 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  FiniNuma allocIndex: 0.
[2020-12-13 08:24:49.499][43591][][gs_ctl]:  waitpid 43594 failed, exitstatus is 256, ret is 2

[2020-12-13 08:24:49.499][43591][][gs_ctl]: stopped waiting
[2020-12-13 08:24:49.499][43591][][gs_ctl]: could not start server
[2020-12-13 08:24:49.499][43591][][gs_ctl]: Examine the log output.

[GAUSS-51607] : Failed to start instance. Error: Please check the gs_ctl log for failure details.
[2020-12-13 08:24:48.450][43591][][gs_ctl]: gs_ctl started,datadir is -D "/gauss/install/data/dn"
[2020-12-13 08:24:48.497][43591][][gs_ctl]: waiting for server to start...
.0 LOG:  Failed to initialze environment for codegen.
0 [BACKEND] LOG:  Begin to start openGauss Database.
2020-12-13 08:24:48.582 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  Recovery parallelism, cpu count = 1, max = 4, actual = 1
2020-12-13 08:24:48.582 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  ConfigRecoveryParallelism, true_max_recovery_parallelism:4, max_recovery_parallelism:4
2020-12-13 08:24:48.582 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  gaussdb.state does not exist, and skipt setting since it is optional.
2020-12-13 08:24:48.582 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  Transparent encryption disabled.
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (4215 Mbytes) is larger.
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] FATAL:  could not create shared memory segment: Cannot allocate memory
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] DETAIL:  Failed system call was shmget(key=5432001, size=4420542464, 03600).
2020-12-13 08:24:48.746 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space, or exceeded your kernel's SHMALL parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMALL.  To reduce the request size (currently 4420542464 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers.
        The PostgreSQL documentation contains more information about shared memory configuration.
2020-12-13 08:24:48.906 5fd55f50.1 [unknown] 140414329295936 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  FiniNuma allocIndex: 0.
[2020-12-13 08:24:49.499][43591][][gs_ctl]:  waitpid 43594 failed, exitstatus is 256, ret is 2

[2020-12-13 08:24:49.499][43591][][gs_ctl]: stopped waiting
[2020-12-13 08:24:49.499][43591][][gs_ctl]: could not start server
[2020-12-13 08:24:49.499][43591][][gs_ctl]: Examine the log output.
[FAILURE] Euler3:
Using omm:dbgrp to install database.
Using installation program path : /gauss/install/app_13b34b53
$GAUSSHOME points to /gauss/install/app_13b34b53, no need to create symbolic link.
Traceback (most recent call last):
  File "/gauss/install/om/script/local/Install.py", line 645, in 
    functionDict[g_opts.action]()
  File "/gauss/install/om/script/local/Install.py", line 588, in startCluster
    dn.start(self.time_out)
  File "/gauss/install/om/script/local/../gspylib/component/Kernel/Kernel.py", line 88, in start
    "failure details." + "\n" + output)
Exception: [GAUSS-51607] : Failed to start instance. Error: Please check the gs_ctl log for failure details.
[2020-12-13 08:24:46.415][22286][][gs_ctl]: gs_ctl started,datadir is -D "/gauss/install/data/dn"
[2020-12-13 08:24:46.432][22286][][gs_ctl]: waiting for server to start...
.0 LOG:  Failed to initialze environment for codegen.
0 [BACKEND] LOG:  Begin to start openGauss Database.
2020-12-13 08:24:46.468 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  Recovery parallelism, cpu count = 1, max = 4, actual = 1
2020-12-13 08:24:46.468 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  ConfigRecoveryParallelism, true_max_recovery_parallelism:4, max_recovery_parallelism:4
2020-12-13 08:24:46.468 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  gaussdb.state does not exist, and skipt setting since it is optional.
2020-12-13 08:24:46.468 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  Transparent encryption disabled.
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (4215 Mbytes) is larger.
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] FATAL:  could not create shared memory segment: Cannot allocate memory
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] DETAIL:  Failed system call was shmget(key=5432001, size=4420542464, 03600).
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space, or exceeded your kernel's SHMALL parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMALL.  To reduce the request size (currently 4420542464 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers.
        The PostgreSQL documentation contains more information about shared memory configuration.
2020-12-13 08:24:46.493 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  FiniNuma allocIndex: 0.
[2020-12-13 08:24:47.433][22286][][gs_ctl]:  waitpid 22289 failed, exitstatus is 256, ret is 2

[2020-12-13 08:24:47.433][22286][][gs_ctl]: stopped waiting
[2020-12-13 08:24:47.433][22286][][gs_ctl]: could not start server
[2020-12-13 08:24:47.433][22286][][gs_ctl]: Examine the log output.

[GAUSS-51607] : Failed to start instance. Error: Please check the gs_ctl log for failure details.
[2020-12-13 08:24:46.415][22286][][gs_ctl]: gs_ctl started,datadir is -D "/gauss/install/data/dn"
[2020-12-13 08:24:46.432][22286][][gs_ctl]: waiting for server to start...
.0 LOG:  Failed to initialze environment for codegen.
0 [BACKEND] LOG:  Begin to start openGauss Database.
2020-12-13 08:24:46.468 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  Recovery parallelism, cpu count = 1, max = 4, actual = 1
2020-12-13 08:24:46.468 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  ConfigRecoveryParallelism, true_max_recovery_parallelism:4, max_recovery_parallelism:4
2020-12-13 08:24:46.468 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  gaussdb.state does not exist, and skipt setting since it is optional.
2020-12-13 08:24:46.468 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  Transparent encryption disabled.
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (4215 Mbytes) is larger.
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] FATAL:  could not create shared memory segment: Cannot allocate memory
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] DETAIL:  Failed system call was shmget(key=5432001, size=4420542464, 03600).
2020-12-13 08:24:46.485 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 42809 0 [BACKEND] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space, or exceeded your kernel's SHMALL parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMALL.  To reduce the request size (currently 4420542464 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers.
        The PostgreSQL documentation contains more information about shared memory configuration.
2020-12-13 08:24:46.493 5fd55f4e.1 [unknown] 140105187447872 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  FiniNuma allocIndex: 0.
[2020-12-13 08:24:47.433][22286][][gs_ctl]:  waitpid 22289 failed, exitstatus is 256, ret is 2

[2020-12-13 08:24:47.433][22286][][gs_ctl]: stopped waiting
[2020-12-13 08:24:47.433][22286][][gs_ctl]: could not start server
[2020-12-13 08:24:47.433][22286][][gs_ctl]: Examine the log output.

在这里插入图片描述

7、修改postgresql.conf(两个节点)

[omm@Euler2 ~]$ vim /gauss/install/data/dn/postgresql.conf
max_process_memory = 3GB       ###之前是2GB,运行不起来
shared_buffers = 256kB 

8、启动集群

[omm@Euler2 ~]$ gs_om -t start
Starting cluster.
=========================================
Waiting for check cluster state...
Waiting for check cluster state...
Waiting for check cluster state...
Waiting for check cluster state...
Waiting for check cluster state...
[GAUSS-51607] : Failed to start cluster. After startup, the last check results were Degraded. Please check manually.

9、查看集群状态

[omm@Euler2 ~]$ gs_om -t status --detail    ###发现Euler3节点需要修理
[   Cluster State   ]

cluster_state   : Degraded
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

node      node_ip         instance                       state            | node      node_ip         instance                       state
----------------------------------------------------------------------------------------------------------------------------------------------------------
1  Euler2 10.10.10.2      6001 /gauss/install/data/dn P Primary Normal | 2  Euler3 10.10.10.3      6002 /gauss/install/data/dn S Standby Need repair(System)

10、修改Euler3节点

[omm@Euler3 ~]$ gs_ctl build -D /gauss/install/data/dn/ -b full
[2020-12-13 08:30:46.492][25432][][gs_ctl]: gs_ctl full build ,datadir is -D "/gauss/install/data/dn"
waiting for server to shut down.... done
server stopped
[2020-12-13 08:30:47.524][25432][][gs_ctl]: set gaussdb state file when full build:db state(BUILDING_STATE), server mode(STANDBY_MODE), build mode(FULL_BUILD).
gs_ctl: set the connection xc_maintenance_mode to on error.
[2020-12-13 08:30:47.691][25432][dn_6001_6002][gs_ctl]: check connect to server success
[2020-12-13 08:30:47.715][25432][dn_6001_6002][gs_ctl]: clear old target dir success
[2020-12-13 08:30:47.728][25432][dn_6001_6002][gs_ctl]: connect to server success, build started.
[2020-12-13 08:30:47.728][25432][dn_6001_6002][gs_ctl]: create build tag file success
[2020-12-13 08:30:47.728][25432][dn_6001_6002][gs_ctl]: get system identifier success
[2020-12-13 08:30:47.728][25432][dn_6001_6002][gs_ctl]: receiving and unpacking files...
[2020-12-13 08:30:47.728][25432][dn_6001_6002][gs_ctl]: create backup label success
[2020-12-13 08:30:48.221][25432][dn_6001_6002][gs_ctl]: xlog start point: 0/2000028
[2020-12-13 08:30:48.221][25432][dn_6001_6002][gs_ctl]: begin build tablespace list
[2020-12-13 08:30:48.221][25432][dn_6001_6002][gs_ctl]: finish build tablespace list
[2020-12-13 08:30:48.221][25432][dn_6001_6002][gs_ctl]: begin get xlog by xlogstream
[2020-12-13 08:30:48.221][25432][dn_6001_6002][gs_ctl]: starting background WAL receiver
[2020-12-13 08:30:48.221][25432][dn_6001_6002][gs_ctl]: starting walreceiver
[2020-12-13 08:30:48.222][25432][dn_6001_6002][gs_ctl]: begin receive tar files
[2020-12-13 08:30:48.222][25432][dn_6001_6002][gs_ctl]: receiving and unpacking files...
[2020-12-13 08:30:48.268][25432][dn_6001_6002][gs_ctl]:  check identify system success
[2020-12-13 08:30:48.269][25432][dn_6001_6002][gs_ctl]:  send START_REPLICATION 0/2000000 success
 keepalive message is received
 keepalive message is received
[2020-12-13 08:30:48.916][25432][dn_6001_6002][gs_ctl]: finish receive tar files
[2020-12-13 08:30:48.916][25432][dn_6001_6002][gs_ctl]: xlog end point: 0/2000160
[2020-12-13 08:30:48.916][25432][dn_6001_6002][gs_ctl]: waiting for background process to finish streaming...
[2020-12-13 08:30:49.762][25432][dn_6001_6002][gs_ctl]: fetching MOT checkpoint
[2020-12-13 08:30:49.809][25432][dn_6001_6002][gs_ctl]: build dummy dw file success
[2020-12-13 08:30:49.809][25432][dn_6001_6002][gs_ctl]: rename build status file success
[2020-12-13 08:30:49.809][25432][dn_6001_6002][gs_ctl]: build completed(/gauss/install/data/dn).
[2020-12-13 08:30:49.825][25432][dn_6001_6002][gs_ctl]: waiting for server to start...
.0 LOG:  Failed to initialze environment for codegen.
0 [BACKEND] LOG:  Begin to start openGauss Database.
2020-12-13 08:30:49.856 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  Recovery parallelism, cpu count = 1, max = 4, actual = 1
2020-12-13 08:30:49.856 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 DB001 0 [REDO] LOG:  ConfigRecoveryParallelism, true_max_recovery_parallelism:4, max_recovery_parallelism:4
2020-12-13 08:30:49.857 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  Transparent encryption disabled.
2020-12-13 08:30:49.869 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2020-12-13 08:30:49.869 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 01000 0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (1024 Mbytes) or shared memory (1246 Mbytes) is larger.
2020-12-13 08:30:49.928 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 00000 0 [CACHE] LOG:  set data cache  size(805306368)
2020-12-13 08:30:49.947 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 00000 0 [CACHE] LOG:  set metadata cache  size(268435456)
2020-12-13 08:30:50.145 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  gaussdb: fsync file "/gauss/install/data/dn/gaussdb.state.temp" success
2020-12-13 08:30:50.145 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  create gaussdb state file success: db state(STARTING_STATE), server mode(Standby)
2020-12-13 08:30:50.145 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  max_safe_fds = 976, usable_fds = 1000, already_open = 14
2020-12-13 08:30:50.146 5fd560b9.1 [unknown] 140027037447232 [unknown] 0 dn_6001_6002 00000 0 [BACKEND] LOG:  Success to start openGauss Database. If you specify "&", please press any key to exit...
.......
[2020-12-13 08:30:57.965][25432][dn_6001_6002][gs_ctl]:  done
[2020-12-13 08:30:57.965][25432][dn_6001_6002][gs_ctl]: server started (/gauss/install/data/dn)

11、再次启动集群

[omm@Euler2 ~]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] Euler2:
[2020-12-13 08:31:33.794][53690][][gs_ctl]: gs_ctl started,datadir is -D "/gauss/install/data/dn"
[2020-12-13 08:31:33.818][53690][][gs_ctl]:  another server might be running; Please use the restart command
[SUCCESS] Euler3:
[2020-12-13 08:31:30.711][26092][][gs_ctl]: gs_ctl started,datadir is -D "/gauss/install/data/dn"
[2020-12-13 08:31:30.717][26092][][gs_ctl]:  another server might be running; Please use the restart command

=========================================
Successfully started.

12、查看状态

[omm@Euler2 ~]$ gs_om -t status --detail
[   Cluster State   ]

cluster_state   : Normal
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

node      node_ip         instance                       state            | node      node_ip         instance                       state
----------------------------------------------------------------------------------------------------------------------------------------------------------
1  Euler2 10.10.10.2      6001 /gauss/install/data/dn P Primary Normal | 2  Euler3 10.10.10.3      6002 /gauss/install/data/dn S Standby Normal

三、测试结果


[omm@Euler2 ~]$ gsql -t postgres
gsql ((openGauss 1.0.1 build 13b34b53) compiled at 2020-10-12 02:00:13 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

postgres=# \l
ERROR:  Please use "ALTER ROLE user_name IDENTIFIED BY 'password' REPLACE 'old password';" to modify the initial password of user omm before operation!

postgres=# ALTER ROLE omm IDENTIFIED BY '新密码' REPLACE '旧密码';
ALTER ROLE
postgres=# CREATE DATABASE mydb WITH ENCODING 'GBK' template = template0;
CREATE DATABASE

postgres=# \l
 mydb      | omm   | GBK       | C       | C     |
 postgres  | omm   | SQL_ASCII | C       | C     |
 template0 | omm   | SQL_ASCII | C       | C     | =c/omm           +
           |       |           |         |       | omm=CTc/omm
 template1 | omm   | SQL_ASCII | C       | C     | =c/omm           +
           |       |           |         |       | omm=CTc/omm

参考文章:openGauss保姆式安装说明

你可能感兴趣的:(运维,openEuler,openGauss,openGauss主从搭建)