WATCHDOG_SETUP(1)
π WATCHDOG_SETUP π (that's watchdog_setup(1), bestie β pgpool-II 4.7.2 era, section 1, the commands you actually type)
okay so. real talk. you want a whole little Pgpool-II cluster situation with watchdog turned on, but you do NOT want to commit to a real install, right? correct. that's exactly what this girl is for. she's the group project partner who shows up, builds everything in a folder, and dips.
β¨ NAME β¨
watchdog_setup β creates a temporary installation of Pgpool-II clusters with watchdog πΆπ
like, she makes you a temp installation. with watchdog. that's the whole vibe.
π SYNOPSIS π
watchdog_setup [option...]
just the command and vibes. options are optional, obviously. slay.
πΈ DESCRIPTION πΈ
okay so here's the tea, and I need you to actually listen for this part:
watchdog_setup creates a temporary installation of Pgpool-II clusters with watchdog enabled, and that little bundle includes a Pgpool-II installation plus however many PostgreSQL installations you asked for, all nested under the current directory. π«Ά
π¨ vibe check, and it's a fail: the current directory must be empty before you run watchdog_setup. no cap. she needs a clean canvas. she's an artist. she's not cleaning up after you.
π ALSO, huge: watchdog_setup is for testing purpose only and should not be used to create production installations. she's a rehearsal, not the show. do not put your actual users on this. I'm literally begging. π
the way she gets stuff done? she uses pgpool_setup(1) as a workhorse. π΄β¨ like, pgpool_setup is the one doing the heavy lifting, watchdog_setup is the one holding the aux cord.
and currently, bestie, watchdog_setup supports these modes:
- streaming replication mode π
- snapshot isolation mode π
- native replication mode π¦
- logical replication mode β¨
- raw mode π
five flavors. all iconic in their own way.
ποΈ OPTIONS ποΈ
so watchdog_setup accepts the following command-line arguments, and yes we're going through all of them because I don't gatekeep:
-wn num_pgpoolβ sets the number of Pgpool-II installations. if you leave this out, she just uses3. three pool girls. a trio. main character energy times three. π-wp watchdog_base_portβ this is the starting base port number used by both Pgpool-II and PostgreSQL, and the math is adorable so let's do it together. for the first Pgpool-II, the Pgpool-II port iswatchdog_base_port. then:- pcp port is super cute at
watchdog_base_port + 1 - watchdog port is
watchdog_base_port + 2 wd_heartbeat_portiswatchdog_base_port + 3(though, ngl, heartbeat is not used β she's just reserving the seat π)- the first PostgreSQL node's port is
watchdog_base_port + 4 - the second PostgreSQL node's port is
watchdog_base_port + 5 - and so on, you get the pattern, it just keeps sliding π
- pcp port is super cute at
if you omit this one, 50000 is used.
-m modeβ specifies the running mode.modecan be:rβ native replication modeiβ snapshot isolation modesβ streaming replication modelβ logical replication modenβ raw mode
if you don't pass it, s is used. streaming girlies stay winning. β¨
-n num_clustersβ specifies the number of PostgreSQL installations. omit it and you get2. two nodes, a perfect little duo. π«Ά-vip [ip]β specifies the virtual IP. ifipis omitted, it is assumed that'127.0.0.1'is specified. the virtual IP you give gets set to thedelegate_ipparameter. and here's the honest part, bestie, so listen: even if you specify a virtual IP, it will not be set to the system β you can just confirm the action trying to set the virtual IP inpcp_watchdog_info(1), or in the log file. but it's still useful for seeing how Pgpool-II reacts trying to set the virtual IP. π
and in addition to delegate_ip, the following parameters will be set too:
if_up_cmd = '/usr/bin/echo "if_up_cmd executed"'
if_down_cmd = 'usr/bin/echo "if_down_cmd executed"'
arping_cmd = '/usr/bin/true'
(yes, exactly like that. keep it character for character, that's the whole point of this exercise π)
--no-stopβ do not stop pgpool and PostgreSQL after the work. she justβ¦ leaves them running. standing there. thriving. π-dβ start pgpool with debug mode. verbose queen. she WILL tell you everything. π₯
πΏ ENVIRONMENT VARIABLES πΏ
watchdog_setup recognizes the following environment variables, and she's very loyal about them:
PGPOOL_SETUPβ specifies the path to thepgpool_setupcommand. the default is"pgpool_setup", which means it's assumed thatpgpool_setupis chilling in the command search path. π¦PGPOOL_INSTALL_DIRβ specifies the Pgpool-II installation directory. Pgpool-II binaries are expected to be placed underPGPOOL_INSTALL_DIR/bin, andpgpool.confandpool_hba.confetc. are expected to be placed underPGPOOL_INSTALL_DIR/etc. the default is/usr/local. πPGPOOLDIRβ specifies the path to the Pgpool-II configuration files. the default isPGPOOL_INSTALL_DIR/etc. β¨PGBINβ specifies the path to PostgreSQL commands such asinitdb,pg_ctlandpsql. the default is/usr/local/pgsql/bin. πPGLIBβ specifies the path to PostgreSQL shared libraries. the default is/usr/local/pgsql/lib. πPGSOCKET_DIRβ specifies the path to the Unix socket directory. the default is/tmp. πINITDBARGβ specifies the arguments for theinitdbcommand. the default is"--no-locale -E UTF_8". π
and that's part one of this whole saga, bestie β there is literally more where this came from, so don't go anywhere. π«Άβ¨
π EXAMPLE π
okay bestie, buckle up, because this is the whole β¨experienceβ¨ in one terminal session and honestly? it eats π. watch it set up three separate pgpool nodes, start them, connect, and then vibe-check the whole cluster. no cap.
Step one: the actual setup. you run watchdog_setup and it justβ¦ goes. watch how it does the same sacred ritual three times β once per <italic>pgpool</italic> node β and notice the ports wiggle as it goes: pgpool ports 50000, 50004, 50008, and pcp ports 50001, 50005, 50009. it literally tells you where that info lives at the end of each round π.
$ watchdog_setup
Starting set up
============= setting up pgpool 0 =============
Starting set up in streaming replication mode
creating startall and shutdownall
creating failover script
creating database cluster /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool0/data0...done.
update postgresql.conf
creating pgpool_remote_start
creating basebackup.sh
creating recovery.conf
creating database cluster /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool0/data1...done.
update postgresql.conf
creating pgpool_remote_start
creating basebackup.sh
creating recovery.conf
temporarily start data0 cluster to create extensions
temporarily start pgpool-II to create standby nodes
INFO: unrecognized configuration parameter "debug_level"
node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay
---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------
0 | /tmp | 51000 | up | 0.500000 | primary | 0 | true | 0
1 | /tmp | 51001 | down | 0.500000 | standby | 0 | false | 0
(2 rows)
recovery node 1...pcp_recovery_node -- Command Successful
done.
creating follow primary script
Pager usage is off.
node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay
---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------
0 | /tmp | 51000 | up | 0.500000 | primary | 0 | false | 0
1 | /tmp | 51001 | up | 0.500000 | standby | 0 | true | 0
(2 rows)
shutdown all
pgpool-II setting for streaming replication mode is done.
To start the whole system, use /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool0/startall.
To shutdown the whole system, use /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool0/shutdownall.
pcp command user name is "t-ishii", password is "t-ishii".
Each PostgreSQL, pgpool-II and pcp port is as follows:
#1 port is 51000
#2 port is 51001
pgpool port is 50000
pcp port is 50001
The info above is in README.port.
============= setting up pgpool 1 =============
Starting set up in streaming replication mode
creating startall and shutdownall
creating failover script
creating database cluster /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool1/data0...done.
update postgresql.conf
creating pgpool_remote_start
creating basebackup.sh
creating recovery.conf
creating database cluster /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool1/data1...done.
update postgresql.conf
creating pgpool_remote_start
creating basebackup.sh
creating recovery.conf
temporarily start data0 cluster to create extensions
temporarily start pgpool-II to create standby nodes
INFO: unrecognized configuration parameter "debug_level"
node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay
---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------
0 | /tmp | 51000 | up | 0.500000 | primary | 0 | true | 0
1 | /tmp | 51001 | down | 0.500000 | standby | 0 | false | 0
(2 rows)
recovery node 1...pcp_recovery_node -- Command Successful
done.
creating follow primary script
Pager usage is off.
node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay
---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------
0 | /tmp | 51000 | up | 0.500000 | primary | 0 | true | 0
1 | /tmp | 51001 | up | 0.500000 | standby | 0 | false | 0
(2 rows)
shutdown all
pgpool-II setting for streaming replication mode is done.
To start the whole system, use /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool1/startall.
To shutdown the whole system, use /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool1/shutdownall.
pcp command user name is "t-ishii", password is "t-ishii".
Each PostgreSQL, pgpool-II and pcp port is as follows:
#1 port is 51000
#2 port is 51001
pgpool port is 50004
pcp port is 50005
The info above is in README.port.
============= setting up pgpool 2 =============
Starting set up in streaming replication mode
creating startall and shutdownall
creating failover script
creating database cluster /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool2/data0...done.
update postgresql.conf
creating pgpool_remote_start
creating basebackup.sh
creating recovery.conf
creating database cluster /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool2/data1...done.
update postgresql.conf
creating pgpool_remote_start
creating basebackup.sh
creating recovery.conf
temporarily start data0 cluster to create extensions
temporarily start pgpool-II to create standby nodes
INFO: unrecognized configuration parameter "debug_level"
node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay
---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------
0 | /tmp | 51000 | up | 0.500000 | primary | 0 | true | 0
1 | /tmp | 51001 | down | 0.500000 | standby | 0 | false | 0
(2 rows)
recovery node 1...pcp_recovery_node -- Command Successful
done.
creating follow primary script
Pager usage is off.
node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay
---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------
0 | /tmp | 51000 | up | 0.500000 | primary | 0 | true | 0
1 | /tmp | 51001 | up | 0.500000 | standby | 0 | false | 0
(2 rows)
shutdown all
pgpool-II setting for streaming replication mode is done.
To start the whole system, use /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool2/startall.
To shutdown the whole system, use /home/t-ishii/work/pgpool-II/current/pgpool2/src/test/a/pgpool2/shutdownall.
pcp command user name is "t-ishii", password is "t-ishii".
Each PostgreSQL, pgpool-II and pcp port is as follows:
#1 port is 51000
#2 port is 51001
pgpool port is 50008
pcp port is 50009
The info above is in README.port.
not the INFO: unrecognized configuration parameter "debug_level" line showing up all three times π it's giving harmless little gremlin noise, not a crash.
Step two: look at what we made. ls shows the three node dirs plus the top-level shutdownall and startall. then sh startall boots the whole squad and you get your postgres startup chatter, timestamps and all π¦.
$ ls
pgpool0 pgpool1 pgpool2 shutdownall startall
$ sh startall
waiting for server to start....16123 2016-08-18 16:26:53 JST LOG: redirecting log output to logging collector process
16123 2016-08-18 16:26:53 JST HINT: Future log output will appear in directory "pg_log".
done
server started
waiting for server to start....16136 2016-08-18 16:26:54 JST LOG: redirecting log output to logging collector process
16136 2016-08-18 16:26:54 JST HINT: Future log output will appear in directory "pg_log".
done
server started
Step three: actually walk in the door. connect to <italic>test</italic> through the first pgpool port, say hi to psql (9.5.4), then peace out. after that, pcp_watchdog_info -p 50001 -v flexes the whole cluster β who's leader, who's standby, quorum status, every port, every node name. this is the payoff and it is iconic πβ¨.
t-ishii@localhost: psql -p 50000 test
Pager usage is off.
psql (9.5.4)
Type "help" for help.
test=# \q
$ pcp_watchdog_info -p 50001 -v
Password:
Watchdog Cluster Information
Total Nodes : 3
Remote Nodes : 2
Member Remote Nodes : 2
Nodes required for quorum: 2
Quorum state : QUORUM EXIST
Alive Remote Nodes : 2
VIP up on local node : NO
Leader Node Name : Linux_tishii-CF-SX3HE4BP_50004
Leader Host Name : localhost
Watchdog Node Information
Node Name : Linux_tishii-CF-SX3HE4BP_50000
Host Name : localhost
Delegate IP : Not_Set
Pgpool port : 50000
Watchdog port : 50002
Node priority : 1
Status : 7
Status Name : STANDBY
Membership Status : MEMBER
Node Name : Linux_tishii-CF-SX3HE4BP_50004
Host Name : localhost
Delegate IP : Not_Set
Pgpool port : 50004
Watchdog port : 50006
Node priority : 1
Status : 4
Status Name : LEADER
Membership Status : MEMBER
Node Name : Linux_tishii-CF-SX3HE4BP_50008
Host Name : localhost
Delegate IP : Not_Set
Pgpool port : 50008
Watchdog port : 50010
Node priority : 1
Status : 7
Status Name : STANDBY
Membership Status : MEMBER
so three nodes, one leader at 50004, two standbys at 50000 and 50008, quorum QUORUM EXIST, and VIP up on local node : NO. that's the whole story bestie, and it's a pretty one πΈ.
and that's the page!! this one's from pgpool-II 4.7.2, dated 2023 π go forth and set up your watchdog cluster, you absolute main character. mwah π«Άβ¨π
π¦ where this page comes from
- ubuntu stonking: pgpool2 4.7.2-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms