My local Neo4j has a lot of transaction logs in data/graph.db
:
251M 3 Sep 16:44 neostore.transaction.db.0
255M 3 Sep 20:01 neostore.transaction.db.1
255M 3 Sep 23:20 neostore.transaction.db.2
251M 4 Sep 19:34 neostore.transaction.db.3
250M 4 Sep 22:16 neostore.transaction.db.4
134M 5 Sep 05:02 neostore.transaction.db.5
16B 5 Sep 09:57 neostore.transaction.db.6
16B 7 Sep 16:44 neostore.transaction.db.7
I'm backing the graph.db
folder up (I have stopped the neo4j instance) in order to reload in another offsite instance, so it would be nice to reduce the folder size.
neostore.transaction.db.X
file has been successfully processed? Logical logs are referred to in the docs, which I believe are the same files: http://neo4j.com/docs/stable/configuration-logical-logs.html
In conf/neo4j.properties
I've changed the option keep_logical_logs
to 100M size
:
# Keep logical logs, helps debugging but uses more disk space, enabled for
# legacy reasons To limit space needed to store historical logs use values such
# as: "7 days" or "100M size" instead of "true".
keep_logical_logs=100M size
and restarted neo4j, but it hasn't removed any of the old log files.
Can I do this manually when neo4j has stopped? Or are all of these files required?
I stopped neo4j, made a backup of the graph.db
directory, removed all bar neostore.transaction.db.7
and started neo4j again. It appears to be happy but...
Thanks!
In most Neo4j server environments, all logs will be found in NEO4J_HOME/logs.
The process of removing transaction logs that are no longer necessary for recovery is called pruning.
You can control the number of transaction logs that Neo4j keeps using the parameter dbms.tx_log.rotation.retention_policy . It is set to 7 days by default, which means Neo4j keeps logical logs that contain any transaction committed within 7 days.
We can now run the following command to see the state of the database: Most of the space is taken up by Logical Log, which is the aggregate size of Neo4j’s transaction logs. These are the files in our data/databases/graph.db field that have the neostore.transaction.db prefix:
The neo4j.log for each DBMS can be accessed directly from Desktop and opens in a separate window, which allows you to keep it in the background. This is the standard log and contains general information about Neo4j. Please see Operations Manual → Logging for more information about other Neo4j log files.
Remove Secondary Transaction Log File Right-click on the database and click Properties. Go the “Files” tab on the left side and select the log file that you want to delete from the “database files” secion and click on the remove button at the bottom right.
If you database in good condition you can delete all neostore.transaction.db.x files, but I recommend to you backup them.
Updating:
In neo4j 3.x, the config has changed to:
dbms.tx_log.rotation.retention_policy=<true/false>
dbms.tx_log.rotation.retention_policy=<amount> <type>
see https://neo4j.com/docs/operations-manual/current/configuration/transaction-logs/ for more details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With