我有一个 Ubuntu 22.04 服务器和一个 Postgresql 14 数据库。我最近从一个提供商迁移到另一个提供商,我使用的是 Postgresql 9.6 版本,出于必要,我必须上传数据库版本。我的迁移是使用云服务器,一切正常,但是......我的 postgres.service 关闭并且显然停用了网站。
我向您展示了今天 postgres 日志的响应:
2023-11-08 12:49:28.254 UTC [375217] postgres@postgres DETAIL: Connection matched pg_hba.conf line 91: "host all all 0.0.0.0/0 md5"
2023-11-08 12:49:28.323 UTC [375219] postgres@postgres FATAL: password authentication failed for user "postgres"
2023-11-08 12:49:28.323 UTC [375219] postgres@postgres DETAIL: Connection matched pg_hba.conf line 91: "host all all 0.0.0.0/0 md5"
2023-11-08 13:01:24.654 UTC [375934] postgres@postgres FATAL: password authentication failed for user "postgres"
2023-11-08 13:01:24.654 UTC [375934] postgres@postgres DETAIL: Connection matched pg_hba.conf line 91: "host all all 0.0.0.0/0 md5"
2023-11-08 13:01:24.943 UTC [375935] postgres@postgres FATAL: password authentication failed for user "postgres"
2023-11-08 13:01:24.943 UTC [375935] postgres@postgres DETAIL: Connection matched pg_hba.conf line 91: "host all all 0.0.0.0/0 md5"
2023-11-08 14:11:10.638 UTC [380509] [unknown]@[unknown] FATAL: unsupported frontend protocol 0.0: server supports 3.0 to 3.0
2023-11-08 14:11:10.935 UTC [380511] [unknown]@[unknown] FATAL: unsupported frontend protocol 255.255: server supports 3.0 to 3.0
2023-11-08 14:11:11.235 UTC [380512] [unknown]@[unknown] FATAL: no PostgreSQL user name specified in startup packet
2023-11-08 16:56:55.852 UTC [390493] [unknown]@[unknown] LOG: invalid length of startup packet
2023-11-08 19:11:15.892 UTC [355722] LOG: received smart shutdown request
2023-11-08 19:11:15.894 UTC [355722] LOG: background worker "logical replication launcher" (PID 355729) exited with exit code 1
2023-11-08 19:11:15.896 UTC [355724] LOG: shutting down
我的pg_hba.conf是:
local all postgres md5
host all all 0.0.0.0/0 md5
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256
# IPv6 local connections:
host all all ::1/128 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
host all all ::/0 md5
我的 postgresql.conf 是:
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
#listen_addresses = 'localhost' # what IP address(es) to listen on;
listen_addresses = '*' # comma-separated list of addresses;
# defaults to 'localhost'; 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 = '/var/run/postgresql' # 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
感谢您的贡献。
我正在尝试解决我的 postgresql 数据库间歇性失败的情况,我认为这是由于我的配置造成的。我希望一些 postgress 用户知道如何根据经验找到解决方案。
如果我关机后执行:systemctl restart postgresql 一切正常
2023-11-08 19:48:50.704 UTC [410235] 日志:在 x86_64-pc-linux-gnu 上启动 PostgreSQL 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1),由 gcc 编译 (Ubuntu 11.4.0-1ubuntu1~ 22.04) 11.4.0,64 位 2023-11-08 19:48:50.704 UTC [410235] 日志:监听 IPv4 地址“0.0.0.0”,端口 5432 2023-11-08 19:48:50.704 UTC [410235] 日志:监听 IPv6 地址“::”,端口 5432 2023-11-08 19:48:50.712 UTC [410235] 日志:监听 Unix 套接字“/var/run/postgresql/.s.PGSQL.5432” 2023-11-08 19:48:50.722 UTC [410236] LOG: 数据库系统于 2023-11-08 19:11:15 UTC 关闭 2023-11-08 19:48:50.735 UTC [410235] 日志:数据库系统已准备好接受连接