Master-slave failover question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Master-slave failover question

Sameer Kumar

On Wed, Jan 8, 2014 at 3:58 PM, Jayadevan <[hidden email]> wrote:
Sameer Kumar wrote
>  Am I missing something here? or some mode of pgpool which I am not aware
> of?

I thought you were mentioning split-brain for PostgreSQL. For pgpool, I am
using virtual IP. Somehow I got the message that the split-brain/virtual IPs
in your mail were with reference to PostgreSQL servers.

It is. Once pgpool faces a split-brain scenario, it will pass on the same knowledge to respective PostgreSQL nodes. Try it out, the pull the network cable or bring down your router [don't do it in your production :-) ] then check you logs on both database, check your pgpool logs. You will know what I am talking about.

 



--
View this message in context: http://postgresql.1045698.n5.nabble.com/Master-slave-failover-question-tp5785199p5785816.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


--
Sent via pgsql-novice mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Reply | Threaded
Open this post in threaded view
|

Re: Master-slave failover question

Sameer Kumar
In reply to this post by Sameer Kumar
I am not sure if this is still relevant for the person posting the question. But I guess this can benefit others who browse through the archives looking for a similar solution. Here is a link to a nice tutorial with pgpool:



Though it looks like the pgpool in this tutorial is running on a different server (and hence pgpool becomes a single point of failure). 
Reply | Threaded
Open this post in threaded view
|

Re: Master-slave failover question

gurunadh.venkata@gmail.com
In reply to this post by Sameer Kumar
Hi all,

I have setup the load balancing and failover for High Availability in pgpool. I
 have used the Master-slave replication(stream mode).

 DB version PPAS 9.4AS(EnterpriseDB)

 pgpool   version 3.3.4

 The following is my failover command in pgpool.conf

 failover_command ='/usr/local/etc/failover.sh %d %P %H
 %R'

 Following is the failover script.

 #!/bin/bash -x
 FALLING_NODE=$1         # %d
 OLDPRIMARY_NODE=$2      # %P
 NEW_PRIMARY=$3          # %H
 PGDATA=$4               # %R

 if [ $FALLING_NODE = $OLDPRIMARY_NODE ]; then
     if [ $UID -eq 0 ]
     then
         su enterprisedb -c "ssh -T enterprisedb@$NEW_PRIMARY touch
 $PGDATA/trigger"
     else
         ssh -T enterprisedb@$NEW_PRIMARY touch $PGDATA/trigger
     fi
     exit 0;
 fi;
 exit 0;

 To check the  failover scenario i have stopped(kill -9) the master db
 server process.According to the script the present salve will take over the
 role of master. But the same was not happening in my case.

From pgpool end

 show pool_nodes;

 o/p:

 edb=# show pool_nodes;
  node_id |  hostname  | port | status | lb_weight |  role
 ---------+------------+------+--------+-----------+---------
  0       | 10.0.0.149 | 5444 | 3      | 0.500000  | standby
  1       | 10.0.0.158 | 5444 | 2      | 0.500000  | standby
 (2 rows)


 Please help me in Fixing this Issue.Provide me the failover script which is working correctly.

 Thanks for your time.
12