安装openGauss极简版一主一备节点环境

举报
小麦苗DB宝 发表于 2022/01/07 14:41:12 2022/01/07
【摘要】 参考:https://opengauss.org/zh/docs/2.1.0/docs/Quickstart/Quickstart.html-- 安装一主一备节点(之前的配置和单节点一样)docker rm -f lhropengausssimpledocker run -d --name lhropengausssimple -h lhropengausssimple \ -p 3543...

参考:https://opengauss.org/zh/docs/2.1.0/docs/Quickstart/Quickstart.html

-- 安装一主一备节点(之前的配置和单节点一样)

docker rm -f lhropengausssimple
docker run -d --name lhropengausssimple -h lhropengausssimple \
  -p 35432-35439:5432-5439 -p 35632-35639:5632-5639 \
  -v /sys/fs/cgroup:/sys/fs/cgroup \
  --privileged=true lhrbest/lhrcentos76:8.5 \
  /usr/sbin/init
  
docker exec -it lhropengausssimple bash
cd /soft



#close selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0

#close firewalld
systemctl stop firewalld && systemctl disable firewalld

echo 'export LANG=en_US.UTF-8' >> /etc/profile

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime


sysctl -w kernel.sem="250 85000 250 330" 


-- 创建用户和组
groupadd dbgrp
useradd -g dbgrp -d /home/omm -m -s /bin/bash omm
echo "lhr" | passwd --stdin omm

## 创建相关目录
mkdir /opengauss
chgrp dbgrp -R /opengauss
chmod 775 -R /opengauss



## 解压数据库安装包,85Mb
wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/2.1.0/x86/openGauss-2.1.0-CentOS-64bit.tar.bz2
tar -jxf openGauss-2.1.0-CentOS-64bit.tar.bz2 -C /opengauss
chown -R omm:dbgrp  /opengauss

su - omm
cd /opengauss/simpleInstall
sh install.sh  -w lhr@123XXT  --multinode -p 5434

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



-- 连接,-r表示可以使用上下左右键
gsql -d postgres -r


-- 修改参数文件
-- master
alter system set replconninfo1 = 'localhost=127.0.0.1 localport=5435 localheartbeatport=5439 localservice=5438 remotehost=127.0.0.1 remoteport=5635 remoteheartbeatport=5639 remoteservice=5638';

-- slave
alter system set replconninfo1 = 'localhost=127.0.0.1 localport=5635 localheartbeatport=5639 localservice=5638 remotehost=127.0.0.1 remoteport=5435 remoteheartbeatport=5439 remoteservice=5438';




# 环境变量
cat >> /home/omm/.bashrc <"EOF"
export GAUSSHOME=/opengauss
export PATH=$GAUSSHOME/bin:$PATH
export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH
export GS_CLUSTER_NAME=dbCluster
ulimit -n 1000000
EOF

source /home/omm/.bashrc


-- 配置远程访问
gsql -d postgres -p 5434
gsql -d postgres -p 5634

-- f 为主,t为备
select pg_is_in_recovery();
create database omm;
alter system set password_policy=0;
alter system set password_encryption_type=1;
alter system set listen_addresses = '*';

echo "host  all  all  0.0.0.0/0  sha256" >> /opengauss/data/master/pg_hba.conf
echo "host  all  all  0.0.0.0/0  sha256" >> /opengauss/data/slave/pg_hba.conf


-- 重启(必须带-M参数,否则主备关系破坏)
gs_ctl restart -D /opengauss/data/master/ -M primary
gs_ctl restart -D /opengauss/data/slave/ -M standby

-- 查询主备关系
gs_ctl query -D /opengauss/data/master
select * from pg_stat_replication;
select pg_is_in_recovery();

-- 新建用户
-- 初始化数据库的用户,是不能通过IP远程连接的,所以需要创建另外一个用户才能远程连接


gsql  -p 5434

# 创建用户(初始化数据库的用户不能进行远程连接,需要重新创建用户)
create user lhr with password 'lhr' sysadmin ;
grant all PRIVILEGES to lhr; 

-- 验证远程登录数据库
gsql -dpostgres -h172.17.0.7 -Ulhr -r -W'lhr'

-- 远程连接
gsql -d postgres -U lhr  -W'lhr' -h 192.168.66.35 -p35434 -r

psql -d postgres -U lhr  -h 192.168.66.35 -p35434


-- 解锁用户
alter user lhr account unlock;


