DOKK / manpages / debian 12 / pgpool2 / pcp_promote_node.1.en
PCP_PROMOTE_NODE(1) pgpool-II 4.3.5 Documentation PCP_PROMOTE_NODE(1)

pcp_promote_node - promotes the given node as new main to Pgpool-II

pcp_promote_node [options...] [node_id] [gracefully] [switchover]

pcp_promote_node promotes the given node as new primary to Pgpool-II. In streaming replication mode only. Please note that this command does not actually promote standby PostgreSQL backend unless switchover option is specified: it just changes the internal status of Pgpool-II and trigger failover and users have to promote standby PostgreSQL outside Pgpool-II.

If switchover is specified, Pgpool-II detaches current primary (changes the internal status to down) and execute the failover_command, with the new main node argument to be set to the specified node id. Because most failover scripts promote the new main node, the specified node will be the new primary node. The follow_primary_command is necessary to be set properly to turn the former primary into standby.

pcp_promote_node executes followings if switchover is not specified. Please be warned that if follow_primary_command is set, the command will be executed. It is a standard advice that you disable follow_primary_command before executing this command.

1.Change the status of standby PostgreSQL from standby to primary. It just changes the internal status of Pgpool-II and it does not actually promote PostgreSQL standby server.

2.Change the status of PostgreSQL node which is not specified by this command's argument to down. It just changes the internal status of Pgpool-II and it does not actually make PostgreSQL standby server down.

3.If follow_primary_command is set, execute follow_primary_command against PostgreSQL.

pcp_promote_node executes followings if switchover is specified. If follow_primary_command is set, the command will be executed. You need to set follow_primary_command before executing this command because failover script will create the new primary and other nodes need to be turned into standbys

1.Change the status of primary PostgreSQL from up to down. This triggers failover_command execution, with the new main node argument to be set to the specified node id. Because most failover scripts promote the new main node, the specified node will become the new primary node.

2.Change the status of standby PostgreSQL node which is not specified by this command's argument to down. It just changes the internal status of Pgpool-II and it does not actually make PostgreSQL standby server down.

3.If follow_primary_command is set, execute follow_primary_command against PostgreSQL.

-n node_id
--node-id=node_id

The index of backend node to promote as new main.

-g
--gracefully

Wait until all clients are disconnected (unless client_idle_limit_in_recovery is -1 or recovery_timeout is expired).

-s
--switchover

Let the specified node to be actually promoted by triggering the failover_command. Also change the current primary node status to down.

Other options

2023 pgpool-II 4.3.5