Book Image

Neo4j High Performance

By : Sonal Raj
Book Image

Neo4j High Performance

By: Sonal Raj

Overview of this book

Table of Contents (15 chapters)
Neo4j High Performance
About the Author
About the Reviewers

Cloud deployment with Azure

In this section, you will learn how to deploy Neo4j to a Linux VM hosted on Azure. Azure has wizards to guide you, but we will be using Command-line Interface (CLI) tools for our setup. If CLI tools are not installed on the system, you can install them using the Node package manager with the following command:

npm install azure-cli

When the tools are installed, we open a terminal, type azure, and we are greeted with cool ASCII art and some common commands. Now, to create our new Linux VM on Azure, we need the following information:

  • The DNS name of our VM, which will later be used to access your app as We will be using myDNS.

  • The name of an existing Ubuntu distribution image that can be selected from existing ones (type azure vm image list to view all images) or a custom image can be uploaded. Here, we use z12k89b3b3w66g78t94rvd5b73dsrd23__Ubuntu-12_04_1-LTS-amd64-server-20140618-en-us-50GB.

You can now create the Linux VM with the following command in the terminal:

azure vm create myDNS  z12k89b3b3w66g78t94rvd5b73dsrd23__Ubuntu-12_04_1-LTS-amd64-server-20140618-en-us-50GB username -e -l "West US"

In this command, username is the default user account that will be created whose username is specified later. The -e flag enables SSH on the default port 22. The -l flag permits specifying the region where the VM will be deployed. Now we have the VM created and we can easily access it with SSH.

Since we are using an Ubuntu instance, we will install Neo4j using the Debian repository by performing the following steps:

  1. Add the repository to your system configuration:

    echo 'deb stable/' > /etc/apt/sources.list.d/neo4j.list
  2. The dependency list needs to be refreshed with the following command:

    sudo apt-get update
  3. Neo4j is installed using the following command:

    Sudo apt-get install neo4j

If we need to access Neo4j from external applications or servers, we need to configure the Neo4j properties accordingly by performing the following steps:

  1. Open the /etc/neo4j/ file. Add the following line to the file:

    org.neo4j.server.webserver.address =
  2. Also, confirm that the SSL port is enabled:

    org.neo4j.server.webserver.https.enabled = true

If the server was already started, we need to restart it with the following command:

sudo /etc/init.d/neo4j-service restart

We will now navigate to the Azure portal and the port that Neo4j runs on (7474 by default) has to be opened if the server is intended to be used as a database server. In this case, we map the 7474 port with the 80 port so that the port need not be specified with the requests. We will be using the add new endpoint function of Azure for this, as shown below:

In order to test whether our installed application has successfully deployed, we can test it with the following call:


If it works, we have successfully set up Neo4j on Azure. However, the fun does not end there. If your Azure subscription gives you access to apps for the Azure store, then you will find that Neo4j has been included as an app there. So, the first thing you need to do is install Apps for Azure.

Search and select the latest version of Neo4j that is available in the store and then click on Deploy To Cloud in the screen that appears. We then need to select the data center and provide our Windows Azure Subscription details in the form of our publishsettings file.

We then select the size of our VM and specify a password for the administrator that will be mailed after the completion of the deployment.

Next, once the deployment completes, you can RDP into the VM using the admin credentials from Similar to the previous process, if we want our server to be accessible from external hosts, we will need to add the following line to the file:

org.neo4j.server.webserver.address =