-- 重新构建主备关系
gs_ctl build -D /opengauss/data/slave -b full -M standby


查询主备关系


[omm@lhropengausssimple ~]$ gs_ctl query -D /opengauss/data/master
[2022-01-07 10:48:22.065][12294][][gs_ctl]: gs_ctl query ,datadir is /opengauss/data/master 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
        sender_pid                     : 11825
        local_role                     : Primary
        peer_role                      : Standby
        peer_state                     : Normal
        state                          : Streaming
        sender_sent_location           : 0/6000CF0
        sender_write_location          : 0/6000CF0
        sender_flush_location          : 0/6000CF0
        sender_replay_location         : 0/6000CF0
        receiver_received_location     : 0/6000CF0
        receiver_write_location        : 0/6000CF0
        receiver_flush_location        : 0/6000CF0
        receiver_replay_location       : 0/6000CF0
        sync_percent                   : 100%
        sync_state                     : Sync
        sync_priority                  : 1
        sync_most_available            : Off
        channel                        : 127.0.0.1:5435-->127.0.0.1:50000

 Receiver info:      
No information 
[omm@lhropengausssimple ~]$ gs_ctl query -D /opengauss/data/slave
[2022-01-07 10:48:26.782][12303][][gs_ctl]: gs_ctl query ,datadir is /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                   : 11824
        local_role                     : Standby
        peer_role                      : Primary
        peer_state                     : Normal
        state                          : Normal
        sender_sent_location           : 0/6000CF0
        sender_write_location          : 0/6000CF0
        sender_flush_location          : 0/6000CF0
        sender_replay_location         : 0/6000CF0
        receiver_received_location     : 0/6000CF0
        receiver_write_location        : 0/6000CF0
        receiver_flush_location        : 0/6000CF0
        receiver_replay_location       : 0/6000CF0
        sync_percent                   : 100%
        channel                        : 127.0.0.1:50000<--127.0.0.1:5435


