Docker启动Postgres失败:invalid value

2022-09-29  本文已影响0人  pumpdev

服务器运行一段时间后,Pg数据库突然启动不了了,查看了Docker启动日志,报错信息如下:

PostgreSQL Database directory appears to contain a database; Skipping initialization

2022-09-29 02:56:52.809 GMT [1] LOG:  invalid value for parameter "log_timezone": "Etc/UTC"
2022-09-29 02:56:52.810 GMT [1] LOG:  invalid value for parameter "TimeZone": "Etc/UTC"
2022-09-29 02:56:52.810 GMT [1] FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors

查阅了相关资料,发现可能是配置文件的时区配置有误(具体原因也没有找到。。),于是尝试修改pg的配置,最终发现改为"Asia/Shanghai"即可,具体步骤:

docker cp e93:/var/lib/postgresql/data/postgresql.conf .
log_timezone = 'Asia/Shanghai'
timezone = 'Asia/Shanghai'
docker cp postgresql.conf e93:/var/lib/postgresql/data/
docker restart e93

启动成功:

PostgreSQL Database directory appears to contain a database; Skipping initialization

2022-09-29 11:27:01.853 CST [1] LOG:  starting PostgreSQL 12.4 (Debian 12.4-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2022-09-29 11:27:01.855 CST [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-09-29 11:27:01.856 CST [1] LOG:  listening on IPv6 address "::", port 5432
2022-09-29 11:27:01.857 CST [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-09-29 11:27:01.872 CST [25] LOG:  database system was interrupted; last known up at 2022-08-10 17:01:10 CST
2022-09-29 11:27:01.905 CST [25] LOG:  database system was not properly shut down; automatic recovery in progress
2022-09-29 11:27:01.907 CST [25] LOG:  redo starts at 0/89034A48
2022-09-29 11:27:01.907 CST [25] LOG:  invalid record length at 0/89034B30: wanted 24, got 0
2022-09-29 11:27:01.907 CST [25] LOG:  redo done at 0/89034AF8
2022-09-29 11:27:01.914 CST [1] LOG:  database system is ready to accept connections
上一篇 下一篇

猜你喜欢

热点阅读