其他分享
首页 > 其他分享> > KingbaseES V8R6集群同步模式synchronous参数配置详解

KingbaseES V8R6集群同步模式synchronous参数配置详解

作者:互联网

如下图所示:

集群数据同步原理说明:

synchronous参数配置测试:

集群节点信息:

ID | Name    | Role    | Status    | Upstream | repmgrd | PID   | Paused? | Upstream last seen
----+---------+---------+-----------+----------+---------+-------+---------+--------------------
 1  | node101 | standby |   running | node102  | running | 7345  | no      | 1 second(s) ago
 2  | node102 | primary | * running |          | running | 13934 | no      | n/a

数据库版本:

test=# select version();
                                                       version
----------------------------------------------------------------------------------------------------------------------
 KingbaseES V008R006C005B0041 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit
(1 row)

一、配置synchronous='sync'

1、配置synchronous参数

[kingbase@node102 bin]$ cat ../etc/repmgr.conf |grep sync
#synchronous='quorum'
synchronous='sync'

2、查看流复制同步状态

test=# select * from sys_stat_replication;
  pid  | usesysid | usename | application_name |  client_addr  | client_hostname | client_port |         backend_start         | backen
d_xmin |   state   |  sent_lsn  | write_lsn  | flush_lsn  | replay_lsn | write_lag | flush_lag | replay_lag | sync_priority | sync_stat
e |          reply_time
-------+----------+---------+------------------+---------------+-----------------+-------------+-------------------------------+-------

 10622 |       10 | system  | node101          | 192.168.1.101 |                 |       19002 | 2022-04-27 00:29:19.703179+08 |
       | streaming | 0/400008E0 | 0/400008E0 | 0/400008E0 | 0/400008E0 |           |           |            |             1 | sync
  | 2022-04-27 15:01:31.539178+08
(1 row)

3、查看kingbase.auto.conf配置

[kingbase@node102 bin]$ cat ../data/kingbase.auto.conf
# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.
enable_upper_colname = 'on'
primary_conninfo = 'user=system connect_timeout=10 host=192.168.1.101 port=54321 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3 application_name=node102'
recovery_target_timeline = 'latest'
primary_slot_name = 'repmgr_slot_2'
wal_retrieve_retry_interval = '5000'
synchronous_standby_names = '1 (node101)'

二、配置synchronous='quorum'(默认)

1、配置synchronous参数

[kingbase@node102 bin]$ cat ../etc/repmgr.conf |grep sync
synchronous='quorum'
#synchronous='sync'
#synchronous='async'

2、查看流复制同步状态

test=# select * from sys_stat_replication;
  pid  | usesysid | usename | application_name |  client_addr  | client_hostname | client_port |         backend_start         | backen
d_xmin |   state   |  sent_lsn  | write_lsn  | flush_lsn  | replay_lsn | write_lag | flush_lag | replay_lag | sync_priority | sync_stat
e |          reply_time
-------+----------+---------+------------------+---------------+-----------------+-------------+-------------------------------+-------
-------+-----------+------------+------------+------------+------------+-----------+-----------+------------+---------------+----------
--+-------------------------------
 16656 |       10 | system  | node101          | 192.168.1.101 |                 |       19593 | 2022-04-27 00:37:24.155837+08 |
       | streaming | 0/42000960 | 0/42000960 | 0/42000960 | 0/42000960 |           |           |            |             1 | quorum
  | 2022-04-27 15:09:06.702206+08
(1 row)

3、查看kingbase.auto.conf配置

[kingbase@node102 bin]$ cat ../data/kingbase.auto.conf
# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.
enable_upper_colname = 'on'
primary_conninfo = 'user=system connect_timeout=10 host=192.168.1.101 port=54321 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3 application_name=node102'
recovery_target_timeline = 'latest'
primary_slot_name = 'repmgr_slot_2'
wal_retrieve_retry_interval = '5000'
synchronous_standby_names = 'ANY 1(node101)'

三、配置synchronous='async'(默认)

1、配置synchronous参数

[kingbase@node102 bin]$ cat ../etc/repmgr.conf |grep sync
#synchronous='quorum'
#synchronous='sync'
synchronous='async'

2、查看流复制同步状态

test=# select * from sys_stat_replication;
  pid  | usesysid | usename | application_name |  client_addr  | client_hostname | client_port |         backend_start         | backend_xmin |   state   |  sent_lsn  | write_lsn  | flush_lsn  | replay_lsn | write_lag | flush_lag | replay_lag | sync_priority | sync_state |          reply_time
-------+----------+---------+------------------+---------------+-----------------+-------------+-------------------------------+--------------+-----------+------------+------------+------------+------------+-----------+-----------+------------+---------------+------------+-------------------------------
 13720 |       10 | system  | node101          | 192.168.1.101 |                 |       19317 | 2022-04-27 00:33:32.600138+08 |       | streaming | 0/41000938 | 0/41000938 | 0/41000938 | 0/41000938 |           |           |            |             0 | async  | 2022-04-27 15:05:25.079617+08
(1 row)

3、查看kingbase.auto.conf配置

[kingbase@node102 bin]$ cat ../data/kingbase.auto.conf
# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.
enable_upper_colname = 'on'
primary_conninfo = 'user=system connect_timeout=10 host=192.168.1.101 port=54321 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3 application_name=node102'
recovery_target_timeline = 'latest'
primary_slot_name = 'repmgr_slot_2'
wal_retrieve_retry_interval = '5000'
synchronous_standby_names = ''

标签:node102,V8R6,lsn,synchronous,sync,kingbase,keepalives,KingbaseES
来源: https://www.cnblogs.com/kingbase/p/16203364.html