### Run pgpool_setup Utility Source: https://www.pgpool.net/docs/latest/en/html/tutorial-replication.html Execute the pgpool_setup utility to create a Pgpool-II installation with streaming replication mode, a primary PostgreSQL installation, and an async standby PostgreSQL installation. Ensure the current directory is empty before running. ```bash pgpool_setup ``` -------------------------------- ### Install Pgpool-II from source Source: https://www.pgpool.net/docs/latest/en/html/example-basic.html Standard commands to compile and install Pgpool-II from a source distribution. ```bash $ ./configure $ make $ make install ``` -------------------------------- ### Install Pgpool-II Source: https://www.pgpool.net/docs/latest/en/html/install-pgpool.html Install the compiled binaries. Use gmake on Solaris or FreeBSD. ```bash make install ``` -------------------------------- ### Build and install pgpool-regclass Source: https://www.pgpool.net/docs/latest/en/html/install-pgpool-regclass.html Compile and install the extension from the source directory. ```bash $ cd pgpool-II-4.7.1/src/sql/pgpool-regclass $ make $ make install ``` -------------------------------- ### Start PostgreSQL Server Source: https://www.pgpool.net/docs/latest/en/html/example-replication-mode.html Start the PostgreSQL server using the pg_ctl command. ```bash [server1]$ /usr/pgsql-18/bin/pg_ctl start ``` -------------------------------- ### Example Route Table Command Configuration Source: https://www.pgpool.net/docs/latest/en/html/example-aws.html Concrete example of if_up_cmd and if_down_cmd settings using specific paths and route table IDs. ```text if_up_cmd = '/etc/pgpool-II/aws_rtb_if_cmd.sh up $_IP_$ eth0 rtb-012345abcd,rtb-67890abcd /usr/local/bin/aws' if_down_cmd = '/etc/pgpool-II/aws_rtb_if_cmd.sh down $_IP_$ eth0 rtb-012345abcd,rtb-67890abcd /usr/local/bin/aws' ``` -------------------------------- ### Compile and install pgpool_recovery Source: https://www.pgpool.net/docs/latest/en/html/install-pgpool-recovery.html Build and install the extension from the source directory. ```bash $ cd pgpool-II-4.7.1/src/sql/pgpool-recovery $ make $ make install ``` -------------------------------- ### Starting Pgpool-II Server Source: https://www.pgpool.net/docs/latest/en/html/pgpool.html Options specific to starting the Pgpool-II main server. ```APIDOC ## Starting Pgpool-II Server ### Description Options specific to starting the Pgpool-II main server. ### Options - `-d` or `--debug` Run Pgpool-II in debug mode. Produces extensive debug messages. - `-n` or `--dont-detach` Do not run in daemon mode; does not detach control ttys. - `-x` or `--debug-assertions` Turns on various assertion checks, which is a debugging aid. - `-C` or `--clear-oidmaps` Clear query cache oidmaps when `memqcache_method` is `memcached`. If `memqcache_method` is `shmem`, Pgpool-II always discards oidmaps at startup, so this option is not necessary. - `-D` or `--discard-status` Discard the `pgpool_status` file and do not restore the previous status. **Caution**: This option is for developer testing purposes only. Using it may lead to split-brain scenarios if `pgpool_status` is accidentally removed. ``` -------------------------------- ### Start Pgpool-II Service Source: https://www.pgpool.net/docs/latest/en/html/example-cluster.html Start the Pgpool-II service on all configured servers using systemctl. ```bash [all servers]# systemctl start pgpool.service ``` -------------------------------- ### Start Pgpool-II System Source: https://www.pgpool.net/docs/latest/en/html/watchdog-setup.html Executes the startall script to initialize the Pgpool-II system components. ```bash $ 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 ``` -------------------------------- ### Start Pgpool-II Service Source: https://www.pgpool.net/docs/latest/en/html/install-rpm.html Start the Pgpool-II service. Ensure that PostgreSQL servers are started before starting Pgpool-II. ```shell systemctl start pgpool.service ``` -------------------------------- ### Start PostgreSQL Primary Server Source: https://www.pgpool.net/docs/latest/en/html/example-cluster.html Start the PostgreSQL service on the primary server using pg_ctl. ```bash [postgres@server1 ~]$ /usr/pgsql-18/bin/pg_ctl start ``` -------------------------------- ### Failover Command Example Source: https://www.pgpool.net/docs/latest/en/html/runtime-config-failover.html This is a pseudocode example illustrating how the `follow_primary_command` is executed after a primary node failover. It shows the logic for setting down node status and executing the command in a child process. ```pseudocode for each backend node { if (the node is not the new primary) set down node status to shared memory status memorize that follow primary command is needed to execute } if (we need to executed follow primary command) { fork a child process (within the child process) for each backend node { if (the node status in shared memory is down) execute follow primary command } } ``` -------------------------------- ### Example Session Output Source: https://www.pgpool.net/docs/latest/en/html/sql-show-pool-version.html Sample output showing the result of the SHOW POOL_VERSION command. ```sql test=# show pool_version; pool_version -------------------------- 3.6.0 (subaruboshi) (1 row) ``` -------------------------------- ### Install Pgpool-II Debug and Devel Packages Source: https://www.pgpool.net/docs/latest/en/html/install-rpm.html Optionally install debuginfo and development header files for Pgpool-II. ```shell dnf install pgpool-II-pg18-debuginfo pgpool-II-pg18-devel ``` -------------------------------- ### Start All Services Source: https://www.pgpool.net/docs/latest/en/html/tutorial-replication.html Start all components of the Pgpool-II and PostgreSQL cluster. This command initiates the primary and standby PostgreSQL servers and Pgpool-II. ```bash ./startall ``` -------------------------------- ### Start PostgreSQL Primary Server Source: https://www.pgpool.net/docs/latest/en/html/example-cluster.html Start the PostgreSQL primary server using pg_ctl. Ensure the postgres user context is used. ```bash [root@server1 ~]# su - postgres -c "/usr/pgsql-18/bin/pg_ctl start" ``` -------------------------------- ### Example Output of SHOW POOL_PROCESSES Source: https://www.pgpool.net/docs/latest/en/html/sql-show-pool-processes.html A sample output showing the status of various Pgpool-II processes. ```text test=# show pool_processes; pool_pid | start_time | client_connection_count | database | username | backend_connection_time | pool_counter | status ----------+------------------------------------------------------+-------------------------+----------+----------+-------------------------+--------------+--------------------- 32641 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection 32642 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection 32643 | 2021-09-28 04:40:45 | 0 | test | kawamoto | 2021-09-28 04:40:48 | 1 | Idle 32644 | 2021-09-28 04:40:45 | 0 | test | kawamoto | 2021-09-28 04:43:15 | 1 | Execute command 32645 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection 32646 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection 32647 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection 32648 | 2021-09-28 04:40:45 (3:15 before process restarting) | 2 | | | | | Wait for connection (8 rows) ``` -------------------------------- ### Heartbeat Configuration Example Source: https://www.pgpool.net/docs/latest/en/html/runtime-watchdog-config.html Example configuration for heartbeat_hostname, heartbeat_port, and heartbeat_device for three Pgpool nodes. This is applicable when wd_lifecheck_method is set to 'heartbeat'. ```properties heartbeat_hostname0 = 'server1' heartbeat_port0 = 9694 heartbeat_device0 = '' heartbeat_hostname1 = 'server2' heartbeat_port1 = 9694 heartbeat_device1 = '' heartbeat_hostname2 = 'server3' heartbeat_port2 = 9694 heartbeat_device2 = '' ``` -------------------------------- ### Start Pgpool-II Process Source: https://www.pgpool.net/docs/latest/en/html/example-basic.html Commands to launch the Pgpool-II service in various modes. ```bash $ pgpool ``` ```bash $ pgpool -n & ``` ```bash $ pgpool -n -d > /tmp/pgpool.log 2>&1 & ``` -------------------------------- ### Start Pgpool-II Server Source: https://www.pgpool.net/docs/latest/en/html/server-start.html Execute this command to start the Pgpool-II server in the background. Specify the paths to the main pgpool configuration file and the pcp server configuration file using the -f and -F flags respectively. ```bash $ `pgpool -f /usr/local/etc/pgpool.conf -F /usr/local/etc/pcp.conf` ``` -------------------------------- ### Configure YUM Repository Exclusions Source: https://www.pgpool.net/docs/latest/en/html/example-cluster.html Example configuration to prevent Pgpool-II from being installed via the PostgreSQL repository. ```ini [pgdg-common] ... exclude=pgpool* [pgdg18] ... exclude=pgpool* [pgdg17] ... exclude=pgpool* [pgdg16] ... exclude=pgpool* [pgdg15] ... exclude=pgpool* [pgdg14] ... exclude=pgpool* [pgdg13] ... exclude=pgpool* ``` -------------------------------- ### Initialize database with pgbench Source: https://www.pgpool.net/docs/latest/en/html/example-basic.html Run pgbench with the -i flag to populate the database with standard test tables and data. ```bash $ pgbench -i -p 9999 bench_replication ``` -------------------------------- ### Initialize pcp.conf Source: https://www.pgpool.net/docs/latest/en/html/example-basic.html Copy the sample PCP configuration file to the active configuration path. ```bash $ cp /usr/local/etc/pcp.conf.sample /usr/local/etc/pcp.conf ``` -------------------------------- ### Install Dependencies for Rocky Linux 10 Source: https://www.pgpool.net/docs/latest/en/html/install-rpm.html Before installing Pgpool-II on Rocky Linux 10, enable the EPEL repository and install `libmemcached-awesome-devel` to satisfy dependencies. ```shell dnf install epel-release dnf install libmemcached-awesome-devel ``` -------------------------------- ### Initialize pgbench tables Source: https://www.pgpool.net/docs/latest/en/html/tutorial-testing-replication.html Create the benchmark tables required for testing using the pgbench tool. ```bash $ pgbench -i -p 11000 test ``` -------------------------------- ### Install and set permissions for failover scripts Source: https://www.pgpool.net/docs/latest/en/html/example-cluster.html Copy sample scripts to the configuration directory and set the appropriate ownership. ```bash [root@server1 ~]# cp -p /etc/pgpool-II/sample_scripts/failover.sh.sample /etc/pgpool-II/failover.sh [root@server1 ~]# cp -p /etc/pgpool-II/sample_scripts/follow_primary.sh.sample /etc/pgpool-II/follow_primary.sh [root@server1 ~]# chown postgres:postgres /etc/pgpool-II/{failover.sh,follow_primary.sh} ``` -------------------------------- ### Initialize pgpool.conf Source: https://www.pgpool.net/docs/latest/en/html/example-basic.html Copy the sample configuration file to the active configuration path. ```bash $ cp /usr/local/etc/pgpool.conf.sample /usr/local/etc/pgpool.conf ``` -------------------------------- ### Run pgpool_setup for Streaming Replication Source: https://www.pgpool.net/docs/latest/en/html/pgpool-setup.html Execute the pgpool_setup script to initialize PostgreSQL in streaming replication mode. This process creates database clusters, configures PostgreSQL and Pgpool-II, and sets up replication scripts. ```bash $ pgpool_setup PostgreSQL major version: 124 Starting set up in streaming replication mode creating startall and shutdownall creating failover script creating database cluster /tmp/test/data0...done. update postgresql.conf creating pgpool_remote_start creating basebackup.sh creating recovery.conf creating database cluster /tmp/test/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 node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay | replication_state | replication_sync_state | last_status_change ---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------+-------------------+------------------------+--------------------- 0 | /tmp | 11002 | up | 0.500000 | primary | 0 | true | 0 | | | 2020-08-18 13:50:19 1 | /tmp | 11003 | down | 0.500000 | standby | 0 | false | 0 | | | 2020-08-18 13:50:18 (2 rows) recovery node 1...pcp_recovery_node -- Command Successful done. creating follow primary script node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay | replication_state | replication_sync_state | last_status_change ---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------+-------------------+------------------------+--------------------- 0 | /tmp | 11002 | up | 0.500000 | primary | 0 | true | 0 | | | 2020-08-18 13:50:19 1 | /tmp | 11003 | up | 0.500000 | standby | 0 | false | 0 | | | 2020-08-18 13:50:23 (2 rows) shutdown all pgpool-II setting for streaming replication mode is done. To start the whole system, use /tmp/test/startall. To shutdown the whole system, use /tmp/test/shutdownall. pc p command user name is "t-ishii", password is "t-ishii". Each PostgreSQL, pgpool-II and pcp port is as follows: #1 port is 11002 #2 port is 11003 pgpool port is 11000 pc p port is 11001 The info above is in README.port. ``` -------------------------------- ### Example pgproto input data file Source: https://www.pgpool.net/docs/latest/en/html/pgproto.html A sample data file demonstrating various PostgreSQL protocol messages like Query, Parse, Bind, Execute, and Sync. ```text # # Test data example # 'Q' "SELECT * FROM aaa" 'Y' 'P' "S1" "BEGIN" 0 'B' "" "S1" 0 0 0 'E' "" 0 'C' 'S' "S1" 'P' "foo" "SELECT 1" 0 'B' "myportal" "foo" 0 0 0 'E' "myportal" 0 'P' "S2" "COMMIT" 0 'B' "" "S2" 0 0 0 'E' "" 0 'C' 'S' "S2" 'S' 'Y' 'X' ``` -------------------------------- ### Install Pgpool-II on Rocky Linux 10 Source: https://www.pgpool.net/docs/latest/en/html/example-cluster.html Commands to install Pgpool-II and its dependencies on Rocky Linux 10. ```bash [all servers]# dnf install -y https://www.pgpool.net/yum/rpms/4.7/redhat/rhel-10-x86_64/pgpool-II-release-4.7-1.noarch.rpm [all servers]# dnf install -y epel-release [all servers]# dnf install -y libmemcached-awesome-devel [all servers]# dnf install -y pgpool-II-pg18-* ``` -------------------------------- ### Basic Pgpool.conf Configuration Example Source: https://www.pgpool.net/docs/latest/en/html/config-setting.html Illustrates the basic syntax for the pgpool.conf file, showing comments, parameter assignments, and quoted string values. Each parameter is on a new line, and the equal sign is optional. Whitespace is generally ignored. ```plaintext # This is a comment listen_addresses = 'localhost' port = 9999 serialize_accept = off reset_query_list = 'ABORT; DISCARD ALL' ``` -------------------------------- ### Install PostgreSQL Server Source: https://www.pgpool.net/docs/latest/en/html/example-cluster.html Commands to install PostgreSQL 18 from the official YUM repository on all cluster nodes. ```bash [all servers]# dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-10-x86_64/pgdg-redhat-repo-latest.noarch.rpm [all servers]# dnf -qy module disable postgresql [all servers]# dnf install -y postgresql18-server ``` -------------------------------- ### Initialize pgbench for replication testing Source: https://www.pgpool.net/docs/latest/en/html/example-replication-mode.html Creates a test database and initializes pgbench tables on the Pgpool-II cluster. ```bash [server1]# /usr/pgsql-18/bin/createdb test -U postgres -p 9999 [server1]# /usr/pgsql-18/bin/pgbench -h server1 -U postgres -i -p 9999 test ``` -------------------------------- ### Install Pgpool-II Core Package Source: https://www.pgpool.net/docs/latest/en/html/install-rpm.html Install the main Pgpool-II package. Replace 'pg18' with your PostgreSQL version. ```shell dnf install pgpool-II-pg18 ``` -------------------------------- ### Install Pgpool-II on Rocky Linux 9 Source: https://www.pgpool.net/docs/latest/en/html/example-cluster.html Command to install Pgpool-II on Rocky Linux 9 using the crb repository. ```bash [all servers]# dnf install -y --enablerepo=crb pgpool-II-pg18-* ``` -------------------------------- ### Start Pgpool-II and PostgreSQL Services Source: https://www.pgpool.net/docs/latest/en/html/pgpool-setup.html Use the generated startall script to initiate all PostgreSQL and Pgpool-II services. This command ensures that both the primary and standby nodes are running. ```bash t-ishii$ ./startall waiting for server to start....5744 2020-08-18 13:50:27 JST LOG: starting PostgreSQL 12.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit 5744 2020-08-18 13:50:27 JST LOG: listening on IPv4 address "0.0.0.0", port 11002 5744 2020-08-18 13:50:27 JST LOG: listening on IPv6 address "::", port 11002 5744 2020-08-18 13:50:27 JST LOG: listening on Unix socket "/tmp/.s.PGSQL.11002" 5744 2020-08-18 13:50:27 JST LOG: redirecting log output to logging collector process 5744 2020-08-18 13:50:27 JST HINT: Future log output will appear in directory "log". done server started waiting for server to start....5757 2020-08-18 13:50:27 JST LOG: starting PostgreSQL 12.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit 5757 2020-08-18 13:50:27 JST LOG: listening on IPv4 address "0.0.0.0", port 11003 5757 2020-08-18 13:50:27 JST LOG: listening on IPv6 address "::", port 11003 5757 2020-08-18 13:50:27 JST LOG: listening on Unix socket "/tmp/.s.PGSQL.11003" 5757 2020-08-18 13:50:27 JST LOG: redirecting log output to logging collector process 5757 2020-08-18 13:50:27 JST HINT: Future log output will appear in directory "log". done server started ``` -------------------------------- ### Install Pgpool-II Packages Source: https://www.pgpool.net/docs/latest/en/html/example-replication-mode.html Installs Pgpool-II packages using the Pgpool-II YUM repository. This command assumes the repository has been added. ```bash [all servers]# yum install -y https://www.pgpool.net/yum/rpms/4.6/redhat/rhel-10-x86_64/pgpool-II-release-4.6-1.noarch.rpm [all servers]# yum install -y pgpool-II-pg18-* ``` -------------------------------- ### Log message examples for parameter status Source: https://www.pgpool.net/docs/latest/en/html/release-3-7-23.html Examples of log messages generated by pgpool-II when handling parameter status discrepancies. ```text LOG: reading message length DETAIL: message length (22) in slot 1 does not match with slot 0(23) ``` ```text LOG: ParameterStatus "TimeZone": node 1 message length 30 is different from main node message length 24 ``` -------------------------------- ### Compile Pgpool-II Documentation Source: https://www.pgpool.net/docs/latest/en/html/install-docs.html Navigate to the 'doc' directory and run 'make' to compile the English documentation. Repeat for 'doc.ja' to compile Japanese documentation. ```bash $ cd doc $ make $ cd .. $ cd doc.ja $ make ``` -------------------------------- ### EXPLAIN with GENERIC_PLAN option Source: https://www.pgpool.net/docs/latest/en/html/release-4-5-0.html Illustrates the use of the GENERIC_PLAN option with EXPLAIN to display the generic plan for a parameterized query. ```sql EXPLAIN (GENERIC_PLAN) SELECT ...; ``` -------------------------------- ### Install Docbook tools on RHEL Source: https://www.pgpool.net/docs/latest/en/html/install-docs.html Use this command to install the necessary Docbook tools on RHEL or similar systems. Ensure the 'powertools' repository is enabled. ```bash dnf install --enablerepo=powertools docbook-dtds docbook-style-dsssl docbook-style-xsl libxslt openjade ``` -------------------------------- ### Copy Sample pgpool.conf Source: https://www.pgpool.net/docs/latest/en/html/configuring-pgpool.html Copy the sample pgpool.conf file to use as your main configuration. This is typically done in the /usr/local/etc directory after installing from source. ```bash # cd /usr/local/etc # cp pgpool.conf.sample pgpool.conf ``` -------------------------------- ### Install pgpool_adm Extension Source: https://www.pgpool.net/docs/latest/en/html/pgpool-adm.html Steps to compile and install the pgpool_adm extension on PostgreSQL servers. Ensure you are in the extension's source directory before running make commands. ```bash $ cd src/sql/pgpool_adm $ make $ make install ``` ```sql $ psql ... $ CREATE EXTENSION pgpool_adm ``` -------------------------------- ### Install Pgpool-II RPM Repository Source: https://www.pgpool.net/docs/latest/en/html/install-rpm.html Install the Pgpool-II official YUM repository configuration file. Replace '4.7' and 'rhel-10-x86_64' with your specific Pgpool-II and distribution versions. ```shell dnf install https://www.pgpool.net/yum/rpms/4.7/redhat/rhel-10-x86_64/pgpool-II-release-4.7-1.noarch.rpm ``` -------------------------------- ### Copy Sample pgpool.conf Source: https://www.pgpool.net/docs/latest/en/html/tutorial-replication.html Copy the sample pgpool.conf file to pgpool.conf to begin configuration. This is a prerequisite for setting up streaming replication. ```bash cp /usr/local/etc/pgpool.conf.sample pgpool.conf ``` -------------------------------- ### Install PostgreSQL and Server Packages Source: https://www.pgpool.net/docs/latest/en/html/example-replication-mode.html Installs PostgreSQL server packages from the official PostgreSQL YUM repository on all servers. Ensure the PostgreSQL YUM repository is configured correctly. ```bash [all servers]# yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-10-x86_64/pgdg-redhat-repo-latest.noarch.rpm [all servers]# yum install -y postgresql18-server ``` -------------------------------- ### Install Pgpool-II Extensions for Online Recovery Source: https://www.pgpool.net/docs/latest/en/html/install-rpm.html Install the extensions package on all PostgreSQL servers to use the online recovery feature. This package depends on the core Pgpool-II package. ```shell dnf install pgpool-II-pg18-extensions pgpool-II-pg18 ``` -------------------------------- ### Show All Configuration Parameters Source: https://www.pgpool.net/docs/latest/en/html/sql-pgpool-show.html Displays all configuration parameters for Pgpool-II, including their values and descriptions. This provides a comprehensive overview of the current settings. ```bash PGPOOL SHOW ALL; item | value | description -------------------------+-------------------------+----------------------------------------------------------- backend_hostname0 | 127.0.0.1 | hostname or IP address of PostgreSQL backend. backend_port0 | 5434 | port number of PostgreSQL backend. backend_weight0 | 0 | load balance weight of backend. backend_data_directory0 | /var/lib/pgsql/data | data directory of the backend. backend_flag0 | ALLOW_TO_FAILOVER | Controls various backend behavior. backend_hostname1 | 127.0.0.1 | hostname or IP address of PostgreSQL backend. backend_port1 | 5432 | port number of PostgreSQL backend. backend_weight1 | 1 | load balance weight of backend. backend_data_directory1 | /home/work/installed/pg | data directory of the backend. backend_flag1 | ALLOW_TO_FAILOVER | Controls various backend behavior. hostname0 | localhost | Hostname of pgpool node for watchdog connection. . . . ssl | off | Enables SSL support for frontend and backend connections (138 rows) ``` -------------------------------- ### CLI Command: watchdog_setup Source: https://www.pgpool.net/docs/latest/en/html/watchdog-setup.html The watchdog_setup command creates a temporary installation of Pgpool-II clusters with watchdog enabled in the current directory. ```APIDOC ## watchdog_setup ### Description Creates a temporary installation of Pgpool-II clusters with watchdog enabled, including specified numbers of Pgpool-II and PostgreSQL installations. This tool is intended for testing purposes only. ### Parameters #### Options - **-wn** (integer) - Optional - Number of Pgpool-II installations (default: 3). - **-wp** (integer) - Optional - Starting base port number for Pgpool-II and PostgreSQL (default: 50000). - **-m** (string) - Optional - Running mode: 'r' (native replication), 'i' (snapshot isolation), 's' (streaming replication), 'l' (logical replication), or 'n' (raw mode) (default: 's'). - **-n** (integer) - Optional - Number of PostgreSQL installations (default: 2). - **-vip** (string) - Optional - Virtual IP address (default: '127.0.0.1'). - **--no-stop** (flag) - Optional - Do not stop pgpool and PostgreSQL after the work. - **-d** (flag) - Optional - Start pgpool with debug mode. ### Environment Variables - **PGPOOL_SETUP** - Path to pgpool_setup command. - **PGPOOL_INSTALL_DIR** - Pgpool-II installation directory. - **PGPOOLDIR** - Path to Pgpool-II configuration files. - **PGBIN** - Path to PostgreSQL commands. - **PGLIB** - Path to PostgreSQL shared libraries. - **PGSOCKET_DIR** - Path to Unix socket directory. - **INITDBARG** - Arguments for initdb command. ```