Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

neo4j: How do I change the database storage location?

Tags:

neo4j

Hi I created a neo4j database with custom java application and tried to change path in configuration file in order to connect to created database.

While trying to check the data in webadmin console only node 0 is visible (seems that the database is empty). I tried to import the same database to Gephi and it's not empty.

Furthermore when I tried to switch back to the original database, which also wasn't empty, in webadmin only node 0 appeared.

I tried to modify the neo4j-server.propertied file the following way:

#***************************************************************** # Administration client configuration #*****************************************************************  # location of the servers round-robin database directory. possible values: # - absolute path like /var/rrd # - path relative to the server working directory like data/rrd # - commented out, will default to the database data directory. org.neo4j.server.webadmin.rrdb.location=data/rrd  # REST endpoint for the data API # Note the / in the end is mandatory #org.neo4j.server.webadmin.data.uri=/db/data/ #original database org.neo4j.server.webadmin.data.uri="/db/mydatabase" #my database  # REST endpoint of the administration API (used by Webadmin) org.neo4j.server.webadmin.management.uri=/db/manage/  # Low-level graph engine tuning file org.neo4j.server.db.tuning.properties=conf/neo4j.properties 

After switching back to the original database (commenting the new path and uncommenting the old)

org.neo4j.server.webadmin.data.uri=/db/data/ #original database #org.neo4j.server.webadmin.data.uri="/db/mydatabase" #my database 

the old one seemed to be empty as well.

Does anyone know how and where to set the path in order to see the appropriate database in the webadmin console and to be able to execute queries on the desired database?

Thank you!

like image 805
Niko Gamulin Avatar asked Jun 04 '12 20:06

Niko Gamulin


People also ask

Where is Neo4j database stored?

Neo4j database files are persisted to storage for long term durability. Data related files located in data/databases/graph. db (v3. x+) by default in the Neo4j data directory.

How do I change the default database in Neo4j?

default_database defines which database is created and started by default when Neo4j starts. The default value of this setting is neo4j . You can change the default database by using dbms. default_database , and restarting the server.

What is the default database in a Neo4j instance?

The default database is named neo4j (can be changed) and is where we can store and query data in a graph and integrate with other applications and tools.

How is data stored in graph database?

Graph data is kept in store files, each of which contain data for a specific part of the graph, such as nodes, relationships, labels and properties. Dividing the storage in this way facilitates highly performant graph traversals (as detailed above).


2 Answers

You first need confirm that the database you are connecting to was properly shut down (means you should not take the image of a running database).

Set the location of the database if you are in server mode from the file

conf/neo4j-server.properties 

by editing the below line.

org.neo4j.server.database.location=data/graph.db 

if you are using embedded neo4j you can set the location of your db while instantaniating the GraphDatabaseService as under:

new EmbeddedGraphDatabase("Path To Db Directory"); 
like image 133
Amit Lamba Avatar answered Sep 20 '22 10:09

Amit Lamba


You need to set the location on disk of the database directory like this:

org.neo4j.server.database.location=data/graph.db 

See http://docs.neo4j.org/chunked/stable/server-configuration.html

like image 26
espeed Avatar answered Sep 21 '22 10:09

espeed