[pgcluster: 1024] Pgreplicateの冗長化について

Morishita Hiromitsu hero @ e-mail.jp
2008年 3月 9日 (日) 08:55:29 JST


森下と申します。

現在、PostgreSQLをバックエンドに使った
システムを構築中なのですが、DB周りを冗長構成にするために
PGClusterを評価しています。評価バージョンは

pgreplicate冗長化したいと思っています。
カスケードのlower側のpgreplicate.confでupper側を設定しているつもりなのですが
upper側を止めると次のようなエラーが出て更新ができなくなります。

This query is not permitted when all replication servers fell down

期待している動作はlower側にレプリケーション処理が引き継がれることなのですが
うまくいきません。
そもそもレプリケーションサーバのカスケードとはこのような機能を実現する
ものではないのでしょうか。
レプリケーションサーバを冗長化し、どちらか一方のレプリケーションサーバが
止まっても更新し続けられる設定方法をご教授いただけないでしょうか。

よろしくお願いします。

評価構成は次の通りです。

マシン1:172.29.239.11
ロードバランサ:pglb.cool-revo.com
クラスターDB:cluster1.cool-revo.com
レプリケーションサーバ(upper):rep1.cool-revo.com

マシン2:172.29.239.39
クラスターDB:cluster2.cool-revo.com
レプリケーションサーバ(lower):rep2.cool-revo.com

【hostsファイル】
172.29.239.11 cluster1.cool-revo.com
172.29.239.39 cluster2.cool-revo.com
172.29.239.11 rep1.cool-revo.com
172.29.239.39 rep2.cool-revo.com
172.29.239.11 lb.cool-revo.com

【マシン1:pglb.conf】
# set cluster DB server information ##################
<Cluster_Server_Info>
<Host_Name> cluster1.cool-revo.com </Host_Name>
<Port> 15432 </Port>
<Max_Connect> 32 </Max_Connect>
</Cluster_Server_Info>
<Cluster_Server_Info>
<Host_Name> cluster2.cool-revo.com </Host_Name>
<Port> 25432 </Port>
<Max_Connect> 32 </Max_Connect>
</Cluster_Server_Info>
# set Load Balance server information ##################
<Host_Name> lb.cool-revo.com </Host_Name>
<Backend_Socket_Dir> /tmp </Backend_Socket_Dir>
<Receive_Port> 5432 </Receive_Port>
<Recovery_Port> 6001 </Recovery_Port>
<Max_Cluster_Num> 128 </Max_Cluster_Num>
<Use_Connection_Pooling> no </Use_Connection_Pooling>
<LifeCheck_Timeout> 3s </LifeCheck_Timeout>
<LifeCheck_Interval> 15s </LifeCheck_Interval>

【マシン1:cluster.conf】
# set Replication Server information ##################
<Replicate_Server_Info>
<Host_Name> rep1.cool-revo.com </Host_Name>
<Port> 18001 </Port>
<Recovery_Port> 18101 </Recovery_Port>
</Replicate_Server_Info>
<Replicate_Server_Info>
<Host_Name> rep2.cool-revo.com </Host_Name>
<Port> 28001 </Port>
<Recovery_Port> 28101 </Recovery_Port>
</Replicate_Server_Info>
# set Cluster DB Server information ##################
<Host_Name> cluster1.cool-revo.com </Host_Name>
<Recovery_Port> 17001 </Recovery_Port>
<Rsync_Path> /usr/bin/rsync </Rsync_Path>
<Rsync_Option> ssh -1 </Rsync_Option>
<Rsync_Compress> yes </Rsync_Compress>
<Pg_Dump_Path> /usr/local/pgsql/bin/pg_dump </Pg_Dump_Path>
<When_Stand_Alone> read_only </When_Stand_Alone>
<Replication_Timeout> 1 min </Replication_Timeout>
<LifeCheck_Timeout> 3s </LifeCheck_Timeout>
<LifeCheck_Interval> 11s </LifeCheck_Interval>

