LinuxParty

NUESTRO SITIO necesita la publicidad para costear hosting y el dominio. Por favor considera deshabilitar tu AdBlock en nuestro sitio. También puedes hacernos una donación entrando en linuxparty.es, en la columna de la derecha.

Ratio: 5 / 5

Inicio activadoInicio activadoInicio activadoInicio activadoInicio activado
 

5 Prueba de la balanceadores de carga

Vamos a ver si los dos balanceadores de carga funcionan como se espera:

loadb1/loadb2:

ip addr eth0 SH

El equilibrador de carga activa debe incluir la dirección IP virtual (192.168.0.105):

2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:16:3e:40:18:e5 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.103/24 brd 192.168.0.255 scope global eth0
inet 192.168.0.105/24 brd 192.168.0.255 scope global secondary eth0

El hot-standby debe indicar lo siguiente:

 2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:16:3e:50:e3:3a brd ff:ff:ff:ff:ff:ff
inet 192.168.0.104/24 brd 192.168.0.255 scope global eth0

loadb1/loadb2:

ldirectord ldirectord.cf status

Salida en el equilibrador de carga activo:

ldirectord for /etc/ha.d/ldirectord.cf is running with pid: 1455

Salida en el hot-standby:

ldirectord is stopped for /etc/ha.d/ldirectord.cf

loadb1/loadb2:

ipvsadm -L -n

Salida en el equilibrador de carga activo:

IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.0.105:80 rr
-> 192.168.0.101:80 Route 0 0 0
-> 192.168.0.102:80 Route 0 0 0
-> 127.0.0.1:80 Local 1 0 0

Salida en el hot-standby:

IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn

loadb1/loadb2:

/etc/ha.d/resource.d/LVSSyncDaemonSwap master status

Salida en el equilibrador de carga activo:

master running
(ipvs_syncmaster pid: 1591)

Salida en el hot-standby:

master stopped

Si las pruebas ha ido bien, ahora puedes seguir y configurar los dos nodos de Apache.

 

6 Configure los dos nodos Apache

Por último, debemos configurar nuestro nodos Apache del clúster webserver1.example.com y webserver2.example.com para aceptar solicitudes en la dirección IP virtual 192.168.0.105.

webserver1/webserver2:

  apt-get install iproute 

Agregue lo siguiente a /etc/sysctl.conf:

webserver1/webserver2:

 vi /etc/sysctl.conf 
 # Enable configuration of arp_ignore option
net.ipv4.conf.all.arp_ignore = 1

# When an arp request is received on eth0, only respond if that address is
# configured on eth0. In particular, do not respond if the address is
# configured on lo
net.ipv4.conf.eth0.arp_ignore = 1

# Ditto for eth1, add for all ARPing interfaces
#net.ipv4.conf.eth1.arp_ignore = 1


# Enable configuration of arp_announce option
net.ipv4.conf.all.arp_announce = 2

# When making an ARP request sent through eth0 Always use an address that
# is configured on eth0 as the source address of the ARP request. If this
# is not set, and packets are being sent out eth0 for an address that is on
# lo, and an arp request is required, then the address on lo will be used.
# As the source IP address of arp requests is entered into the ARP cache on
# the destination, it has the effect of announcing this address. This is
# not desirable in this case as adresses on lo on the real-servers should
# be announced only by the linux-director.
net.ipv4.conf.eth0.arp_announce = 2

# Ditto for eth1, add for all ARPing interfaces
#net.ipv4.conf.eth1.arp_announce = 2

A continuación, ejecute lo siguiente:

webserver1/webserver2:

sysctl -p

Añade esta sección para la dirección IP virtual a  /etc/network/interfaces:

webserver1/webserver2:

vi /etc/network/interfaces
auto lo:0
iface lo:0 inet static
address 192.168.0.105
netmask 255.255.255.255
pre-up sysctl -p > /dev/null

A continuación, ejecute lo siguiente:

webserver1/webserver2:

ifup lo:0

Por último debemos crear el archivo ldirector.html. Este archivo es solicitado por los dos nodos del equilibrador de carga repetidamente para que puedan ver si los dos nodos Apache se está ejecutando. Supongo que la raíz de documentos del sitio web principal de apache en webserver1 y webserver2 es /var/www, por lo tanto, vamos a crear el archivo /var/www/ldirector.html:

webserver1/webserver2:

 vi /var/www/ldirector.html  
Test Page

 


[ <- Anterior ]          [ Siguiente ->]


 

Pin It

Escribir un comentario


Código de seguridad
Refescar



Redes:



 

Suscribete / Newsletter

Suscribete a nuestras Newsletter y periódicamente recibirás un resumen de las noticias publicadas.

Donar a LinuxParty

Probablemente te niegues, pero.. ¿Podrías ayudarnos con una donación?


Tutorial de Linux

Filtro por Categorías