1. 修改postgresql.conf
vim /var/lib/pgsql/9.3/data/postgresql.conf,修改以下内容:
wal_level = archivearchive_mode = on
archive_command = 'test ! -f /data/pgsql-9.3-backup/increament/%f && cp %p /data/pgsql-9.3-backup/increament/%f'
max_wal_senders = 4
wal_keep_segments = 4
2. 重启postgresql
service postgresql restart
3. 创建备份用户
su - postgresql
psql
db=>create role replicator login password 'password';
db=>alter role replicator replication;
4. 修改pg_hba.conf
vim /var/lib/pgsql/9.3/data/pg_hba.conf
增加一行:host replication replicator 127.0.0.1/32 md5
5. 得到基础备份
pg_basebackup -D basebackup -U replicator -P -x -R -Ft -z -h 127.0.0.1 -l 20150715