日志文件不存在,导致归档进程启动失败
2021-05-09 13:13 abce 阅读(814) 评论(0) 编辑 收藏 举报一测试环境,在启动后,在日志中发现归档进程频繁启动失败:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | $ more postgresql-Sun.csv 2021-05-09 11:16:42.586 CST,,,3619,,6097541a.e23,1,,2021-05-09 11:16:42 CST,,0,LOG,00000, "ending log output to stderr" ,, "Future log output will go to log destination " "csvlog" "." ,,,,,,, "" 2021-05-09 11:16:42.606 CST,,,3621,,6097541a.e25,1,,2021-05-09 11:16:42 CST,,0,LOG,00000, "database system was shut down at 2021-05-09 11:12:24 CST" ,,,,,,,,, "" 2021-05-09 11:16:42.656 CST,,,3619,,6097541a.e23,2,,2021-05-09 11:16:42 CST,,0,LOG,00000, "database system is ready to accept connections" ,,,,,,,,, "" 2021-05-09 11:16:42.667 CST,,,3626,,6097541a.e2a,1,,2021-05-09 11:16:42 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:16:43.674 CST,,,3626,,6097541a.e2a,2,,2021-05-09 11:16:42 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:16:44.681 CST,,,3626,,6097541a.e2a,3,,2021-05-09 11:16:42 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:16:44.849 CST,,,3619,,6097541a.e23,3,,2021-05-09 11:16:42 CST,,0,LOG,00000, "archiver process (PID 3626) was terminated by signal 11: Segmentation fault" , ,,,,,,,, "" 2021-05-09 11:16:52.695 CST,,,3656,,60975424.e48,1,,2021-05-09 11:16:52 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:16:53.703 CST,,,3656,,60975424.e48,2,,2021-05-09 11:16:52 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:16:54.711 CST,,,3656,,60975424.e48,3,,2021-05-09 11:16:52 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:16:54.735 CST,,,3619,,6097541a.e23,4,,2021-05-09 11:16:42 CST,,0,LOG,00000, "archiver process (PID 3656) was terminated by signal 11: Segmentation fault" , ,,,,,,,, "" 2021-05-09 11:17:02.695 CST,,,3663,,6097542e.e4f,1,,2021-05-09 11:17:02 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:17:03.702 CST,,,3663,,6097542e.e4f,2,,2021-05-09 11:17:02 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:17:04.708 CST,,,3663,,6097542e.e4f,3,,2021-05-09 11:17:02 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:17:04.849 CST,,,3619,,6097541a.e23,5,,2021-05-09 11:16:42 CST,,0,LOG,00000, "archiver process (PID 3663) was terminated by signal 11: Segmentation fault" , ,,,,,,,, "" 2021-05-09 11:17:12.701 CST,,,3687,,60975438.e67,1,,2021-05-09 11:17:12 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:17:13.707 CST,,,3687,,60975438.e67,2,,2021-05-09 11:17:12 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:17:14.714 CST,,,3687,,60975438.e67,3,,2021-05-09 11:17:12 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" 2021-05-09 11:17:14.739 CST,,,3619,,6097541a.e23,6,,2021-05-09 11:16:42 CST,,0,LOG,00000, "archiver process (PID 3687) was terminated by signal 11: Segmentation fault" , ,,,,,,,, "" 2021-05-09 11:17:22.702 CST,,,3693,,60975442.e6d,1,,2021-05-09 11:17:22 CST,,0,LOG,00000, "archive command failed with exit code 1" , "The failed archive command was: /us r/bin/cp pg_wal/000000010000004B00000052 /pg/11/wal_archive/000000010000004B00000052" ,,,,,,,, "" |
查看pg_wal目录中的日志
1 2 3 4 5 6 7 8 9 10 11 | $ ll ../pg_wal/ total 65900 -rw -------. 1 postgres postgres 343 May 8 18:03 0000000100000155000000ED.00000028.backup -rw -------. 1 postgres postgres 343 May 9 10:02 0000000100000155000000F0.00000028.backup -rw -------. 1 postgres postgres 343 May 9 10:33 0000000100000155000000F4.00000028.backup -rw -------. 1 postgres postgres 16777216 May 9 11:06 000000010000015600000001 -rw -------. 1 postgres postgres 16777216 May 9 11:16 000000010000015600000002 -rw -------. 1 postgres postgres 16777216 May 9 10:52 000000010000015600000003 -rw -------. 1 postgres postgres 16777216 Apr 14 13:56 000000010000015600000015 drwx ------. 2 postgres postgres 352256 May 9 11:06 archive_status -rw -------. 1 postgres postgres 1300 Feb 25 08:35 logfile |
可以看到,这里没有日志文件000000010000004B00000052
查看归档设置
1 2 3 4 5 6 7 8 9 10 | postgres=# select name ,setting from pg_settings where name like 'archive%' or name = 'wal_level' ; name | setting -----------------+----------------------------------------------- archive_command | /usr/bin/cp %p /pg/11/wal_archive/%f archive_mode | on archive_timeout | 600 wal_level | logical (4 rows ) postgres=# |
因为是测试环境而已,直接尝试先关闭归档,然后再次开启归档
1.修改postgresql.conf中archive_mode =off,然后重启pg
2.然后再修改为archive_mode=on,再重启pg
启动后,还是报相同的错误!
然后尝试在开启归档的同时,将归档命令设置成空命令,重启pg:
修改postgresql.conf
1 2 | archive_mode= on archive_command = '' |
启动后,还是报错!
尝试修改成其他的命令,比如:
1 2 | archive_mode= on archive_command = 'ls -l /pg/11/wal_archive/' |
发现重启后,不再报错!
最终,再将归档命令还原成最初的命令:
1 2 | archive_mode= on archive_command = '/usr/bin/cp %p /pg/11/wal_archive/%f' |
重启后,系统恢复正常!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)