Neo4j Community Edition backup in windows - neo4j

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.

Related

Neo4j plugin : can't use the spatial procedures after installing neo4j spatial plugin

So I have neo4j3.1.4 community edition, and tried to put neo4j spatial plugin jar v0.24 file under the "E:\softwares\Neo4j CE 3.2.0\plugins" directory. "E:\softwares\Neo4j CE 3.2.0\" is my neo4j installation directory. I couldn't find any of th procedures of spatial from cypher through browser. But I seem to have done exactly what the manual told me.
Judging from the installation path I'd say you actually have Neo4j 3.2.0 running, no ? Anyway (shouldn't make a difference really), if you take the latest release from https://github.com/neo4j-contrib/spatial/releases/download/0.24-neo4j-3.1.1/neo4j-spatial-0.24-neo4j-3.1.1-server-plugin.jar, drop it into the plugins directory and then restart (don't forget that) Neo4j, things should work. You can verify if the spatial-procedures are there with a CALL dbms.procedures(). If not, please verify the neo4j.log file ... there are multiple messages about loading "geometry" related stuff in there if things go well (or you may see the reason it's not loading otherwise).
Also, and again judging from your installation directory, I think you may have used the Windows installer ? If so, the plugins directory is actually located at C:\Users\youruser\Documents\Neo4j\default.graphdb\plugins, not in the installation directory.
Hope this helps,
Tom

For neo4j community edition on windows,Failed to start Neo4j with an older data store version

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

Neo4j restore asks for DB upgrade

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.

Neo4j 1.9.4 Windows Installer- where did the shell go?

When you install 1.9.4 using the new Windows installer, from where does one launch the Neo4j-Shell (previously found in bin)?
The neo4j-shell isn't currently shipping with the neo4j desktop but you can launch it by running the following command from 'C:\Program Files\Neo4j Community\' (or equivalent location:):
jre\bin\java -classpath bin\neo4j-desktop-1.9.4.jar org.neo4j.shell.StartClient
I'm not sure whether there are plans to include it in the next release, I'll check.
You can uninstall your neo4j windowns instalation version, so you can download an zip file with contains the neo4j binary version for Windows at http://www.neo4j.org/download. Using this version, you can find the bin, conf and lib folder. Besides that, you can find the Neo4jShell.bat. This file is the shell.
I believe the stand alone Neo4j-Shell isn't included in the installer for 1.9.4, but there is the Power tool console in the web interface, and you can also use the shell from the 1.8.3 package. I have no idea if it's supported though, but it seems to work.
For future googlers who end up here, there is a cypher shell at <neo4_dir>\bin\cypher-shell.bat. Neo4j-CE-3.1.0

Windows x64 RabbitMQ install error with Erlang environment var (ERLANG_HOME)

