How to Backup Neo4j

Hello! I am a beginner in Neo4j and I am carrying out a project in the area of Software Engineering with this database. In this moment of social isolation, I can no longer gather the team to work, so that the others have access to what I do I thought about the backup to send to them, but I don't know how to do it.
Can anyone help me with a step by step tutorial on how to make a backup on Neo4j? Explanatory images or video would help a lot ...

I wait ... Hugs to all!

Online backup is available only in Enterprise Edition, instructions here:

For community, the best to backup is to fully stop the database, and then copy the data/databases folder, zipping it up. To restore you can unzip it in the right place, and restart the database. Do not take this kind of backup from community while the database is running.


Hello. I did what you said, followed the steps and it didn't work. any idea what happens?

I gave two different sets of steps and I'm not sure which you followed. Additionally you haven't provided any details on what went wrong, so I can't help you further here. Recommend you open a new topic, and put in the steps you followed and what the exact console outputs were.

1 Like

I managed to accomplish. I used data folder compression backup. Before, he was uncrossing in the wrong place.
Thanks a lot for the help!!

1 Like

Hello David,

I tried to do a backup/restore from one container to another container using Docker version of Neo4j Community Edition 4.1.

  • Shut down container running Neo4j on server1
  • Copied the contents of the databases folder (had neo4j & system folders + store_lock file) and compressed to a tar.gz file
  • Uploaded the tar.gz file to server 2 and decompressed the contents to the same databases location
  • Attempted to start the new container on server 2 with the restored contents.
  • Neo4j shut down with the following error message:

Directories in use:
home: /var/lib/neo4j
config: /var/lib/neo4j/conf
logs: /logs
plugins: /var/lib/neo4j/plugins
import: /var/lib/neo4j/import
data: /var/lib/neo4j/data
certificates: /var/lib/neo4j/certificates
run: /var/lib/neo4j/run
Starting Neo4j.
APOC couln't set a URLStreamHandlerFactory since some other tool already did this (e.g. tomcat). This means you cannot use s3:// or hdfs:// style URLs in APOC. This is caused by a limitation of the JVM which we cannot fix.

2020-09-03 21:23:18.441+0000 INFO Starting...
2020-09-03 21:23:20.620+0000 INFO ======== Neo4j 4.1.0 ========
2020-09-03 21:23:35.870+0000 ERROR Failed to start Neo4j on dbms.connector.http.listen_address, a socket address. If missing port or hostname it is acquired from dbms.default_listen_address. Error starting Neo4j database s
erver at /data/databases
java.lang.RuntimeException: Error starting Neo4j database server at /data/databases
at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.startDatabaseServer(
at org.neo4j.server.CommunityBootstrapper.createNeo(
at org.neo4j.server.NeoBootstrapper.start(
at org.neo4j.server.NeoBootstrapper.start(
at org.neo4j.server.CommunityEntryPoint.main(
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.dbms.database.DefaultSystemGraphInitializer@78054f54' was successfully initialized, but failed to start. Please see the attached cause exceptio
n "Multiple components failed to initialize the system graph:
multi-database: org.neo4j.graphdb.DatabaseShutdownException: This database is shutdown.
security-users: org.neo4j.graphdb.DatabaseShutdownException: This database is shutdown.".
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(
at org.neo4j.kernel.lifecycle.LifeSupport.start(

I was able to get it to work by also copying the transactions folder, but would prefer not to since it is much larger than the databases folder.

Is there a command you should run on your database prior to shutting it down and copying the databases folder to perhaps make this work without having to also copy the transactions folder?

You really shouldn't just copy files on disk to perform a backup, this is generally not a safe operation -- the use of the backup tool is recommended. That being said, the transaction log itself is governed by these settings here, and can be adjusted to make the TX log on disk as big or as small as you like.,log%20sizes%20surpass%20250%20MB.&text=If%20this%20parameter%20is%20set,logs%20will%20be%20kept%20indefinitely.

Obviously the smaller it is, the less history you're keeping, and the more trouble you're going to be in if you need to recover a store with an issue

I'm using the community edition of Neo4j. The backup tool is only available in the Enterprise edition. So the only way I know of to backup/restore is copying these files? Is that not correct for the community edition?

Even in the case of community, copying transaction files is not the right approach. The better way is to do offline load/dump like this:

Thanks David.

The problem I had initially was I could not stop the database in my docker container. The STOP command is only available in the Enterprise Edition.

If you're running Neo4j in a docker container and want to perform an offline backup, you need to start the container without starting the normal Neo4j services. Then you can use the dump tool to perform a backup.

I found the solution mentioned here

Hi David,

I've been trying to get this to work for several days without success. I'm using the community edition.

My process is:

  1. Stop the server
  2. Dump the neo4j database
  3. Start server
  4. Copy that dump to S3

Then to test the backup
5) Stop server
6) Pull down the dump from S3
7) Load dump into the same server and neo4j database (using force)
8) Start server

After doing this, whenever I use the browser to attempt to look at the database it says it is "offline"

Any ideas?


1 Like