Running Neo4j on Azure
For those of you who don’t know what I’m talking about, Neo4j is a graph DB, which is great for dealing with certain types of data such as relationships between people (I find it ironic that relational databases aren’t great for this) and it’s perfect for the project I’m working on at the moment.
However this project also needs to be deployable on Azure, which means if I want a graph DB for storing data, I need something running on Azure. I’d originally looked at Sones for doing this since it was the only one around that I knew could run on Azure, but my preference was to run Neo4j instead, because I know it a little better, and because I know that the community around it is quite helpful.
The great news is that as of just recently (a week ago at time of writing) Neo4j can now run on Azure! Happy days!! and “Perfect Timing”™ for my project. I just had to try it out. P.S. Feel free to go ahead and read the Neo4j blog post because it has a basic explanation of how to set it up, has some interesting notes on the implementation and also talks about the roadmap ahead.
Here’s a simple step-by-step on how to get Neo4j running on you local Azure development environment:
1. Download the Neo4j software from http://neo4j.org/download/. I grabbed the 1.3.M02 (windows) version.
2. You’ll also need to download the Neo4j Azure project, which is linked to from the Neo4j blog post.
3. I’m assuming you have an up to date Java runtime locally, so go to your program files folder and zip up the jre6 folder. Call it something creative like jre6.zip :-)
4. If you haven’t already done so I’d also suggest you get yourself a utility for managing Azure blob storage. I’m using the Azure Blob Studio 2011 Visual Studio Extension.
5. Spin up Visual Studio and load the Neo4j Azure solution. Make sure the Azure project is the startup project
6. Next, upload both the Ne04j and JRE zip files you have to Azure blob storage. Note that by default the Azure project looks for a neo4j container, so it’s best to create that container first:
7. Now it’s time to spin this thing up! Press the infamous F5 and wait for a while as Azure gets it act in order, deploys the app and starts everything up for you. You’ll know things are up and running when a neo4j console app appears on your desktop. You may also get asked about allowing a windows firewall exception, depending on your machine configuration.
Behind the scenes, the Neo4j Azure app will pull both the java runtime and neo4j zip files down from blob storage, unzip them and then call java to start things up. As you can imagine, this can take some time.
If you have the local Compute Emulator running, then you should be able to see logging information indicating what’s happening, for example:
8. Once everything is up and running you should be able to start a browser up and point it to the administration interface. On my machine that was http://localhost:5100. You can check the port number to use by having a look at the top of the log for this:
You should then see something like this:
That chart is showing data being added to the database. Just what we want to see!
So that’s it. The server is up and running and it wasn’t too hard at all! The Neo team is looking to make the whole process much simpler, but I think this is a great start and it is very welcome indeed!
If you do have problems, check the locations in the settings of the Neo4jServerHost in the Azure project to make sure they match your local values. You might just need to adjust them to get it working.
P.S. If you have questions, then ask in the Neo4j forums. I’m not an expert in any of this ;-) I’m just really pleased to be able to see it running on Azure.