Postgresql Chained Slaves and Slave Promotion So I have a setup like Master -> Slave1 -> Slave2. Slave1 replicates from Master and Slave2 replicates from Slave1. If I promote Slave1 to master is it possible for Slave2 to continue replicating from Slave1. This the log I see on Slave2 after I promote Slave1 to master:

2014-06-13 04:28:11 UTC LOG:  replication terminated by primary server
2014-06-13 04:28:11 UTC DETAIL:  End of WAL reached on timeline 3 at 3E/62B2C758.
2014-06-13 04:28:11 UTC LOG:  fetching timeline history file for timeline 4 from primary server
2014-06-13 04:28:11 UTC LOG:  invalid record length at 3E/62B2C758
2014-06-13 04:28:11 UTC LOG:  restarted WAL streaming at 3E/62000000 on timeline 3
2014-06-13 04:28:11 UTC LOG:  replication terminated by primary server
2014-06-13 04:28:11 UTC DETAIL:  End of WAL reached on timeline 3 at 3E/62B2C758.
2014-06-13 04:28:16 UTC LOG:  restarted WAL streaming at 3E/62000000 on timeline 3
2014-06-13 04:28:16 UTC LOG:  replication terminated by primary server
You should be able to use recovery_target_timeline='latest' in your recovery.conf, as noted in the recovery target settings documentation

If you are on PostgreSQL 9.1 or 9.2 and using streaming replication, you'll need to have a WAL archive set up as well, if you want to have this continue automatically after failover, or as @amacvar mentioned, copy the necessary WAL segments over so that the replicas can continue streaming along the newer timelines.

In 9.3 and later, this happens without needing an additional WAL archive, because the timeline switch is now included in the replication stream. Michael Paquier details this behavior in his blog post timeline switch of slave node without archives