了解逻辑日志和参数 keep_logical_logs 和 logical_log_rotation_threshold 的影响
Neo4j 为增量备份和集群一致性维护逻辑日志。逻辑日志的命名方式如下
2.2 之前 |
data/graph.db/nioneo_logical.log* |
2.2 及以后 |
data/graph.db/neostore.transaction.db* |
当通过 bin/neo4j-backup
运行数据库备份时,如果 -to <目标目录>
包含以前的备份,则备份将是增量备份,而不是完整备份。如果自上次完整备份后已将逻辑日志轮换出去,则备份将强制为完整备份。
在集群环境中,逻辑日志用于确保新发现的从服务器使用正确的交易进行更新。如果已将逻辑日志轮换出去,则不会简单地从逻辑日志更新新的从服务器,而是会进行完整的存储副本。
在 conf/neo4j.properties
中,可以配置以下两个参数
logical_log_rotation_threshold
keep_logical_logs
这两个参数都在 Neo4j 文档中进行了说明。概括地说,logical_log_rotation_threshold
决定了当前逻辑日志文件在轮换出去之前可以增长到多大。例如,2.3.0 版本中 logical_log_rotation_threshold
的默认值为 250M。因此,预计 data/graph.db/neostore.transaction.db
下的任何文件都不会超过 250M。当 neostore.transaction.db.<N>
达到 250M 时,neostore.transaction.db.<N>
将轮换到 neostore.transaction.db.<N+1>
,然后会查询 keep_logical_logs
参数,以确定是否应自动删除之前的 neostore.transaction.db.<N>
文件。
例如,如果
logical_log_rotation_threshold=250M
keep_logical_logs=3 days
那么,当 neostore.transaction.db.<N>
超过 250M 时,我们将创建一个 neostore.transaction.db.<N+1>
,然后自动删除所有比 3 天早的 neostore.transaction.db.<N>
。需要注意的是,根据 keep_logical_logs
参数删除文件仅在满足 logical_log_rotation_threshold
的条件时才考虑。
此外,如果最初
logical_log_rotation_threshold=250M
keep_logical_logs=10 days
然后编辑 conf/neo4j.properties 并将
keep_logical_logs=10 days
更改为
keep_logical_logs=5 days
然后重启 Neo4j,过去 10 天的 neostore.transaction.db.<N>
仍然存在。当当前 neostore.transaction.db
达到 250M 时,我们将删除除过去 5 天外的所有逻辑日志。
此页面对您有帮助吗?