-
Notifications
You must be signed in to change notification settings - Fork 1
Neo4j Setup
-
- go to Community Server
- choose your OS
Let us denote by
$NEO4J_DIRthe directory where you uncompressed neo4j. Actually, you can export this as an environment variable in bash, e.g.,export NEO4J_DIR=/home/manu/neo4j-community-3.5.0and then copy-paste the commands below.
-
Awesome Procedures On Cypher, aka APOC
-
download the latest release (a jar file) from here. At the time of writing this, you could do
wget https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.1/apoc-3.5.0.1-all.jar
-
-
- download both GraphAware Framework and GraphAware UUID
-
Anaconda and, in particular
-
conda install pyyaml -
conda install colorama -
conda install pandas -
conda install matplotlib -
conda install tqdm -
conda install -c conda-forge ipdb -
pip install neo4j-driver -
pip install mysqlclient
Putting everything together:
-
conda install pyyaml colorama pandas matplotlib tqdm
conda install -c conda-forge ipdb
pip install neo4j-driver mysqlclient
-
Move the downloaded jar files for APOC (just one) and GraphAware (two files) to the neo4j directory. For the above version, it would be something along the lines of
mv apoc-3.5.0.1-all.jar graphaware-uuid-3.5.0.53.17.jar graphaware-server-community-all-3.5.0.53.jar $NEO4J_DIR/plugins -
Edit
$NEO4J_DIR/conf/neo4j.conf-
comment out the line
dbms.directories.import=importThis allows neo4j (server) read files from any location (not allowed by default for security reasons)
-
Add, e.g. at the end in Other Neo4j system properties,
dbms.security.procedures.unrestricted=apoc.*This allows the (unrestricted) execution of APOC procedures.
-
Add settings (also at the end?) for GraphAware
com.graphaware.runtime.enabled=true #UIDM becomes the module ID: com.graphaware.module.UIDM.1=com.graphaware.module.uuid.UuidBootstrapper #optional, default is uuid: com.graphaware.module.UIDM.uuidProperty=uuid #optional, default is false: com.graphaware.module.UIDM.stripHyphens=false #optional, default is all nodes: com.graphaware.module.UIDM.node=hasLabel('person') #optional, default is no relationships: #com.graphaware.module.UIDM.relationship=isType('Type1') #optional, default is uuidIndex com.graphaware.module.UIDM.uuidIndex=uuidIndex #optional, default is uuidRelIndex com.graphaware.module.UIDM.uuidRelationshipIndex=uuidRelIndex -
(optional) uncomment line
dbms.connectors.default_listen_address=0.0.0.0This allows remote connections to neo4j. You may also have to tweak the firewall settings of the machine running neo4j server.
-
A basic config file with the above settings (and some more) can be found here.
In a terminal, run
$NEO4J_DIR/bin/neo4j start
-
(optional): you can check what's going on by monitoring the messages neo4j is logging:
tail -f $NEO4J_DIR/logs/neo4j.log(Press
Ctrl-Cto stop)
The neo4j browser should (by default) be now accesible at http://localhost:7474/
...you'll be asked for a login and password. They are both neo4j. Next, you'll be asked to choose a new password. Anything will do, but if you choose any other than wapwap, don't forget to update the yaml parameters file.
In a terminal, run
$NEO4J_DIR/bin/neo4j stop
In a terminal, after stopping neo4j, run
rm -rf $NEO4J_DIR/data/databases/graph.db/
-
Start neo4j and monitor the log
$NEO4J_DIR/bin/neo4j start && tail -f $NEO4J_DIR/logs/neo4j.log -
Stop neo4j and reset the database
$NEO4J_DIR/bin/neo4j stop && rm -rf $NEO4J_DIR/data/databases/graph.db/
The Anaconda-less part of the setup can (sort of) be automated using this script here. If you want to give it a try, you should also download the config patch and the environment file. Additionally, you might have to edit the latter. The easy thing to do is to clone the entire wiki.
In the files/scripts directory, you can also find the files start_neo4j.sh, stop_neo4j.sh and clean_neo4j.sh. They depend on the environment file.
In practice you can have several databases by keeping different conf directories. Assume you have or intend to create a new database named foo. It should go in $NEO4J_DIR/data/databases/foo (the default db goes in $NEO4J_DIR/data/databases/graph.db).
-
create a new conf directory; the default conf directory is $NEO4J_DIR/conf, but you can create another one, e.g.,
$NEO4J_DIR/conf_foo -
edit
$NEO4J_DIR/conf_foo/neo4j.confand setdbms.active_databaseto the directory (relative to $NEO4J_DIR/data/databases) of a different database (in the above example,dbms.active_database=foo) -
start neo4j server with
NEO4J_CONF=$NEO4J_DIR/conf_foo $NEO4J_DIR/bin/neo4j start(notice the environment variable
NEO4J_CONFbeing set at the beginning)
See also this post.