Discussion:
Postgresql switch over process
(too old to reply)
Shams Khan
2012-10-17 19:20:09 UTC
Permalink
Can somebody tell me how we can automate the switch over process, I
know there is once file recovery.conf which contains the parameter
trigger_file. But my question is what code that file contains....Hope
my thinking is correct.
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Bill MacArthur
2012-10-17 19:48:37 UTC
Permalink
Post by Shams Khan
Can somebody tell me how we can automate the switch over process, I
know there is once file recovery.conf which contains the parameter
trigger_file. But my question is what code that file contains....Hope
my thinking is correct.
The trigger file itself contains nothing. You can simply create an empty file when it's needed. You can use 'touch' in linux. The server will see that it has appeared and do what it needs to do from there.

Bill MacArthur
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Albe Laurenz
2012-10-18 08:10:57 UTC
Permalink
Post by Shams Khan
Can somebody tell me how we can automate the switch over process, I
know there is once file recovery.conf which contains the parameter
trigger_file. But my question is what code that file contains....Hope
my thinking is correct.
The contents of the trigger file are irrelevant, it is just a
switch: the existence of the file tells the standby to stop
recovering.

To automate failover, you need some cluster software.
It is a nontrivial problem to detect if the primary really
went down. You can't have the standby make this decision
by itself -- it could be that it is the standby that has a problem
that keeps it from seeing the primary.
Moreover, you should have a way to deactivate the old primary
when you fail over, otherwise you might end up with two
servers who both think that they are the active one.

Yours,
Laurenz Albe
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Loading...