暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

通过gs_expansion命令完成主库增加备库的处理,测试switchover正常(3)

原创 jieyancai 2021-09-16
1742

上接:
openGauss训练营学习心得-手动安装主备HA环境,并测试switchover和failover效果(2)
由于之前手动安装的HA,所以主备脱离了gs_om集群的管理。
本次使用gs_expansion命令完成了主库增加备库的处理,使得主备HA可以通过gs_om监控及简单管理。

openGauss训练营学习心得-安装初体验(1)的基础上,克隆出虚机omm03作为备库,从而具备了opengauss软件及omm用户、用户组等文件信息(没有克隆就按(1)文档重新安装opengauss软件即可)。

主要步骤:
1.备库系统克隆/openGauss软件安装
2.主备环境变量准备
3.主库xml集群配置文件准备
4.root/omm用户在主备节点互信配置
5.主库postgres.conf和pg_hba.conf修改信息
6.主库启动成primary模式
7.执行gs_expansion增加备库操作
8.主备switchover测试

如下为详细安装步骤:

1.omm03虚机系统克隆完毕(忽略步骤)
2.主备库环境变量修改
注意环境变量提前添加好,避免后续的报错提示:
vi /etc/profile

export PGDATA=/gaussdb/data/db1
export GPHOME=/gaussdb/om
export GAUSSHOME=/gaussdb/app
export PGHOST=/gaussdb/om/omm_mppdb
export PATH=/root/gauss_om/omm/script:$GAUSSHOME/bin:$PATH

source /etc/profile 即时生效
3.主库omm02准备好集群脚本:
vi /soft/openGauss/clusterconfig.xml

[root@omm02 openGauss]# cat clusterconfig.xml
<?xml version="1.0" encoding="UTF-8"?> 
<ROOT> 
    <!-- openGauss整体信息 --> 
    <CLUSTER> 
        <PARAM name="clusterName" value="dbCluster" /> 
        <PARAM name="nodeNames" value="omm02,omm03" /> 
        <PARAM name="backIp1s" value="192.168.52.143,192.168.52.144"/> 
        <PARAM name="gaussdbAppPath" value="/gaussdb/app" /> 
        <PARAM name="gaussdbLogPath" value="/gaussdb/log" /> 
        <PARAM name="gaussdbToolPath" value="/gaussdb/om" /> 
        <PARAM name="corePath" value="/gaussdb/corefile"/> 
    </CLUSTER> 
    <!-- 每台服务器上的节点部署信息 --> 
    <DEVICELIST> 
        <!-- node1上的节点部署信息 --> 
        <DEVICE sn="omm02"> 
            <PARAM name="name" value="omm02"/> 
            <PARAM name="azName" value="AZ1"/> 
            <PARAM name="azPriority" value="1"/> 
            <!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP --> 
            <PARAM name="backIp1" value="192.168.52.143"/> 
            <PARAM name="sshIp1" value="192.168.52.143"/>             
            <!--dbnode--> 
            <PARAM name="dataNum" value="1"/> 
            <PARAM name="dataPortBase" value="26000"/> 
            <PARAM name="dataNode1" value="/gaussdb/data/db1,omm03,/gaussdb/data/db1"/> 
            <PARAM name="dataNode1_syncNum" value="0"/>
        </DEVICE> 
        <!-- node1上的节点部署信息 -->
        <DEVICE sn="omm03">
            <PARAM name="name" value="omm03"/>
            <PARAM name="azName" value="AZ1"/>
            <PARAM name="azPriority" value="1"/>
            <!-- 如果服务器只有一个网卡可用,将backIP1和sshIP1配置成同一个IP -->
            <PARAM name="backIp1" value="192.168.52.144"/>
            <PARAM name="sshIp1" value="192.168.52.144"/>
        </DEVICE>
    </DEVICELIST> 
</ROOT>

4.root/omm用户在主备节点互信配置
在omm02主库操作即可:

