[pgpool-general: 4133] Re: Testing pgpool + failover on random servers restarts
Tatsuo Ishii
ishii at postgresql.org
Thu Oct 22 09:18:20 JST 2015
> Hello,
>
> Sorry for late reply on this issue, I've been busy with other tasks.
>
> On Fri, Oct 16, 2015 at 7:05 PM, Tatsuo Ishii <ishii at postgresql.org> wrote:
>
>>
>> > Is there a way I
>> > could overcome this issue? I thought I could update the pgpool status
>> file
>> > in /var/log/pgpool in my scripts once a failover occurs. Would that be
>> the
>> > way to go or there are better ways to fix this?
>>
>> The situation above heavily relies on how you wrote pgpool_failover.sh
>> and pgpool_failback.sh. Also you'd better present how you start
>> pgpool. The point here is, you use -D or not.
>>
>>
> I start pgpool using the /etc/init.d/pgpool-II script:
>
> PGPOOL2_BIN=/usr/sbin/pgpool
> test -x $PGPOOL2_BIN || { echo "$PGPOOL2_BIN not installed";
> if [ "$1" = "stop" ]; then exit 0;
> else exit 5; fi; }
>
> # Check for existence of needed config file and read it
> PGPOOL2_CONFIG=/etc/sysconfig/pgpool-II
> test -r $PGPOOL2_CONFIG || { echo "$PGPOOL2_CONFIG not existing";
> if [ "$1" = "stop" ]; then exit 0;
> else exit 6; fi; }
>
> # Read config
> . $PGPOOL2_CONFIG
> PGPOOL2_CONFFILE="/etc/pgpool-II/pgpool.conf"
> PGPOOL2_PID="/var/run/pgpool/pgpool.pid"
>
> ...
>
> start)
> echo -n "Starting pgpool "
> ## Start daemon with startproc(8). If this fails
> ## the return value is set appropriately by startproc.
> /sbin/startproc -u pgpool -g pgpool $PGPOOL2_BIN
>
> # Remember status and be verbose
> rc_status -v
> sleep 1
Please show us "stop)" part as well.
> and this is my failover script:
>
> #!/bin/sh
>
> crt_date=`date`
> echo "$crt_date : old master id=$1 new master id=$2 new master host=$3" >>
> ${log_file}
>
> old_master_id=$1
> new_master_id=$2
> new_master_host=$3
>
> if [ ${old_master_id} -ne ${new_master_id} ]
> then
> ssh root@${new_master_host}
> "/cbnDBscripts/DBCluster/dbcluster_promote_as_primary.sh" >
> /cbnDBscripts/log/pgpool_failover_${new_master_host}.log
> else
> ssh root@${new_master_host}
> "/cbnDBscripts/DBCluster/dbcluster_standby_failed.sh" >
> /cbnDBscripts/log/pgpool_failover_slave_${new_master_host}.log
> fi
Can you show me dbcluster_promote_as_primary.sh and dbcluster_standby_failed.sh?
Also it seems failback.sh is missing.
Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
More information about the pgpool-general
mailing list