I am using neo4j with docker version 4.2.5 and cypher file to initialize data.
I am setting following environment property to initialize data with docker-compose -
NEO4J_apoc_initializer_cypher=CALL apoc.cypher.runFile ("file:///sample.cypher")
This works fine and load the data after server started.
However, you cannot create indexes in this file. You need runSchema call to create indexes.
As per doc for neo4j 4.2, you can run multiple cypher,
NEO4J_apoc_initializer_cypher_0=CALL apoc.cypher.runSchemaFile ("file:///schema.cypher")
NEO4J_apoc_initializer_cypher_1=CALL apoc.cypher.runFile ("file:///sample.cypher")
However, this throws error:
unknown settings: apoc.initilizer.cypher.0
unknown settings: apoc.initilizer.cypher.1
Can someone please help me with this?
This has been resolved. It seems the issue was the wrong documentation on how to run multiple cypher queries. Please check this link for more details
I'm new to neo4j.
I have created a new graph/database named db-learning. I'm able to connect and perform some operations on the database via neo4j browser. No issue at all.
However when I tried to dump it using neo4j-admin dump --database "db-learning" --to "/some/path" I get this error saying database not found.
Database does not exist: db-learning
Am I missing something?
Sorry if that's confusing. The database name in the project is not related to the underlying database name (which is neo4j for the default database)
So if you open the terminal, this should be good enough:
./bin/neo4j-admin dump --database "neo4j" --to "/tmp/test.dump"
I think you can also leave off the default database name.
Getting the same issue when neo4j is in fact an existing DB. I don't know how the N4J team managed to overcomplicate this so much but this whole process is such a nightmare.
The Aura service only accepts .dump files, which have to be generated via neo4j-admin. This won't allow remote DBs so you have to pull down a neo4j directory (for instance, from a graphenedb.com dump), load it locally, then export that via neo4j-admin -> dump file in order to upload and import into a Aura instance.
Has anyone at Neo4j actually used their own software?
I use the neo4j community edition on windows to see a database.
The path of database is D:\Alamgir\neo4jdb.
When start it shows:
Failed to start Neo4j with an older data store version.
To enable automatic upgrade, please set configuration parameter "allow_store_upgrade=true"
I update the parameter on neo4j.properties and neo4j.conf just like this:
But it still doesn't work .What can I do? Help~
You need to uncomment the line in the config file, i.e. remove the preceding #:
allow_store_upgrade=true
I have an instance in AWS hosting a Neo4j DB.
The version im using is 2.3.1.
I backed it up using "neo4j-backup".
I then zipped the files and uploaded to an external storage.
I wanted to restore the DB to another instance I have using the same version (2.3.1), so I copied the files to the same folder the 1st instance is using.
When I run the neo4j console command it states:
ERROR Neo4j cannot be started, because the database files require upgrading and upgrades are disabled in configuration. Please set 'allow_store_upgrade' to 'true' in your configuration file and try again.
Of course the "allow_store_upgrade" is commented out,
Do I have to do the upgrade when restoring?
How can I find the DB version?
If you're using the same version you shouldn't need to comment it out. Though I don't think it would harm anything if you do (especially if you still have that backup somewhere else).
You should be able to find the version of Neo4j in the CHANGES.txt / README.txt files. It should also output the version in data/graph.db/messages.log when you start up the server. Also if you go to the web console (at http://localhost:7474 by default) it will show you the version.
Currently am using Neo4j Community version 1.8.2 with Windows 8. Is it possible to backup the neo4j community version db in windows?
As Pangea said, the official backup tool is only available on Enterprise Edition.
His suggestion of using Windows backup tools isn't a good option unless you know other things about Neo4j. Neo4j doesn't flush information immediately, nor does Lucene, so if you use something like Windows Backup, you will not get the database in a stable backup. You need to either use the Neo4j Backup tool, or you need to shutdown the Graph Database so everything flushes/closes, then backup using Windows.
Here are my Powershell scripts for Community edition
#http://stackoverflow.com/questions/1153126/how-to-create-a-zip-archive-with-powershell
function zipFiles()
{
param(
[Parameter(Mandatory=$true,Position=0)]$zipfilename
,[Parameter(Mandatory=$true,Position=1)]$sourcedir
)
Add-Type -Assembly System.IO.Compression.FileSystem
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir, $zipfilename, $compressionLevel, $false)
}
#http://stackoverflow.com/questions/18612294
function BackupNeo4jCommunity
{
param(
[Parameter(Mandatory=$true,Position=0)]$serviceName
,[Parameter(Mandatory=$true,Position=1)]$sourceNeoFolder
,[Parameter(Mandatory=$true,Position=2)]$zipFilename
)
Stop-Service $serviceName
zipFiles $zipfilename $sourceNeoFolder
Start-Service $serviceName
}
BackupNeo4jCommunity -serviceName neoWindowsServiceName -sourceNeoFolder "D:\neo4j\myapp\data\graph.db" -zipFilename "D:\Downloads\neo-data.zip"
Hiyo!
They may work, but neo4j is pretty explicit in their guidance:
By contrast, file system copy-and-paste of databases is not supported [1]
So! Your neo4j install path has a bin folder. In it, you have a neo4j.bat and neo4j-admin.bat. You can use these to stop the database, dump the database in a supported way, and start the database back up.
Make sure neo4j*.bat files know where your java is. For example, using the default chocolatey install method, you might have this file structure 'C:\tools\neo4j-community\neo4j-community-VERSION\java\jdkVERSION'. Set a JAVA_HOME environment variable as needed. e.g. in PowerShell, $ENV:JAVA_HOME = 'C:\tools\neo4j-community\neo4j-community-VERSION\java\jdkVERSION'
Check if it worked! C:\tools\neo4j-community\neo4j-community-3.2.3\bin\neo4j-admin.bat help. If it failed, you'll get an error message saying something like Invoke-Neo4jAdmin : Could not find java at...
It worked? Stop the service, back it up, start the service.
Here's a super simple example; you would want to validate paths, add error handling and so forth.
$ENV:JAVA_HOME = 'C:\tools\neo4j-community\neo4j-community-VERSION\java\jdkVERSION'
C:\tools\neo4j-community\neo4j-community-VERSION\bin\neo4j.bat stop
C:\tools\neo4j-community\neo4j-community-VERSION\bin\neo4j-admin.bat dump --database graph.db --to=C:\temp\neo4j.dump
C:\tools\neo4j-community\neo4j-community-VERSION\bin\neo4j.bat start
This code might change if you have spaces in your path, among other environment variances...
Good luck!
[1] https://neo4j.com/docs/operations-manual/current/tools/dump-load
[2] https://neo4j.com/docs/operations-manual/current/installation/windows
[3] https://neo4j.com/blog/chocolatey-neo4j-windows
The Backup service is only available in enterprise edition. You can schedule a regular backup of the Neo4j's data files using the tools that come with Windows.