neo4j | 增加同时打开文件数

neo4j 数据库在数据量较大时需要增加同时打开文件数的上限。

主要是两种方法。

直接增加 Linux 的打开文件上限

将以下条目添加到 /etc/security/limits.conf 文件中:

1
2
root   soft    nofile  40000
root hard nofile 40000

然后重启服务器。

这种方法需要最终启动该服务的用户是 root 用户。

增加 neo4j 的打开文件数上限

自 Neo4J 3.1 以来,

可以在 /etc/default/neo4j 中添加一行:

1
NEO4J_ULIMIT_NOFILE=60000

为服务设置 ulimit 设置 (60000 个打开的文件)。

不再需要更改 /etc/security/limits.conf