Hey,
Using these steps to for archiving and HA:
Node1 : current master ...... Node2 : current standby
On master in (postgresql.conf):
archive_mode = on
archive_command = 'test ! -f /data/pgsql/archivedir/%f && cp %p /data/pgsql/archivedir/%f'
archive_timeout = 3600
Note : I sync /data/pgsql/archivedir/ between master and standby using rsync.
On standby in (recovery.conf):
standby_mode = 'on'
primary_conninfo = 'host=<MASTER IP> port=5432 user=replicationuser'
trigger_file = '/tmp/pg_failover_trigger'
restore_command = 'cp /data/pgsql/archivedir/%f %p'
recovery_target_timeline = 'latest'
So when a switchover happens,
Node1 = new standby ....... Node2 = new master.
On Node1 :
1. I stop postgres.
2. Update postgresql.conf to remove archiving settings.
3. Place recovery.conf in data cluster.
5. Forcefully sync /data/pgsql/archivedir/ from Node2. (To get 0000000x.history file in Node1 archives).
4. And restart postgres.
So Node1 comes up in Standby mode now.
It connects Streaming Replication with Node2.
But then breaks the SR connection giving above errors.
One doubt that i have is, that when Node1 comes up it has all the archives (including that it generated when Node1 was master) when it comes up in standby mode.
Is that a problem?
Please let me know the problem with this approach.
regards,
Prakhar.