Postgresql 9.0中的故障转移不成功

时间:2011-11-16 12:30:27

标签: linux postgresql

我在Linux上使用PostgreSQL9.0。我正在尝试使用java进行faiover。所以,我能够创建触发器文件。但是在创建触发器文件之后Postgres服务器正在停止。 我认为有人正在杀死服务器进程。 在pg_log中写道: -

2011-11-16 15:25:18 ETC/GMT LOG:  startup process (PID 32542) was terminated by signal 6: Aborted
2011-11-16 15:25:18 ETC/GMT LOG:  terminating any other active server processes
2011-11-16 15:25:18 ETC/GMT DEBUG:  sending SIGQUIT to process 32546
2011-11-16 15:25:18 ETC/GMT DEBUG:  sending SIGQUIT to process 32547
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  reaping dead processes
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  reaping dead processes
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(1): 3 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(1): 3 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  exit(1)
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  logger shutting down
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(0): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(0): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  exit(0)
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(-1): 0 callbacks to make

由于关闭服务器,它无法作为主服务器,仍处于恢复模式。

当我手动使用pg_ctl启动postgres服务器时,待机状态将以生产模式启动。

请告诉我该怎么做才能解决这个问题。 谁向邮政局长发送SIGHQUIT信号?


这是Log:

2011-11-16 15:25:12 ETC/GMT DEBUG:  executing restore command "cp /data/PostgreSQL/testdata/archive/000000030000000000000008 "pg_xlog/RECOVERYXLOG""
cp: cannot stat `/data/PostgreSQL/testdata/archive/000000030000000000000008': No such file or directory
2011-11-16 15:25:12 ETC/GMT DEBUG:  could not restore file "000000030000000000000008" from archive: return code 256
2011-11-16 15:25:12 ETC/GMT DEBUG:  could not open file "pg_xlog/000000030000000000000008" (log file 0, segment 8): No such file or directory
2011-11-16 15:25:14 ETC/GMT DEBUG:  skipping restartpoint, already performed at 0/8000020
2011-11-16 15:25:18 ETC/GMT DEBUG:  find_in_dynamic_libpath: trying "/data/PostgreSQL/lib/postgresql/libpqwalreceiver"
2011-11-16 15:25:18 ETC/GMT DEBUG:  find_in_dynamic_libpath: trying "/data/PostgreSQL/lib/postgresql/libpqwalreceiver.so"
2011-11-16 15:25:18 ETC/GMT FATAL:  could not connect to the primary server: could not connect to server: Connection refused
                Is the server running on host "172.168.1.28" and accepting
                TCP/IP connections on port 5433?

2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(1): 5 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(1): 2 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  exit(1)
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  reaping dead processes
2011-11-16 15:25:18 ETC/GMT DEBUG:  executing restore command "cp /data/PostgreSQL/testdata/archive/000000030000000000000008 "pg_xlog/RECOVERYXLOG""
cp: cannot stat `/data/PostgreSQL/testdata/archive/000000030000000000000008': No such file or directory
2011-11-16 15:25:18 ETC/GMT DEBUG:  could not restore file "000000030000000000000008" from archive: return code 256
2011-11-16 15:25:18 ETC/GMT PANIC:  could not open file "pg_xlog/000000030000000000000008" (log file 0, segment 8): Permission denied
2011-11-16 15:25:18 ETC/GMT DEBUG:  reaping dead processes
2011-11-16 15:25:18 ETC/GMT LOG:  startup process (PID 32542) was terminated by signal 6: Aborted
2011-11-16 15:25:18 ETC/GMT LOG:  terminating any other active server processes
2011-11-16 15:25:18 ETC/GMT DEBUG:  sending SIGQUIT to process 32546
2011-11-16 15:25:18 ETC/GMT DEBUG:  sending SIGQUIT to process 32547
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  reaping dead processes
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  reaping dead processes
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(1): 3 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(1): 3 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  exit(1)
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  logger shutting down
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(0): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(0): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  exit(0)
2011-11-16 15:25:18 ETC/GMT DEBUG:  shmem_exit(-1): 0 callbacks to make
2011-11-16 15:25:18 ETC/GMT DEBUG:  proc_exit(-1): 0 callbacks to make

1 个答案:

答案 0 :(得分:1)

因此,查看您的日志,似乎存在来自主服务器的日志传送问题:

2011-11-16 15:25:12 ETC/GMT DEBUG: executing restore command "cp /data/PostgreSQL/testdata/archive/000000030000000000000008 "pg_xlog/RECOVERYXLOG"" cp: cannot stat `/data/PostgreSQL/testdata/archive/000000030000000000000008': No such file or directory 
2011-11-16 15:25:18 ETC/GMT DEBUG: could not restore file "000000030000000000000008" from archive: return code 256 
2011-11-16 15:25:18 ETC/GMT PANIC: could not open file "pg_xlog/000000030000000000000008" (log file 0, segment 8): Permission denied 2011-11-16 

您确定从服务器正确复制日志文件并且本地postgres进程可以读/写吗?我会验证。

我看到的另一个错误(我不熟悉,似乎是自上次设置备用服务器后它们添加的内容)是:

15:25:18 ETC/GMT FATAL: could not connect to the primary server: could not connect to server: Connection refused Is the server running on host "172.168.1.28" and accepting TCP/IP connections on port 5433?

您确定连接信息是否正确?你能看到主服务器上的传入连接吗?

查看此日志,当您点击触发器文件时,服务器似乎不处于一致状态,这会导致服务器在您尝试完成启动序列时关闭。如果您确保日志传送正常,您应该能够启动它。希望这会有所帮助。