PCP_PROMOTE_NODE(1)

πŸ’– PCP_PROMOTE_NODE(1) β€” the glow-up guide πŸ’–

okay bestie, welcome to the pgpool-II 4.7.2 docs, page one and only: pcp_promote_node. she's giving main character energy and she's here to hand out promotions πŸ’…


✨ NAME ✨

pcp_promote_node β€” promotes the given node as new main to Pgpool-II 🫢


🌸 SYNOPSIS 🌸

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, pcp_promote_node promotes the given node as new primary to Pgpool-II. streaming replication mode only, no exceptions bestie. and here's the tea: this command does not actually promote the standby PostgreSQL backend unless the switchover option is specified. it just changes the internal status of Pgpool-II and triggers a failover, and you (yes, you) have to promote standby PostgreSQL outside of Pgpool-II. ik ik, rude. 😭

If switchover is specified, Pgpool-II detaches the current primary (changes the internal status to down) and executes the failover_command, with the new main node argument set to the specified node id. Because most failover scripts promote the new main node, the specified node will be the new primary node. and the follow_primary_command is necessary to be set properly to turn the former primary into a standby. no cutting corners on that one. πŸ‘‘

pcp_promote_node executes the following if switchover is not specified. pleaseeee be warned that if follow_primary_command is set, the command will be executed. it is standard advice that you disable follow_primary_command before executing this command. like, genuinely, do that. πŸ™ˆ

  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 the PostgreSQL standby server. (so it's giving promotion, but it's not actually a promotion, iykyk)
  2. Change the status of the 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 the PostgreSQL standby server down.
  3. If follow_primary_command is set, execute follow_primary_command against PostgreSQL.

pcp_promote_node executes the following 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 the failover script will create the new primary and other nodes need to be turned into standbys. periodt. πŸ’…

  1. Change the status of primary PostgreSQL from up to down. This triggers failover_command execution, with the new main node argument set to the specified node id. Because most failover scripts promote the new main node, the specified node will become the new primary node. slay. ⭐
  2. Change the status of the 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 the PostgreSQL standby server down.
  3. If follow_primary_command is set, execute follow_primary_command against PostgreSQL.

πŸŽ€ OPTIONS πŸŽ€

  • -n node_id, --node-id=node_id β€” the index of the backend node to promote as new main. the specified node must be in "up" or "waiting" status. no dusty nodes allowed bestie, she has to be ready. πŸ”₯
  • -g, --gracefully β€” wait until all clients are disconnected (unless client_idle_limit_in_recovery is -1 or recovery_timeout is expired). so patient of her honestly 🧚
  • -s, --switchover β€” let the specified node be actually promoted by triggering the failover_command. Also changes the current primary node status to down. this is the one that ACTUALLY does the thing πŸ’€
  • Other options β€” See pcp_common_options(1). go read that one too, she's cute 🌈

⚠️ reminder bestie: without -s/--switchover, nothing on the PostgreSQL side actually happens β€” it's all Pgpool-II internal status changes. don't get caught lacking. πŸ’œ

okay that's the whole page, you ate it, no cap. this was pgpool-II 4.7.2 documentation, dropped in 2023, and it's literally iconic. go promote a node responsibly πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from