[root@omm02 openGauss]# pwd
/soft/openGauss
[root@omm02 openGauss]# vi hostfile 
192.168.52.143
192.168.52.144
[root@omm02 openGauss]# cd script
[root@omm02 script]# ./gs_sshexkey -f /soft/openGauss/hostfile 
Please enter password for current user[root].
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.
[root@omm02 script]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.52.143  omm02  #Gauss OM IP Hosts Mapping
192.168.52.144  omm03  #Gauss OM IP Hosts Mapping
root测试互信ok:
[root@omm02 script]# ssh omm03 date
Thu Sep 16 10:46:09 CST 2021
[root@omm02 script]# ssh omm02 date
Thu Sep 16 10:46:13 CST 2021
omm同样su - omm用户下:
执行./gs_sshexkey -f /soft/openGauss/hostfile并完成测试互信

5.主库和备库postgres.conf和pg_hba.conf修改信息

postgres.conf增加修改内容:
listen_addresses = '*'
replconninfo1 = 'localhost=192.168.52.143 localport=26001 localheartbeatport=26003 localservice=26004 remotehost=192.168.52.144 remoteport=26001 remoteheartbeatport=26003 remoteservice=26004' 
wal_level = hot_standby

pg_hba.conf增加内容:
host    all             omm             192.168.52.0/24         trust
host    replication     omm        192.168.52.0/24            trust

6.主库启动成primary模式

[omm@omm02 db1]$ gs_ctl stop
[2021-09-16 12:21:33.781][112972][][gs_ctl]: gs_ctl stopped ,datadir is /gaussdb/data/db1 
waiting for server to shut down..... done
server stopped
[omm@omm02 db1]$ gs_ctl start -M primary
[2021-09-16 12:21:39.445][112980][][gs_ctl]: gs_ctl started,datadir is /gaussdb/data/db1 
[2021-09-16 12:21:39.538][112980][][gs_ctl]: waiting for server to start...
.0 LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG:  [Alarm Module]Host Name: omm02 

0 LOG:  [Alarm Module]Host IP: 192.168.52.143 

0 LOG:  [Alarm Module]Cluster Name: dbCluster 

0 LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 52

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.
0 LOG:  Failed to initialze environment for codegen.
0 WARNING:  bbox_dump_path is set to /gaussdb/corefile/

2021-09-16 12:21:39.727 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 DB010  0 [REDO] LOG:  Recovery parallelism, cpu count = 4, max = 4, actual = 4
2021-09-16 12:21:39.727 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 DB010  0 [REDO] LOG:  ConfigRecoveryParallelism, true_max_recovery_parallelism:4, max_recovery_parallelism:4
2021-09-16 12:21:39.727 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.

2021-09-16 12:21:39.727 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  [Alarm Module]Host Name: omm02 

2021-09-16 12:21:39.727 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  [Alarm Module]Host IP: 192.168.52.143 

2021-09-16 12:21:39.727 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  [Alarm Module]Cluster Name: dbCluster 

2021-09-16 12:21:39.727 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 52

2021-09-16 12:21:39.727 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  Transparent encryption disabled.

2021-09-16 12:21:39.730 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  loaded library "security_plugin"
2021-09-16 12:21:39.732 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2021-09-16 12:21:39.732 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (1496 Mbytes) is larger.
2021-09-16 12:21:39.744 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [CACHE] LOG:  set data cache  size(12582912)
2021-09-16 12:21:39.745 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [CACHE] LOG:  set metadata cache  size(4194304)
2021-09-16 12:21:41.196 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  gaussdb: fsync file "/gaussdb/data/db1/gaussdb.state.temp" success
2021-09-16 12:21:41.196 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  create gaussdb state file success: db state(STARTING_STATE), server mode(Primary)
2021-09-16 12:21:41.226 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  max_safe_fds = 979, usable_fds = 1000, already_open = 11
bbox_dump_path is set to /gaussdb/corefile/
2021-09-16 12:21:41.228 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  the configure file /gaussdb/app/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. Please create it by root user!
2021-09-16 12:21:41.228 6142c653.1 [unknown] 140035911341824 [unknown] 0 dn_6001 00000  0 [BACKEND] LOG:  Failed to parse cgroup config file.
.
[2021-09-16 12:21:42.381][112980][][gs_ctl]:  done
[2021-09-16 12:21:42.381][112980][][gs_ctl]: server started (/gaussdb/data/db1)
[omm@omm02 db1]$ gs_om -t status --all
-----------------------------------------------------------------------

