Reputation: 3125
I am trying to create a new database in Neo4j community edition 3.0.1, by reading in csv files using the import tool.
(In hopes of getting an answer, I'm going to break down my steps as clear as I can. My apologies if this is pedantic. I'm using Ubuntu 14.04, fwiw.)
I'm using the basic ideas presented in the documentation here.
What is wrong with my workflow? I can create a new database, but I can't populate it with data from the csv tool.
1) I created a new directory to hold my db, on the filesystem, which is in the correct place: /home/monica/neo4j-community-3.0.1/data/databases/new_db
2) I gave neo4j permission to access it, by typing
sudo chown -R neo4j:adm /home/monica/neo4j-community-3.0.1/data/databases/new_db
and then ls -l
gave me this:
drwxrwxr-x 3 neo4j adm 4096 Jul 16 16:44 new_db
which appears fine.
3) I read in the csv using the csv import tool, which worked okay, and I got positive talkback from the tool:
IMPORT DONE in 1s 908ms. Imported:
6 nodes
0 relationships
32 properties
4) Then, I went and edited the neo4j.conf
file to point to the new database, as instructed here:
#*****************************************************************
# Neo4j configuration
#*****************************************************************
# The name of the database to mount
dbms.active_database=/home/monica/neo4j-community-3.0.1/data/databases/new_db
# Paths of directories in the installation.
dbms.directories.data=/home/monica/neo4j-community-3.0.1/data/databases/new_db
5) Then I restarted the service, typing neo4j-community-3.0.1/bin/neo4j start
5) Then, time to play with the database I've just created: $MATCH (n) RETURN n LIMIT 25
But here's where it all comes crashing down. This query doesn't result in anything -- my database is totally empty.
Looking into the new_db
directory, I see that indeed a new database has been created. But the data I imported isn't in that new database.
I don't understand -- I'm creating my database at Step 3. I'm able to access it and I know I'm in the correct place. I know from the talkback that the load csv step was successful. Then why is my database empty??
Upvotes: 1
Views: 151
Reputation: 3125
I think I figured it out.
I needed to:
Shutdown the server first!!
Next, do what @William Lyon said, which is edit the config file as such:
# The name of the database to mount
dbms.active_database=test_db
# Paths of directories in the installation.
dbms.directories.data=/home/monica/neo4j-community-3.0.1/data
Note: don't do what I did and set the second path as dbms.directories.data=/home/monica/neo4j-community-3.0.1/data/databases. Leave databases off the path. Why is it like this? I don't know.
Now, do NOT create an empty directory as I did, on Step 1 in my question.
Then,
cd /home/monica/neo4j-community-3.0.1/bin
and then run this, but YES now you have to specify the directory (test_db) here in the -- into path, as opposed to in Step 1 in the question:
neo4j-import --into /home/monica/neo4j-community-3.0.1/data/databases/test_db --nodes /home/monica/import_match.csv --nodes /home/monica/import_player.csv --nodes /home/monica/import_record.csv
That seemed to do the trick.
Upvotes: 0
Reputation: 8546
I think dbms.active_database
and dbms.directories.data
are specified incorrectly.
Try this:
dbms.active_database=new_db
dbms.directories.data=/home/monica/neo4j-community-3.0.1/data
dbms.active_database
should take a string that is the name of the database, I don't think it takes a path.
dbms.directories.data
takes the path to the data directory, not to the specific database datastore
Upvotes: 2