Example

Figure 1.2 is an example of a simple SPARKSEEHA installation containing:

Figure 1.2: SPARKSEEHA example

Figure 1.2: SPARKSEEHA example

HAProxy

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 sparksee

backend sparksee
    server s1 192.168.1.3:8080
    server s2 192.168.1.5:8080

listen admin
    bind *:8080
    stats enable 

ZooKeeper

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.

SPARKSEEHA

The SPARKSEE configuration file for the first instance (the master) would look like this:

sparksee.ha=true
sparksee.ha.ip=192.168.1.3:7777
sparksee.ha.coordinators=192.168.1.2:2181
sparksee.ha.sync=600s
sparksee.ha.master.history=24H

And this would be the content for the file in the second instance (the slave):

sparksee.ha=true
sparksee.ha.ip=192.168.5.3:7777
sparksee.ha.coordinators=192.168.1.2:2181
sparksee.ha.sync=600s
sparksee.ha.master.history=24H

The only difference between these two files is the value of the sparksee.ha.ip variable.

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:

  1. Start the master server by starting first the server with the 192.168.1.3 IP address.
  2. Once the master has been started, start all the slave instances.
  3. Finally, start the HAProxy.

Likewise, to shut down the system it is highly recommended that the slaves are stopped first, followed by the master.

Back to Index