cluster_state             : Normal
redistributing            : No

-----------------------------------------------------------------------

node                      : 1
node_name                 : omm02
instance_id               : 6001
node_ip                   : 192.168.52.143
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
static_connections        : 1
HA_state                  : Normal
instance_role             : Primary

-----------------------------------------------------------------------

[omm@omm02 db1]$ netstat -tunlp|grep LISTEN
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -                   
tcp        0      0 192.168.52.143:26000    0.0.0.0:*               LISTEN      112983/gaussdb      
tcp        0      0 192.168.52.143:26001    0.0.0.0:*               LISTEN      112983/gaussdb      
tcp        0      0 192.168.52.143:26004    0.0.0.0:*               LISTEN      112983/gaussdb      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp6       0      0 ::1:25                  :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -     

7.执行gs_expansion增加备库操作

[root@omm02 script]# ./gs_expansion -U omm -G dbgrp -X /soft/openGauss/clusterconfig.xml -h 192.168.52.144 -L
Database on standby nodes installed finished.

Checking gaussdb and gs_om version.
End to check gaussdb and gs_om version.

Start to establish the relationship.
Start to build standby 192.168.52.144.
Build standby 192.168.52.144 success.
Start to generate and send cluster static file.
End to generate and send cluster static file.

Expansion results:
192.168.52.144: Success
Expansion Finish.
[root@omm02 script]# su - omm
Last login: Thu Sep 16 12:40:20 CST 2021 on pts/0
[omm@omm02 ~]$ gs_om -t status --all
-----------------------------------------------------------------------

cluster_state             : Normal
redistributing            : No

-----------------------------------------------------------------------

node                      : 1
node_name                 : omm02
instance_id               : 6001
node_ip                   : 192.168.52.143
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
static_connections        : 1
HA_state                  : Normal
instance_role             : Primary

-----------------------------------------------------------------------

node                      : 2
node_name                 : omm03
instance_id               : 6002
node_ip                   : 192.168.52.144
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
instance_role             : Standby
HA_state                  : Streaming
sender_sent_location      : 0/2117DB0
sender_write_location     : 0/2117DB0
sender_flush_location     : 0/2117DB0
sender_replay_location    : 0/2117DB0
receiver_received_location: 0/2117DB0
receiver_write_location   : 0/2117DB0
receiver_flush_location   : 0/2117DB0
receiver_replay_location  : 0/2117DB0
sync_percent              : 100%
sync_state                : Async

-----------------------------------------------------------------------
[omm@omm02 ~]$ gs_ctl query
[2021-09-16 12:44:37.008][54136][][gs_ctl]: gs_ctl query ,datadir is /gaussdb/data/db1 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
        sender_pid                     : 51324
        local_role                     : Primary
        peer_role                      : Standby
        peer_state                     : Normal
        state                          : Streaming
        sender_sent_location           : 0/2118228
        sender_write_location          : 0/2118228
        sender_flush_location          : 0/2118228
        sender_replay_location         : 0/2118228
        receiver_received_location     : 0/2118228
        receiver_write_location        : 0/2118228
        receiver_flush_location        : 0/2118228
        receiver_replay_location       : 0/2118228
        sync_percent                   : 100%
        sync_state                     : Async
        sync_priority                  : 0
        sync_most_available            : Off
        channel                        : 192.168.52.143:26001-->192.168.52.144:34404

 Receiver info:      
