Figure 1.2 is an example of a simple DEXHA installation containing:
HAProxy is a free, fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. Check their documentation site for more details about the installation and configuration of this balancer.
The configuration file for the example would look like this:
global daemon maxconn 500 defaults mode http timeout connect 10000ms timeout client 50000ms timeout server 50000ms frontend http-in bind *:80 default_backend dex backend dex server s1 192.168.1.3:8080 server s2 192.168.1.5:8080 listen admin bind *:8080 stats enable
In this example, the
$ZOOKEEPER_HOME/conf/zoo.cfg configuration file for the ZooKeeper server would be:
tickTime=2000 dataDir=$ZOOKEEPER_HOME/var clientPort=2181 initLimit=10 syncLimit=5
Please note that, as it is running a single-node ZooKeeper cluster,
server.x variable is not necessary.
The DEX configuration file for the first instance (the master) would look like this:
dex.ha=true dex.ha.ip=192.168.1.3:7777 dex.ha.coordinators=192.168.1.2:2181 dex.ha.sync=600s dex.ha.master.history=24H
And this would be the content for the file in the second instance (the slave):
dex.ha=true dex.ha.ip=192.168.5.3:7777 dex.ha.coordinators=192.168.1.2:2181 dex.ha.sync=600s dex.ha.master.history=24H
The only difference between these two files is the value of the
As seen in the 'Architecture' chapter the role of the master is given to the first starting instance, so to make sure the instance master is that designated in the example, the order of the operations is as follows:
Likewise, to shut down the system it is highly recommended that the slaves are stopped first, followed by the master.