pg版本:11.7
version:1.0发布节点:192.168.232.20
订阅节点:192.168.232.21
#发布节点调整参数:
[postgres@rhel6wcb data]$ more postgresql.conf | grep wal_level
wal_level = logical # minimal, replica, or logical
[postgres@rhel6wcb data]$ more postgresql.conf | grep max_replication_slots
max_replication_slots = 8 # max number of replication slots
#订阅节点调整参数:
[postgres@rhel6wcb data]$ more postgresql.conf |grep max_replication_slots
max_replication_slots = 8 # max number of replication slots
[postgres@rhel6wcb data]$ more postgresql.conf |grep max_logical_replication
max_logical_replication_workers = 8 # taken from max_worker_processes
#max_sync_workers_per_subscription = 2 # taken from max_logical_replication_workers
#发布节点创建逻辑复制用户:
postgres@postgres=>\c test
You are now connected to database "test" as user "postgres".
postgres@test=>create user logical_user replication login connection limit 8 encrypted password 'logical_user';
CREATE ROLE
postgres@test
postgres@test=>create table t_lr1(id int4,name text);
CREATE TABLE
postgres@test=>insert into t_lr1 values (1,'a');
INSERT 0 1
postgres@test=>create publication pub1 for table t_lr1;
CREATE PUBLICATION
postgres@test=>select * from pg_publication;
pubname | pubowner | puballtables | pubinsert | pubupdate | pubdelete | pubtruncate
---------+----------+--------------+-----------+-----------+-----------+-------------
pub1 | 10 | f | t | t | t | t
(1 row)