Neo4J Cheat Sheet

Server Installation Mac OS X

An installation tutorial can be found at http://docs.neo4j.org/chunked/1.8.M03/server-installation.html

Here are some problems / solutions I faced while trying to install the server on Mac OS X. After downloading and inflating the Neo4J package into a directory $NEO4J_HOME here is what I did:

$ cd $NEO4J_HOME
$ sudo ./bin/neo4j install

# On my computer, it happened that there were some missing privileges on a .plist file, so you have to change them:
$ sudo chown root  /Users/mimi/Library/LaunchAgents/org.neo4j.server.7474.plist
$ sudo chmod 644  /Users/mimi/Library/LaunchAgents/org.neo4j.server.7474.plist

# needed to tell launchd about the "job"
$ launchctl load ~/Library/LaunchAgents/org.neo4j.server.7474.plist

#should reveal the launchd "org.neo4j.server.7474" job for running the Neo4j Server
$ launchctl list | grep neo

# to start the Neo4j Server under launchd control
$ launchctl start org.neo4j.server.7474

# should indicate that the server is running
$ ./bin/neo4j status



Server Administration

On Mac OS the following commands are used for managing Neo4J server:

# Starting server
$ launchctl start org.neo4j.server.7474

# Stopping server
$ launchctl stop org.neo4j.server.7474

# Checking server state
$ ./bin/neo4j status

Backup Neo4J Server

On Community and Advanced Edition of Neo4J server, there is no built-in online backup. Here is my trivial solution on how to do a backup and restore of Neo4J offline:

###############
# Backup
###############

# Stopping Server
$ launchctl stop org.neo4j.server.7474

# Zipping all files of $NEO4J_HOME/data/
$ cd $NEO4J_HOME
$ zip -r backup.zip ./*

# Starting Server again
$ launchctl start org.neo4j.server.7474



###############
# Restore
###############

# Stopping Server
$ launchctl stop org.neo4j.server.7474

# Unzipping backup archive
$ cd $NEO4J_HOME
$ unzip backup.zip

# Starting Server again
$ launchctl start org.neo4j.server.7474

Some common queries

Here is a bunch of common queries to be run on Neo4J console that can be used through Neo4J's browser-based user interface:

# Delete all relationships from graph database
neo4j-sh (0)$ START r = relationship(*) DELETE r;

# Delete all nodes from graph database
neo4j-sh (0)$ START n = node(*) DELETE n;

 
Inhalt © Michael Knoll 2009-2017  •  Powered by TYPO3  •  TypoScript Blogging by Fabrizio Branca  •  TYPO3 Photo Gallery Management by yag  •  Impressum