Setting Up your first Cluster

In this post, I will help you to set up your first RavenDB cluster.

To be honest, it is not a difficult task.  In fact, you do not need to be an expert to manage a RavenDB cluster (We did our best to make it mostly self-managed).

What is the point of setting up a cluster?

A RavenDB cluster is a set of machines that have been joined together. Each machine in the cluster is a node.

When you create a database, it can live on a single node (one machine in the cluster), some number of the nodes or even all the nodes. Each node will then hold a complete copy of the database and will be able to serve all queries, operations and writes (RavenDB cluster implements multi-master replication).

The primary reason for this duplicating data is to allow  high availability. If a  node goes down, the cluster will still have a copies of the data, andthe cluster can shuffle things around so clients can talk to another node without really noticing that anything happened.

The cluster can distribute the work, handle the failures and adopt recovery procedures automatically.

So, let’s set up a cluster?

In fact, assuming that you are already started the RavenDB server on your computer,  you are already using a Cluster (a cluster with a single node, but still a cluster).

The thing you need to do is to add more nodes to your cluster (I will help you)

So, could we simply add nodes to a cluster?

Yes. We Can!  But, first we need to review our license: RavenDB Community edition only allows you to set up the cluster using 3 cores (total). So, before setting a cluster, we will need to reduce the number of cores in use of the current node. You can skip this depending on your license.

In the left panel, select the option Manage Server, and then Cluster. Then, in the list of nodes (there is only one), click in Operations and Reassign Cores

Change the number of Cores in Use to 1 and click on Save.

Starting the second node

Now that the “nodes problem” is solved. Let’s simple start a second instance of the RvenDB server. Typically, you would do that on a separate machine, but to make this exercise easier, we’ll run it on the same computer. Open a new terminal session and run the following command:

Note that we specified the address as 127.0.0.2:8080. The logs directory is Logs/B and data directory is Data/B. Two servers are running on your computer.

Open the Management Studio from the first server, then, In the left panel, select the option Manage Server, and then Cluster. So, click in Add Node To Cluster. Inform the address of the second server and hit Test Connection.

Success? Hit Add.

Starting your third node

I strongly recommend you to repeat the process to create the third node (on http://127.0.0.3:8080, storing data at Data/C and logs at Logs/C). I think you are able to do that.

In a future post, you will learn that makes little sense to setup a cluster with only two nodes.

Done?! This is our result:

Some new concepts

Now that you know what is a cluster, it is time to learn some new concepts. Are you ready? Let’s go:

  • Database – the named database we’re talking about,  regardless of whether we’re speaking about a specific instance or the whole group.
  • Database Instance – exists on a single node.
  • Database Group – the grouping of all the different instances, typically used to explicitly refer to its distributed nature.
  • Database Topology – the specific nodes that all the datab ase instances in a database group reside on in a particular point in time.

Consider you have a cluster with 5 nodes. It is possible to create a database setting the replication factor to only 3. So, only 3 nodes will have instances of the database. The selected nodes will form the Database Topology and all the three instances will constitute the Database Group. Got the idea?

In the future posts I will help you to create a database and how to specify the replication factor. Also, how to define what nodes will compose the Database Topology.

Last words…

Congratulations! Now you know how to setup a cluster. That was easy right?

RavenDB Studio is so easy to learn that I could bet you can discover how to replicate your databases. If not, no problem, we will discuss about it in future posts.

Let me know if you need help.

Compartilhe este insight:

Elemar Júnior

Sou fundador e CEO da EximiaCo e atuo como tech trusted advisor ajudando diversas empresas a gerar mais resultados através da tecnologia.

Elemar Júnior

Sou fundador e CEO da EximiaCo e atuo como tech trusted advisor ajudando diversas empresas a gerar mais resultados através da tecnologia.

Mais insights para o seu negócio

Veja mais alguns estudos e reflexões que podem gerar alguns insights para o seu negócio:

O desenvolvimento de uma aplicação com ótima performance só é possível mediante considerações desde sua arquitetura. Otimizações pontuais de código,...
What kind of optimizations could we expect from the C# compiler and the JIT? In this post, I would like...
O que mais me agrada no C4 Model é a forma como detalhes vão sendo explicitados na medida em que...
Felicidade é uma coisa ótima. Tanto que, geralmente, nos sentimos plenos, inclusive, quando fazemos alguém feliz – não necessariamente a...
No meu cotidiano, reconheço que, por mais estranho que pareça, comprometo muito do meu tempo ouvindo música ruim até que,...
A publicação original desse post ocorreu em meu blog, em 2011, e gerou uma bela discussão. Infelizmente, essa publicação não...

Inscrição realizada com sucesso!

No dia da masterclass você receberá um e-mail com um link para acompanhar a aula ao vivo. Até lá!

A sua subscrição foi enviada com sucesso!

Aguarde, em breve entraremos em contato com você para lhe fornecer mais informações sobre como participar da mentoria.

Crie sua conta

Preencha os dados para iniciar o seu cadastro no plano anual do Clube de Estudos:

Crie sua conta

Preencha os dados para iniciar o seu cadastro no plano mensal do Clube de Estudos:

× Precisa de ajuda?