Configure Load Balancer Redundancy on Allied Telesis Routers and Switches
11
Configure the Triggers: Extra Commands
When the preferred server goes down or comes back up again, the load balancer needs to
change to the appropriate resource. This example uses triggers to make this change
automatically, by running a script when the server’s state changes.
This section describes the extra trigger commands you need to add on both load balancer 1
and load balancer 2. See
"Create New Scripts" on page 12
for instructions for making the
scripts.
As part of its
healthcheck
feature, the load balancer regularly sends pings to check the health
of each server. If the server does not respond, the load balancer changes the resource state
to Closing. If the server starts to respond to the pings again, the load balancer changes the
resource state to Up. The following triggers activate a script when one of these state changes
occurs.
Set the router to run the script
sftp1down.scp
if the first resource fails. This script enables
the second resource.
create trigger=4 module=loadbalancer event=resstate
resource=sftp1 lbstate=closing script=sftp1down.scp
Set the router to run the script
sftp1up.scp
if the first resource becomes available again.
This script disables the second resource.
create trigger=5 module=loadbalancer event=resstate
resource=sftp1 lbstate=up script=sftp1up.scp
Modify the Scripts
When the router is the master load balancer, it needs a rule to pass SFTP traffic through the
firewall. Similarly, this rule needs to be deleted when the router becomes the slave.
Add the following lines to the scripts on both load balancer 1 and load balancer 2. See
"Create the Scripts" on page 9
for the original scripts.
# Add an allow rule for SFTP traffic access over the SSHv2 port 22.
add firewall policy=lb rule=2 int=vlan2-1 action=allow protocol=tcp port=22
# Remove the SFTP access rule.
delete firewall policy=lb rule=2
!
master.scp
!
slave.scp