The following postgres.auto.conf is from a slave server:
wal_level = 'replica' hot_standby = on hot_standby_feedback = 'on' primary_slot_name = 'stby1' max_connections = 636 primary_conninfo = 'host=pgserver01.oric.no port=5432 user=replicate password=mysecretpassword' promote_trigger_file = '/tmp/MasterNow'The master server may have a very simple postgres.auto.conf file:
# Do not edit this file manually! # It will be overwritten by the ALTER SYSTEM command. wal_level = 'replica'If the server is up, use queries:
1. On the primary server, check that data is shipped over to the replica server:
[postgres@pgserver01.oric.no /pgdata/data]$ echo 'select usename,state,sync_state,sync_priority,client_hostname from pg_stat_replication;' | psql usename | state | sync_state | sync_priority | client_hostname -----------+-----------+------------+---------------+-------------------------------- replicate | streaming | async | 0 | pgserver02.oric.no (1 row)2. The following query should return f (false) on primary server, t (true) on the replica server:
[postgres@pgserver01 /pgdata/data/log]$ echo "select pg_is_in_recovery();" | psql pg_is_in_recovery ------------------- f (1 row) [postgres@pgserver02 /pgdata/data/log]$ echo "select pg_is_in_recovery();" | psql pg_is_in_recovery ------------------- t (1 row)
No comments:
Post a Comment