<div>Hi,</div><div>&nbsp; &nbsp; &nbsp;Sometime I&nbsp; fail to activate the standby node&nbsp; as a new primary node when the old primary node is down&nbsp; by using the failover of pgpool-II.</div><div>&nbsp; &nbsp; &nbsp;I have 2 severs with centOS7,one for pgpool-II-4.0.0 and&nbsp; postgresql-11.0, the other for postgresql-11.0. I installed pgpool-II and postgresql by using sources.</div><div><br></div><div>&nbsp; &nbsp; As the following show,I have 2 nodes, pgsrv14 is the primary node and pgsrv13 is the standby node, for using streaming replication. And the pgpool-II is installed in pgsrv13 server.</div><div>&nbsp; &nbsp; &nbsp;[postgres@pgsrv13 replscript]$ psql -p 9999</div><div>psql (11.0)</div><div>Type "help" for help.</div><div><br></div><div>postgres=# show pool_nodes;</div><div>&nbsp;node_id | hostname | port | status | lb_weight |&nbsp; role&nbsp; &nbsp;| select_cnt | load_balance_node | replication_delay | last_status_change&nbsp;&nbsp;</div><div>---------+----------+------+--------+-----------+---------+------------+-------------------+-------------------+---------------------</div><div>&nbsp;0&nbsp; &nbsp; &nbsp; &nbsp;| pgsrv13&nbsp; | 5432 | up&nbsp; &nbsp; &nbsp;| 0.500000&nbsp; | standby | 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | true&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 2018-10-26 07:42:46</div><div>&nbsp;1&nbsp; &nbsp; &nbsp; &nbsp;| pgsrv14&nbsp; | 5432 | up&nbsp; &nbsp; &nbsp;| 0.500000&nbsp; | primary | 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | false&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 2018-10-26 07:41:15</div><div>(2 rows)</div><div>&nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; When I use the command "pg_ctl stop" to&nbsp; stop the database in pgsrv14£¬it should have activated the pgsrv13(the standby node) as a new primary node by executing failover.sh script.&nbsp; However, it failed.</div><div>&nbsp; &nbsp; &nbsp; I have specify 4 special characters in failover_command&nbsp; in pgpool.conf.</div><div><div>&nbsp; &nbsp; &nbsp; failover_command = '/usr/local/pgpool-4.0.0/replscript/failover.sh %d %h %P %H'</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Executes this command at failover</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Special values:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#&nbsp; &nbsp;%d = node id</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#&nbsp; &nbsp;%h = host name</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#&nbsp; &nbsp;%H = hostname of the new master node</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#&nbsp; &nbsp;%P = old primary node id</div></div><div><br></div><div>and the log of failover.sh said,</div><div>.......</div><div><div>failover.sh FALLING_NODE: 1; FALLING_HOST: pgsrv14; OLDPRIMARY_NODE: 1; NEW_PRIMARY: pgsrv13; at Fri Oct 26 07:43:06 EDT 2018&nbsp;</div><div>ssh -f -n -T postgres@pgsrv13 /usr/local/pgpool-4.0.0/replscript/promote.sh -d pgsrv14</div><div>failover done!&nbsp;</div><div><br></div><div>failover.sh FALLING_NODE: 0; FALLING_HOST: pgsrv13; OLDPRIMARY_NODE: 0; NEW_PRIMARY: ; at Fri Oct 26 07:43:11 EDT 2018&nbsp;</div><div>ssh -f -n -T postgres@ /usr/local/pgpool-4.0.0/replscript/promote.sh -d pgsrv13</div><div>failover done!&nbsp;</div></div><div>.......</div><div><br></div><div>the first paragraph in the log of failover.sh is proper, it correctly realize the falling node&nbsp; and old primary node is 1(pgsrv14) ,and new primary node is pgsrv13. And the result of command "select pg_is_in_recovery()" in pgsrv13 is 'f', which show that pgsrv13 is the primary node now and is alive.</div><div><br></div><div>However, because I can not execute the recovery command to recovery pgsrv14&nbsp; to a normal node in such a short period of time which is&nbsp; 5 seconds, the pgpool execute a second failover command,as the second paragreph show.But pgpool realize the falling node is pgsrv13 (pgsrv 13 is up and primary node actually)</div><div><br></div><div>when the second paragraph happened, pgpool.log said pgsrv13 was shutdown by adminstrative command(actually it was alive), and all db nodes are in down status,and&nbsp; pgpool set new primary node :-1, maybe this is the reason why the new_primary is null in the second paragraph.</div><div><br></div><div>that pgpool.log said,</div><div><div>Oct 26 07:43:11 pgsrv13 pgpool[3827]: [438-1] 2018-10-26 07:43:11: pid 3827: LOG:&nbsp; reading and processing packets</div><div>Oct 26 07:43:11 pgsrv13 pgpool[3827]: [438-2] 2018-10-26 07:43:11: pid 3827: <font color="#cc0000">DETAIL:&nbsp; postmaster on DB node 0 was shutdown by administrative command</font></div><div>Oct 26 07:43:11 pgsrv13 pgpool[3827]: [439-1] 2018-10-26 07:43:11: pid 3827: LOG:&nbsp; received degenerate backend request for node_id: 0 from pid [3827]</div><div>Oct 26 07:43:11 pgsrv13 pgpool[3036]: [467-1] 2018-10-26 07:43:11: pid 3036: LOG:&nbsp; Pgpool-II parent process has received failover request</div><div>Oct 26 07:43:11 pgsrv13 pgpool[3036]: [468-1] 2018-10-26 07:43:11: pid 3036: LOG:&nbsp; starting degeneration. shutdown host pgsrv13(5432)</div><div>Oct 26 07:43:11 pgsrv13 pgpool[3036]: [469-1] 2018-10-26 07:43:11: pid 3036: <font color="#cc0000">WARNING:&nbsp; All the DB nodes are in down status and skip writing status file.</font></div><div>Oct 26 07:43:11 pgsrv13 pgpool[3036]: [470-1] 2018-10-26 07:43:11: pid 3036: LOG:&nbsp; failover: no valid backend node found</div><div>Oct 26 07:43:11 pgsrv13 pgpool[3036]: [471-1] 2018-10-26 07:43:11: pid 3036: LOG:&nbsp; Restart all children</div><div>Oct 26 07:43:11 pgsrv13 pgpool[3036]: [472-1] 2018-10-26 07:43:11: pid 3036: LOG:&nbsp; execute command: /usr/local/pgpool-4.0.0/replscript/failover.sh 0 pgsrv13 0 ""</div><div>Oct 26 07:43:11 pgsrv13 pgpool[3036]: [473-1] 2018-10-26 07:43:11: pid 3036: LOG:&nbsp; find_primary_node_repeatedly: waiting for finding a primary node</div><div>Oct 26 07:48:11 pgsrv13 pgpool[3036]: [474-1] 2018-10-26 07:48:11: pid 3036: LOG:&nbsp; <span style="background-color: rgb(255, 255, 255);"><font color="#cc0000">failover: set new primary node: -1</font></span></div><div>Oct 26 07:48:11 pgsrv13 pgpool[4029]: [475-1] 2018-10-26 07:48:11: pid 4029: LOG:&nbsp; failback event detected</div><div>Oct 26 07:48:11 pgsrv13 pgpool[4029]: [475-2] 2018-10-26 07:48:11: pid 4029: DETAIL:&nbsp; restarting myself</div></div><div><br></div><div>I don't know what 's wrong! Any help is welcome, and I am glad to offer more information if it's helpful to solve the problem.</div><div>Thank you!</div><div><br></div><div id="">--------------------------------<br></div><div id="">Mandy&nbsp;</div><div id=""><br></div><div id=""><br></div><div id=""><br></div><div id=""><br></div><div id=""><br></div><div id=""><br></div><div id=""><br></div><div id=""><br></div>