- Estréllate y Arde - https://www.estrellateyarde.org -
Clusters LVS + Keepalived en Linux
Otra opción para instalar un cluster HA (High Availability, alta disponibilidad), utilizados principalmente en granjas de servidores, es LVS junto con KeepAlived (keepalived.org) que se encarga de monitorizar los balanceadores de carga (mediante el protocolo VRRP, Virtual Router Redundancy Protocol) y los servidores reales (permite chequeos TCP_CHECK, HTTP_GET y SSL_GET), reemplazando así a HeartBeat y Ldirectord, las herramientas utilizadas en UltraMonkey.
Recursos
Veamos un ejemplo de un cluster HA utilizando LVS + Keepalived:
global_defs { notification_email { [email protected] } notification_email_from [email protected] smtp_server 127.0.0.1 smtp_connect_timeout 30 lvs_id LVS_EXAMPLE_01 }
virtual_server 192.168.6.240 80 { delay_loop 30 lb_algo wrr lb_kind NAT persistence_timeout 50 protocol TCP sorry_server 192.168.6.2 80 real_server 192.168.6.4 80 { weight 2 TCP_CHECK { connect_port 80 connect_timeout 3 } } real_server 192.168.6.5 80 { weight 1 TCP_CHECK { connect_port 80 connect_timeout 3 } } }
Si tenemos más IPs virtuales o servicios añadiremos otras secciones virtual_server: por ejemplo, en la misma IP virtual 192.168.6.240 un servidor de correo en el puerto 25:
virtual_server 192.168.6.240 25 { delay_loop 15 lb_algo wlc lb_kind NAT persistence_timeout 50 protocol TCP sorry_server 192.168.6.2 25 real_server 192.168.6.6 25 { weight 1 TCP_CHECK { connect_port 25 connect_timeout 3 } } real_server 192.168.6.7 25 { weight 2 TCP_CHECK { connect_port 25 connect_timeout 3 } } }
vrrp_instance VI_1 { state MASTER interface eth0 lvs_sync_daemon_inteface eth0 virtual_router_id 51 priority 150 advert_int 1 smtp_alert authentication { auth_type PASS auth_pass example } virtual_ipaddress { 192.168.6.240 } }
# /etc/init.d/keepalived start Starting Keepalived for LVS: [ OK ]
# ip addr sh eth0
# ipvsadm -L -n
# /etc/ha.d/resource.d/LVSSyncDaemonSwap master status
# /etc/init.d/apache stop
# /etc/init.d/keepalived stop
# /etc/init.d/heartbeat start
Article printed from Estréllate y Arde: https://www.estrellateyarde.org
URL to article: https://www.estrellateyarde.org/discover/cluster-lvs-keepalived-en-linux
Click here to print.
Copyright © 2010 Estrellate y Arde