Обсуждение: How to get current timeline of host in postgres 10.4?
HI
Can someone let me know what is the best way to get current timeline of host (in both master and the slaves) in postgres 10.4?
Thanks,
Hi Debraj,
From master:
pg_xlogfile_name -- right!
From standby:
using replication prtotocol (example from version 92)
psql -h "$host" -F' ' -c 'IDENTIFY_SYSTEM' 'dbname=replication replication=true'
Hope it helps.
Regards,
Pavan
On Fri, Jun 15, 2018, 9:36 PM Debraj Manna <subharaj.manna@gmail.com> wrote:
HICan someone let me know what is the best way to get current timeline of host (in both master and the slaves) in postgres 10.4?Thanks,
Hi Debraj,
Execute below query on Master Side :
select pg_current_wal_lsn();
Execute below query on Slave Side:
using replication protocol (example from version 10.4)
psql -h "$host" -F' ' -c 'IDENTIFY_SYSTEM' 'dbname=replication replication=true'
select pg_current_wal_lsn();
Execute below query on Slave Side:
using replication protocol (example from version 10.4)
psql -h "$host" -F' ' -c 'IDENTIFY_SYSTEM' 'dbname=replication replication=true'
Hope it helps.
On Fri, Jun 15, 2018 at 9:35 PM, Debraj Manna <subharaj.manna@gmail.com> wrote:
HICan someone let me know what is the best way to get current timeline of host (in both master and the slaves) in postgres 10.4?Thanks,
Hi Shreeyansh
I have executed the below query on master. But it is giving output like below
postgres=# select pg_current_wal_lsn();
pg_current_wal_lsn
--------------------
0/4B17D198
(1 row)
In slave side it is saying timeline 6
ubuntu@platform1:~$ psql -h "localhost" -F' ' -c 'IDENTIFY_SYSTEM' 'dbname=replication replication=true' -U postgres
systemid | timeline | xlogpos | dbname
---------------------+----------+------------+--------
6567260231287314481 | 6 | 0/4B1786E0 |
How can I get the timeline from the output of the query in master?
On Fri, Jun 15, 2018 at 9:57 PM, Shreeyansh Dba <shreeyansh2014@gmail.com> wrote:
Hi Debraj,Execute below query on Master Side :
select pg_current_wal_lsn();
Execute below query on Slave Side:
using replication protocol (example from version 10.4)
psql -h "$host" -F' ' -c 'IDENTIFY_SYSTEM' 'dbname=replication replication=true'Hope it helps.On Fri, Jun 15, 2018 at 9:35 PM, Debraj Manna <subharaj.manna@gmail.com> wrote:HICan someone let me know what is the best way to get current timeline of host (in both master and the slaves) in postgres 10.4?Thanks,
Shreeyansh,
Given the LSN you can get the filename which has the timeline encoded in it.
(Can only get the filename on master)
> select substring(pg_walfile_name(pg_current_wal_lsn()), 1, 8);
substring
-----------
00000002
Other options (works on both master/slave):
# pg_control_data | grep -i TimeLine
Or
Just use the same method on the you used on slave on the master.
psql -h "localhost" -F' ' -c 'IDENTIFY_SYSTEM' 'dbname=replication replication=true' -U postgres
On Jun 15, 2018, at 12:41 PM, Debraj Manna <subharaj.manna@gmail.com> wrote:Hi ShreeyanshI have executed the below query on master. But it is giving output like belowpostgres=# select pg_current_wal_lsn();pg_current_wal_lsn--------------------0/4B17D198(1 row)In slave side it is saying timeline 6ubuntu@platform1:~$ psql -h "localhost" -F' ' -c 'IDENTIFY_SYSTEM' 'dbname=replication replication=true' -U postgressystemid | timeline | xlogpos | dbname---------------------+----------+------------+--------6567260231287314481 | 6 | 0/4B1786E0 |How can I get the timeline from the output of the query in master?On Fri, Jun 15, 2018 at 9:57 PM, Shreeyansh Dba <shreeyansh2014@gmail.com> wrote:Hi Debraj,Execute below query on Master Side :
select pg_current_wal_lsn();
Execute below query on Slave Side:
using replication protocol (example from version 10.4)
psql -h "$host" -F' ' -c 'IDENTIFY_SYSTEM' 'dbname=replication replication=true'Hope it helps.On Fri, Jun 15, 2018 at 9:35 PM, Debraj Manna <subharaj.manna@gmail.com> wrote:HICan someone let me know what is the best way to get current timeline of host (in both master and the slaves) in postgres 10.4?Thanks,