[pgcluster: 536] リカバリーできない

kazunari takahashi kazunari.takahashi @ ctc-g.co.jp
2004年 9月 14日 (火) 16:32:50 JST


高橋です.

リカバリできない現象が発生しております.
以前見たメッセージですので、/etc/hostsなど調べたのですが、
問題なさそうに見えます.
行き詰まってしまったので、どなたか助力ください.
createdbやcreateuserは問題なくできました.
個人的には、デバックログ中の
DEBUG(pgr_createConn): PQsetdbLogin host[serverA] port[5432] db[template1] user[root]
が怪しいかなと思い、再度postgresユーザで、コンパイルしてみました.
ちなみに、各サーバともインターフェースは2つついており、
片方を使用しております.


####################################
#環境
####################################
pgcluster-1.0.8RC2

clusterDB ×2 (solaris8 sparc) host名:serverA , serverB
rgrp × 1 (solaris8 sparc)


####################################
#手順
####################################


-------------------------
1.テーブル作成
-------------------------

test=> create TABLE test(id serial , name varchar(10));
NOTICE:  CREATE TABLE will create implicit sequence 'test_id_seq' for SERIAL column 'test.id'
CREATE TABLE

-------------------------
2.データをclusterDB上からインサート
-------------------------

test=> insert into test(name) values('a');
INSERT 33366 1

2clusterDBとも正常にインサートされる.

----------------------------
3.serverCのpostmasterを落とす
-----------------------------

$ pg_ctl stop -D /usr/local/pgsql/data -m i

-------------------------
2.データをclusterDB上からインサート
-------------------------

test=> insert into test(name) values('b');
INSERT 33366 1

serverAに正常にインサートされる.

----------------------------
4.serverAのpostmasterを起動
----------------------------
serverB% pg_ctl start -D /usr/local/pgsql/data -o "-i -R"
postmaster successfully started
serverB% Start in recovery mode!
Please wait until a data synchronization finishes from Master DB...
/usr/local/pgsql/bin/postmaster: sorry, recovery failed.

---------------
デバックログ
---------------

DEBUG(replicate_loop): wait replicate

DEBUG(replicate_loop): wait replicate

DEBUG(replicate_loop): replicate main: selected

DEBUG(pgrecovery_loop): recovery accept port 8101

DEBUG(read_packet): receive packet no:1

DEBUG(first_setup_recovery): 1st setup target serverB

DEBUG(first_setup_recovery): 1st setup port 5432

DEBUG(first_setup_recovery): check another recovery process

DEBUG(PGRsem_unlock): add recovery target to host table

DEBUG(PGRsend_load_balance_packet): set RECOVERY_PGDATA_REQ packet data

DEBUG(PGRsend_replicate_packet_to_server): host(serverA) : port(5432)
DEBUG(getTransactionTbl): not found in getTransactionTbl
DEBUG(pgr_createConn): PQsetdbLogin host[serverA] port[5432] db[template1] user[root]
DEBUG(replicate_loop): wait replicate

ERROR(pgr_createConn): PQsetdbLogin failed. close socket!!
ERROR(write_log_file): PQsetdbLogin failed. close socket!!
ERROR(write_log_file): PQsetdbLogin failed. close socket!!
ERROR(write_log_file): PQsetdbLogin failed. close socket!!
ERROR(write_log_file): PQsetdbLogin failed. close socket!!
ERROR(write_log_file): dbPersistLogin  timeout
ERROR(write_log_file): New Transaction but pgr_createConn failed
ERROR(write_log_file): 5432 @ serverA is not ready
ERROR(write_log_file): setTransactionTbl failed
ERROR(write_log_file): vacuum error , master may be down

DEBUG(PGRsem_unlock): 1st master  - 0
DEBUG(PGRsem_unlock): 1st target serverB - 5432
DEBUG(pgrecovery_loop): recovery accept port 8101

DEBUG(read_packet): receive packet no:200

DEBUG(read_packet): recovery error accept. top queueing and initiarse recovery status

DEBUG(PGRsend_queue): master  - 0

ERROR(PGRget_HostTbl): master table is null

DEBUG(replicate_loop): replicate_loop selected

DEBUG(PGRclear_connections): replicate loop exit

---------------
/etc/hosts
---------------

レプリケーションサーバ上で、
$ grep serverA /etc/hosts
192.168.1.181   serverA
$ grep serverB /etc/hosts
192.168.1.183   serverB

---------------
pgreplicate.conf
---------------
eventrp01% cat /usr/local/pgsql/etc/pgreplicate.conf
#=============================================================
#  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>   serverA  </Host_Name>
    <Port>        5432                </Port>
    <Recovery_Port>       8102        </Recovery_Port>
</Cluster_Server_Info>
<Cluster_Server_Info>
    <Host_Name>   serverB </Host_Name>
    <Port>        5432                </Port>
    <Recovery_Port>       8102        </Recovery_Port>
