Allied Telesis Routers and Switches Configure the Triggers Extra Commands, Modify the Scripts

Page 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.

!master.scp

#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

!slave.scp

#Remove the SFTP access rule.

delete firewall policy=lb rule=2

Configure Load Balancer Redundancy on Allied Telesis Routers and Switches

11

Image 11
Contents Examples IntroductionWhich products and software version does it apply to? What information will you find in this document?Example of Basic Redundancy Configure Load BalancerDisable the GUI and the Http server on port Configure the firewallConfigure load balancing Configure VrrpSave the configuration Configure triggersSet system name=LB-2 Either Create the Scripts Script for when a load balancer becomes the slave slave.scpExtension Controlling Server Selection Configure Load Balancing Extra CommandsSlave.scp Configure the Triggers Extra CommandsModify the Scripts Master.scpCreate New Scripts Script for when the preferred server goes down sftp1down.scpCommands Load Balancer Configuration SummaryCommands Load Balancer File sftp1up.scp File master.scpFile slave.scp File sftp1down.scp