Postgresql 异步流复制
发布时间:2020-12-13 17:05:05 所属栏目:百科 来源:网络整理
导读:压力测试环境 version:Postgresql 9.5.2 OS: CentOS 6.5 Source Code: Postgresql9.5.2 172.31.107.30 primary 172.31.107.32 slave 172.31.107.31 slave 开启 防火墙端口 iptables -I INPUT -p tcp --dport 5432 -j ACCEPT Primary 添加 环境变量 echo 'P
压力测试环境
version:Postgresql 9.5.2
OS:
CentOS 6.5
Source Code: Postgresql9.5.2
172.31.107.30 primary
172.31.107.32 slave
172.31.107.31 slave
开启 防火墙端口
iptables -I INPUT -p tcp --dport 5432 -j ACCEPT
Primary
echo 'PATH=$PATH:/usr/local/postgresql/bin' >> /etc/profile
echo 'PGDATA=/usr/local/postgresql/data' >> /etc/profile
source /etc/profile#使其生效
host all all 172.31.107.31/24 trust
host all all 172.31.107.32/24 trust
host all all 172.29.10.250/16 trust
host all all 172.28.10.250/16 trust
host replication postgres 172.31.107.31/24 trust
host replication replUser 172.31.107.31/24 trust
host replication postgres 172.31.107.32/24 trust
host replication replUser 172.31.107.32/24 trust
listen_addresses = '*'
port = 5432
max_connections = 900
wal_level = hot_standby
fsync = on
synchronous_commit = on
wal_sync_method = fsync
checkpoint_segments = 3
checkpoint_timeout = 5min
max_wal_senders = 2
wal_keep_segments = 3
wal_sender_timeout = 60s
max_replication_slots =2
shell>su - postgres
pg_ctl -D $PGDATA start
增加一个 同步复制数据专用账号 (本案例使用的是postgres账号)
create user replUser REPLICATION LOGIN CONNECTION LIMIT 3 ENCRYPTED PASSWORD 'replUserfxiaoke2016';
Slave
pg_basebackup -D $PGDATA -F p -h 172.31.107.30 -p 5432 -U postgres -W
注:9.1版本以前在做该 过程前 登录 primary
做 selec pg_start_backup('Replition work');
拷贝完毕后
select pg_stop_backup();
9.1版本以后由于提供了 pg_basebackup 工具 可以跳过该环节。
pg_ctl -D $PGDATA start
登录 Primary
验证是否为 异步流复制 方式
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读