从 Python 测试 fastcgi 守护进程
我有一个不可靠的 PHP 服务器,每天会锁定几次。进程保持活动状态,但 nginx 启动网关超时。我花了太长时间试图修复它,我只需要它能够工作。
所以我想编写每分钟运行两次的脚本(我可以处理这一点),通过套接字 fastcgi 连接到 php-fpm 服务器并获取状态,或者只是说“你好”。它不需要执行任何操作,只需尝试连接即可。
如果不能的话,我会强制它重新启动 PHP,但同样,我可以做到这一点。
那么,如何从 Python 连接到 FastCGI 套接字,让我知道它是活动的,而不干扰来自 nginx 的连接。
I have a dodgy PHP server that locks up a few times a day. The processes stay alive but nginx kicks off a gateway timeout. I've spent too long trying to fix it I just need it to work.
So I want to script something that runs twice a minute (I can handle that bit) that connects to the php-fpm server via socketed fastcgi and get a status, or just say "hello". It doesn't need to do anything but attempt to connect.
If it can't, I'll have it forcibly restart PHP, but again, I can do that bit.
So how do I connect to a FastCGI socket in a way that will let me know it's alive, from Python, without disturbing connections from nginx.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论