Thread: a warm standby takes over, hot standby does not catch up
Recently, I crafted my site like this to achieve HA and load balancing:
----------------------
| Apache |
| | |
| read | ...... many of this
&nb sp; | | |
| V |
|postgresql READ ONLY|
----------------------
Λ
&nbs p; |
restore_command
|
-----------------
| WAL archive | actually I have two of this. Only one is depicted for simlicity.
-----------------
Λ &n bsp; |
| restore_command
archive_command |
| V
-------------------- --------------------------
|postgresql MASTER| |postgresql WARM STANDBY|
-------------------- --------------------------
I encounted a serious problem: if the MASTER crashes, and the WARM STANDBY takes over:
----------------------
| Apache |
| | |
| read | ......&nbs p; many of this
| | |
| V |
|postgresql READ ONLY|
----------------------
Λ
|
restore_command
|
-----------------
| WAL archive |
-----------------
; Λ
|
archive_command
|
------------------------------- -----------------------------------------
|postgresql former MASTER x_x| |postgresql former WARM STANDBY  ̄�� ̄|
------------------------------- -----------------------------------------
I noticed that the warm standby starts a new time line when it generate WAL archive in place of the former MASTER. BUT the read only ones do not know this change and insist on finding the next WAL file of the old time line.
So how do I notice the read only ones that they should switch to a new time line?
----------------------
| Apache |
| | |
| read | ...... many of this
&nb sp; | | |
| V |
|postgresql READ ONLY|
----------------------
Λ
&nbs p; |
restore_command
|
-----------------
| WAL archive | actually I have two of this. Only one is depicted for simlicity.
-----------------
Λ &n bsp; |
| restore_command
archive_command |
| V
-------------------- --------------------------
|postgresql MASTER| |postgresql WARM STANDBY|
-------------------- --------------------------
I encounted a serious problem: if the MASTER crashes, and the WARM STANDBY takes over:
----------------------
| Apache |
| | |
| read | ......&nbs p; many of this
| | |
| V |
|postgresql READ ONLY|
----------------------
Λ
|
restore_command
|
-----------------
| WAL archive |
-----------------
; Λ
|
archive_command
|
------------------------------- -----------------------------------------
|postgresql former MASTER x_x| |postgresql former WARM STANDBY  ̄�� ̄|
------------------------------- -----------------------------------------
I noticed that the warm standby starts a new time line when it generate WAL archive in place of the former MASTER. BUT the read only ones do not know this change and insist on finding the next WAL file of the old time line.
So how do I notice the read only ones that they should switch to a new time line?