No information 
[omm@omm02 ~]$ gs_ctl query -D /gaussdb/data/db1 
[2021-09-16 12:44:44.748][54148][][gs_ctl]: gs_ctl query ,datadir is /gaussdb/data/db1 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
        sender_pid                     : 51324
        local_role                     : Primary
        peer_role                      : Standby
        peer_state                     : Normal
        state                          : Streaming
        sender_sent_location           : 0/2118228
        sender_write_location          : 0/2118228
        sender_flush_location          : 0/2118228
        sender_replay_location         : 0/2118228
        receiver_received_location     : 0/2118228
        receiver_write_location        : 0/2118228
        receiver_flush_location        : 0/2118228
        receiver_replay_location       : 0/2118228
        sync_percent                   : 100%
        sync_state                     : Async
        sync_priority                  : 0
        sync_most_available            : Off
        channel                        : 192.168.52.143:26001-->192.168.52.144:34404

 Receiver info:      
No information 

8.主备switchover测试
备库检查和切换操作:

[omm@omm03 db1]$ gs_ctl query -D /gaussdb/data/db1
[2021-09-16 12:45:19.713][28732][][gs_ctl]: gs_ctl query ,datadir is /gaussdb/data/db1 
 HA state:           
        local_role                     : Standby
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
        receiver_pid                   : 28087
        local_role                     : Standby
        peer_role                      : Primary
        peer_state                     : Normal
        state                          : Normal
        sender_sent_location           : 0/2118340
        sender_write_location          : 0/2118340
        sender_flush_location          : 0/2118340
        sender_replay_location         : 0/2118340
        receiver_received_location     : 0/2118340
        receiver_write_location        : 0/2118340
        receiver_flush_location        : 0/2118340
        receiver_replay_location       : 0/2118340
        sync_percent                   : 100%
        channel                        : 192.168.52.144:34404<--192.168.52.143:26001

[omm@omm03 db1]$ gs_om -t status --all
-----------------------------------------------------------------------

cluster_state             : Normal
redistributing            : No

-----------------------------------------------------------------------

node                      : 1
node_name                 : omm02
instance_id               : 6001
node_ip                   : 192.168.52.143
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
static_connections        : 1
HA_state                  : Normal
instance_role             : Primary

-----------------------------------------------------------------------

node                      : 2
node_name                 : omm03
instance_id               : 6002
node_ip                   : 192.168.52.144
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
instance_role             : Standby
HA_state                  : Streaming
sender_sent_location      : 0/2118340
sender_write_location     : 0/2118340
sender_flush_location     : 0/2118340
sender_replay_location    : 0/2118340
receiver_received_location: 0/2118340
receiver_write_location   : 0/2118340
receiver_flush_location   : 0/2118340
receiver_replay_location  : 0/2118340
sync_percent              : 100%
sync_state                : Async

-----------------------------------------------------------------------
备库切换:
[omm@omm03 db1]$ gs_ctl switchover
[2021-09-16 12:46:20.369][29068][][gs_ctl]: gs_ctl switchover ,datadir is /gaussdb/data/db1 
[2021-09-16 12:46:20.369][29068][][gs_ctl]: switchover term (1)
[2021-09-16 12:46:20.374][29068][][gs_ctl]: waiting for server to switchover.........
[2021-09-16 12:46:26.443][29068][][gs_ctl]: done
[2021-09-16 12:46:26.443][29068][][gs_ctl]: switchover completed (/gaussdb/data/db1)
[omm@omm03 db1]$ gs_om -t status --all
-----------------------------------------------------------------------

cluster_state             : Normal
redistributing            : No

-----------------------------------------------------------------------

node                      : 1
node_name                 : omm02
instance_id               : 6001
node_ip                   : 192.168.52.143
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
instance_role             : Standby
HA_state                  : Streaming
sender_sent_location      : 0/2118570
sender_write_location     : 0/2118570
sender_flush_location     : 0/2118570
sender_replay_location    : 0/2118570
receiver_received_location: 0/2118570
receiver_write_location   : 0/2118570
receiver_flush_location   : 0/2118570
receiver_replay_location  : 0/2118570
sync_percent              : 100%
sync_state                : Async

-----------------------------------------------------------------------

node                      : 2
node_name                 : omm03
instance_id               : 6002
node_ip                   : 192.168.52.144
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
static_connections        : 1
HA_state                  : Normal
instance_role             : Primary