【マシン1: pgreplicate.conf】
# A setup of Cluster DB(s) ##################
<Cluster_Server_Info>
<Host_Name> cluster1.cool-revo.com </Host_Name>
<Port> 15432 </Port>
<Recovery_Port> 17001 </Recovery_Port>
</Cluster_Server_Info>
<Cluster_Server_Info>
<Host_Name> cluster2.cool-revo.com </Host_Name>
<Port> 25432 </Port>
<Recovery_Port> 27001 </Recovery_Port>
</Cluster_Server_Info>
# A setup of Load Balance Server ##################
<LoadBalance_Server_Info>
<Host_Name> lb.cool-revo.com </Host_Name>
<Recovery_Port> 6001 </Recovery_Port>
</LoadBalance_Server_Info>
# A setup of a replication server ##################
<Host_Name> rep1.cool-revo.com </Host_Name>
<Replication_Port> 18001 </Replication_Port>
<Recovery_Port> 18101 </Recovery_Port>
<RLOG_Port> 18301 </RLOG_Port>
<Response_Mode> normal </Response_Mode>
<Use_Replication_Log> yes </Use_Replication_Log>
<Replication_Timeout> 1min </Replication_Timeout>
<LifeCheck_Timeout> 3s </LifeCheck_Timeout>
<LifeCheck_Interval> 15s </LifeCheck_Interval>

【マシン2: cluster.conf 】
# set Replication Server information ##################
<Replicate_Server_Info>
<Host_Name> rep1.cool-revo.com </Host_Name>
<Port> 18001 </Port>
<Recovery_Port> 18101 </Recovery_Port>
</Replicate_Server_Info>
<Replicate_Server_Info>
<Host_Name> rep2.cool-revo.com </Host_Name>
<Port> 28001 </Port>
<Recovery_Port> 28101 </Recovery_Port>
</Replicate_Server_Info>
# set Cluster DB Server information ##################
<Host_Name> cluster2.cool-revo.com </Host_Name>
<Recovery_Port> 27001 </Recovery_Port>
<Rsync_Path> /usr/bin/rsync </Rsync_Path>
<Rsync_Option> ssh -1 </Rsync_Option>
<Rsync_Compress> yes </Rsync_Compress>
<Pg_Dump_Path> /usr/local/pgsql/bin/pg_dump </Pg_Dump_Path>
<When_Stand_Alone> read_only </When_Stand_Alone>
<Replication_Timeout> 1 min </Replication_Timeout>
<LifeCheck_Timeout> 3s </LifeCheck_Timeout>
<LifeCheck_Interval> 11s </LifeCheck_Interval>

【マシン2: pgreplicate.conf】
# A setup of Cluster DB(s) ##################
<Cluster_Server_Info>
<Host_Name> cluster1.cool-revo.com </Host_Name>
<Port> 15432 </Port>
<Recovery_Port> 17001 </Recovery_Port>
</Cluster_Server_Info>
<Cluster_Server_Info>
<Host_Name> cluster2.cool-revo.com </Host_Name>
<Port> 25432 </Port>
<Recovery_Port> 27001 </Recovery_Port>
</Cluster_Server_Info>
# A setup of Load Balance Server ##################
<LoadBalance_Server_Info>
<Host_Name> lb.cool-revo.com </Host_Name>
<Recovery_Port> 6001 </Recovery_Port>
</LoadBalance_Server_Info>
# A setup of the cascade connection between replication servers. ####
<Replicate_Server_Info>
<Host_Name> rep1.cool-revo.com </Host_Name>
<Port> 18001 </Port>
<Recovery_Port> 18101 </Recovery_Port>
</Replicate_Server_Info>
# A setup of a replication server ##################
<Host_Name> rep2.cool-revo.com </Host_Name>
<Replication_Port> 28001 </Replication_Port>
<Recovery_Port> 28101 </Recovery_Port>
<RLOG_Port> 18301 </RLOG_Port>
<Response_Mode> normal </Response_Mode>
<Use_Replication_Log> yes </Use_Replication_Log>
<Replication_Timeout> 1min </Replication_Timeout>
<LifeCheck_Timeout> 3s </LifeCheck_Timeout>
<LifeCheck_Interval> 15s </LifeCheck_Interval>



pgcluster メーリングリストの案内