知识库

如何配置 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=<# of bytes before the file is rotated>

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

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

© . This site is unofficial and not affiliated with Neo4j, Inc.