Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Ipswitching in an Nginx can be done by Wackamole. Wackamole is an application that helps with making a cluster highly available. It manages a bunch of virtual IPs, that should be available to the outside world at all times. Wackamole ensures that a single machine within a cluster is listening on each virtual IP address that Wackamole manages. If it discovers that particular machines within the cluster are not alive, it will almost immediately ensure that other machines acquire these public IPs. At no time will more than one machine listen on any virtual IP. Wackamole also works toward achieving a balanced distribution of number IPs on the machine within the cluster it manages.

Wackamole operates on a cluster of tightly connected machines (all on the same LAN). It works by managing a pool of IP addresses that you expect to be available at all times. These IP addresses are virtual (meaning no machine has any of those IPs as its default IP address). Wackamole will work to ensure that all of the IP addresses in the pool are assigned as virtual IPs to the machines in the cluster. No IP address is held by more than one machine and every IP address is available.

Configure Spread

Now we need to tell Spread which machines are available inside the cluster. For this example, let’s use a simple two machine cluster (www1 and www2) available under the IP addresses 192.168.1.10 and 192.168.1.11

$ sudo vi /etc/default/spread

# Change to enable spread

ENABLED=1

# Options, see spread.1 for list

OPTIONS=”-n www1″ # www1 or www2 depending on the machine

$ sudo vi /etc/spread/spread.conf

Spread_Segment 192.168.3.255:4803 {

www1 192.168.3.140

www2 192.168.3.141

}

DebugFlags = { PRINT EXIT }

EventLogFile = /var/log/spread.log

EventTimeStamp

DangerousMonitor = false

DaemonUser = spread

DaemonGroup = spread

Once we’ve changed the configuration on one machine, we need to copy it over to the other machines and restart spread:

$ sudo /etc/init.d/spread restart

Configure Wackamole

The next step is to configure Wackamole on all machines. Like we did with Spread, we start by editing /etc/default/wackamole to make sure that Wackamole is enabled and that will run when the machine starts:

$ sudo vi /etc/default/wackamole

# Change to enable wackamole

ENABLED=1

# Options

OPTIONS=””

The next configuration file (/etc/wackamole.conf) is, luckily, very straight forward and a few changes to the default configurations are enough to get us on the right track.

Spread – Port where Spread is listening

SpreadRetryInterval – Amount of time between attempts to connect to Spread

Group – Spread group to join

Control – Location of Wackamole control socket

VirtualInterfaces – List of Virtual IP addresses that we want to make available

Arp-Cache – Collect and broadcast the IPs in our ARP table every N seconds

Notify – Define which machines to send ARP-spoofs when an IP is acquired

balance – Describes how to balance the IP addresses across the available machines

mature – Amount of time for an instance to join a group and be ready to assume virtual IPs

$ sudo vi /etc/wackamole.conf

Spread = 4803

SpreadRetryInterval = 5s

Group = www

Control = /var/run/wackamole/wackamole.it

VirtualInterfaces {

{ eth4:192.168.3.145/24 }

}

Arp-Cache = 90s

Notify {

eth4:192.168.1.1/32

arp-cache

}

balance {

AcquisitionsPerRound = all

interval = 4s

}

mature = 5s


Shares
Contact Us On WhatsApp