カスタム検索
|
Tweet |
|
|
レプリケーションサーバーの設定と起動
Modified: 26 November 2005
設定の方法
http://pgcluster.projects.postgresql.org/jp/1_0/configuration.html
設定の準備
クラスタサーバーに関する設定
ロードバランサーに関する設定
レプリケーションサーバーに関する設定
起動してみる
サンプルの設定ファイルをコピーします。
# chown postgres.postgres /usr/local/pgsql # su - postgres $ mkdir /usr/local/pgsql/etc $ cd /usr/local/pgsql/etc $ cp /home/postgres/pgcluster-1.0.9a/src/pgcluster/pgrp/pgreplicate.conf.sample pgreplicate.conf $"pgreplicate.conf"を開きます。
3台のクラスタサーバーとして設定をしていますので、コメントを取って、ポートはデフォルトのままでいいので、ホスト名(コメントにIPアドレスではだめだと書いてあります)だけ設定します。
#============================================================= # PGReplicate configuration file #------------------------------------------------------------- # file: pgreplicate.conf #------------------------------------------------------------- # This file controls: # o which hosts & port are cluster server # o which port use for replication request from cluster server #============================================================= # #------------------------------------------------------------- # A setup of Cluster DB(s) # # o Host_Name : The host name of Cluster DB. # -- please write a host name by FQDN. # -- do not write IP address. # o Port : The connection port with postmaster. # o Recovery_Port : The connection port at the time of # a recovery sequence . #------------------------------------------------------------- <Cluster_Server_Info> <Host_Name> wd-db1.tomo.ac </Host_Name> <Port> 5432 </Port> <Recovery_Port> 7779 </Recovery_Port> </Cluster_Server_Info> <Cluster_Server_Info> <Host_Name> wd-db2.tomo.ac </Host_Name> <Port> 5432 </Port> <Recovery_Port> 7779 </Recovery_Port> </Cluster_Server_Info> <Cluster_Server_Info> <Host_Name> wd-db3.tomo.ac </Host_Name> <Port> 5432 </Port> <Recovery_Port> 7779 </Recovery_Port> </Cluster_Server_Info>
1台のロードバランサーとして設定をしていますので、コメントを取って、ポートはデフォルトのままでいいので、ホスト名(コメントにIPアドレスではだめだと書いてあります)だけ設定します。
# #------------------------------------------------------------- # A setup of Load Balance Server # # o Host_Name : The host name of a load balance server. # -- please write a host name by FQDN. # -- do not write IP address. # o Recovery_Port : The connection port at the time of # a recovery sequence . #------------------------------------------------------------- <LoadBalance_Server_Info> <Host_Name> wd-pglb1.tomo.ac </Host_Name> <Recovery_Port> 7780 </Recovery_Port> </LoadBalance_Server_Info> <LoadBalance_Server_Info> <Host_Name> wd-pglb2.tomo.ac </Host_Name> <Recovery_Port> 7780 </Recovery_Port> </LoadBalance_Server_Info> #
1台のレプリケーションサーバーとして設定をしていますので、コメントを取って、ポートはデフォルトのままでいいので、ホスト名(コメントにIPアドレスではだめだと書いてあります)だけ設定します。
#------------------------------------------------------------ # A setup of the upper replication server for cascade connection. # # o Host_Name : The host name of Cluster DB. # -- please write a host name by FQDN. # -- do not write IP address. # o Port : The connection port with postmaster. # o Recovery_Port : The connection port at the time of # a recovery sequence . #------------------------------------------------------------ #<Replicate_Server_Info> # <Host_Name> wd-pgrp.tomo.ac </Host_Name> # <Port> 8002 </Port> # <Recovery_Port> 8102 </Recovery_Port> #</Replicate_Server_Info> # #------------------------------------------------------------- # A setup of a replication server # # o Replicate_Port : connection for reprication # o Recovery_Port : connection for recovery # o Response_mode : timing which returns a response # normal -- return result of DB which received the query # reliable -- return result after waiting for response of # all Cluster DBs. #------------------------------------------------------------- <Replication_Port> 8001 </Replication_Port> <Recovery_Port> 8101 </Recovery_Port> <Response_Mode> normal </Response_Mode>以下のコマンドで起動します。
$ /usr/local/pgsql/bin/pgreplicate -D /usr/local/pgsql/etc以下のようにプロセスが見えればOKです。
$ ps ax : 13195 ? S 0:00 /usr/local/pgsql/bin/pgreplicate -D /usr/local/pgsql/etc 13196 ? S 0:00 /usr/local/pgsql/bin/pgreplicate -D /usr/local/pgsql/etc : $