我使用PG 4和PostgreSQL 11作为我的数据。在昨天的一些崩溃之后,我再也无法启动postgresql了。我做了一些研究,但看起来不像本地主机、IP地址或端口问题。

日志文件声明(以粗体表示我认为相关的内容):
2021-03-21 06:49:36.682 AEDT [11796] LOG: database system was shut down at 2021-03-20 14:56:05 AEDT
2021-03-21 06:49:36.682 AEDT [11796] LOG: invalid record length at 5B1/CA7F5900: wanted 24, got 0
2021-03-21 06:49:36.682 AEDT [11796] **LOG: invalid primary checkpoint record**
2021-03-21 06:49:36.682 AEDT [11796] **PANIC: could not locate a valid checkpoint record**
2021-03-21 06:49:36.890 AEDT [13136] LOG: startup process (PID 11796) was terminated by exception 0xC0000409
2021-03-21 06:49:36.890 AEDT [13136] HINT: See C include file "ntstatus.h" for a description of the hexadecimal value.
2021-03-21 06:49:36.890 AEDT [13136] LOG: aborting startup due to startup process failure
2021-03-21 06:49:36.898 AEDT [13136] LOG: database system is shut down我检查了postgresql.conf和pg_hba.conf文件。它们看起来很好,没有变化(允许所有用户拥有正确的IP地址和端口号)。
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to '*'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '' # comma-separated list of directories
# (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
# (change requires restart)
#bonjour = off # advertise server via Bonjour
# (change requires restart)
#bonjour_name = '' # defaults to the computer name
# (change requires restart)
# - TCP Keepalives -
# see "man 7 tcp" for details
#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default
# - Authentication -
#authentication_timeout = 1min # 1s-600s
#password_encryption = md5 # md5 or scram-sha-256
#db_user_namespace = off
**pg_hba.conf**
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5我的SSD硬盘驱动器,其中包含postgres的数据目录似乎很好(也就是说,我可以读/写和访问所有文件)。为了修复我的起始问题,我试图运行pg_resetwal,但没有成功,因为虽然postgres服务停止了,但程序没有打开。
从Windows日志中:
等待服务器启动..。日志:侦听IPv6地址"::",端口5432日志:侦听IPv4地址"0.0.0.0",端口5432日志:将日志输出重定向到日志收集器进程提示:未来的日志输出将出现在目录“日志”中。
pgAdmin给出了以下内容(显然我无法启动postgresql.):
无法连接到服务器:拒绝连接(0x0000274D/10061)服务器是否在主机"localhost“(127.0.0.1)上运行,并在端口5432上接受TCP/IP连接?
你知道这里会有什么问题吗?非常感谢!
发布于 2021-03-21 10:12:22
我很抱歉地告诉你,你的WAL文件中似乎有腐败。你把WAL文件移除了吗?如果是的话,将它们复制回WAL目录。
如果您没有丢失的WAL文件(我看到存档是禁用的,所以很可能没有它们),数据丢失是不可避免的。
我的建议:
pg_resetwal尝试重置wals (请参阅文档这里,请阅读整个页面,以便您理解这会导致数据丢失)pg_dumpall everything (参见documentation 这里) (如果它太大的话重定向到/dev/null )以检查是否有任何数据损坏。我很抱歉这个坏消息..。
https://dba.stackexchange.com/questions/287417
复制相似问题