[pgcluster: 298] pg_restoreが出来ません。
Kouji Hamada
hamada @ hamlock.jp
2004年 5月 26日 (水) 13:25:51 JST
はじめまして浜田と申します。
pg_restoreを行なうと必ずエラーが発生してしまします。
【構成及び設定】
クラスタサーバ:2台
レプリケーションサーバ:1台
PGClusterバージョン:1.0.6フルパッケージ版
OSバージョン:RedHat7.3(3台ともOSインストールからやりました)
IPアドレスは以下のように振っています。
192.168.0.210 test0.aaa.jp(レプリケーションサーバ)
192.168.0.211 test1.aaa.jp(クラスタサーバ(マスタDB))
192.168.0.212 test2.aaa.jp(クラスタサーバ(2号機))
クラスタサーバ2台
/usr/local/pgsql/data/cluster.confの内容は以下の通りです。
クラスタサーバ2台同じ設定内容です。
<Replicate_Server_Info>
<Host_Name> test0.aaa.jp </Host_Name>
<Port> 8777 </Port>
<Recovery_Port> 7778 </Recovery_Port>
<Recovery_Port> 7779 </Recovery_Port>
<Rsync_Path> /usr/bin/rsync </Rsync_Path>
<Rsync_Option> ssh -1 </Rsync_Option>
<When_Stand_Alone> read_only </When_Stand_Alone>
/usr/local/pgsql/data/pg_hda.confの内容は以下の通りです。
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all 192.168.0.0 255.255.255.0 trust
レプリケーションサーバの設定
/usr/local/pgsql/data/cluster.confの内容は以下の通りです。
<Replicate_Server_Info>
<Host_Name> test0.aaa.jp </Host_Name>
<Port> 8777 </Port>
<Recovery_Port> 7778 </Recovery_Port>
<Recovery_Port> 7779 </Recovery_Port>
<Rsync_Path> /usr/bin/rsync </Rsync_Path>
<Rsync_Option> ssh -1 </Rsync_Option>
<When_Stand_Alone> read_only </When_Stand_Alone>
/usr/local/pgsql/data/pg_hda.confの内容は変更していません。
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all 192.168.0.0 255.255.255.0 trust
/usr/local/pgsql/etc/pgreplicate.confの内容は以下の通りです。
<Cluster_Server_Info>
<Host_Name> test1.aaa.jp </Host_Name>
<Port> 5432 </Port>
<Recovery_Port> 7779 </Recovery_Port>
</Cluster_Server_Info>
<Cluster_Server_Info>
<Host_Name> test2.aaa.jp </Host_Name>
<Port> 5432 </Port>
<Recovery_Port> 7779 </Recovery_Port>
</Cluster_Server_Info>
<Replication_Port> 8777 </Replication_Port>
<Recovery_Port> 7778 </Recovery_Port>
【発生した現象】
マスターDBにpg_restoreを行なうとマスターDBはうまくいくのですが
この時レプリケーションサーバーがエラーとなりクラスタサーバー
2号機とのセッションが切れてしまい2号機にpg_restoreされていません。
【検証手順】
1.クラスタサーバ(マスタDB)にcreatedbを行なう。
createdb test
この時点では2台のクラスタサーバにDBが作られている。
List of databases
Name | Owner | Encoding
-----------+----------+----------
template0 | postgres | UNICODE
template1 | postgres | UNICODE
test | postgres | UNICODE
(3 rows)
2.クラスタサーバ(マスタDB)にcreate tableを行なう。
create table hoge (
id int4 ,
name text );
この時点では2台のクラスタサーバにtableが作られている。
3.クラスタサーバ(マスタDB)に値のセットを行なう。
insert into hoge values
( 1 , 'test' );
この時点では2台のクラスタサーバに値が入っている。
4.クラスタサーバ(マスタDB)でpg_dumpを行なう。
pg_dump -Fc test > test.dump
5.クラスタサーバ(マスタDB)にcreatedbを行なう。
createdb test2
この時点では2台のクラスタサーバにDBが作られている。
List of databases
Name | Owner | Encoding
-----------+----------+----------
template0 | postgres | UNICODE
template1 | postgres | UNICODE
test | postgres | UNICODE
test2 | postgres | UNICODE
(4 rows)
6.クラスタサーバ(マスタDB)に対してpg_restoreを行なう。
pg_restore -d test2 test.dump
レプリケーションサーバーのコンソールに以下のようにセマフォアンロックで
エラーが発生したと表示されて、2号機のクラスタサーバーとのセッションが
切れてしまいます。
ERROR(sem_unlock): PQexec error
ERROR(read_packet): read_packet failed
<pgreplicate.logの内容>
Wed May 26 10:45:30 2004 port(5432) host:test1.aaa.jp start use
Wed May 26 10:45:30 2004 port(5432) host:test2.aaa.jp start use
Wed May 26 10:46:42 2004 port(5432) host:test2.aaa.jp error
現時点ではpostgresqlのチューニング等一切行なっておりません。
createdb,insert,update等はうまく動作していますがpg_restoreを行なうと
必ずエラーが発生してしまします。
よろしくお願いします。
pgcluster メーリングリストの案内