I need some info about master server details like (master-host, master-port, etc..) from the standby server in master-slave replication in PostgreSQL version 9.0.
I have found a solution regarding the master details above version 9.6, by using the pg_stat_wal_receiver() view. In this view
, there is a column named conninfo
which gives the info of master/primary server in a replication setup. In the same way, I need to know whether there is any possibility to find master details from the standby server in Postgres version 9.0
postgres=# select * from pg_stat_wal_receiver;
-[ RECORD 1 ]---------+---------------------------------------------------------
--------------------------------------------------------------------------------
-------------------------------------------------------------
pid | 24824
status | streaming
receive_start_lsn | 0/E000000
receive_start_tli | 1
received_lsn | 0/E000060
received_tli | 1
last_msg_send_time | 2019-03-25 19:47:45.032121+05:30
last_msg_receipt_time | 2019-03-25 22:28:14.007002+05:30
latest_end_lsn | 0/E000060
latest_end_time | 2019-03-25 19:46:44.890244+05:30
slot_name |
conninfo | user=replication password=******** dbname=replication ho
st=172.21.166.68 port=5432 fallback_application_name=walreceiver sslmode=prefer
sslcompression=1 krbsrvname=postgres target_session_attrs=any
There is no way to find that information using SQL. You can use tools like lsof
on the WAL receiver process or read the recovery.conf
file.
One thing you can try is to use pg_read_file
on recovery.conf
, if that function exists in 9.0, and parse the output. But that solution is fragile and ugly as hell.
Really, you should upgrade.