知识库

如何配置 Neo4j 以使 data/graph.db/messages.log 自动轮换

经 Neo4j 2.3.0 测试和验证,data/graph.db/messages.log 的大小和轮换归档数量由 conf/neo4j.properties 文件中的以下参数控制:

名称 描述 默认值

store.internal_log.max_archives

内部日志文件的最大历史文件数。

7

store.internal_log.rotation_threshold

内部日志轮换的阈值。

20MB

使用上述默认参数,data/graph.db/messages.log 文件的大小应不超过 20MB,并且将保留多达 7 个归档文件,即 data/graph.db/messages.log.1data/graph.db/messages.log.2 …​ data/graph.db/messages.log.7

如果您希望更改默认值,则 conf/neo4j.properties 文件需要包含以下新值:

store.internal_log.max_archives=<N number of archives>

store.internal_log.rotation_threshold=<文件轮换前的字节数>

然后执行 bin/neo4j restart 命令以使新参数生效。

在 2.3.0 之前,需要使用 Linux 内置的 logrotate 功能。