[pgpool-general: 4841] Re: failover_command and follow_command does not exit and hangs indefinitely

Tema Zelikin gunslinger at nightflame.info
Tue Aug 2 17:16:56 JST 2016


02.08.2016 11:12, Tatsuo Ishii пишет:
>> 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
>
But then, how would i know that command has finished its run?


More information about the pgpool-general mailing list