[pgcluster: 671] Re: ロードバランサーについて

真鍋 彰宏 spooky_mana @ ybb.ne.jp
2005年 2月 21日 (月) 00:11:24 JST


お世話になっております。
真鍋です。

前回は調査不足で大変失礼いたしました。
結局、phpの設定が悪くタイムアウトを起こしていたのと、
ひとつのマシンからセッションを2つまでしかはれなかったことが原因で、
正しくテストを行えておりませんでした。

その後、障害時の復旧などのテストを行っていたのですが、
その際に一つ気づいたことがありますのでご連絡させて頂きます。
実験環境は前回のままで、1台のクラスタサーバを停止させて、
その後に復旧させた場合にレプリケーションサーバとロードバランサーの
それぞれで、障害・復旧を検知するか検証していました。
すると、設定ファイルの順番で3番目のクラスタサーバを一度止めて復旧
させた場合に、ロードバランサー側で障害は検知しますが、復旧を認識しない
現象が起こりました。
この時、レプリケーションサーバでは問題なく障害・復旧とも検知しています。
また、1番目、2番目のクラスタサーバに関しては問題ありませんでした。
この後に、設定ファイル中で2番目のクラスタサーバの設定をコメントアウトし、
クラスタサーバ2台の構成で再度実験を行ったところ、ロードバランサー側でも
問題なく障害・復旧の検知が行えました。

以下に、実験の手順と設定ファイル、あとDEBUGモードでのログでクラスタ構成を
2台と3台で動かしたときに違いがあった箇所を記述しますので、
お気づきの点があればご指摘頂ければ幸いです。

■実験の手順
1.すべてのサーバを正常に起動
2.クラスタサーバ3のポスグレを停止
3.phpでDBへ書き込みを行い、障害を検知
4.クラスタサーバ3をリカバリモードで起動
5.再度phpでDBへの書き込みを行い、問題がないかどうか確認

■DEBUGモードのログ(クラスタサーバが3台の場合)
DEBUG:set_recovery():received no:1
DEBUG:set_recovery():add_db host:real3 port:5432 max:32
DEBUG:PGRset_status_on_cluster_tbl():host:real3 port:5432 max:32 use:99 status3
DEBUG:set_recovery():received no:3
DEBUG:set_recovery():stop_db host:real1 port:5432 max:32
DEBUG:PGRset_status_on_cluster_tbl():host:real1 port:5432 max:32 use:2 status3
DEBUG:set_recovery():received no:9
DEBUG:set_recovery():start_db host:real1 port:5432 max:32
DEBUG:PGRset_status_on_cluster_tbl():host:real1 port:5432 max:32 use:3 status2
DEBUG:set_recovery():received no:9

■DEBUGモードのログ(クラスタサーバが2台の場合)
DEBUG:set_recovery():received no:1
DEBUG:set_recovery():add_db host:real3 port:5432 max:32
DEBUG:PGRset_status_on_cluster_tbl():host:real3 port:5432 max:32 use:99 status3
DEBUG:set_recovery():received no:3
DEBUG:set_recovery():stop_db host:real1 port:5432 max:32
DEBUG:PGRset_status_on_cluster_tbl():host:real1 port:5432 max:32 use:2 status3
DEBUG:set_recovery():received no:9
DEBUG:set_recovery():start_db host:real1 port:5432 max:32
DEBUG:PGRset_status_on_cluster_tbl():host:real1 port:5432 max:32 use:3 status2
DEBUG:set_recovery():received no:9
DEBUG:set_recovery():start_db host:real3 port:5432 max:32
DEBUG:PGRset_status_on_cluster_tbl():host:real3 port:5432 max:32 use:3 status2

■cluser.conf
<Replicate_Server_Info>
        <Host_Name> replicate2 </Host_Name>
        <Port> 8001 </Port>
        <Recovery_Port> 8101 </Recovery_Port>
</Replicate_Server_Info>

<Recovery_Port> 7779 </Recovery_Port>
<Rsync_Path> /usr/bin/rsync </Rsync_Path>
<Rsync_Option> ssh -2 </Rsync_Option>
<When_Stand_Alone> read_only  </When_Stand_Alone>


■pgreplicate.conf
<Cluster_Server_Info>
    <Host_Name>   real1  </Host_Name>
    <Port>        5432                </Port>
    <Recovery_Port>       7779        </Recovery_Port>
</Cluster_Server_Info>
<Cluster_Server_Info>
    <Host_Name>   real2 </Host_Name>
    <Port>        5432                </Port>
    <Recovery_Port>       7779        </Recovery_Port>
</Cluster_Server_Info>
<Cluster_Server_Info>
    <Host_Name>   real3   </Host_Name>
    <Port>        5432                </Port>
    <Recovery_Port>       7779       </Recovery_Port>
</Cluster_Server_Info>

<LoadBalance_Server_Info>
        <Host_Name>   lb2  </Host_Name>
        <Recovery_Port>       8201            </Recovery_Port>
</LoadBalance_Server_Info>

<Replication_Port>    8001            </Replication_Port>
<Recovery_Port>       8101            </Recovery_Port>
<Response_Mode>       normal          </Response_Mode>


■pglb.conf
<Cluster_Server_Info>
    <Host_Name>   real1  </Host_Name>
    <Port>        5432                </Port>
    <Max_Connect> 32                  </Max_Connect>
</Cluster_Server_Info>
<Cluster_Server_Info>
    <Host_Name>   real2   </Host_Name>
    <Port>        5432                </Port>
    <Max_Connect> 32                  </Max_Connect>
</Cluster_Server_Info>
<Cluster_Server_Info>
    <Host_Name>   real3   </Host_Name>
    <Port>        5432                </Port>
    <Max_Connect> 32                  </Max_Connect>
</Cluster_Server_Info>

<Backend_Socket_Dir>    /tmp     </Backend_Socket_Dir>
<Receive_Port>          5432     </Receive_Port>
<Recovery_Port>         8201     </Recovery_Port>
<Max_Cluster_Num>        128     </Max_Cluster_Num>
<Use_Connection_Pooling>  no     </Use_Connection_Pooling>


-- 
真鍋 彰宏 




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