opengauss双region流式容灾搭建

2023年 10月 25日 70.7k 0

一、主备双集群部署

架构:主集群:一主一备;灾备集群:一主一备

1. 安装集群 1

主节点:192.168.0.141 备节点:192.168.0.145

xml 文件参考:

2. 安装集群 2

主节点:192.168.0.142 备节点:192.168.0.143

xml 文件参考:

3. 在主集群创建容灾用户

gsql -d postgres -p PORT -c "create user DR_USERNAME with replication password 'DR_PASSWORD';"

4. 将集群 1 启动为主集群

gs_sdr -t start -m primary -X XMLFILE [-U DR_USERNAME [-W DR_PASSWORD]] [--time-out=SECS]

5. 将集群 2 启动为备集群

gs_sdr -t start -m disaster_standby -U USER -W PASSWORD -X XMLFILE [-U DR_USERNAME [-W DR_PASSWORD]] [--time-out=SECS]

6. 查询

gs_sdr -t query

主集群:

备集群:

以上:

-U 容灾用户名,-W 容灾用户密码,为可选参数,如果未携带需要在搭建过程中交互输入;

–time-out 超时时间,为可选参数,默认为 1200 秒。

二、搭建容灾关系前后参数对比

1. 方案

搭建前后将流复制相关参数导入文件,使用 diff 对比

2. 步骤

gsql -p 26000 -d postgres -c "select name,reset_val from pg_settings where category ='Write-Ahead Log / Settings'">settings1.log
gsql -p 26000 -d postgres -c "select name,reset_val from pg_settings where category ='Write-Ahead Log / Checkpoints'" >>settings1.log
gsql -p 26000 -d postgres -c "select name,reset_val from pg_settings where category ='Replication / Sending Servers'" >>settings1.log
gsql -p 26000 -d postgres -c "select name,reset_val from pg_settings where category ='Resource usage / Recovery'" >>settings1.log
gsql -p 26000 -d postgres -c "select name,reset_val from pg_settings where category ='Replication / Master Server'" >>settings1.log
gsql -p 26000 -d postgres -c "select name,reset_val from pg_settings where category ='Replication / Standby Servers'" >>settings1.log

  1. 对比结果

< replconninfo1| localhost=192.168.0.141 localport=26001 localheartbeatport=26005 localservice=26004 remotehost=192.168.0.145 remoteport=26001 remoteheartbeatport=26005 remoteservice=26004
< replconninfo2|
< replconninfo3|

> replconninfo1| localhost=192.168.0.141 localport=26001 localheartbeatport=26005 localservice=26004 remotehost=192.168.0.145 remoteport=26001 remoteheartbeatport=26005 remoteservice=26004 iscascade=true iscrossregion=false
> replconninfo2| localhost=192.168.0.141 localport=26001 localheartbeatport=26005 localservice=26004 remotehost=192.168.0.142 remoteport=26001 remoteheartbeatport=26005 remoteservice=26004 iscascade=false iscrossregion=true
> replconninfo3| localhost=192.168.0.141 localport=26001 localheartbeatport=26005 localservice=26004 remotehost=192.168.0.143 remoteport=26001 remoteheartbeatport=26005 remoteservice=26004 iscascade=false iscrossregion=true

< wal_keep_segments | 16

> wal_keep_segments | 128

注:主集群搭建后 wal_keep_segments=128,备集群搭建后 wal_keep_segments=16

< most_available_sync | off

> most_available_sync | on

后(新增)

opgs1com/opgs2com

stream_cluster_run_mode = 'cluster_primary'

opgs3com/opgs4com

stream_cluster_run_mode = 'cluster_standby'

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论