[pgsql-jp: 32936] pgpoolのfailoverについて

HIRANO Yoshitaka yo @ hirano.cc
2004年 5月 14日 (金) 18:17:46 JST


初めまして、平野と申します。

 PostgreSQLのサーバのfail overを実現しようと、pgpoolを
検証させて頂いております。かなり気に入っているのですが、
fail overしない状況がありましたので、報告します。

 3台のサーバを用意して、

A: pgpool のみインストールされたPC (postgreSQLなし) (Turbolinux 8)
B: postgreSQL7.4.2がインストールされたPC (Primary) (Turbolinux 8)
C: postgreSQL7.4.2がインストールされたPC (Secondary) (Fedora Core 1)

という構成で、

1) B C ともpostmasterの起動している状態で、Aにてpgpool -dn を起動
2) Bより psql -h A test でpgpoolに接続
3) CのLANケーブルを抜く
4) psqlから何か問い合わせ(\dt)を送る
5) 反応なし (数分経っても終了しない,
             かなり(?)待つと正しくfailoverする)

というテストを行ったのですが、failoverせずに、黙りになって
しまいます。この時の、pgpoolの出力は、

| DEBUG: pid 18297: read kind from frontend Q(51)
| DEBUG: pid 18297: pool_read_string: readsize: 1024 readp: 0 secondary: 0
| DEBUG: pid 18297: pool_read_string: buf:SELECT n.nspname as "Schema",
| -- snip --
| ORDER BY 1,2;: readlen: 523
| DEBUG: pid 18297: strlength: 523
| DEBUG: pid 18297: pool_read_string: string: :SELECT n.nspname as "Schema",
| -- snip --
| DEBUG: pid 18297: pool_read_string: next string: ::
| DEBUG: pid 18297: pool_read_string: final read 523 string: :SELECT n.nspname as
| -- snip --
| DEBUG: pid 18297: pool_read_string: total result 523 string: :SELECT n.nspname a
| -- snip --
| DEBUG: pid 18297: read kind from backend P

というような感じで、ここで止まってしまっています。

 マニュアル通りに、DBノード側でpostmasterプロセスを停止した
場合は、正しく、

| test=> \dt
| server closed the connection unexpectedly
|         This probably means the server terminated abnormally
|         before or while processing the request.
| The connection to the server was lost. Attempting reset: Failed.
| !> 

という状態になりましたので、pgpool <-> postgreSQLサーバ 間の
コネクションの断が検出出来ていないのだと思います。

 実際、netstatで見たところ、

| $ netstat -a | grep 5432
| tcp        0      0 *:5432                  *:*                     LISTEN
| tcp        0      0 test2.test:5432         192.168.5.161:1202      ESTABLISHED
| tcp        0    524 test2.test:1298         192.168.5.163:5432      ESTABLISHED 
| tcp      118      0 test2.test:1297         192.168.5.161:5432      ESTABLISHED
| unix  2      [ ACC ]     STREAM     LISTENING     48405  /tmp/.s.PGSQL.5432

Bサーバ(192.168.5.161)もCサーバ(192.168.5.163)同様にestablished
の状態になっています。


 実際の障害では、障害の起きたサーバのpostmasterがshutdown
してくれるとは到底考えられないので、何とかしたいと考えているの
ですが、何かいい方法はありませんでしょうか。

 無理なら、とりあえず、時間のかかるqueryはないものとして、
タイムアウトさせて逃げようか、とも思っていますが。

 よろしくお願いいたします。



pgsql-jp メーリングリストの案内