Download pgpool-II user manual

Transcript
In this example, the accounts table is partitioned, and the branches and tellers table are replicated. The accounts table
and the branches table are joined by bid. The branches table is registered into the replication table. If the three tables
(accounts, branches, and tellers) are to be joined, it is necessary to register a replication rule for the tellers table too.
INSERT INTO pgpool_catalog.dist_def VALUES (
'pgpool',
'public',
'accounts',
'aid',
ARRAY['aid','bid','abalance','filler'],
ARRAY['integer','integer','integer','character(84)'],
'pgpool_catalog.dist_def_accounts'
);
INSERT INTO pgpool_catalog.replicate_def VALUES (
'pgpool',
'public',
'branches',
ARRAY['bid','bbalance','filler'],
ARRAY['integer','integer','character(84)']
);
The partitioning rule function (here, pgpool_catalog.dist_def_accounts) takes a value for the partitioning key column,
and returns the corresponding DB node ID. Note that the node ID must start from 0. Below is an example of this
function for pgbench.
CREATE OR REPLACE FUNCTION pgpool_catalog.dist_def_accounts (val ANYELEMENT) RETURNS INTEGER AS '
SELECT CASE WHEN $1 >= 1 and $1 <= 30000 THEN 0
WHEN $1 > 30000 and $1 <= 60000 THEN 1
ELSE 2
back to top
Setting up pool_hba.conf for client authentication (HBA)
Just like the pg_hba.conf file for PostgreSQL, pgpool supports a similar client authentication function using a
configuration file called "pool_hba.conf".
When you install pgpool, pool_hba.conf.sample will be installed in "/usr/local/etc", which is the default directory for
configuration files. Copy pool_hba.conf.sample as pool_hba.conf and edit it if necessary. By default, pool_hba
authentication is disabled. Change enable_pool_hba to on to enable it.