PGCluster Installation Instructions 
  with pgc_admin & pgc_probe servers

=============================================================
1. Installation
=============================================================

1-1. Install PGCluster 
----------------------------------------------------------------
$ cd $source_dir 
$ ./configure
$ gmake
$ su
# gmake install
# chown -R postgres /usr/local/pgsql
----------------------------------------------------------------

=============================================================
2. Initialize in each server
=============================================================
login as postgres user
$ ssh-keygen
(without passphrase)
$ su
# mkdir /usr/local/pgsql
# chown -R postgres.poatgres /usr/local/pgsql
# vi /etc/hosts
(edit hosts file as same as all servers)
# service iptable stop
# service ip6table stop

=============================================================
3. configuration file
=============================================================
(EX.System Composition)

                        |
                 ((Server ID:1))
             ((Load Balance Server))
          (hostname: lb.pgcluster.org)
                        |
----------+-------------+------------+----------
          |                          |
   ((Server ID:2))               ((Server ID:3))
  ((Cluster DB 1))              ((Cluster DB 2))
 (hostname:db1.pgcluster.org)  (hostname:db2.pgcluster.org)
          |                          |
----------+-------------+------------+----------
                        |
                 ((Server ID:4))
               ((Replication Server))
            (hostname:pgr.pgcluster.org)


3-1. server.conf

The setup file of physical server is copied from the sample file and edited.
(the sample file is installed '/usr/local/pgsql/admin' in default)
----------------------------------------------------------------
$cd /usr/local/pgsql/admin
$cp server.conf.sample server.conf
$vi server.conf
(edit as follows)
----------------------------------------------------------------

In the case of the above system composition example,
the setup example of server.conf file is as the following 

#-------------------------------------------------------------
# Information of the physical server section
#-------------------------------------------------------------
# (setup contents)
#        o Server_ID    :     The id number of the physical server.
#        o Host_Name :    The host name of the physical server.
#                    Please write a host name by FQDN not IP address.
#        o User_Name :    The user name who is going to access other servers with ssh.
#-------------------------------------------------------------
# Physical server 1
#-------------------------------------------------------------
<Physical_Server_Info>
    <Server_ID>            1                   </Server_ID>
    <Host_Name>            lb.pgcluster.org    </Host_Name>
    <User_Name>            postgres            </User_Name>
</Physical_Server_Info>
#-------------------------------------------------------------
# Physical server 2
#-------------------------------------------------------------
<Physical_Server_Info>
    <Server_ID>            2                   </Server_ID>
    <Host_Name>            db1.pgcluster.org   </Host_Name>
    <User_Name>            postgres            </User_Name>
</Physical_Server_Info>
#-------------------------------------------------------------
# Physical server 3
#-------------------------------------------------------------
<Physical_Server_Info>
    <Server_ID>            3                   </Server_ID>
    <Host_Name>            db2.pgcluster.org   </Host_Name>
    <User_Name>            postgres            </User_Name>
</Physical_Server_Info>
#-------------------------------------------------------------
# Physical server 4
#-------------------------------------------------------------
<Physical_Server_Info>
    <Server_ID>            4                   </Server_ID>
    <Host_Name>            pgr.pgcluster.org   </Host_Name>
    <User_Name>            postgres            </User_Name>
</Physical_Server_Info>

#-------------------------------------------------------------
# Information of the admin server section
#-------------------------------------------------------------
# (setup contents)
#        o Server_ID    :     The id number of the physical server.
#-------------------------------------------------------------
# PGC_Admin
#-------------------------------------------------------------
<Admin_Server_Info>
    <Server_ID>            1   </Server_ID>
</Admin_Server_Info>

#-------------------------------------------------------------
# Information of the probe server section
#-------------------------------------------------------------
# (setup contents)
#        o Server_ID    :     The id number of the physical server.
#-------------------------------------------------------------
<Probe_Server_Info>
    <Server_ID>        1,2,3,4    </Server_ID>
</Probe_Server_Info>

#-------------------------------------------------------------
# Information of the load balance server section
#-------------------------------------------------------------
# (setup contents)
#        o Server_ID    :     The id number of the physical server.
#-------------------------------------------------------------
<Loadbalance_Server_Info>
    <Server_ID>        1        </Server_ID>
</LoadBalance_Server_Info>

#-------------------------------------------------------------
# Information of the cluster DB server section
#-------------------------------------------------------------
# (setup contents)
#        o Server_ID    :        The id number of the physical server.
#-------------------------------------------------------------
<Cluster_Server_Info>
    <Server_ID>        2,3    </Server_ID>
</Cluster_Server_Info>

#-------------------------------------------------------------
# Information of the replication server section
#-------------------------------------------------------------
# setup contents:
#        o Server_ID    :     The id number of the physical server.
#-------------------------------------------------------------
<Replicate_Server_Info>
    <Server_ID>        4     </Server_ID>
</Replicate_Server_Info>

#-------------------------------------------------------------
# End
#-------------------------------------------------------------

3-2. Generate configuration files

All setup files are generated by execute "pgc_admin_init command.
----------------------------------------------------------------
$ cd /usr/local/pgsql/admin
$ pgc_admin_init -D /usr/local/pgsql/admin install

If you want to modify the each setup files, 
you can divide action as generate setupfiles and install 
----------------------------------------------------------------
(generate setup files)
$ pgc_admin_init -D /usr/local/pgsql/admin
(install setup files to each server)
$ pgc_admin_init -D /usr/local/pgsql/admin install

=============================================================
4. Start Up / Stop
=============================================================
There are two servers as administoration service of PGCluster.
(1) pgc_admin
The pgc_admin is a control server. 
It watches all services and manages start/stop services.
(2) pgc_probe
The pgc_probe is a probe server in each physical server.
It collects status data on each server and some execute commands as startup and stop command. 

4-1. Start up 
The pgc_probe should start in advace of pgc_admin.

A. Start probe server (in each server)
----------------------------------------------------------------
$ /usr/local/pgsql/bin/pgc_probe -D /usr/local/pgsql/probe
----------------------------------------------------------------

B. Start admin server (in admin server) 
----------------------------------------------------------------
$ /usr/local/pgsql/bin/pgc_admin -D /usr/local/pgsql/admin
----------------------------------------------------------------

4-2. Stop
The pgc_admin should stop in advace of pgc_probe.
Even if pgc_admin server stopped, other services are not stopprd.

A. Stop admin server (in admin server) 
----------------------------------------------------------------
$ /usr/local/pgsql/bin/pgc_admin -D /usr/local/pgsql/admin stop
----------------------------------------------------------------

B. Stop probe server (in each server)
----------------------------------------------------------------
$ /usr/local/pgsql/bin/pgc_probe -D /usr/local/pgsql/probe stop
----------------------------------------------------------------

4-2. Stop all service

A. Shutdown admin server (in admin server) 
----------------------------------------------------------------
$ /usr/local/pgsql/bin/pgc_admin -D /usr/local/pgsql/admin shutdown
----------------------------------------------------------------

usage: pgc_admin [-D path_of_config_file] [-W path_of_work_files]
[-n][-v][-h][stop][shutdown][status]
	-n: don't run in daemon mode.
	-v: debug mode. need '-n' flag
	-h: print this help
	stop: stop pgc_admin
	shutdown: stop all PGCluster services
	status: show status of pgc_admin

usage: pgc_probe [-D path_of_config_file] [-W path_of_work_files]
[-n][-v][-h][stop][status]
	-n: don't run in daemon mode.
	-v: debug mode. need '-n' flag
	-h: print this help
	stop: stop pgc_probe
	status: show status of pgc_probe

