Piranha
Piranha
Piranha
Servers (LVS) for balancing IP load across a set of real servers. The Load Balancer Add-On runs on an active LVS router as well as a backup LVS router. The active LVS router serves two roles: To balance the load across the real servers. To check the integrity of the services on each real server. The backup LVS router monitors the active LVS router and takes over from it in case the active LVS router fails. Main configuration file is /etc/sysconfig/ha/lvs.cf . To view log messages type tail -f /var/log/messages at command prompt. The LVS cluster software is released in three RPM packages: piranha (programs) piranha-gui (graphical configuration tool) piranha-docs (documentation) On the LVS router, there are three services which need to be set to activate at boot time: The piranha-gui service The pulse service The sshd service Remember Load Balancer Add- on is not compatible with the NetworkManager service. Also during configuration, you select the tool (uptime, ruptime, or rup) that the active router will use to monitor the workload on the real servers. Enable the selected tool on the real servers. If this cannot be done (for example, one of your real servers is a Windows/NT Web server), the cluster will still provide highly available services. However, the Weighted round robin and Weighted least-connections algorithms will be affected. Namely, since load information will not be available, the user-assigned weights will be applied statically rather than dynamically adjusted based on server workload. ruptime Set up each LVS router and real server to start rwhod whenever it boots. or rup Set up each real server to start rpc.rstatd whenever it boots. Before using the Piranha Configuration Tool for the first time on the primary LVS router, you must restrict access to it by creating a password. To do this, login as root and issue the following command: /usr/sbin/piranha-passwd After entering this command, create the administrative password when prompted. After you have set the password for the Piranha Configuration Tool, start or restart the piranha- gui /sbin/service piranha-gui start The Apache HTTP Server must be installed on the system. The piranha-gui service is all that is necessary to begin configuring Load Balancer Add-On. However, if you are configuring Load Balancer Add-On remotely, the sshd service is also required. You do not need to start the pulse service until configuration using the Piranha Configuration Tool is complete. The Piranha Configuration Tool runs on port 3636 by default. To use the Piranha Configuration Tool open the location http://localhost:3636. Enter piranha in the Username field and the password set with piranha- passwd in the Password field. In order for the LVS router to forward network packets properly to the real servers, each LVS router node must have IP forwarding turned on in the kernel. Log in as root and change the line which reads net.ipv4.ip_forward = 0 in /etc/sysctl.conf to the following: net.ipv4.ip_forward = 1 .
This section describes step by step how to create a cluster of two LVS routers and two Webservers. First, collect information and set up the four systems as explained in the next section. Locate 4 servers and designate their roles: 1 primary LVS router, 1 backup LVS router, 2 real servers. The LVS routers must be Linux boxes running Red Hat 6.1 or later. The real servers may be any platform running any operating system and Web server. On each LVS router, install two ethernet adapter cards, eth0 and eth1. Create a public IP interface on eth0 and a private IP interface on eth1. The public interface device (eth0) is the heartbeat device. The virtual server address is aliased to this device. Primary LVS Router DEVICE="eth0" BOOTPROTO="static" ONBOOT="yes" IPADDR="203.124.96.5" NETMASK="255.255.255.0" GATEWAY="203.124.96.1" DEVICE="eth1" BOOTPROTO="static" ONBOOT="yes" IPADDR="192.168.3.5" NETMASK="255.255.255.0" Backup LVS Router DEVICE="eth0" BOOTPROTO="static" ONBOOT="yes" IPADDR="203.124.96.8" NETMASK="255.255.255.0" GATEWAY="203.124.96.1" DEVICE="eth1" BOOTPROTO="static" ONBOOT="yes" IPADDR="192.168.3.8" NETMASK="255.255.255.0"
Designate an IP address (192.168.3.254) for the router device (eth1) connecting the active LVS router to the private network. This floating IP address will be aliased to the router device as eth1:1, and will be the gateway to the private network and the default route used by each real server to communicate with the active router. On each real server, install an ethernet network card, eth0, create an IP address on the same private subnet, and assign a weight to each server indicating its processing capacity relative to that of the others. In this example, rs1 has twice the capacity (two processors) of rs2. Real Server 1 (rs1) DEVICE=eth1 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.3.10 NETMASK=255.255.255.0 GATEWAY=192.168.3.254 Real Server 2 (rs2) DEVICE="eth1" ONBOOT="yes" BOOTPROTO="static" IPADDR="192.168.3.11" NETMASK="255.255.255.0" GATEWAY="192.168.3.254"
Decide which program (uptime, ruptime, rup) will be used by the active router to monitor the workload on the real servers. If you choose uptime, each LVS router must be able to connect with each real server without administrator intervention, using the tool family you selected. Verify that each real server runs an installed and configured httpd server. Note that the real servers must listen on the same port (80 in the example) as the corresponding virtual server. Verify (for example, using telnet or ping) that each real server can reach hosts on the public LAN. If a real server on the private network cannot reach a host on your LAN, this probably indicates a communication failure between the server and the active router Now we are ready to implement the example. Or you can use the GUI configuration tool Piranha.
Open /etc/sysconfig/ha/lvs.cf and set the values shown below : serial_no = 104 primary = 203.124.96.5 service = lvs backup_active = 1 backup = 203.124.96.8 heartbeat = 1 heartbeat_port = 539 keepalive = 6 deadtime = 18 network = nat nat_router = 192.168.3.254 eth1:1 nat_nmask = 255.255.255.0 debug_level = NONE monitor_links = 1 syncdaemon = 0 virtual vs1 { active = 1 address = 203.124.96.4 eth0:1 port = 8080 send = "GET / HTTP/1.0\r\n\r\n" expect = "HTTP" use_regex = 0 load_monitor = ruptime scheduler = wlc protocol = tcp timeout = 6 reentry = 15 quiesce_server = 0 server rs1 { address = 192.168.3.10 active = 1 weight = 1 } server rs2 { address = 192.168.3.11 active = 1 weight = 1 } } When configuring the Load Balancer Add-On, you should always begin by configuring the primary router with the Piranha Configuration Tool. If you are accessing the machine locally, you can open http://localhost:3636 in a Web browser to access the Piranha Configuration Tool. Otherwise, type in the hostname or real IP address for the server followed by : 3636. Once the browser connects, you will see the screen shown below :