我的服务器被托管服务提供商重启了,导致我的旧容器和新容器(上周升级的,并保留了旧容器以备回滚)同时运行。
现在新容器显示了这一系列重复的日志,并且不提供任何服务:
(42) 正在等待新的 unicorn 主进程 pid...
(42) 正在等待新的 unicorn 主进程 pid... 1265109
(42) 旧 pid 是: 1264439 新 pid 是: 1265109
正在关闭
run-parts: 正在执行 /etc/runit/3.d/01-nginx
ok: down: nginx: 0s, 正常运行
run-parts: 正在执行 /etc/runit/3.d/02-unicorn
(42) 正在退出
ok: down: unicorn: 1s, 正常运行
run-parts: 正在执行 /etc/runit/3.d/10-redis
ok: down: redis: 0s, 正常运行
run-parts: 正在执行 /etc/runit/3.d/99-postgres
ok: down: postgres: 0s, 正常运行
ok: down: nginx: 2s, 正常运行
ok: down: postgres: 1s, 正常运行
ok: down: redis: 1s, 正常运行
ok: down: unicorn: 2s, 正常运行
ok: down: cron: 0s, 正常运行
ok: down: rsyslog: 0s, 正常运行
run-parts: 正在执行 /etc/runit/1.d/00-ensure-links
run-parts: 正在执行 /etc/runit/1.d/00-fix-var-logs
run-parts: 正在执行 /etc/runit/1.d/01-cleanup-web-pids
run-parts: 正在执行 /etc/runit/1.d/anacron
run-parts: 正在执行 /etc/runit/1.d/cleanup-pids
正在清理过时的 PID 文件
run-parts: 正在执行 /etc/runit/1.d/copy-env
已启动 runsvdir,PID 为 34
ok: run: redis: (pid 48) 0s
ok: run: postgres: (pid 44) 0s
supervisor pid: 45 unicorn pid: 76
(45) 正在重新打开日志
正在关闭
run-parts: 正在执行 /etc/runit/3.d/01-nginx
ok: down: nginx: 1s, 正常运行
run-parts: 正在执行 /etc/runit/3.d/02-unicorn
(45) 正在退出
ok: down: unicorn: 0s, 正常运行
run-parts: 正在执行 /etc/runit/3.d/10-redis
ok: down: redis: 1s, 正常运行
run-parts: 正在执行 /etc/runit/3.d/99-postgres
ok: down: postgres: 1s, 正常运行, 需要运行
ok: down: nginx: 2s, 正常运行
ok: down: postgres: 1s, 正常运行, 需要运行
ok: down: redis: 1s, 正常运行
ok: down: unicorn: 1s, 正常运行
ok: down: cron: 0s, 正常运行
ok: down: rsyslog: 0s, 正常运行
run-parts: 正在执行 /etc/runit/1.d/00-ensure-links
run-parts: 正在执行 /etc/runit/1.d/00-fix-var-logs
run-parts: 正在执行 /etc/runit/1.d/01-cleanup-web-pids
run-parts: 正在执行 /etc/runit/1.d/anacron
run-parts: 正在执行 /etc/runit/1.d/cleanup-pids
正在清理过时的 PID 文件
run-parts: 正在执行 /etc/runit/1.d/copy-env
已启动 runsvdir,PID 为 34
ok: run: redis: (pid 48) 0s
ok: run: postgres: (pid 44) 0s
supervisor pid: 49 unicorn pid: 70
config/unicorn_launcher: 第 71 行: kill: (70) - 没有那个进程
config/unicorn_launcher: 第 15 行: kill: (70) - 没有那个进程
(49) 正在退出
ok: run: redis: (pid 48) 5s
ok: run: postgres: (pid 86) 1s
supervisor pid: 88 unicorn pid: 92
config/unicorn_launcher: 第 71 行: kill: (92) - 没有那个进程
config/unicorn_launcher: 第 15 行: kill: (92) - 没有那个进程
(88) 正在退出
ok: run: redis: (pid 48) 7s
ok: run: postgres: (pid 109) 0s
supervisor pid: 106 unicorn pid: 112
config/unicorn_launcher: 第 71 行: kill: (112) - 没有那个进程
config/unicorn_launcher: 第 15 行: kill: (112) - 没有那个进程
(106) 正在退出
ok: run: redis: (pid 48) 10s
ok: run: postgres: (pid 121) 0s
supervisor pid: 128 unicorn pid: 132
config/unicorn_launcher: 第 71 行: kill: (132) - 没有那个进程
config/unicorn_launcher: 第 15 行: kill: (132) - 没有那个进程
(128) 正在退出
ok: run: redis: (pid 48) 13s
ok: run: postgres: (pid 149) 0s
supervisor pid: 146 unicorn pid: 152
config/unicorn_launcher: 第 71 行: kill: (152) - 没有那个进程
config/unicorn_launcher: 第 15 行: kill: (152) - 没有那个进程
(146) 正在退出
ok: run: redis: (pid 48) 16s
ok: run: postgres: (pid 171) 0s
supervisor pid: 168 unicorn pid: 174
config/unicorn_launcher: 第 71 行: kill: (174) - 没有那个进程
config/unicorn_launcher: 第 15 行: kill: (174) - 没有那个进程
(168) 正在退出
ok: run: redis: (pid 48) 20s
ok: run: postgres: (pid 193) 1s
并且 ./launcher rebuild 由于连接到 postgres 的错误(“/var/run/postgresql/.s.PGSQL.5432” 未找到该文件或目录)而无法构建新的容器。
看起来两个应用程序同时运行并访问同一数据库造成了问题。
我该如何着手修复这个问题?