The parent directory is:node
/Users/tom
two folders:sql
testdb113-->master node testdb113b->slave node
mkdir testdb113 initdb -D ./testdb113 pg_ctl -D ./testdb113 start
mkdir testdb113b pg_basebackup -D ./testdb113b chmod -R 700 ./testdb113b
CREATE ROLE replicauser WITH REPLICATION LOGIN ENCRYPTED PASSWORD 'abcdtest';
master:app
mkdir ./testdb113/archive
master: postgresql.confpost
wal_level = replica synchronous_commit = remote_apply archive_mode = on archive_command = 'cp %p /Users/tom/testdb113/archive/%f' max_wal_senders = 2 wal_keep_segments = 10 synchronous_standby_names = 'pgslave001'
master: pg_hba.confrest
host replication replicauser 127.0.0.1/32 md5 host replication replicauser ::1/128 md5
standby: postgresql.confpostgresql
port = 6432 hot_standby = on
standby: recovery.confcode
standby_mode = 'on' primary_conninfo = 'host=localhost port=5432 user=replicauser password=abcdtest application_name=pgslave001' restore_command = 'cp /Users/tom/testdb113/archive/%f %p' trigger_file = '/tmp/postgresql.trigger.6432'
pg_ctl -D ./testdb113 restart
pg_ctl -D ./testdb113b start
create table test ( id int, name varchar(100)); insert into test values(1,'Tom');
select * from test;