</Cluster_Server_Info>
#<Cluster_Server_Info>
#    <Host_Name>   cluster3.postgres.jp   </Host_Name>
#    <Port>        5432                </Port>
#    <Recovery_Port>       7779       </Recovery_Port>
#</Cluster_Server_Info>
#
#-------------------------------------------------------------
# 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>   loadbalancer.postgres.jp  </Host_Name>
#       <Recovery_Port>       7780            </Recovery_Port>
#</LoadBalance_Server_Info>
#
#------------------------------------------------------------
# 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> upper_replicate.postgres.jp </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>       reliable          </Response_Mode>

---------------
cluster.conf
---------------
serverB% cat /usr/local/pgsql/data/cluster.conf
#============================================================
#          Cluster DB Server configuration file
#------------------------------------------------------------
# file: cluster.conf
#------------------------------------------------------------
# This file controls:
#       o which hosts & port are replication server
#       o which port use for replication request to replication server
#       o which command use for recovery function
#============================================================
#------------------------------------------------------------
# set Replication Server information
#               o Host_Name : hostname
#               o Port : connection for postmaster
#               o Recovery_Port : connection for recovery process
#------------------------------------------------------------
<Replicate_Server_Info>
        <Host_Name> eventrp01 </Host_Name>
        <Port> 8001 </Port>
        <Recovery_Port> 8101 </Recovery_Port>
</Replicate_Server_Info>
#<Replicate_Server_Info>
#       <Host_Name> replicate2.postgres.jp </Host_Name>
#       <Port> 8002 </Port>
#       <Recovery_Port> 8102 </Recovery_Port>
#</Replicate_Server_Info>
#<Replicate_Server_Info>
#       <Host_Name> replicate3.postgres.jp </Host_Name>
#       <Port> 8003 </Port>
#       <Recovery_Port> 8103 </Recovery_Port>
#</Replicate_Server_Info>
#-------------------------------------------------------------
# set Cluster DB Server information
#               o Recovery_Port : connection for recovery
#               o Rsync_Path : path of rsync command
#               o Rsync_Option : file transfer option for rsync
#       o When_Stand_Alone : When all replication servers fell,
#                            you can set up two kinds of permittion,
#                            "real_only" or "read_write".
#-------------------------------------------------------------
<Recovery_Port> 8102 </Recovery_Port>
<Rsync_Path> /usr/local/bin/rsync </Rsync_Path>
<Rsync_Option> ssh -1 </Rsync_Option>
<When_Stand_Alone> read_only  </When_Stand_Alone>
#-------------------------------------------------------------
# set partitional replicate control information
#     set DB name and Table name to stop reprication
#       o DB_Name : DB name
#       o Table_Name : table name
#-------------------------------------------------------------
#<Not_Replicate_Info>
#       <DB_Name>     test_db      </DB_Name>
#       <Table_Name>  log_table    </Table_Name>
#</Not_Replicate_Info>

---------------
pg_hba.conf(serverA,B)
---------------
serverA% pwd
/usr/local/pgsql
serverA% cat data/pg_hba.conf
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the PostgreSQL Administrator's Guide, chapter "Client
# Authentication" for a complete description.  A short synopsis
# follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access.  Records take one of three forms:
#
# local    DATABASE  USER  METHOD  [OPTION]
# host     DATABASE  USER  IP-ADDRESS  IP-MASK  METHOD  [OPTION]
# hostssl  DATABASE  USER  IP-ADDRESS  IP-MASK  METHOD  [OPTION]
#
# (The uppercase quantities should be replaced by actual values.)
# DATABASE can be "all", "sameuser", "samegroup", a database name (or
# a comma-separated list thereof), or a file name prefixed with "@".
# USER can be "all", an actual user name or a group name prefixed with
# "+" or a list containing either.  IP-ADDRESS and IP-MASK specify the
# set of hosts the record matches.  METHOD can be "trust", "reject",
# "md5", "crypt", "password", "krb4", "krb5", "ident", or "pam".  Note
# that "password" uses clear-text passwords; "md5" is preferred for
# encrypted passwords.  OPTION is the ident map or the name of the PAM
# service.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal.  If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect, or use
# "pg_ctl reload".

# Put your actual configuration here
# ----------------------------------
#
# CAUTION: The default configuration allows any local user to connect
# using any PostgreSQL user name, including the superuser, over either
# Unix-domain sockets or TCP/IP.  If you are on a multiple-user
# machine, the default configuration is probably too liberal for you.
# Change it to use something other than "trust" authentication.
#
# If you want to allow non-local connections, you need to add more
# "host" records.  Also, remember TCP/IP connections are only enabled
# if you enable "tcpip_socket" in postgresql.conf.

# TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK           METHOD

local   all         all                                             trust
host    all         all         127.0.0.1         255.255.255.255   trust
host    all         all         192.168.1.0       255.255.255.0     trust


高橋 一成 <kazunari.takahashi @ ctc-g.co.jp>




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