-----------------------------------------------------------------------

[omm@omm03 db1]$ gs_ctl query -D /gaussdb/data/db1
[2021-09-16 12:46:36.695][29382][][gs_ctl]: gs_ctl query ,datadir is /gaussdb/data/db1 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
        sender_pid                     : 29084
        local_role                     : Primary
        peer_role                      : Standby
        peer_state                     : Normal
        state                          : Streaming
        sender_sent_location           : 0/2118570
        sender_write_location          : 0/2118570
        sender_flush_location          : 0/2118570
        sender_replay_location         : 0/2118570
        receiver_received_location     : 0/2118570
        receiver_write_location        : 0/2118570
        receiver_flush_location        : 0/2118570
        receiver_replay_location       : 0/2118570
        sync_percent                   : 100%
        sync_state                     : Async
        sync_priority                  : 0
        sync_most_available            : Off
        channel                        : 192.168.52.144:26001-->192.168.52.143:58058

 Receiver info:      
No information 
[omm@omm03 db1]$ gsql -d postgres -p 26000
gsql ((openGauss 2.0.1 build d97c0e8a) compiled at 2021-06-02 19:37:17 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

postgres=# \l
                         List of databases
   Name    | Owner | Encoding | Collate | Ctype | Access privileges 
-----------+-------+----------+---------+-------+-------------------
 postgres  | omm   | UTF8     | C       | C     | 
 template0 | omm   | UTF8     | C       | C     | =c/omm           +
           |       |          |         |       | omm=CTc/omm
 template1 | omm   | UTF8     | C       | C     | =c/omm           +
           |       |          |         |       | omm=CTc/omm
(3 rows)

postgres=# create database jyc;
CREATE DATABASE
postgres=# \c jyc
Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "jyc" as user "omm".
jyc=# create table test(id int);
CREATE TABLE
jyc=# insert into test values(1);
INSERT 0 1
jyc=# select * from test;
 id 
----
  1
(1 row)

-------此时原来的主库上做switchover测试-----------
jyc=# insert into test values(1);
FATAL:  terminating connection due to administrator command
could not send data to server: Broken pipe
The connection to the server was lost. Attempting reset: Succeeded.
jyc=# 
jyc=# 
jyc=# insert into test values(1);
ERROR:  cannot execute INSERT in a read-only transaction
jyc=# select * from test;
 id 
----
  1
  2
(2 rows)

jyc=# \q

再测试通过gs_om启停集群:
主库:
[omm@omm02 ~]$ gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.
集群停止后,检查备库也自动停止。
[omm@omm03 ~]$ gs_ctl query -D /gaussdb/data/db1
[2021-09-16 13:43:53.407][29592][][gs_ctl]: gs_ctl query ,datadir is /gaussdb/data/db1 
[2021-09-16 13:43:53.407][29592][][gs_ctl]:  PID file "/gaussdb/data/db1/postmaster.pid" does not exist
[2021-09-16 13:43:53.407][29592][][gs_ctl]: Is server running?
[omm@omm03 ~]$ ps -ef|grep gas
omm       29595  29573  0 13:44 pts/0    00:00:00 grep --color=auto gas

集群启动后,主备自动恢复。
[omm@omm02 ~]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] omm02
2021-09-16 13:44:23.753 6142d9b7.1 [unknown] 140271822272256 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (1496 Mbytes) is larger.
[SUCCESS] omm03
2021-09-16 13:44:25.661 6142d9b9.1 [unknown] 140431521761024 [unknown] 0 dn_6001 01000  0 [BACKEND] WARNING:  Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (1496 Mbytes) is larger.
Waiting for check cluster state...
=========================================
Successfully started.
[omm@omm02 ~]$ gs_ctl query -D /gaussdb/data/db1 
[2021-09-16 13:44:47.702][59148][][gs_ctl]: gs_ctl query ,datadir is /gaussdb/data/db1 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
        sender_pid                     : 58774
        local_role                     : Primary
        peer_role                      : Standby
        peer_state                     : Normal
        state                          : Streaming
        sender_sent_location           : 0/211E4E8
        sender_write_location          : 0/211E4E8
        sender_flush_location          : 0/211E4E8
        sender_replay_location         : 0/211E4E8
        receiver_received_location     : 0/211E4E8
        receiver_write_location        : 0/211E4E8
        receiver_flush_location        : 0/211E4E8
        receiver_replay_location       : 0/211E4E8
        sync_percent                   : 100%
        sync_state                     : Async
        sync_priority                  : 0
        sync_most_available            : Off
        channel                        : 192.168.52.143:26001-->192.168.52.144:34470

 Receiver info:      
