User Tools

Site Tools


informatica:linux:heartbeat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
informatica:linux:heartbeat [2012/06/26 14:44] – creado javiinformatica:linux:heartbeat [2015/04/13 20:19] (current) – external edit 127.0.0.1
Line 8: Line 8:
  
   sudo aptitude install heartbeat   sudo aptitude install heartbeat
 +
 +Requisitos:
 +
 +  * Los dos nodos se comunican mediante trafico multicast, por lo que la red/cortafuegos... lo tiene que permitir
 +
 +
  
 ===== Configuracion ===== ===== Configuracion =====
Line 13: Line 19:
 Escenario: Escenario:
  
 +^ Nombre ^ Direccion IP ^ Interfaz de red ^ Descripcion ^
 +| balancer.dev.jj.com | 10.0.0.200 | -- | IP virtual. La comparten los dos nodos de heartbeat |
 +| balancer-1.dev.jj.com | 10.0.0.15 | eth2 | Nodo maestro de heartbeat |
 +| balancer-2.dev.jj.com | 10.0.0.17 | eth3 | Nodo maestro de heartbeat |
 +
 +----
 +\\
 +/etc/ha.d/authkeys
 +
 +<code>
 +auth 2
 +2 sha1 jj.com
 +</code>
 +
 +| jj.com | Contrasenya. El archivo tiene que ser de root y con 0600 |
 +
 +----
 +\\
 +/etc/ha.d/ha.cf
 +
 +<code>
 +debugfile /var/log/ha-debug
 +
 +logfile /var/log/ha-log
 +
 +logfacility local0
 +
 +keepalive 2
 +
 +deadtime 30
 +
 +warntime 10
 +
 +initdead 120
 +
 +udpport 694
 +
 +bcast eth2 # Linux
 +
 +mcast eth2 225.0.0.1 694 1 0
 +
 +ucast eth2 10.0.0.15
 +
 +auto_failback off
 +
 +node balancer-1.dev.jj.com
 +node balancer-2.dev.jj.com
 +</code>
 +
 +| eth2 | NIC of the node. In this case belongs to balancer-1.dev.jj.com |
 +| 225.0.0.1 | Multicast address. Should be the same on both nodes |
 +| 10.0.0.15 | IP address of the node. In this case belongs to balancer-1.dev.jj.com |
 +| node balancer-1.dev.jj.com\\ node balancer-2.dev.jj.com | Nodes name. Should be the same on both nodes. If no DNS entry have them added to /etc/hosts |
 +| auto_failback off | Prefiero hacer un sanity check antes de volver a poner como activo el nodo que fallo |
 +
 +----
 +\\
 +/etc/ha.d/haresources
 +
 +<code>
 +balancer-1.dev.jj.com 10.0.0.200 haproxy
 +</code>
 +
 +| balancer-1.dev.jj.com | Nombre del nodo maestro. Tiene que ser el mismo en los dos nodos |
 +| 10.0.0.200 | Direccion IP virtual que comparten los dos nodos. Tiene que ser el mismo en los dos nodos |
 +| haproxy | Opcional. Servicio que para y arranca cuando se para/arranca heartbeat. Tiene que tener un script de arranque/parada estandar en /etc/init.d |
 +
 +
 +
 +
 +
 +
 +===== Servicio =====
 +
 +  sudo /etc/init.d/heartbeat restart
 +
 +Nodo **ACTIVO** (especificar tarjeta de red adecuada):
 +
 +   sudo ip addr sh eth2
 +
 +<code>
 +2: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
 +    link/ether 00:16:36:93:ad:cf brd ff:ff:ff:ff:ff:ff
 +    inet 10.0.0.15/24 brd 10.0.0.255 scope global eth2
 +    inet 10.0.0.200/24 brd 10.0.0.255 scope global secondary eth2:0
 +    inet6 fe80::216:36ff:fe93:adcf/64 scope link 
 +       valid_lft forever preferred_lft forever
 +</code>
 +
 +Existe la linea con la IP compartida:
 +
 +  inet 10.0.0.200/24 brd 10.0.0.255 scope global secondary eth2:0
 +
 +Nodo **FAILOVER** (especificar tarjeta de red adecuada):
 +
 +   sudo ip addr sh eth3
 +
 +<code>
 +2: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
 +    link/ether 00:16:36:8c:f1:09 brd ff:ff:ff:ff:ff:ff
 +    inet 10.0.0.17/24 brd 10.0.0.255 scope global eth3
 +    inet6 fe80::216:36ff:fe8c:f109/64 scope link 
 +       valid_lft forever preferred_lft forever
 +</code>
 +
 +Comprobar:
 +
 +1. (Desde cliente) Hacer un ping a la IP compartida:
 +
 +  ping 10.0.0.200
 +
 +2. (En el nodo maestro) Parar el servicio heartbeat:
  
 +  ssh balancer-1.dev.jj.com
 +  sudo /etc/init.d/heartbeat stop
 +  ps ax | grep heartbeat
  
 +Los pings no deberian parar
informatica/linux/heartbeat.1340721875.txt.gz · Last modified: 2015/04/13 20:19 (external edit)