[pgpool-general: 4840] Re: failover_command and follow_command does not exit and hangs indefinitely
Tatsuo Ishii
ishii at postgresql.org
Tue Aug 2 17:12:12 JST 2016
> 02.08.2016 09:44, Tatsuo Ishii пишет:
>>> On 02.08.2016 4:26, Tatsuo Ishii wrote:
>>>>> I'm trying to configure expandable cluster using Ubuntu 14.04 LTS,
>>>>> PostgreSQL 9.5 and PgPool 3.5.3.
>>>>> I'm having a problem with failover/follow commands: any command, be
>>>>> that
>>>>> ansible-playbook, ssh or anything else does not exit after successful
>>>>> run and hangs indefinitely, reacting only to "kill -9". Which, in
>>>>> case
>>>>> of failover script, makes pgpool running that command wait for it's
>>>>> exit
>>>>> and also to hang.
>>>>> My current workaround is forking script, running a command in the new
>>>>> fork, and terminate it after successful execution. Obviously, its not
>>>>> a
>>>>> viable production solution.
>>>>> Please help me undestand, why is this happening?
>>>> I guess your fail over script is waiting for stdin/stdout/stderr
>>>> closed?
>>> I dont exactly know, that's why i'm asking. Right now i'm having a
>>> problem with ansible-playbook and ssh.
>> Without seeing the fail over script, I can't tell. Can you share the
>> fail over script you created?
>>
>
> Yes, i'm attaching script to this message.
I'm not familiar with Python but I guess at leat you should redirect
stdin and stdout to /dev/null for this ssh. Pgpool-II executes fail
over command by using system(3).
promote_command = ssh + 'postgres@' + pgnodemaster + ' /usr/bin/repmgr standby promote'
follow_command = ssh + 'postgres@' + sys.argv[2] + ' /usr/bin/repmgr standby follow'
To do that, see this page for example:
http://stackoverflow.com/questions/1628204/how-to-run-a-command-in-background-using-ssh-and-detach-the-session
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