@
Sample Cluster DB Architecture
|
The Cluster DB has a setting parameter within a system as shown in the
following figures.Explanation of the setting parameter in this page is
due to the following figure.
Create configuration files
|
The template of a configuration files are created by initialization of
a database.
initdb
-------------------------------------------------
# su -l postgres
$ cd /usr/local/pgsql
$ bin/initdb -D /usr/local/pgsql/data -E EUC_JP --no-locale |
A setup of $PGDATA/pg_hba.conf
|
Please set up to permit connection by a network, cause the Cluster DB is connected
with load balancer or replication server by a network.
------------------------------------------------------------
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host@@all@@all@@127.0.0.1/32@@@@trust
host@all@@all@192.168.0.0/24@@trust
#<-- It adds this line
|
A setup of $PGDATA/postgresql.conf
|
Please set up a receiving port, the number of the maximum connection,
etc. Please configure the contents of a setting according to machine environment
or the scale of a database.
| # - Connection Settings -
listen_addresses = '*' # what
IP interface(s) to listen on;
# defaults to localhost, '*' = any
port = 5432
max_connections = 100
# note: increasing max_connections costs about 500 bytes of shared
# memory per connection slot, in addition to costs from shared_buffers
# and max_locks_per_transaction.
#superuser_reserved_connections = 2
|
A setup of $PGDATA/cluster.conf
|
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> replicate_upper
</Host_Name>
<Port> 8001 </Port>
<Recovery_Port> 8101 </Recovery_Port>
<LifeCheck_Port> 8201 </LifeChck_Port>
</Replicate_Server_Info>
<Replicate_Server_Info>
<Host_Name> replicate_lower
</Host_Name>
<Port> 8001 </Port>
<Recovery_Port> 8101 </Recovery_Port>
<LifeCheck_Port> 8201 </LifeChck_Port>
</Replicate_Server_Info>
#--------------------------------------------------------------------
# The setup value of Cluster DB
#--------------------------------------------------------------------
<Recovery_Port> 7101 </Recovery_Port>
<LifeCheck_Port> 7201 </LifeCheck_Port>
<Rsync_Path> /usr/bin/rsync </Rsync_Path>
<Rsync_Option> ssh -1 </Rsync_Option>
<When_Stand_Alone> read_only
</When_Stand_Alone>
<Status_Log_File> /tmp/cluster.sts
</Status_Log_File>
<Error_Log_File> /tmp/cluster.err
</Error_Log_File>
#--------------------------------------------------------------------
# The combination of DB+ table which does
not perform a replication
# (Partial replication function)
#--------------------------------------------------------------------
<Not_Replicate_Info>
<DB_Name> Local_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
E<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.
E<Host_Name>`</Host_Name>
A replication server's host name is described. Please do
not describe an IP address.
E<Port>`</Port>
The port number of the replication server which connects at the time of
a replication demand is described.
E<Recovery_Port>`</Recovery_Port>
The port number of the replication server which connects at the time of
a recovery demand is described.
E<LifeCheck_Port>`</LifeCheck_Port>
The port number which receives the life check from other servers is described.
(2)A setup of Cluster DB
E<Recovery_Port>`</Recovery_Port>
When it becomes Master DB, the port number which receives a recovery demand
from a replication server is described.
E<LifeCheck_Port>`</LifeCheck_Port>
The port number which receives the life check from other servers is described.
E<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.
E<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.
E<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.
E<Status_Log_File> ` </Status_Log_File>
The log file name which records the status of the replication server which
this Cluster DB has connected is described.
E<Error_Log_File> ` </Error_Log_File>
The log file name which records the debugging message and error message
of this Cluster DB is described.
(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.
E<DB_Name>`</DB_Name>
DB name which does not want to replicate is described.
E<Table_Name>`</Table_Name>
Table name which does not want to replicate is described.
|