gpt4 book ai didi

linux - 故障转移在 Postgresql 9.0 中不成功

转载 作者:太空宇宙 更新时间:2023-11-04 11:35:34 26 4
gpt4 key购买 nike

我在 Linux 上使用 PostgreSQL9.0。我正在尝试使用 java 进行故障转移。因此,我能够创建触发器文件。但是在创建触发器文件后,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 服务器时,备用服务器进入生产模式。

请告诉我我应该怎么做才能解决这个问题。谁在向 postmaster 发送 SIGHQUIT 信号?


这是日志:

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

最佳答案

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

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?

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

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

关于linux - 故障转移在 Postgresql 9.0 中不成功,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8151723/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com