首页 > 解决方案 > Cloudfoundry 重载终端信号

问题描述

目前我有一个运行在cloud foundry. 我在诱捕sigtermsighup。我正在尝试验证cf restage执行 a 时发送的信号。我已经看到了许多其他命令的终端信号,除了文档中的这个。如果有人可以向我指出任何文档或仅了解在 cf 重演时发送到操作系统的信号,我将不胜感激。谢谢你。

标签: cloud-foundry

解决方案


发送给您的信号不应在cf操作之间有所不同(即停止、重新启动、重新暂存,或者即使您的应用程序由于基础维护而重新启动),它应该总是得到一个 SIGTERM,十秒钟后很好地关闭,然后是一个 SIGKILL。

https://docs.pivotal.io/pivotalcf/2-6/devguide/deploy-apps/app-lifecycle.html#shutdown

我在 Pivotal Web Service 上做了一些测试,以确认何时使用cf restage,我在发送 SIGTERM 时捕获并记录。您可以在应用程序捕获 SIGTERM 的中间看到。在这种情况下,这只是有点难看,因为您同时还有登台日志。

希望有帮助!

   2019-08-25T22:02:02.90-0400 [CELL/0] OUT Cell 65a71ce1-e630-4765-8f60-adebfa730268 stopping instance a91e593b-d9b6-42aa-7021-b8cd
   2019-08-25T22:02:02.98-0400 [API/9] OUT Creating build for app with guid f58e6aae-783d-4a28-bd30-54c20d314ef4
   2019-08-25T22:02:03.87-0400 [STG/0] OUT Downloading binary_buildpack...
   2019-08-25T22:02:03.91-0400 [APP/PROC/WEB/0] OUT running
   2019-08-25T22:02:03.94-0400 [STG/0] OUT Downloaded binary_buildpack
   2019-08-25T22:02:03.94-0400 [STG/0] OUT Cell 9aa90abe-6a8f-4485-90d1-71da907de9a3 creating container for instance 4cd508ee-3ce3-4e61-a9b7-5a997ca5583e
   2019-08-25T22:02:05.36-0400 [STG/0] OUT Cell 9aa90abe-6a8f-4485-90d1-71da907de9a3 successfully created container for instance 4cd508ee-3ce3-4e61-a9b7-5a997ca5583e
   2019-08-25T22:02:05.72-0400 [STG/0] OUT Downloading app package...
   2019-08-25T22:02:05.72-0400 [STG/0] OUT Downloading build artifacts cache...
   2019-08-25T22:02:05.77-0400 [STG/0] ERR Downloading build artifacts cache failed
   2019-08-25T22:02:05.92-0400 [STG/0] OUT Downloaded app package (651.6K)
   2019-08-25T22:02:06.57-0400 [STG/0] OUT -----> Binary Buildpack version 1.0.33
   2019-08-25T22:02:06.83-0400 [STG/0] OUT Exit status 0
   2019-08-25T22:02:06.83-0400 [STG/0] OUT Uploading droplet, build artifacts cache...
   2019-08-25T22:02:06.83-0400 [STG/0] OUT Uploading droplet...
   2019-08-25T22:02:06.83-0400 [STG/0] OUT Uploading build artifacts cache...
   2019-08-25T22:02:06.97-0400 [STG/0] OUT Uploaded build artifacts cache (215B)
   2019-08-25T22:02:07.02-0400 [API/2] OUT Creating droplet for app with guid f58e6aae-783d-4a28-bd30-54c20d314ef4
   2019-08-25T22:02:08.12-0400 [APP/PROC/WEB/0] OUT SIGTERM caught, exiting
   2019-08-25T22:02:08.13-0400 [CELL/SSHD/0] OUT Exit status 0
   2019-08-25T22:02:08.20-0400 [APP/PROC/WEB/0] OUT Exit status 134
   2019-08-25T22:02:08.28-0400 [CELL/0] OUT Cell 65a71ce1-e630-4765-8f60-adebfa730268 destroying container for instance a91e593b-d9b6-42aa-7021-b8cd
   2019-08-25T22:02:08.91-0400 [PROXY/0] OUT Exit status 137
   2019-08-25T22:02:09.16-0400 [CELL/0] OUT Cell 65a71ce1-e630-4765-8f60-adebfa730268 successfully destroyed container for instance a91e593b-d9b6-42aa-7021-b8cd
   2019-08-25T22:02:10.07-0400 [STG/0] OUT Uploaded droplet (653.1K)
   2019-08-25T22:02:10.07-0400 [STG/0] OUT Uploading complete
   2019-08-25T22:02:11.24-0400 [STG/0] OUT Cell 9aa90abe-6a8f-4485-90d1-71da907de9a3 stopping instance 4cd508ee-3ce3-4e61-a9b7-5a997ca5583e
   2019-08-25T22:02:11.24-0400 [STG/0] OUT Cell 9aa90abe-6a8f-4485-90d1-71da907de9a3 destroying container for instance 4cd508ee-3ce3-4e61-a9b7-5a997ca5583e
   2019-08-25T22:02:11.68-0400 [CELL/0] OUT Cell e9fa9dcc-6c6e-4cd4-97cd-5781aa4c64e6 creating container for instance f2bc9aaa-64cf-4331-53b5-bd5f
   2019-08-25T22:02:11.95-0400 [STG/0] OUT Cell 9aa90abe-6a8f-4485-90d1-71da907de9a3 successfully destroyed container for instance 4cd508ee-3ce3-4e61-a9b7-5a997ca5583e
   2019-08-25T22:02:13.28-0400 [CELL/0] OUT Cell e9fa9dcc-6c6e-4cd4-97cd-5781aa4c64e6 successfully created container for instance f2bc9aaa-64cf-4331-53b5-bd5f
   2019-08-25T22:02:14.43-0400 [CELL/0] OUT Downloading droplet...
   2019-08-25T22:02:14.78-0400 [CELL/0] OUT Downloaded droplet (653.1K)
   2019-08-25T22:02:16.07-0400 [APP/PROC/WEB/0] OUT running

推荐阅读