知识库

使用 supervisord 管理 Neo4j 进程

一般来说,直接运行 neo4j 进程是启动和停止 Neo4j 服务器的最常见方式。但如果使用 supervisord 来管理进程,其他人也已经验证可行。

需要注意的事项

supervisord 只能管理非守护进程,因此需要使用 neo4j console 而不是 neo4j start

必须在 supervisord 配置中正确设置 “stopsignal”,以免在意外重启时导致集群出现问题。

尤其需要设置

stopsignal=SIGTERM

以下是一个在生产环境中已经验证可行的 supervisord 配置示例

[program:neo4j]
command=/usr/local/neo4j-enterprise/bin/neo4j console
user=neo4j
autostart=true
autorestart=unexpected
startsecs=30
startretries=999
priorities=90
exitcodes=0,1,2
stopsignal=SIGTERM
stopasgroup=true
killasgroup=true
redirect_stderr=true
stdout_logfile=/usr/local/neo4j-enterprise/data/log/neo4j.out
stdout_logfile_backups=10
stderr_capture_maxbytes=20MB
© . This site is unofficial and not affiliated with Neo4j, Inc.