Connect to the primary server and execute:
ltcluster=# SELECT * FROM pg_stat_replication;
-[ RECORD 1 ]----+------------------------------
pid | 19111
usesysid | 16384
usename | ltcluster
application_name | node2
client_addr | 192.168.1.12
client_hostname |
client_port | 50378
backend_start | 2017-08-28 15:14:19.851581+09
backend_xmin |
state | streaming
sent_location | 0/7000318
write_location | 0/7000318
flush_location | 0/7000318
replay_location | 0/7000318
sync_priority | 0
sync_state | async
This shows that the previously cloned standby (node2 shown in the field
application_name) has connected to the primary from IP address
192.168.1.12.
From LightDB 21 you can also use the view
pg_stat_wal_receiver to check the replication status from the standby.
ltcluster=# SELECT * FROM pg_stat_wal_receiver;
Expanded display is on.
-[ RECORD 1 ]---------+--------------------------------------------------------------------------------
pid | 18236
status | streaming
receive_start_lsn | 0/3000000
receive_start_tli | 1
received_lsn | 0/7000538
received_tli | 1
last_msg_send_time | 2017-08-28 15:21:26.465728+09
last_msg_receipt_time | 2017-08-28 15:21:26.465774+09
latest_end_lsn | 0/7000538
latest_end_time | 2017-08-28 15:20:56.418735+09
slot_name |
sender_host | node1
sender_port | 5432
conninfo | user=ltcluster dbname=replication host=node1 application_name=node2
Note that the conninfo value is that generated in recovery.conf
and will differ slightly from the primary's conninfo as set in ltcluster.conf -
among others it will contain the connecting node's name as application_name.