[omm@lhropengausssimple ~]$ gsql -p 5434
gsql ((openGauss 2.1.0 build 590b0f8e) compiled at 2021-09-30 14:29:04 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

omm=# select pg_is_in_recovery();
 pg_is_in_recovery 
-------------------
 f
(1 row)
postgres=> \x
Expanded display is on.
postgres=> select * from pg_stat_replication;
-[ RECORD 1 ]------------+----------------------------------
pid                      | 140431925966592
usesysid                 | 10
usename                  | omm
application_name         | WalSender to Standby[walreceiver]
client_addr              | 127.0.0.1
client_hostname          |
client_port              | 50000
backend_start            | 2022-01-07 10:40:53.514293+08
state                    | Streaming
sender_sent_location     | 0/6000268
receiver_write_location  | 0/6000268
receiver_flush_location  | 0/6000268
receiver_replay_location | 0/6000268
sync_priority            | 1
sync_state               | Sync



[omm@lhropengausssimple slave]$ gsql -p 5634
gsql ((openGauss 2.1.0 build 590b0f8e) compiled at 2021-09-30 14:29:04 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.

omm=# select pg_is_in_recovery();
 pg_is_in_recovery 
-------------------
 t
(1 row)

主从切换

主从Switchover切换

在备机做切换:

[omm@lhropengausssimple ~]$ gs_ctl switchover -D /opengauss/data/slave/
[2022-01-07 11:21:22.238][16834][][gs_ctl]: gs_ctl switchover ,datadir is /opengauss/data/slave 
[2022-01-07 11:21:22.239][16834][][gs_ctl]: switchover term (1)
[2022-01-07 11:21:22.252][16834][][gs_ctl]: waiting for server to switchover..............
[2022-01-07 11:21:33.593][16834][][gs_ctl]: done
[2022-01-07 11:21:33.593][16834][][gs_ctl]: switchover completed (/opengauss/data/slave)

[omm@lhropengausssimple ~]$ gs_ctl query -D /opengauss/data/master
[2022-01-07 11:22:10.434][16926][][gs_ctl]: gs_ctl query ,datadir is /opengauss/data/master 
 HA state:           
        local_role                     : Standby
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
        receiver_pid                   : 16882
        local_role                     : Standby
        peer_role                      : Primary
        peer_state                     : Normal
        state                          : Normal
        sender_sent_location           : 0/6005408
        sender_write_location          : 0/6005408
        sender_flush_location          : 0/6005408
        sender_replay_location         : 0/6005408
        receiver_received_location     : 0/6005408
        receiver_write_location        : 0/6005408
        receiver_flush_location        : 0/6005408
        receiver_replay_location       : 0/6005408
        sync_percent                   : 100%
        channel                        : 127.0.0.1:50120<--127.0.0.1:5635

[omm@lhropengausssimple ~]$ gs_ctl query -D /opengauss/data/slave/
[2022-01-07 11:22:19.877][16940][][gs_ctl]: gs_ctl query ,datadir is /opengauss/data/slave 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
        sender_pid                     : 16883
        local_role                     : Primary
        peer_role                      : Standby
        peer_state                     : Normal
        state                          : Streaming
        sender_sent_location           : 0/6005408
        sender_write_location          : 0/6005408
        sender_flush_location          : 0/6005408
        sender_replay_location         : 0/6005408
        receiver_received_location     : 0/6005408
        receiver_write_location        : 0/6005408
        receiver_flush_location        : 0/6005408
        receiver_replay_location       : 0/6005408
        sync_percent                   : 100%
        sync_state                     : Sync
        sync_priority                  : 1
        sync_most_available            : Off
        channel                        : 127.0.0.1:5635-->127.0.0.1:50120

 Receiver info:      
No information 

主从Failover切换

在备机操作:

[omm@lhropengausssimple ~]$ gs_ctl failover -D /opengauss/data/master/
[2022-01-07 11:25:04.187][17134][][gs_ctl]: gs_ctl failover ,datadir is /opengauss/data/master 
[2022-01-07 11:25:04.188][17134][][gs_ctl]: failover term (1)
[2022-01-07 11:25:04.200][17134][][gs_ctl]:  waiting for server to failover...
.[2022-01-07 11:25:05.232][17134][][gs_ctl]:  done
[2022-01-07 11:25:05.232][17134][][gs_ctl]:  failover completed (/opengauss/data/master)

[omm@lhropengausssimple ~]$ gs_ctl query -D /opengauss/data/slave/
[2022-01-07 11:25:21.319][17169][][gs_ctl]: gs_ctl query ,datadir is /opengauss/data/slave 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
No information 

[omm@lhropengausssimple ~]$ gs_ctl query -D /opengauss/data/master/
[2022-01-07 11:25:28.813][17180][][gs_ctl]: gs_ctl query ,datadir is /opengauss/data/master 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
No information 


-- 由于slave已经为异常库,所以,这里重启slave库
gs_ctl restart -D /opengauss/data/slave/ -M standby


[omm@lhropengausssimple ~]$ gs_ctl query -D /opengauss/data/slave/
[2022-01-07 11:27:30.297][17740][][gs_ctl]: gs_ctl query ,datadir is /opengauss/data/slave 
 HA state:           
        local_role                     : Standby
        static_connections             : 1
        db_state                       : Need repair
        detail_information             : WAL segment removed

 Senders info:       
No information 
 Receiver info:      
No information 

可见,现在为2个主库,重启“slave”之后,“slave”为standby,对于“slave”应该为备库,所以,这里只能重建:

-- 重新构建主备关系
gs_ctl build -D /opengauss/data/slave -b full -M standby



[omm@lhropengausssimple ~]$ gs_ctl build -D /opengauss/data/slave -b full -M standby
[2022-01-07 11:29:30.081][19353][][gs_ctl]: gs_ctl full build ,datadir is /opengauss/data/slave
waiting for server to shut down.... done
server stopped
[2022-01-07 11:29:31.109][19353][][gs_ctl]: current workdir is (/home/omm).
[2022-01-07 11:29:31.109][19353][][gs_ctl]: fopen build pid file "/opengauss/data/slave/gs_build.pid" success
[2022-01-07 11:29:31.109][19353][][gs_ctl]: fprintf build pid file "/opengauss/data/slave/gs_build.pid" success
[2022-01-07 11:29:31.129][19353][][gs_ctl]: fsync build pid file "/opengauss/data/slave/gs_build.pid" success
[2022-01-07 11:29:31.130][19353][][gs_ctl]: set gaussdb state file when full build:db state(BUILDING_STATE), server mode(STANDBY_MODE), build mode(FULL_BUILD).
[2022-01-07 11:29:31.140][19353][datanode1][gs_ctl]: connect to server success, build started.
[2022-01-07 11:29:31.140][19353][datanode1][gs_ctl]: create build tag file success
[2022-01-07 11:29:31.390][19353][datanode1][gs_ctl]: clear old target dir success
[2022-01-07 11:29:31.390][19353][datanode1][gs_ctl]: create build tag file again success
[2022-01-07 11:29:31.390][19353][datanode1][gs_ctl]: get system identifier success
[2022-01-07 11:29:31.391][19353][datanode1][gs_ctl]: receiving and unpacking files...
[2022-01-07 11:29:31.391][19353][datanode1][gs_ctl]: create backup label success
INFO:  The starting position of the xlog copy of the full build is: 0/403BDC8. The slot minimum LSN is: 0/403BDC8.
[2022-01-07 11:29:31.652][19353][datanode1][gs_ctl]: xlog start point: 0/403BDC8
[2022-01-07 11:29:31.652][19353][datanode1][gs_ctl]: begin build tablespace list
[2022-01-07 11:29:31.652][19353][datanode1][gs_ctl]: finish build tablespace list
[2022-01-07 11:29:31.652][19353][datanode1][gs_ctl]: begin get xlog by xlogstream
[2022-01-07 11:29:31.652][19353][datanode1][gs_ctl]: starting background WAL receiver
[2022-01-07 11:29:31.652][19353][datanode1][gs_ctl]: starting walreceiver
[2022-01-07 11:29:31.652][19353][datanode1][gs_ctl]: begin receive tar files
[2022-01-07 11:29:31.653][19353][datanode1][gs_ctl]: receiving and unpacking files...
[2022-01-07 11:29:31.660][19353][datanode1][gs_ctl]: check identify system success
[2022-01-07 11:29:31.661][19353][datanode1][gs_ctl]: send START_REPLICATION 0/4000000 success
[2022-01-07 11:29:34.015][19353][datanode1][gs_ctl]: finish receive tar files
[2022-01-07 11:29:34.015][19353][datanode1][gs_ctl]: xlog end point: 0/7000058
[2022-01-07 11:29:34.016][19353][datanode1][gs_ctl]: fetching MOT checkpoint
gs_ctl: no mot checkpoint exists
[2022-01-07 11:29:34.017][19353][datanode1][gs_ctl]: waiting for background process to finish streaming...
[2022-01-07 11:29:36.717][19353][datanode1][gs_ctl]: starting fsync all files come from source.
[2022-01-07 11:30:06.777][19353][datanode1][gs_ctl]: finish fsync all files.
[2022-01-07 11:30:06.847][19353][datanode1][gs_ctl]: build dummy dw file success
[2022-01-07 11:30:06.847][19353][datanode1][gs_ctl]: rename build status file success
[2022-01-07 11:30:06.869][19353][datanode1][gs_ctl]: build completed(/opengauss/data/slave).
[2022-01-07 11:30:07.071][19353][datanode1][gs_ctl]: waiting for server to start...
.0 LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG:  [Alarm Module]Host Name: lhropengausssimple 

0 LOG:  [Alarm Module]Host IP: 172.17.0.7 

0 LOG:  [Alarm Module]Cluster Name: dbCluster 

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

0 WARNING:  failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.
0 WARNING:  failed to parse feature control file: gaussdb.version.
0 WARNING:  Failed to load the product control file, so gaussdb cannot distinguish product version.
The core dump path is an invalid directory
2022-01-07 11:30:07.396 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  when starting as multi_standby mode, we couldn't support data replicaton.
2022-01-07 11:30:07.396 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.

2022-01-07 11:30:07.396 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host Name: lhropengausssimple 

2022-01-07 11:30:07.396 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host IP: 172.17.0.7 

2022-01-07 11:30:07.396 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Cluster Name: dbCluster 

2022-01-07 11:30:07.397 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Invalid data in AlarmItem file! Read alarm English name failed! line: 55

2022-01-07 11:30:07.464 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  loaded library "security_plugin"
2022-01-07 11:30:07.614 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] WARNING:  No explicit IP is configured for listen_addresses GUC.
2022-01-07 11:30:07.614 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2022-01-07 11:30:07.614 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for backend threads is: 220 MB
2022-01-07 11:30:07.614 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for WAL buffers is: 128 MB
2022-01-07 11:30:07.614 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  Set max backend reserve memory is: 348 MB, max dynamic memory is: 11069 MB
2022-01-07 11:30:07.614 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  shared memory 358 Mbytes, memory context 11417 Mbytes, max process memory 12288 Mbytes
2022-01-07 11:30:07.696 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [CACHE] LOG:  set data cache  size(402653184)
2022-01-07 11:30:07.727 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [CACHE] LOG:  set metadata cache  size(134217728)
2022-01-07 11:30:07.785 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [SEGMENT_PAGE] LOG:  Segment-page constants: DF_MAP_SIZE: 8156, DF_MAP_BIT_CNT: 65248, DF_MAP_GROUP_EXTENTS: 4175872, IPBLOCK_SIZE: 8168, EXTENTS_PER_IPBLOCK: 1021, IPBLOCK_GROUP_SIZE: 4090, BMT_HEADER_LEVEL0_TOTAL_PAGES: 8323072, BktMapEntryNumberPerBlock: 2038, BktMapBlockNumber: 25, BktBitMaxMapCnt: 512
2022-01-07 11:30:07.861 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  gaussdb: fsync file "/opengauss/data/slave/gaussdb.state.temp" success
2022-01-07 11:30:07.861 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  create gaussdb state file success: db state(STARTING_STATE), server mode(Standby)
2022-01-07 11:30:07.911 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  max_safe_fds = 975, usable_fds = 1000, already_open = 15
The core dump path is an invalid directory
2022-01-07 11:30:07.917 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  the configure file /opengauss/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. Please create it by root user!
2022-01-07 11:30:07.917 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [BACKEND] LOG:  Failed to parse cgroup config file.
2022-01-07 11:30:07.959 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2022-01-07 11:30:07.959 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2022-01-07 11:30:07.959 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2022-01-07 11:30:07.959 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.
2022-01-07 11:30:07.965 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2022-01-07 11:30:07.965 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2022-01-07 11:30:07.965 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2022-01-07 11:30:07.965 [unknown] [unknown] localhost 140319055131584 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.
...........
[2022-01-07 11:30:19.120][19353][datanode1][gs_ctl]:  done
[2022-01-07 11:30:19.120][19353][datanode1][gs_ctl]: server started (/opengauss/data/slave)
[2022-01-07 11:30:19.120][19353][datanode1][gs_ctl]: fopen build pid file "/opengauss/data/slave/gs_build.pid" success
[2022-01-07 11:30:19.120][19353][datanode1][gs_ctl]: fprintf build pid file "/opengauss/data/slave/gs_build.pid" success
[2022-01-07 11:30:19.145][19353][datanode1][gs_ctl]: fsync build pid file "/opengauss/data/slave/gs_build.pid" success
[omm@lhropengausssimple ~]$ 
[omm@lhropengausssimple ~]$ 
[omm@lhropengausssimple ~]$ gs_ctl query -D /opengauss/data/slave/                  
[2022-01-07 11:30:34.278][19488][][gs_ctl]: gs_ctl query ,datadir is /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                   : 19472
        local_role                     : Standby
        peer_role                      : Primary
        peer_state                     : Normal
        state                          : Normal
        sender_sent_location           : 0/8000148
        sender_write_location          : 0/8000148
        sender_flush_location          : 0/8000148
        sender_replay_location         : 0/8000148
        receiver_received_location     : 0/8000148
        receiver_write_location        : 0/8000148
        receiver_flush_location        : 0/8000148
        receiver_replay_location       : 0/8000148
        sync_percent                   : 100%
        channel                        : 127.0.0.1:39592<--127.0.0.1:5435

[omm@lhropengausssimple ~]$ gs_ctl query -D /opengauss/data/master
[2022-01-07 11:30:38.960][19497][][gs_ctl]: gs_ctl query ,datadir is /opengauss/data/master 
 HA state:           
        local_role                     : Primary
        static_connections             : 1
        db_state                       : Normal
        detail_information             : Normal

 Senders info:       
        sender_pid                     : 19473
        local_role                     : Primary
        peer_role                      : Standby
        peer_state                     : Normal
        state                          : Streaming
        sender_sent_location           : 0/8000148
        sender_write_location          : 0/8000148
        sender_flush_location          : 0/8000148
        sender_replay_location         : 0/8000148
        receiver_received_location     : 0/8000148
        receiver_write_location        : 0/8000148
        receiver_flush_location        : 0/8000148
        receiver_replay_location       : 0/8000148
        sync_percent                   : 100%
        sync_state                     : Sync
        sync_priority                  : 1
        sync_most_available            : Off
        channel                        : 127.0.0.1:5435-->127.0.0.1:39592

 Receiver info:      
No information 

可见,主从已经恢复正常状态!!!

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。