如下图所示:

集群数据同步原理说明:

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 | backend_xmin | state | sent_lsn | write_lsn | flush_lsn | replay_lsn | write_lag | flush_lag | replay_lag | sync_priority | sync_state | 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 | backend_xmin | state | sent_lsn | write_lsn | flush_lsn | replay_lsn | write_lag | flush_lag | replay_lag | sync_priority | sync_state | 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 = ''

最新文章

  1. 搭建emacs的go编程语言环境
  2. java使用split分隔,需要注意的点
  3. Markdown常用基本语法
  4. 安装faac编译问题
  5. 使用httputils上传图片到服务器
  6. Extjs4使用iframe注意事项
  7. [HttpClient]SSL双向实例
  8. 获取json对象的长度
  9. 容器 list
  10. C++习题 复数类--重载运算符2+
  11. C#发送邮件类
  12. jQuery与js的length属性
  13. Halcon的应用程序 打开后 弹出没有帮助文件错误提示
  14. 利用WSUS部署更新程序
  15. Vue 2.6 中部分引入 TypeScript 的方法
  16. Robot Framework 遇到过的错误 1. Chrome打开无法数据网址,地址栏只显示data:,
  17. Delphi Class of 类引用
  18. MySQL存储过程的异常处理
  19. spring boot2.03 spring cloud Finchley.RELEASE遇到的问题
  20. Python学习之web框架 Flask

热门文章

  1. 针对elementUI 中InfiniteScroll按需引入的一点注意事项
  2. 使用Vite2+TypeScript4+Vue3技术栈,如何入手开发项目
  3. MySQL-5-TCL,视图,变量,存储过程和函数,流程控制
  4. 设计模式-策略模式前端应用校验vue写法
  5. 158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能
  6. C#中的 Attribute 与 Python/TypeScript 中的装饰器是同个东西吗
  7. 我看谁还说程序员不会P图?拜托~4行python代码就够~
  8. idea控制台不能输入问题
  9. Spring框架系列(11) - Spring AOP实现原理详解之Cglib代理实现
  10. rxjava回调地狱-kotlin协程来帮忙