我有一个PostgreSQL 8.4数据库,我正在尝试以待机模式启动(我从活动数据库发送我自己的日志)。我认为我的备用数据库处于待机/恢复模式,但我不知道该怎么说。
首先,pg_controldata表示数据库已“关闭”:
[root@node2 pgsql]# pg_controldata data
pg_control version number: 843
Catalog version number: 200904091
Database system identifier: 6514583873281163231
Database cluster state: shut down
pg_control last modified: Sun 15 Apr 2018 05:39:25 PM EDT
Latest checkpoint location: 7/56000020
Prior checkpoint location: 7/55000020
Latest checkpoint's REDO location: 7/56000020
Latest checkpoint's TimeLineID: 116
Latest checkpoint's NextXID: 0/40171
Latest checkpoint's NextOID: 20826
Latest checkpoint's NextMultiXactId: 1
Latest checkpoint's NextMultiOffset: 0
Time of latest checkpoint: Sun 15 Apr 2018 05:39:24 PM EDT
Minimum recovery ending location: 0/0
Maximum data alignment: 8
Database block size: 8192
Blocks per segment of large relation: 131072
WAL block size: 8192
Bytes per WAL segment: 16777216
Maximum length of identifiers: 64
Maximum columns in an index: 32
Maximum size of a TOAST chunk: 1996
Date/time type storage: 64-bit integers
Float4 argument passing: by value
Float8 argument passing: by value
但这与状态命令输出相矛盾:
[root@node2 pgsql]# sudo -u postgres pg_ctl status -D /var/lib/pgsql/data
pg_ctl: server is running (PID: 35852)
/usr/bin/postgres "-D" "/var/lib/pgsql/data"
然而,当我尝试启动数据库时,它说它已经在运行:
[root@node2 pgsql]# sudo -u postgres pg_ctl start -D /var/lib/pgsql/data
pg_ctl: another server might be running; trying to start server anyway
[2018-04-15 23:06:11 GMT] FATAL: lock file "postmaster.pid" already exists
[2018-04-15 23:06:11 GMT] HINT: Is another postmaster (PID 35852) running in data directory "/var/lib/pgsql/data"?
pg_ctl: could not start server
Examine the log output.
我可以看到我的recovery.conf仍然存在:
[root@node2 pgsql]# cat data/recovery.conf
restore_command='pg_standby -r 10 -t /var/run/myapp.trigger /var/lib/pgsql/data/myapp-archive "%f" "%p"'
最后,我在归档目录中看到了每个不断增长的文件列表。
那么,有没有办法判断wal(存档)文件是否正在应用于数据库?