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.
'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'
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...
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With