A free Highly Availabile Database

The code for this post is available on GitHub

With the release of RavenDb4 and in combination with their Community License and Ubuntu Server Edition it is now possible to deploy a highly available database setup that is free of software licensing costs (server hosting costs obviously still apply)

The source code provides a server.pfx and client.pfx which are obviously for TEST environments only. Do not use these when rolling out to production. There i warned you. In fact you may want to consider the RavenDb Wizard setup and/or RavenDb Cloud offering if you are looking for a more automated setup

To demonstrate a possible setup clone my vagrant-ravendb, navigate to the root folder and run

vagrant up

This will reproduce the network shown below: (as an aside, if you haven't already checked out vagrant i highly recommend doing so)

Network Overview

Cluster Setup

The nice part is that you can perform the setup from a single instance.

As the certificates are self-signed you will need to trust the certificate in your host by running

certutil -importpfx -f -user ./install_files/client.pfx

Navigate to https://raven1.mooo.com:8080 and enter your license by clicking the 'License Information' in the toolbar at the bottom on the right hand side. (do NOT enter the license on the other nodes as it will prevent them from being added to the cluster)

Navigate to Manage Server -> Cluster and click Add Node To Cluster - in the URL field enter the names of the other nodes e.g. https://raven1.mooo.com:8080/

Your cluster is now setup and should look like

Cluster

From here you can create a new database Databases -> New database named TestDb and use the provided nodejs client application to connect to your cluster.

Navigate to the /client folder in the source code and execute

npm i
tsc 
node index.js

This app will insert a document into the cluster every 5 seconds:

saved new message with id messages/1-B
saved new message with id messages/2-B

In this example you can see the client has connected to Node B (raven2) thereafter the document is propagated to the other nodes in the cluster. You can use this to experiment with the cluster and see how it recovers after you turn the nodes off and on.

To see the specifics of how to setup RavenDb on Ubuntu see install.sh in the root folder.

I think its incredibly impressive that you can leverage this product to give a free HA database. Let us know your thoughts in the comments.

Posted by: Wallace Turner
Last revised: 11 Sep, 2019 01:13 AM History

Comments

No comments yet. Be the first!

Your Comments

Used for your gravatar. Not required. Will not be public.
Posting code? Indent it by four spaces to make it look nice. Learn more about Markdown.

Preview