LVS Load Balancer Extension
Follow the steps given below to set up the LVS load balancer and extend it:
Spawning the instances with the dummy IP interface
Follow the steps given below to spawn the instance:
Define the virtual IP and the subnet mask under the subscribable information property in the Application cartridge JSON file, if the cartridge needs to use LVS.
For more information on the cartridge resource definition, see Cartridge Resource Definition.
Example:
Identify the virtual IP and the subnet mask from the lvsVirtualIP:192.168.30.30|255.255.255.0.- The virtual IP also known as the access IP of the load balancer, is 192.168.30.30.
- The subnet mask of the network is 255.255.255.0.
- The virtual IP and the subnet mask is passed to the payload of the spawned instance.
- The Cartridge agent receives the information from the payload and creates a dummy interface in the instance.
- Once the instances are spawned,  you need to run the LVS extension on both the master and backup LVS servers as mentioned in configuring and starting the LVS load balancer.
Configuring and starting the LVS load balancer
The Apache Stratos LVS Extension is used to integrate the LVS load balancer with Apache Stratos. Follow the steps given below to proceed with the installation:
Install Keepalived and IPVSADM.
apt-get install keepalived ipvsadm
Download  and extract the
org.apache.stratos.lvs.extension-4.1.x.zip
file, from the stratos distribution by selecting the preferred version, to a desired location such as<LVS-EXTENSION-HOME>
.
ÂUpdate the following system properties found in the
l
vs-extension.sh
file, which is in theÂ<LVS-EXTENSION-HOME>/bin
directory.ÂIt is required that you set-up two LVS servers. One server will be used to pass the
server.state
to the LVS Master, while the other will be used as a backup.# Keepalived configuration file location: -Dconf.file.path=/etc/keepalived/keepalived.conf # Enable/disable cep statistics publisher: -Dcep.stats.publisher.enabled=false # If cep statistics publisher is enabled define the following properties: -Dthrift.receiver.ip=127.0.0.1 -Dthrift.receiver.port=7615 -Dnetwork.partition.id=network-partition-1 # LVS server Virtual IP set for services -Dlvs.service.virtualip.set=tomcat2|192.168.56.40,tomcat1|192.168.56.41,tomcat|192.168.56.40 # Server state (MASTER|BACKUP) -Dserver.state=MASTER
Update the fields under message broker in the
jndi.properties
file, which is in theÂ<LVS-EXTENSION-HOME>/conf
file.java.naming.provider.url=tcp://<STRATOS_HOST>:<STRATOS_HTTPS_PORT>
- By default,Â
<STRATOS_HOST>
 isÂlocalhost.
 However, if you are using a public IP, the respective IP address or domain needs to be specified. - By default,Â
<STRATOS_HTTPS_PORT>
 has been set to 9443. However, if the port offset has been incremented byÂn
, the default port value needs to be incremented byÂn
.
- By default,Â
Navigate to theÂ
<lvs-extension-home>/bin
directory and start the LVS load balancer.ÂOnly a user having the super tenant user permissions, can excuse the following command.
./lvs-extension.sh
The following sample information will be displayed in the console having the LVS extension.
[2015-05-27 18:31:06,693] INFO - [LoadBalancerCommonTopologyEventReceiver] Load balancer topology receiver thread started [2015-05-27 18:31:06,693] INFO - [LoadBalancerExtension] Topology receiver thread started [2015-05-27 18:31:06,693] INFO - [TopologyEventMessageDelegator] Topology event message delegator started [2015-05-27 18:31:06,706] INFO - [LoadBalancerExtension] Application signup event receiver thread started [2015-05-27 18:31:06,706] INFO - [ApplicationSignUpEventMessageDelegator] Application signup event message delegator started [2015-05-27 18:31:06,714] INFO - [LoadBalancerExtension] Domain mapping event receiver thread started [2015-05-27 18:31:06,714] WARN - [LoadBalancerExtension] Load balancer statistics reader not found [2015-05-27 18:31:06,715] INFO - [DomainMappingEventMessageDelegator] Domain mapping event message delegator started [2015-05-27 18:31:06,715] INFO - [LoadBalancerExtension] Waiting for complete topology event... [2015-05-27 18:31:34,912] INFO - [CompleteTopologyMessageProcessor] Topology initialized [2015-05-27 18:31:34,913] INFO - [TopologyProvider] Service added: [service] php [2015-05-27 18:31:34,914] INFO - [TopologyProvider] Cluster added to service: [service] php [cluster] single-cartridge-app.my-php.php.domain [hostnames] [single-cartridge-app.my-php.php.stratos.org] [2015-05-27 18:31:34,914] INFO - [TopologyProvider] Member added to cluster: [cluster] single-cartridge-app.my-php.php.domain [member] 10.0.0.5 [2015-05-27 18:31:34,914] INFO - [TopologyProvider] Member added to cluster: [cluster] single-cartridge-app.my-php.php.domain [member] 10.0.0.4 [2015-05-27 18:31:34,915] INFO - [TopologyProvider] Member added to cluster: [cluster] single-cartridge-app.my-php.php.domain [member] 10.0.0.3 [2015-05-27 18:31:34,915] INFO - [TopologyProvider] Member added to cluster: [cluster] single-cartridge-app.my-php.php.domain [member] 10.0.0.6 [2015-05-27 18:31:34,915] INFO - [LVS] Generating lvs configuration... [2015-05-27 18:31:34,992] INFO - [Main] Configuration written to file: /etc/keepalived/keepalived.conf [2015-05-27 18:31:34,992] INFO - [LVS] Starting lvs instance... [2015-05-27 18:31:36,008] INFO - [LVS] lvs instance started