No information 
[omm@omm02 ~]$ gs_om -t status --all
-----------------------------------------------------------------------

cluster_state             : Normal
redistributing            : No

-----------------------------------------------------------------------

node                      : 1
node_name                 : omm02
instance_id               : 6001
node_ip                   : 192.168.52.143
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
static_connections        : 1
HA_state                  : Normal
instance_role             : Primary

-----------------------------------------------------------------------

node                      : 2
node_name                 : omm03
instance_id               : 6002
node_ip                   : 192.168.52.144
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
instance_role             : Standby
HA_state                  : Streaming
sender_sent_location      : 0/211E4E8
sender_write_location     : 0/211E4E8
sender_flush_location     : 0/211E4E8
sender_replay_location    : 0/211E4E8
receiver_received_location: 0/211E4E8
receiver_write_location   : 0/211E4E8
receiver_flush_location   : 0/211E4E8
receiver_replay_location  : 0/211E4E8
sync_percent              : 100%
sync_state                : Async

-----------------------------------------------------------------------
集群启动后,备库恢复:
[omm@omm03 ~]$ gs_ctl query 
[2021-09-16 13:45:11.781][29872][][gs_ctl]: gs_ctl query ,datadir is /gaussdb/data/db1 
 HA state:           
        local_role                     : Standby
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
        receiver_pid                   : 29781
        local_role                     : Standby
        peer_role                      : Primary
        peer_state                     : Normal
        state                          : Normal
        sender_sent_location           : 0/211E4E8
        sender_write_location          : 0/211E4E8
        sender_flush_location          : 0/211E4E8
        sender_replay_location         : 0/211E4E8
        receiver_received_location     : 0/211E4E8
        receiver_write_location        : 0/211E4E8
        receiver_flush_location        : 0/211E4E8
        receiver_replay_location       : 0/211E4E8
        sync_percent                   : 100%
        channel                        : 192.168.52.144:34470<--192.168.52.143:26001

[omm@omm03 ~]$ gs_om -t status --all
-----------------------------------------------------------------------

cluster_state             : Normal
redistributing            : No

-----------------------------------------------------------------------

node                      : 1
node_name                 : omm02
instance_id               : 6001
node_ip                   : 192.168.52.143
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
static_connections        : 1
HA_state                  : Normal
instance_role             : Primary

-----------------------------------------------------------------------

node                      : 2
node_name                 : omm03
instance_id               : 6002
node_ip                   : 192.168.52.144
data_path                 : /gaussdb/data/db1
type                      : Datanode
instance_state            : Normal
az_name                   : AZ1
instance_role             : Standby
HA_state                  : Streaming
sender_sent_location      : 0/211E4E8
sender_write_location     : 0/211E4E8
sender_flush_location     : 0/211E4E8
sender_replay_location    : 0/211E4E8
receiver_received_location: 0/211E4E8
receiver_write_location   : 0/211E4E8
receiver_flush_location   : 0/211E4E8
receiver_replay_location  : 0/211E4E8
sync_percent              : 100%
sync_state                : Async

-----------------------------------------------------------------------

[omm@omm03 ~]$ 

参考链接:
https://www.modb.pro/db/44358
https://opengauss.org/zh/docs/2.0.1/docs/installation/%E5%88%9B%E5%BB%BAXML%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6.html

最后修改时间:2021-09-18 12:33:15
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论