Sample Cluster Architecture
|

It is almost the same as a setup of PostgreSQL. Please be sure to permit connection
with the back end by a network.
A Setup of $PGDATA/pg_hba.conf file
|
Please set up to permit connection by a network, cause the Cluster DB is connected
with load balancer or replication server by a network.
(The example of a setting to which the connection from 192.168.5.0/24
network is permitted in pg_hba.conf )
------------------------------------------------------------
# TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE AUTH_ARGUMENT
local all trust
host all 127.0.0 255.255.255.255 trust
host all 192.168.5.0 255.255.255.0 trust
#<-- It adds here.
|
A Setup of '$PGDATA/cluster.conf' file
|
The "cluster.conf" is a configuration file for Clusters DB. After
DB initialization processing, the sample of the "cluster.conf"
file is created automatically in DB storing directory. Please edit a sample
file according to each server environment.
|
#=============================================
# cluster.conf
#---------------------------------------------
# There are two kinds of the description methods of the setup value
in this file.
# One is the setting up two or more values, and another is the setting
up one value at a time.
#
# <Table_Name_Tag>
# <Data_Name_Tag1> value1 </Data_Name_Tag1>
# <Data_Name_Tag2> value2 </Data_Name_Tag2>
# <Data_Name_Tag3> value3 </Data_Name_Tag3>
# </Table_Name_Tag>
# or
# <Data_Name_Tag> value </Data_Name_Tag>
#
# It is interpreted as a comment after "#" .
#=============================================
#--------------------------------------------------------------------
# A setup of a replication server
#--------------------------------------------------------------------
<Replicate_Server_Info>
<Host_Name> pgr.hoo.com
</Host_Name>
<Port> 8001 </Port>
<Recovery_Port> 8101 </Recovery_Port>
</Replicate_Server_Info>
#--------------------------------------------------------------------
# The setup value of Cluster DB
#--------------------------------------------------------------------
<Recovery_Port> 7001 </Recovery_Port>
<Rsync_Path> /usr/bin/rsync </Rsync_Path>
<Rsync_Option> ssh -1 </Rsync_Option>
<When_Stand_Alone> read_only
</When_Stand_Alone>
#--------------------------------------------------------------------
# The combination of DB+ table which does
not perform a replication
# (Partial replication function)
#--------------------------------------------------------------------
#<Not_Replicate_Info>
# <DB_Name> test_db </DB_Name>
# <Table_Name> log_table </Table_Name>
#</Not_Replicate_Info>
|
In this configuration file, a setup value is described using the following
tags.
(1)A setup about a replication server
・<Replicate_Server_Info>〜</Replicate_Server_Info>
A replication server's setup value is declared. A replication server's
setup value (a host name, the port number for replications, port number
for recovery) is described between a start and an end tag. A replication
server can set up more than one.
・<Host_Name>〜</Host_Name>
A replication server's host name is described. Please do
not describe an IP address.
・<Port>〜</Port>
The port number of the replication server which connects at the time of
a replication demand is described.
・<Recovery_Port>〜</Recovery_Port>
The port number of the replication server which connects at the time of
a recovery demand is described.
(2)A setup of Cluster DB
・<Recovery_Port>〜</Recovery_Port>
When it becomes Master DB, the port number which receives a recovery demand
from a replication server is described.
・<Rsync_Path>〜</Rsync_Path>
The path of the rsync command used at the time of recovery is described.
The details of a
setup of rsync are here.
・<Rsync_Option>〜</Rsync_Option>
The option of the rsync command used at the time of recovery is described.
The details of a setup of rsync are here.
・<When_Stand_Alone> 〜 </When_Stand_Alone>
When all replication servers stop and a cluster DB server changes into
a stand-alone state, mode of operation can be specified. It is described
as "read_only" to accept only a search query. It is described
as "read_write" to also accept a update query.
(3)A setup of a partial replication
The combination of DB and table which does not want
to replicate is described.
<Not_Replicate_Info> 〜 </Not_Replicate_Info>
A setup of a partial replication is declared. The combination (DB name
and table name) which does not want to replicate between a start tag and
an end tag is described. Two or more combination of a partial replication
can be set up.
・<DB_Name>〜</DB_Name>
DB name which does not want to replicate is described.
・<Table_Name>〜</Table_Name>
Table name which does not want to replicate is described.
A setup of replication server
|
The sample file ("pgreplicate.conf.sample") of a configuration file
is created under the "etc" directory under an installation directory
(default is "/usr/local/pgsql/etc") by a replication server's
installation. Please copy this file, create the file "pgreplicate.conf"
and edit according to each environment. At the time of starting of a replication
server, the path of this configuration file can be specified as a parameter.
$cd /usr/local/pgsql/etc
$cp [path to source]/src/pgcluster/pgrp/pgreplicate.conf.sample pgreplicate.conf
|
A setup of 'pgreplicate.conf' file
|
|
#=============================================
# pgreplicate.conf
#---------------------------------------------
# There are two kinds of the description methods of the setup value
in this file.
# One is the setting up two or more values, and another is the setting
up one value at a time.
#
# <Table_Name_Tag>
# <Data_Name_Tag1> value1 </Data_Name_Tag1>
# <Data_Name_Tag2> value2 </Data_Name_Tag2>
# <Data_Name_Tag3> value3 </Data_Name_Tag3>
# </Table_Name_Tag>
# or
# <Data_Name_Tag> value </Data_Name_Tag>
#
# It is interpreted as a comment after "#"
#=============================================
#--------------------------------------------------------------------
# The setup value of Cluster DB
#--------------------------------------------------------------------
<Cluster_Server_Info>
<Host_Name> db1.hoo.com
</Host_Name>
<Port> 5432 </Port>
<Recovery_Port> 7001 </Recovery_Port>
</Cluster_Server_Info>
<Cluster_Server_Info>
<Host_Name> db2.hoo.com
</Host_Name>
<Port> 5432 </Port>
<Recovery_Port> 7001</Recovery_Port>
</Cluster_Server_Info>
<Cluster_Server_Info>
<Host_Name> db3.hoo.com
</Host_Name>
<Port> 5432 </Port>
<Recovery_Port> 7001</Recovery_Port>
</Cluster_Server_Info>
#--------------------------------------------------------------------
# A setup of loader balancer
#--------------------------------------------------------------------
<LoadBalance_Server_Info>
<Host_Name> lb.hoo.com
</Host_Name>
<Recovery_Port> 6001 </Recovery_Port>
</LoadBalance_Server_Info>
#--------------------------------------------------------------------
# A setup of a replication
server
#--------------------------------------------------------------------
<Replication_Port> 8001 </Replication_Port>
<Recovery_Port> 8101 </Recovery_Port>
<Response_Mode> normal </Response_Mode>
|
(1)A setup about Cluster DB
・<Cluster_Server_Info>〜</Cluster_Server_Info>
A setup of Cluster DB is declared. The setup value (a host name, the port
number for postmaster, port number for recovery) of Cluster DB is described
between a start tag and an end tag. Two or more Cluster DBs can be set
up. Fundamentally, the first Cluster DB becomes Master DB. When a problem
occurs in the first Cluster DB, the following Cluster DB becomes Master
DB.
・<Host_Name>〜</Host_Name>
The host name of Cluster DB describes. Please do
not describe an IP address.
・<Port>〜</Port>
The port number of Cluster DB (postmaster) is described.
・<Recovery_Port>〜</Recovery_Port>
The port number of the master DB connected at the time of recovery is
described.
(2)A setup about loader balancer
・<LoadBalance_Server_Info>〜</LoadBalance_Server_Info>
A setup of loader balancer is declared. The setup value (a host name,
port number for recovery) of loader balancer is described between a start
tag and an end tag. Two or more information on loader balancer can be
set up.
・<Host_Name>〜</Host_Name>
The host name of loader balancer describes. Please do
not describe an IP address.
・<Recovery_Port>〜</Recovery_Port>
The port number of the loader balancer connected at the time of recovery
of Cluster DB is described.
(3)A setup of a replication server
・<Replication_Port>〜</Replication_Port>
The port number which receives the replication demand from Cluster DB
is described.
・<Recovery_Port>〜</Recovery_Port>
The port number which receives the recovery demand from Cluster DB is
described.
The sample file ("pglb.conf.sample") of a configuration file is
created under the "etc" directory under an installation directory
(default is "/usr/local/pgsql/etc") by a loader balancer's installation.
Please copy this file, create the file "pglb.conf" and edit
according to each environment. At the time of starting of a loader balancer,
the path of this configuration file can be specified as a parameter.
$cd /usr/local/pgsql/etc
$cp [path to source]/src/pgcluster/pglb/pglb.conf.sample pglb.conf
|
A setup of 'pglb.conf' file
|
#=============================================
# pglb.conf
#---------------------------------------------
# There are two kinds of the description methods of the setup value
in this file.
# One is the setting up two or more values, and another is the setting
up one value at a time.
#
# <Table_Name_Tag>
# <Data_Name_Tag1> value1 </Data_Name_Tag1>
# <Data_Name_Tag2> value2 </Data_Name_Tag2>
# <Data_Name_Tag3> value3 </Data_Name_Tag3>
# </Table_Name_Tag>
# or
# <Data_Name_Tag> value </Data_Name_Tag>
#
# It is interpreted as a comment after "#"
#=============================================
#--------------------------------------------------------------------
# The setup value of Cluster DB
#--------------------------------------------------------------------
<Cluster_Server_Info>
<Host_Name> db1.hoo.com
</Host_Name>
<Port> 5432 </Port>
<Max_Connect> 32 </Max_Connect>
</Cluster_Server_Info>
<Cluster_Server_Info>
<Host_Name> db2.hoo.com
</Host_Name>
<Port> 5432 </Port>
<Max_Connect> 32 </Max_Connect>
</Cluster_Server_Info>
<Cluster_Server_Info>
<Host_Name> db3.hoo.com
</Host_Name>
<Port> 5432 </Port>
<Max_Connect> 32 </Max_Connect>
</Cluster_Server_Info>
#--------------------------------------------------------------------
# A setup of a loader balancer
#--------------------------------------------------------------------
<Receive_Port> 5432 </Receive_Port>
<Recovery_Port> 6001 </Recovery_Port>
<Max_Cluster_Num> 128 </Max_Cluster_Num>
<Use_Connection_Pooling> no </Use_Connection_Pooling>
|
(1)A setup of Cluster DB
・<Cluster_Server_Info>〜</Cluster_Server_Info>
A setup of Cluster DB is declared. The setup value (a host name, the port
number for postmaster, the number of Maximum connection) of Cluster DB
is described between a start tag and an end tag. Two or more information
on Cluster DB can be set up.
・<Host_Name>〜</Host_Name>
The host name of Cluster DB describes. Please do
not describe an IP address.
・<Port>〜</Port>
The port number of Cluster DB (postmaster) is described.
・<Max_Connect>〜</Max_Connect>
The maximum amount of the session linked to Cluster DB is set up. It needs
to be lesser than the value of "max_connections" of Cluster
DB. Cluster DB connects not only with loader balancer but with a replication
server. The number which loader balancer can connect to Cluster DB becomes
less than the value of "max_connections" of Cluster DB.
(2)A setup of loader balancer
・<Receive_Port>〜</Receive_Port>
The port number which receives a query from a client is described.
・<Recovery_Port>〜</Recovery_Port>
The port number which receives the recovery demand from a replication
server is described.
・<Max_Cluster_Num>〜</Max_Cluster_Num>
The maximum amount of Cluster DB is described. This value contains the
number of the Cluster DBs to extend in the future.
・<Use_Connection_Pool>〜</Use_Connection_Pool>
It is specified whether a connection pooling function is used for connection
with Cluster DB. Please describe by 'yes'
or 'no'.
|