I'm ask/answering this question because it hung me up & it's likely someone else will have the same problem.
Install of RabbitMQ x64 v2.8.6 on Windows Server 2008 x64.
After Erlang install using default install location to C:\Program Files\erl5.9.2, I'm attempting to start the server via running the rabbitmq-service.bat. Fail:
Please either set ERLANG_HOME to point to your Erlang installation
or place the RabbitMQ server distribution in the Erlang lib folder.
Problem is the .bat file does not have the correct subpath. with 5.9.2 (R15B02) version of erlang. My ERLANG_HOME directory is set correctly, but the script does not use it correctly for this version of Erlang, which, it appears to this Erlang noob to have a new subdirectory called "erts-5.9.2" which is causing the problems. Maybe someone intimate with these scripts can describe how to make this work correctly without the hack workaround I'm about to describe?
1- Set environment variable:
Variable name : ERLANG_HOME
Variable value: C:\Program Files (x86)\erl6.4
note: don't include bin on above step.
2- Add %ERLANG_HOME%\bin to the PATH environmental variable:
Variable name : PATH
Variable value: %ERLANG_HOME%\bin
This works well.
There are several RabbitMQ control .bat files on windows. Every one you use needs to get changed to reflect the Erlang path correctly. In this example, I'm editing the rabbitmq-server.bat because it's one of the easier ones... any of the .bat files you want to run will need this hack to get them to work, with the rabbitmq_service.bat file being the most involved to adjust.
editing that rabbitmq_server.bat file, you can see on about line 48 or so there's a check to see if the erl.exe is found, but the path isn't correct:
if not exist "!ERLANG_HOME!\bin\erl.exe" (
that path does not match the file structure for the 5.9.2 version of Erlang. I fixed this by simply removing this path check from about line 48 to 58, then, where the .bat actually makes a call to the erl.exe on about line 129 which reads:
"!ERLANG_HOME!\bin\erl.exe"
I simply hardcoded the path to my erl.exe:
"C:\Program Files\erl5.9.2\erts-5.9.2\bin\erl.exe"
With the pathing correct, the rabbitmq .bat files will run.
I had the similar issue, modifying ERLANG_HOME in .bat files did not work. Then I tried echo %ERLANG_HOME% in command prompt, that did not print the environment variable value(I could see that ERLANG_HOME environment variable has been created under advance system settings), that lead me to believe that I need to restart server for 64 bit installation of Erlang. After rebooting server, It worked like a charm. I hope this helps someone.
Just to share an up-to-date answer as of 2019: On Windows Server 2019, after setting up the environment variable, a restart is required to solve the problem.
I got into same kind of problem.
I solved it by doing three changes as given below.
Update Path variable "ERLANG_HOME" : "C:\Program Files\erl8.0" in Environment Variables.
Upadte "Path" variable "Path" : ";%ERLANG_HOME%\bin;"
Give urself FULL CONTROL permissions over "Program Files" in C drive.
It worked for me in this way.
This problem still occurs in Erlang 18.3 (erl7.3) and RabbitMQ 3.6.9 on Windows when upgrading from any older version of RabbitMQ to version 3.6.9. The solution as already stated here is to manually set ERLANG_HOME with 'setx -m ERLANG_HOME "C:\Program Files\erl7.3"' before starting the service.
What happens is that the RabbitMQ 3.6.9 installer removes the environment variable ERLANG_HOME from the system while removing the older version of RabbitMQ. Then, when it proceeds to the installation step, it does not put back the ERLANG_HOME variable. Then, the batch files that start up RabbitMQ cannot find Erlang. They try to find Erlang's home directory using "where.exe" but it always fails after an upgrade.
RabbitMQ's installer also does not kill all of the Erlang background processes, causing many of its files to be undeletable due to the Windows "file in use" problem. This leaves behind "files in use" in %APPDATA%\RabbitMQ and "C:\Program Files\RabbitMQ." These processes are "erl.exe," "erlsrv.exe," and "epmd.exe." The RabbitMQ installer should taskkill these processes after shutting down the RabbitMQ Windows service.
RabbitMQ is rather clunky on Windows.
Download Erlang or OTP - Only one Version of OTP should be installed
Download RabbitMQ installer
Install both exe file as Administrator
Set class path for Erlang. (Setting classpath is a bit troublesome, so follow these steps)
Set a new path with name ERLANG_HOME and value C:\Program Files\erl-23.1 (do not copy bin folder here)
Edit System "path" and add %ERLANG_HOME%\bin
Go to Start - Open rabbitmq command promt and run
rabbitmq-plugins enable rabbitmq_management
Navigate to localhost:15672
Use guest/guest to login
Interesting that this worked for you. There is record of a two bugs in Erl5.9.2 that cause an incomplete installation where %ERLANG_HOME%\bin is not installed.
Either of
* Installed 64bit erlang on 32bit machine
* "The program can't start because MSVCR100.dll is missing from your computer."
https://groups.google.com/d/topic/erlang-programming/wGtFLzapiQ0/discussion
Try 5.9.1 or any other version. They also mention making the future versions of the installer alert you if it fails.
I just had the same problem mentioned here. I installed otp_win64_R15B02 on a Windows 7 machine and everything worked perfectly, but I used the same installer on a Windows 2008 server and the bin directory was not created. I then uninstalled otp_win64_R15B02 and downloaded the otp_win64_R15B02_with_MSVCR100_installer_fix and the bin directory was created.
I suspect the reason it worked on my Windows 7 system is that I have Visual Studio installed and the required libraries were already available which allowed the otp_win64_R15B02 installer to work correctly.
Oh, and if you're installing Erlang to run RabbitMQ the RabbitMQ install will succeed with the broken installer but installing otp_win64_R15B02_with_MSVCR100_installer_fix after RabbitMQ will not work, just un-install and re-install RabbitMQ to resolve this.
Just give C:\Program Files\erl10.6\ not C:\Program Files\erl10.6\bin\erl.exe in the environment variable. If you open the server.bat file I came to know the issueenter image description here
I think this is encoding issue on windows.I see a correct value but I write echo %ERLANG_HOME% on console the value come with question mark. These steps fix it.
1.go environment variable window
2.edit ERLANG_HOME item
3.copy the value, open notepad and paste there
4.copy again on notepad and paste to edit window
5.apply and exit window
6.close command line tools and reopen
7.run rabbitmq bat file.
I solved it in a quick and dirty way,without naming path variables
I've opened the bat file and replaced every occurrence of
!ERLANG_HOME!\bin\erl.exe
with hard coded path for example might be diffrent path for you because of diffrent version
C:\Program Files\erl10.3\erts-10.3\bin\erl.exe
and replaced
%RABBITMQ_HOME%\escript\rabbitmq-plugins
with
C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.14\escript\rabbitmq-plugins
Even I was this problem. The issue was the environment variable ERLANG_HOME=c:\Program Files\erl9.0 which was never existed.
I cross checked the path. The correct path was c:\Program Files\erl9.3.
After correcting the
ERLANG_HOME=c:\Program Files\erl9.3
the problem solved. So, definitely it is a path issue.
In my case, it should be installed erlang using admin role running
If above solutions doesn't work for you then you can try following
Find another compatible version of erlang for your rabbit mq e.g. for rabbit 3.7.x erlang version 20.3.x to 22.0.x all are compatible .
Right click newly downloaded erlang version and from properties select the option to unblock the file .
Run the erlang with admin persssion .
Re run rabbit mq exe

Resources