V. pgpool_adm extension

pgpool_adm is a set of extensions to allow SQL access to Reference II, PCP commands (actually, pcp libraries). It uses foreign data wrapper as shown in the diagram below.

Figure 1. How pgpool_adm works

It is possible to call the functions from either via pgpool-II (1) or via PostgreSQL (2). In case (1), Pgpool-II accepts query from user (1), then forward to PostgreSQL (3). PostgreSQL connects to Pgpool-II (5) and Pgpool-II reply back to PostgreSQL with the result (3). PostgreSQL returns the result to Pgpool-II (5) and Pgpool-II fowards the data to the user (6).

In case (2), PostgreSQL accepts query from user (2). PostgreSQL connects to Pgpool-II (5) and Pgpool-II reply back to PostgreSQL with the result (3). PostgreSQL replies back the data to the user (6).

There are two forms to call pgpool_adm functions: first form accepts Pgpool-II host name (or IP address), pcp port number, pcp user name, its password and another parameters.

In the second form, Pgpool-II server name is required. The server name must be already defined using "CREATE FOREIGN SERVER" command of PostgreSQL. The pcp port number is hard coded as 9898, the pcp user name is assumes to be same as caller's PostgreSQL user name. password is extraced from $HOME/.pcppass.

1. Installing pgpool_adm

pgpool_adm is an extension and should be installed on all PostgreSQL servers.

$ cd src/sql/pgpool_adm
$ make
$ make install
	  

Then issue following SQL command for every database you want to access.

$ psql ...
$ CREATE EXTENSION pgpool_adm
	  

Table of Contents
pgpool_adm_pcp_node_info --  a function to display the information on the given node ID
pgpool_adm_pcp_pool_status --  a function to retrieves parameters in pgpool.conf.
pgpool_adm_pcp_node_count --  a function to retrieves number of backend nodes.
pgpool_adm_pcp_attach_node --  a function to attach given node ID
pgpool_adm_pcp_detach_node --  a function to detach given node ID