EventStore on Azure and Ubuntu - it's a piece of cake! #3

In the last but one post of this series we'll try to run a simple cluster of 3 nodes running EventStore instances. What is worth noting here is the fact, that there're three ways to organize and configure instances, so they work with each other:

  • running them on the same machine
  • running them on separate machines using IPs
  • running them on separate machines using DNS

Because the first one is almost self-describing(you have to start three instances on different ports), we'll omit it here and focus on the more complicated examples.

Running on separate machines

We'll start with creating 2 additional machines for our purposes. Just create two additional VM instances in the resource group you're using just like in the very first post of this series and we're good to go. Make sure that you're creating them in the same virtual network, which was created for the first virtual machine.

Once VMs are created, log in to each one and install EventStore instances as described in the previous posts.

Now we have to configure our instances so they're aware of other nodes. Basically what you have to do here is to change configuration on each node so it knows cluster size and other communication partners. Your eventstore.conf file could look like this:

/
---
RunProjections: None
ClusterSize: 3
GossipSeed: 10.0.3.6:2112,10.0.3.5:2112
DiscoverViaDns: False
ExtIp: 10.0.3.4
IntIp: 10.0.3.4

The important thing here is the GossipSeed property, which points to other cluster nodes. I'm using here private IPs so my instances are still secured inside the network. The important thing here is that ES uses internal HTTP port for gossiping so make sure you're using the right value - if anything's wrong, election service won't be able to other machines and you'll see DEAD as other nodes status.

Configure all three nodes with proper gossip seeds and IPs by modifying each one's configuration file. Once you're done, go to the web panel of ES and sign in as admin.

Checking cluster status

If you sign in to the web panel, you'll see Cluster status menu item:

It will show all nodes attached, current state(which one is a master) and many, many more. I strongly recommend you to play a bit with it.

We've managed to create a cluster of 3 different machines running EventStore using VMs from Azure. In the last part of this series we'll try to use DNS instead to ease configuration a bit if anything changes.

EventStore on Azure and Ubuntu - it's a piece of cake! #2

In the previous post we installed and started an EventStore instance. To be honest it's possible to work with it from this point with no problem. However, there're things, which I'd like to focus on a bit more. 

EventStore structure and configuration

How EventStore is structured on Linux differs somehow when compared with the Windows version. Default directories for it can be found here and I strongly recommend to read so there's no confusion. Important thing is the configuration file stored in /etc/eventstore/ and being read-only. If you'd like to edit it(e.g. to change external IP used by ES), here's the easiest way to do it using vi:

/
kamz@Ubuntu-EventStore:/$ cd etc/eventstore
kamz@Ubuntu-EventStore:/etc/eventstore$ sudo vi eventstore.conf

To edit a file simple press i. Once you're done with your changes, press Escape and :wq to save them and exit. The reason we're using sudo here is to force changes on this locked file. More detailed instruction how to use vi can be found here.

Accessing ES locally

Well, we have EventStore configured and running. What if we'd like to access it via browser. Going to your_vm_ip:2113 is not working just out of the box. Honestly, there're two possible ways:

  • port tunneling
  • using RDP

Both are quite easy to get and configure.

Using port tunneling

For the purpose of port tunneling I'm using PuTTY. The instruction is pretty simple - tunnel target :2113 port to the local port of your choice. How to do it is described here and here. Once you're done, simply go to e.g. 127.0.0.1:2113 in your browser. It should connect to the VM and open EventStore screen.

Using RDP

If you don't want to allow external access to your EventStore instance you can use RDP and manage it from within your virtual machine. If you prefer this way, make sure you are familiar with this instruction how to connect from Windows to Ubuntu using xRDP. One additional thing is needed here - since a VM in Azure is defended by network security group, which denies whole traffic, we have to allow inbound access using RDP. Here's what you have to do:

  • Go to your resource group and find Network security group resource related to your VM
  • Go to Inbound security rules
  • Add a new security rule using port TCP 3389
  • Save a new configuration

Now go to your RDP client and pass public IP of your Ubuntu VM. You should be able to see xRDP screen. Just use credentials you're using to connect to the VM and that's all - you've accessed Ubuntu's desktop. Open a browser window and go to 127.0.0.1:2113. Now you can log in and manage EventStore as you wish.

In the next post we'll try to create and connect ES cluster using multiple Ubuntu machines.