英文:
Graceful restart to keep connections open
问题
我确定我看到过一些用Go编写的开源服务器,它能够重新启动并保持连接开放。
我找不到它来学习这个技术。
我知道apache.httpd有apachectl graceful
,它可以重新启动并保持连接开放。
一般情况下和在Go中是如何实现的呢?
我认为它必须进行fork,1个退出,2个执行(新的Go应用程序)并通过Fd链接连接。
但是在Go中,我只能找到ForkExec
函数。我认为Fork
是必需的。
此外,syscall
包的文档不是很完善。
英文:
I am sure I saw some open source server written in Go that was able to restart and keep connections open.
I can't find it to learn that technique.
I know apache.httpd has apachectl graceful
that restarts and keeps connections open.
How does it done in general and in Go?
I thought it must fork and 1 exit, 2 exec(new go app) and link connections by Fd.
But in Go I can find only ForkExec
function. I think Fork
is required.
Also syscall
package is not very well documented.
答案1
得分: 7
CloseOnExec可能有所帮助,
[FileListener,CloseOnExec和优雅地重启服务器][1]
[Go中TCP服务器的零停机升级][2]
[1]: https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/B98plzvQQN8 "FileListener,CloseOnExec和优雅地重启服务器"
[2]: http://blog.nella.org/?p=879 "Go中TCP服务器的零停机升级"
英文:
CloseOnExec may help,
[FileListener, CloseOnExec and gracefully restarting servers][1]
[Zero Downtime upgrades of TCP servers in Go][2]
[1]: https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/B98plzvQQN8 "FileListener, CloseOnExec and gracefully restarting servers"
[2]: http://blog.nella.org/?p=879 "Zero Downtime upgrades of TCP servers in Go"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论