neo4j console how to specify local path of existing db? - neo4j

Suppose I have a graph database created with Neo4j Desktop in the path
path/neo4jDatabases/database-abc/installation-3.5.5
In a different path I have the neo4j-community-3.5.5 folder (I am on OSX). I am trying to start the path/neo4jDatabases/database-abc/installation-3.5.5 database with neo4j-community.
I am trying this command:
sudo ./bin/neo4j console -path path/neo4jDatabases/database-abc/installation-3.5.5
but the started database is using the directories of neo4j-community-3.5.5 instead of the ones specified in the path.
How can I start neo4j-community using the path of an existing db (created with Neo4j Desktop)?

The path argument doesn't exist for the command neo4j.
If you want to change the data folder location of your community server, you need to modify the configuration of your community server (the conf/neo4j.conf) by specifying the dbms.directories.data property :
dbms.directories.data=path/neo4jDatabases/database-abc/installation-3.5.5/data
Cheers.

Related

starting neo4j data at user defined directory

I created a directory where I'm storing my current graph.db which is different than the default location of /var/lib/neo4j/data/database. I changed my neo4j.config file providing new location of the database as dbms.directories.data=/neo4j/data, but somehow I cannot start the neo4j server using systemctl start neo4j
When using a deb or rpm distribution package (I assume you are because you are using systemctl to start the database), the database is run under neo4j user by default and this user needs to have write permissions to the data directory.
Does the user have permissions to write to your new /neo4j/data directory?

Neo4j Desktop 1.1.10 how to export cypher file?

I have created a graph database within Neo4j Desktop (version 1.1.10) I wish to export that as a Cypher file.
How do I do that? I can't see any command within the app for export a Cypher file.
You can try following the documentation here: Neo4j - Export a (sub)graph to Cypher script and import it again
First, install the apoc procedure library, and add it into the plugins directory.
Second, run Neo4j as an administrator. If not, Neo4j doesn't have permission to write files.
Before starting Neo4j, edit the neo4j.conf file and add this line:
apoc.export.file.enabled=true
Then, start Neo4j, and in the Neo4j browser, execute the following command:
CALL apoc.export.cypher.all("export.cypher",{})
This will store the whole database in the file "export.cypher".

Neo4j Dump: How to specify the database?

Having successfully created and populated a database with 200,000+ nodes, I would like to create a dump as a backup.
The instructions in the documentation are simple:
neo4j-admin dump --database=<database> --to=<destination-path>
But it's not clear what to use for <database>. If I use graph.db (or leave out the option) I get an error. I know the location of the database folder.
If I put the path to the database I get the following error:
unexpected error: 'database' should be a name but you seem to have specified a path
OS: Windows 10
Partial answer:
The database parameter refers to databases that are located in neo4jFolder/data/databases folder, where neo4jFolder is the folder of the unzipped install of Neo4j.
For example: I unzipped the neo4j install zip into E:\Program Files\neo4j-community-3.3.2. My database was elsewhere on the drive. So I copied the database to E:\Program Files\neo4j-community-3.3.2\data\databases\MyDatabase. Then I was able to run neo4j-admin dump --database=MyDatabase --to=backup5.dmp successfully.
I don't know if it's possible to run dump on databases that are not found under /data/databases. I also don't know how to run a dump when Neo4j is installed with the exe installer. My solution is for the zip file installation.

Copying a local database from one computer to another ne04j

I created a database Neo4j on a PC, with many relationships, node, etc
how to move/ copy the database from this pc to another?
thanks for the help
francesco
update1: I have tried to found conf/neo4j-server.properties but i don't have...
this is a screenshot of my folder ne04j (It is in Windows document Folder)
http://s12.postimg.org/vn4e22s3x/fold.jpg
Neo4J databases live in your filesystem, you can simply make a copy of the folder in which your Neo4J data is stored. If you are running standalone this folder will be configured in conf/neo4j-server.properties and the line will look something like this:
org.neo4j.server.database.location=data/graph.db
Copy the content of that folder to the graph database folder on your other machine. I'd recommend that your databases are not running when you do this.
I believe you're looking for the dump shell command which you can use to export a database into a single Cypher create statement, you'd "dump" the database and then import it on your new machine.
Information on using the command is outlined here: Neo4j docs
A Neo4j database can be dumped and loaded using the following commands:
neo4j-admin dump --database=<database> --to=<destination-path>
neo4j-admin load --from=<archive-path> --database=<database> [--force]
Limitations
The database should be shutdown before running the dump and load commands.
https://neo4j.com/docs/operations-manual/current/tools/dump-load/
i used the above solution, but the file name was different.
in the folder of the neo4j data, look for folder called conf and inside the configuration file called neo4j.conf
inside this file you will see a line that direct to the folder that contain the data.
its called "graph.db"
replace it with the same folder from your backup of the DB that you want to clone.

Neo4j configuration file

I've tried to run a simple example "Hello World" with Neo4j but I don't know how to modify the configuration file.
I don't know what to put as a parameter for
"GraphDatabaseService graphDB = new GraphDatabaseFactory()
.newEmbeddedDatabase(" ..... ");"
and what other modification do I have to make. Do I have to put the org.neo4j.server.database.location from the neo4j-server.properties?
But first, do I have to run the server?
Thanks!
You can either put in the path from org.neo4j.server.database.location in the neo4j-server.properties file which will allow you to access the same database referred to when you run the server/webadmin.
Or you can put in the path to any directory that you have access to and your database will be created there.
You should not run the server since the above code uses Neo4j in embedded mode.

Resources