Neo4j 系统服务
本页面涵盖了 Neo4j 系统服务的配置和操作。它假设您的系统拥有 systemd
,这适用于大多数 Linux 发行版。
设置打开文件数。
有关如何设置用户可以同时打开的文件数的说明,请参阅设置打开文件数。 |
控制服务
系统服务通过 systemctl
命令进行控制。它接受多个命令
systemctl {start|stop|restart} neo4j
服务自定义项可以放置在服务覆盖文件中。要编辑您的特定选项,请执行以下命令,该命令将打开相应文件的编辑器
systemctl edit neo4j
然后将任何自定义项放置在 [Service]
部分下。以下示例列出了某些用户可能希望更改的默认值
[Service]
# The user and group which the service runs as.
User=neo4j
Group=neo4j
# If it takes longer than this then the shutdown is considered to have failed.
# This may need to be increased if the system serves long-running transactions.
TimeoutSec=120
您可以打印有效服务,包括可能的覆盖,使用
systemctl cat neo4j
如果您更改了任何设置,请记住重启 Neo4j。
systemctl restart neo4j
日志
Neo4j 日志写入 journald
,可以使用 journalctl
命令查看
journalctl -e -u neo4j
journald
会在一定时间后自动轮换日志,并且默认情况下通常不会在重启后持久化。有关更多详细信息,请参阅 man journald.conf
。
卸载 Neo4j
请按照以下步骤卸载 Neo4j
-
(可选) 创建一个备份以避免数据丢失。
-
卸载 Neo4j
--- sudo apt remove neo4j ---