[pgcluster: 873] Re: リカバリモードにてオンライン復旧について 

奥田 高広 okuda @ bownet.co.jp
2006年 4月 14日 (金) 14:07:34 JST


はじめまして
奥田と申します。

環境は異なりますが、同様の現象での対応内容を記載させて頂きます。

環境は
Cent OS 4.2
PGCluster 1.5.0 rc7
です。

原因は、OpenSSHが、SSH 1の場合、公開鍵方式に対応して 
いないため、
リカバリモードで起動時に、SSHによる他クラスタの接続ができ 
なかった
ためです。
もし、rsyncで公開鍵による接続が出来ているのであれば、異な 
りますが
公開鍵での接続が出来ていないのであれば、原因は同じかも知れません。

この場合の対処方法ですが、鍵をSSH 2で作成し、 
cluster.confのrsync
オプションをssh -2に設定します。
また、接続時のフレーズが入力できないので(私が知らないだけかもしれ
ませんが)、ssh-agentを起動し、リカバリ前にssh-addで 
フレーズの登録
も必要になると思います。


以上、ご参考までに



On 2006/04/14, at 11:59, 柳田 wrote:

>
> 先日、『テーブルの登録等でリクエストが重複』の件にて
> お世話になった柳田です。
>
> どうにも解決できないので、また質問させてください。
> 現在行っている作業は、リカバリモードのテストです。設定ミスなの 
> か正常動作しません。
>
> pgcluster-1[1].0.9a.tar.gz を使用しております。
> 現在、2台のレプリケーションサーバ、2台のロードバランサ、 
> 3台の クラスタサーバで
> 環境を構築しています。
> ・サーバ1(happy118)
>      クラスタサーバ1
> ・サーバ2(happy119)
>      クラスタサーバ2
>      ロードバランサ(マスタ)
>      レプリケーションサーバ(スレーブ)
> ・サーバ3(happy114)
>      クラスタサーバ3
>      ロードバランサ(スレーブ)
>      レプリケーションサーバ(マスタ)
>
>
> テストで確認したいことはオンライン復旧できるかどうかです。
> テストパターンはレプリケーションサーバ、クラスタサーバ、ロード 
> バランサーの順番で起動させ、正常動作を確認。
> 正常動作を確認したら、 クラスタサーバ2の 
> postmasterを終了させます。
> ロードバランサーに対し、更新クエリーを実行します。クラスタサー 
> バ1、3は正常に更新されます。
> クラスタサーバ2がpgreplicate.stsで「error」となっ 
> たので、クラスタサーバ2でリカバリーコマンドを実行しました
> 以下の内容が表示され、復旧できませんでした。
> 【リカバリーコマンド実 
> 行】------------------------------------------------------------ 
> ---
> [postgres @ fire119 etc]$ /service/pgc_pgsql7.3.9/bin/pg_ctl start - 
> D /service/pgc_pgsql7.3.9/data -o "-i -R"
> /service/pgc_pgsql7.3.9/bin/postmaster: Assert checking is not  
> compiled in.
> postmaster successfully started
> [postgres @ fire119 etc]$ Start in recovery mode!
> Please wait until a data synchronization finishes from Master DB...
> /service/pgc_pgsql7.3.9/bin/postmaster: sorry, recovery failed.
> ---------------------------------------------------------------------- 
> ------------
>
> リカバリコマンド実行後にpgreplicate.stsを見たところ、な 
> ぜかクラスタサーバ1と
> クラスタサーバ2も「error」となっていました。
> 【pgreplicate.sts】------------------------------------
> Fri Apr 14 10:53:52 2006  port(5431) host:fire118 start use
> Fri Apr 14 10:53:52 2006  port(5431) host:fire119 start use
> Fri Apr 14 10:53:52 2006  port(5431) host:fire114 start use
> Fri Apr 14 10:53:52 2006  cascade(fire114) port(8001) start use
> Fri Apr 14 10:53:52 2006  cascade(fire114) port(8001) become top
> Fri Apr 14 11:11:37 2006  port(5431) host:fire119 error
> Fri Apr 14 11:15:50 2006  port(5431) host:fire119 initialize
> Fri Apr 14 11:15:50 2006  port(5431) host:fire119 initialize
> Fri Apr 14 11:15:54 2006  port(5431) host:fire118 error
> Fri Apr 14 11:15:58 2006  port(5431) host:fire114 error
> --------------------------------------------------
> ロードバランサにて更新クエリを実行すると、クラスタ1,3で正常 
> に動作してくれます。
>
>
> 下記のコマンドにて"rsync"を使ってファイルを取得できるこ 
> とは確認しています。
> rsync -au -e "ssh -1" fire118:/service/pgc_pgsql7.3.9/data /service/ 
> pgc_pgsql7.3.9/
>
> 関係ない話になってしまうかもしれませんが、『[pgcluster:  
> 831] リカバリモードでクラスタサーバがうまく起動しない場合の対 
> 応について』にて
> --安定版である1.0は,1.0.10rc1が最新ですので,こち 
> らを試されることをお勧めします.-- と記載されていますが、
> バージョンアップを行ったほうが、よろしいのでしょうか?
>
>
> 以下に【OS】、【cluster.conf】、 
> 【pgreplicate.conf 】、【pglb.conf】、【再現中のレ 
> プリケーションデバッグ】を記載しました。
> よろしくお願いします。
>
> 【OS】----------------------------------------
> すべて下記のOSです。
> Red Hat Enterprise Linux ES release 3 (Taroon)
>
> 【cluster.conf】3台のクラスタDBは同じ設 
> 定--------------
> # set Replication Server information
> <Replicate_Server_Info>
>         <Host_Name> happy118 </Host_Name>
>         <Port> 8001 </Port>
>         <Recovery_Port> 8101 </Recovery_Port>
> </Replicate_Server_Info>
> # set Cluster DB Server information
> <Recovery_Port> 7001 </Recovery_Port>
> <Rsync_Path> /usr/bin/rsync </Rsync_Path>
> <Rsync_Option> ssh -1 </Rsync_Option>
> <When_Stand_Alone> read_only  </When_Stand_Alone>
>
> 【pgreplicate.conf 】--------------------------------
> # A setup of Cluster DB(s)
> <Cluster_Server_Info>
>     <Host_Name>   fire118  </Host_Name>
>     <Port>        5431                </Port>
>     <Recovery_Port>       7779        </Recovery_Port>
> </Cluster_Server_Info>
> <Cluster_Server_Info>
>     <Host_Name>   fire119  </Host_Name>
>     <Port>        5431                </Port>
>     <Recovery_Port>       7779        </Recovery_Port>
> </Cluster_Server_Info>
> <Cluster_Server_Info>
>     <Host_Name>   fire114  </Host_Name>
>     <Port>        5431                </Port>
>     <Recovery_Port>       7779       </Recovery_Port>
> </Cluster_Server_Info>
> # A setup of Load Balance Server
> <LoadBalance_Server_Info>
>         <Host_Name>   fire119  </Host_Name>
>         <Recovery_Port>       7780            </Recovery_Port>
> </LoadBalance_Server_Info>
> <LoadBalance_Server_Info>
>         <Host_Name>   fire114  </Host_Name>
>         <Recovery_Port>       7780            </Recovery_Port>
> </LoadBalance_Server_Info>
> # A setup of a replication server
> <Replication_Port>    8001            </Replication_Port>
> <Recovery_Port>       8101            </Recovery_Port>
> <Response_Mode>       reliable        </Response_Mode>
>
> 【pglb.conf】------------------------------------
> # set cluster DB server information
> <Cluster_Server_Info>
>     <Host_Name>   fire118             </Host_Name>
>     <Port>        5431                </Port>
>     <Max_Connect> 16                 </Max_Connect>
> </Cluster_Server_Info>
> <Cluster_Server_Info>
>     <Host_Name>   fire119             </Host_Name>
>     <Port>        5431                </Port>
>     <Max_Connect> 16                 </Max_Connect>
> </Cluster_Server_Info>
> <Cluster_Server_Info>
>     <Host_Name>   fire114             </Host_Name>
>     <Port>        5431                </Port>
>     <Max_Connect> 16                 </Max_Connect>
> </Cluster_Server_Info>
> # set Load Balance server information
> <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>  yes     </Use_Connection_Pooling>
>
> 【リカバリコマンド実行時のレプリケーションデバッ 
> グ】---------------------
> ■■■■クラスターサーバ2のpostmaster停止後、更新クエ 
> リーをロードバランサで実行■■■■
> DEBUG:PGRdo_replicate():query :: insert into t_hoge 
> (hoge_id,hoge_no) values ('ABA','1')
> DEBUG:cmdSts=Q
> DEBUG:cmdType=I
> DEBUG:port=5431
> DEBUG:pid=10718
> DEBUG:from_host=fire118
> DEBUG:dbName=hogedb
> DEBUG:userName=postgres
> DEBUG:recieve sec=1144980572
> DEBUG:recieve usec=395246
> DEBUG:query_size=54
> DEBUG:query=insert into t_hoge(hoge_id,hoge_no) values ('ABA','1')
> DEBUG:sem_lock[1]
> DEBUG:PGRreturn_result():PGRreturn_result[3,1144980572,395246,2]
> DEBUG:PGRreturn_result():128 send
> DEBUG:PGRsend_replicate_packet_to_server():host(fire119) : port(5431)
> DEBUG:PGRsend_replicate_packet_to_server():connect db:hogedb port: 
> 5431 user:postgres host:fire119 query:insert into t_hoge 
> (hoge_id,hoge_no) values ('ABA','1')
> DEBUG:PGRsend_replicate_packet_to_server():sync_command(SELECT  
> PGR_SYSTEM_COMMAND_FUNCTION(3,1144980572,395246,2) )
> WARNING:  Message from PostgreSQL backend:
>         The Postmaster has informed me that some other backend
>         died abnormally and possibly corrupted shared memory.
>         I have rolled back the current transaction and am
>         going to terminate your database system connection and exit.
>         Please reconnect to the database system and repeat your query.
> DEBUG:PGRsend_replicate_packet_to_server():host(fire114) : port(5431)
> DEBUG:PGRsend_replicate_packet_to_server():connect db:hogedb port: 
> 5431 user:postgres host:fire114 query:insert into t_hoge 
> (hoge_id,hoge_no) values ('ABA','1')
> DEBUG:PGRsend_replicate_packet_to_server():sync_command(SELECT  
> PGR_SYSTEM_COMMAND_FUNCTION(3,1144980572,395246,2) )
> DEBUG:read_answer():answer[PGR_QUERY_DONE_NOTICE_CMD]
> DEBUG:read_answer():QUERY DONE
> DEBUG:PGRsend_replicate_packet_to_server():PQexec send :insert into  
> t_hoge(hoge_id,hoge_no) values ('ABA','1')
> DEBUG:sem_unlock[1]
> DEBUG:PGRreturn_result():PGRreturn_result[6]
> DEBUG:PGRreturn_result():128 send
>
> ■■■■クラスタサーバ2に対し、リカバリーコマンド実行■■■■
> DEBUG:pgrecovery_loop():recovery accept port 8101
> DEBUG:pgrecovery_loop():receive packet no:1
> DEBUG:first_setup_recovery():1st setup target fire119
> DEBUG:first_setup_recovery():1st setup port 5431
> DEBUG:first_setup_recovery():add recovery target to host table
> DEBUG:PGRsend_load_balance_packet():host[fire119] port[7780]
> ERROR:send_packet():host[fire119] port[7780] 
> PGR_Create_Socket_Connect failed
> DEBUG:PGRsend_load_balance_packet():host[fire114] port[7780]
> ERROR:send_packet():host[fire114] port[7780] 
> PGR_Create_Socket_Connect failed
> DEBUG:first_setup_recovery():set RECOVERY_PGDATA_REQ packet data
> DEBUG:PGRsend_replicate_packet_to_server():host(fire118) : port(5431)
> DEBUG:pgr_createConn():PQsetdbLogin host[fire118] port[5431] db 
> [template1] user[postgres]
> DEBUG:pgr_createConn():PQsetdbLogin ok!!
> DEBUG:PGRsend_replicate_packet_to_server():connect db:template1  
> port:5431 user:postgres host:fire118 query:VACUUM
> DEBUG:PGRsend_replicate_packet_to_server():sync_command(SELECT  
> PGR_SYSTEM_COMMAND_FUNCTION(3,0,0,2) )
> DEBUG:PGRsend_replicate_packet_to_server():PQexec send :VACUUM
> DEBUG:first_setup_recovery():send packet to master fire118  
> recoveryPort 7779
> ERROR:send_packet():host[fire118] port[7779] 
> PGR_Create_Socket_Connect failed
> ERROR:first_setup_recovery():connection error , master may be down
> DEBUG:PGRsend_load_balance_packet():host[fire119] port[7780]
> ERROR:send_packet():host[fire119] port[7780] 
> PGR_Create_Socket_Connect failed
> DEBUG:PGRsend_load_balance_packet():host[fire114] port[7780]
> ERROR:send_packet():host[fire114] port[7780] 
> PGR_Create_Socket_Connect failed
> DEBUG:PGRsend_replicate_packet_to_server():host(fire114) : port(5431)
> DEBUG:pgr_createConn():PQsetdbLogin host[fire114] port[5431] db 
> [template1] user[postgres]
> DEBUG:pgr_createConn():PQsetdbLogin ok!!
> DEBUG:PGRsend_replicate_packet_to_server():connect db:template1  
> port:5431 user:postgres host:fire114 query:VACUUM
> DEBUG:PGRsend_replicate_packet_to_server():sync_command(SELECT  
> PGR_SYSTEM_COMMAND_FUNCTION(3,0,0,2) )
> DEBUG:PGRsend_replicate_packet_to_server():PQexec send :VACUUM
> DEBUG:first_setup_recovery():send packet to master fire114  
> recoveryPort 7779
> ERROR:send_packet():host[fire114] port[7779] 
> PGR_Create_Socket_Connect failed
> ERROR:first_setup_recovery():connection error , master may be down
> DEBUG:PGRsend_load_balance_packet():host[fire119] port[7780]
> ERROR:send_packet():host[fire119] port[7780] 
> PGR_Create_Socket_Connect failed
> DEBUG:PGRsend_load_balance_packet():host[fire114] port[7780]
> ERROR:send_packet():host[fire114] port[7780] 
> PGR_Create_Socket_Connect failed
> ERROR:first_setup_recovery():get master info error , master may be  
> down
> DEBUG:pgrecovery_loop():1st master fire114 - 5431
> DEBUG:pgrecovery_loop():1st target fire119 - 5431
> DEBUG:pgrecovery_loop():recovery accept port 8101
> DEBUG:pgrecovery_loop():receive packet no:200
> DEBUG:pgrecovery_loop():recovery error accept. top queueing and  
> initiarse recovery status
> DEBUG:PGRsend_queue():master fire114 - 5431
> DEBUG:PGRsend_queue():send_queue return status 0
> ERROR:send_packet():host[fire114] port[7779] 
> PGR_Create_Socket_Connect failed
> DEBUG:PGRsend_load_balance_packet():host[fire119] port[7780]
> DEBUG:replicate_loop():replicate loop exit
> ERROR:send_packet():host[fire119] port[7780] 
> PGR_Create_Socket_Connect failed
> DEBUG:PGRsend_load_balance_packet():host[fire114] port[7780]
> ERROR:send_packet():host[fire114] port[7780] 
> PGR_Create_Socket_Connect failed




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