|pgpool-II 4.2.13 Documentation|
|Prev||Up||Chapter 3. Server Setup and Operation||Next|
To start Pgpool-II, execute:
$ pgpool -f /usr/local/etc/pgpool.conf -F /usr/local/etc/pcp.conf
which will start the server running in the background. "-f" specifies the path to the main pgpool configuration file and "-F" specifies the path to the configuration file of pcp server, which is the control server for Pgpool-II. For other options of the command please take a look at pgpool manual.
Before starting Pgpool-II, you must start PostgreSQL because if PostgreSQL has not started yet, Pgpool-II triggers failover process and makes PostgreSQL is in down status.
If you have difficulty in controlling the startup sequence of PostgreSQL, for example Pgpool-II and PostgreSQL are installed on different servers, you can make search_primary_node_timeout longer (the default is 5 minutes) so that Pgpool-II waits for PostgreSQL starts up until search_primary_node_timeout expires. If PostgreSQL starts up before search_primary_node_timeout expires, Pgpool-II should start up without problem. If search_primary_node_timeout expires before PostgreSQL starts up, no primary node will be detected, which means you cannot execute DML/DDL. You need to restart Pgpool-II in this case. To confirm that the primary node exists you can use SHOW POOL NODES command.
Please note search_primary_node_timeout can only be used in the streaming replication mode because the parameter is only valid in the mode. See Section 3.3.2 for more details about streaming replication mode. For other mode, tweak the health check (see Section 5.8) parameters so that there's enough time before PostgreSQL becomes available.
If health check detects that PostgreSQL is not available before Pgpool-II starts up, some or all PostgreSQL are recognized in "down" status. In this case you need to manually put the PostgreSQL server in "up" state by using pcp_attach_node command. If a client tries to connect to Pgpool-II before PostgreSQL is available, failover could be triggered. In this case you also need to execute pcp_attach_node command to put the PostgreSQL server in "up" state.