标签:prim cat int receiver inter ati 编辑 man 创建
1.创建复制用户:2.编辑recovery文件:
cat /pgdata/10/data/recovery.conf
standby_mode = ‘on‘
primary_conninfo = ‘host=192.168.56.202 port=5432 user=postgres application_name=db3 user=repl password=repl keepalives_idle=60 keepalives_interval=5 keepalives_count=5‘
restore_command = ‘‘
recovery_target_timeline = ‘latest‘
3.在db3上执行,ip:192.168.56.203:
pg_basebackup -D /pgdata/10/data -F p -X stream -h 192.168.56.202 -p 5432 -U repl
4.启动数据库:
pg_ctl start
5.
主库检查复制状态:
select * from pg_stat_replication;
备库:
ps -ef |grep postgres |grep receiver
主库:
ps -ef |grep postgres |grep sender
备注:
如果使用pha4pgsql,检查登录分布式事务,保证无密码可以登录:
psql -U postgres -h 10.11.55.31 -p 5432 -d postgres
标签:prim cat int receiver inter ati 编辑 man 创建
原文地址:http://blog.51cto.com/1937519/2343857