Mobile Monitoring Solutions

Search
Close this search box.

Neo4j database drops and restores

MMS Founder
MMS Raul Salas

Ok, so the latest database platform for Artificial Intelligence is Neo4j (www.neo4j.com), a knowledge graph database that provides in-depth analytics and insight into your data.  It is a relatively newcomer to the database world and with that comes less than mature functionality that is taken for granted in the relational database industry. Operations such as dropping and restoring databases need to be performed manually across all cluster nodes and the cluster will require a full outage.  This means loss of High Availability for a period of time.  This is a less than ideal situation, even for development environments, especially in the offshore around the clock development cycles that are the norm in many development environments.  

Be prepared that developers will be treating your database environment as disposable as they iterate thru their development cycle troubleshooting the new technology.  This usually results in deleting databases as well as restoring databases multiple times a day. The following steps outline deleting and restoring databases that would get an administrator up to speed. 

Developers may want to start out with a full new load from an external source such as Kafka and will want you to delete database data so they can restart a batch load from an external source like Kafka or Hadoop.

Delete NEO4j Data 

1. make sure you bring down all instances on the cluster before doing any other steps!

cd /neo4j-enterprise-3.5.4/bin

./neo4j stop

 2. after all neo instances are down, issue the following commands on each node

 cd /neo4j-enterprise-3.5.4/bin

./neo4j stop

./neo4j-admin unbind

rm -rf /neo4j/data/databases/*

Once data directory on all nodes are deleted then startup the cluster nodes

 ./neo4j status

./neo4j start

tail -f /neo4j/logs/neo4j.log (logs should eventually show the instance coming up waiting for additional cluster members)

You should at this point have a fully blank slate cluster ready for testing!

Developers may want to freeze data with a backup and revert back to it at will. So here are the steps to restore a neo4j database.

RESTORE NEO4J database operations

On each host issue the following commands to refresh 

1. make sure you bring down all instances on the cluster before doing any other steps!

cd /neo4j/bin/neo4j-enterprise-3.5.5/bin

./neo4j stop

2. after all neo instances are down, issue the following commands on each node and wait for neo to start up without error before moving to the next node (of course you will need to pre-stage your backup to the restore location below)

cd /neo4j/bin/neo4j-enterprise-3.5.5/bin

./neo4j stop

./neo4j-admin unbind

./neo4j-admin restore –from=/neo4j/data/test_restore/graph.db-backup –database=graph.db3.5 –force

./neo4j status

./neo4j start

tail -f /neo4j/logs/neo4j.log (logs should eventually show the instance coming up waiting for additional cluster members)

3. if for some reason the node does not come up delete the data directory  /neo4j/data/databases

and re-execute tasks in step #2 above.

Raul Salas

Raul@mobilemonitoringsolutions.com

Subscribe for MMS Newsletter

By signing up, you will receive updates about our latest information.

  • This field is for validation purposes and should be left unchanged.