Clustering.

Usually in production environment, we have more than one server. With Armada you can simply join them together forming a cluster. This allows you to manage services on any ship from any ship within such cluster.

Joining ships.

Let's say we have two servers running Armada services: 192.168.3.10 and 192.168.3.11.


Host: 192.168.3.10
$ armada list
Name Address ID Status Tags armada 192.168.3.10:8900 ae148a2d3a1a passing - example-1 192.168.3.10:32868 e93f803bbea8 passing ['env:dev']

Host: 192.168.3.11
$ armada list
Name Address ID Status Tags armada 192.168.3.11:8900 27cc85f15888 passing - example-2 192.168.3.11:32422 efe0e1ab41e5 passing ['env:dev']

We can join them together with simple armada join command:

Host: 192.168.3.10
$ armada join 192.168.3.11
{u'status': u'ok'}
$ armada list
Name Address ID Status Tags armada 192.168.3.10:8900 ae148a2d3a1a passing - armada 192.168.3.11:8900 27cc85f15888 passing - example-1 192.168.3.10:32868 e93f803bbea8 passing ['env:dev'] example-2 192.168.3.11:32422 efe0e1ab41e5 passing ['env:dev']

armada info command displays core information about our cluster.

Host: 192.168.3.10
$ armada info
Ship name Ship role API address API status Version 192.168.3.11 leader 192.168.3.11:8900 passing 0.8.0 192.168.3.10 ship 192.168.3.10:8900 passing 0.7.3 WARNING: We cannot survive leader leaving/failure. Such configuration should only be used in development environments.

Notice that when forming a cluster, the ship that we joined to is marked as a leader. Another important thing is a displayed warning. We will cover it below.



We can now manage services on any ship. Let's try it out!!

Host: 192.168.3.10
$ armada stop example-2
Stopping service example-2... Service has been stopped.
$ armada run example -r example-clustering --ship 192.168.3.11 --env dev
Running microservice example-clustering (renamed from example) from dockyard: dockyard.armada.sh (alias: armada) on remote ship: 192.168.3.11... Service is running in container 054546732f69 available at addresses: 192.168.3.11:32769 (80/tcp)
$ armada list
Name Address ID Status Tags armada 192.168.3.10:8900 ae148a2d3a1a passing - armada 192.168.3.11:8900 27cc85f15888 passing - example-1 192.168.3.10:32868 e93f803bbea8 passing ['env:dev'] example-clustering 192.168.3.11:32769 054546732f69 passing ['env:dev']

Production environment.

Right now, our cluster has one leader, one ship and zero commanders. There can be only one leader and multiple commanders. In case of failure, they are responsible for making recovery decisions based on Raft Consensus. Because decisions are based on majority, we suggest having at least 2 commanders in addition to leader. To promote a ship to commander role run armada promote command.

Hints.

  • To remove a ship from cluster run armada shutdown followed by sudo service armada start
  • If you don't want to use IP addresses as ship names, you can run armada rename {new_name}. Renaming restarts a ship, so do it before joining into a cluster, or after you have formed recoverable cluster.