Neo4J 3.5.17 Migration
2022, May, 28
DatabaseNeo4JLinux
Recently I had to move data from Neo4J database running on an old linux box to another.
Neo4J is a Graph Database.
Graph database stores data in form of nodes and edges.
I'm using it for a side project Badam Satti. More details here
Take backup
neo4j-admin dump --to=<path_for_file>
This created a file graph.db.dump
Install Neo4J on Ubuntu 20.4
Following steps are based on documentation. I tried installing Neo4J 4.4 but it was not able to read dump file from version 3.5.17 so decided to install older version.
apt-get update
- install java 8 required by Neo4J 3.5.17
apt install openjdk-8-jdk-headless
- check java compiler version
javac --version
- add Neo4J to apt sources
wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -echo 'deb https://debian.neo4j.com stable 3.5' | sudo tee -a /etc/apt/sources.list.d/neo4j.list
- update apt to get details for Neo4J
sudo apt-get update
- install Neo4J 3.5.17
sudo apt-get install neo4j=1:3.5.17
- Start Neo4J
systemctl start neo4j.service
- Check neo4j status and verify Bolt is started
systemctl status neo4j.service
- Also verify Neo4J is listening on port 7687 & 7474
lsof -i -P -n
- Check cypher-shell with user neo4j
cypher-shell -u neo4j
- Set password for 'neo4j'
systemctl stop neo4j.servicerm -f /var/lib/neo4j/data/dbms/authneo4j-admin set-initial-password <PASSWORD>
- Load dump
neo4j-admin load --from=<PATH_TO_DUMP> --force --database=graph
- Ensure that /var/lib/neo4j/data/databases/graph.db is owned by neo4j user. If not change ownership
chown -R neo4j:neo4j /var/lib/neo4j/data/databases/graph.db
- Again start Neo4J & verify Bolt is started
systemctl start neo4j.servicesystemctl status neo4j.service