informatica:linux:heartbeat
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
informatica:linux:heartbeat [2012/06/26 14:44] – creado javi | informatica: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/ | ||
+ | |||
+ | |||
===== 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 | | ||
+ | |||
+ | ---- | ||
+ | \\ | ||
+ | / | ||
+ | |||
+ | < | ||
+ | auth 2 | ||
+ | 2 sha1 jj.com | ||
+ | </ | ||
+ | |||
+ | | jj.com | Contrasenya. El archivo tiene que ser de root y con 0600 | | ||
+ | |||
+ | ---- | ||
+ | \\ | ||
+ | / | ||
+ | |||
+ | < | ||
+ | debugfile / | ||
+ | |||
+ | logfile / | ||
+ | |||
+ | logfacility local0 | ||
+ | |||
+ | keepalive 2 | ||
+ | |||
+ | deadtime 30 | ||
+ | |||
+ | warntime 10 | ||
+ | |||
+ | initdead 120 | ||
+ | |||
+ | udpport 694 | ||
+ | |||
+ | bcast eth2 # | ||
+ | |||
+ | 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 | ||
+ | </ | ||
+ | |||
+ | | 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 | | ||
+ | |||
+ | ---- | ||
+ | \\ | ||
+ | / | ||
+ | |||
+ | < | ||
+ | balancer-1.dev.jj.com 10.0.0.200 haproxy | ||
+ | </ | ||
+ | |||
+ | | 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/ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Servicio ===== | ||
+ | |||
+ | sudo / | ||
+ | |||
+ | Nodo **ACTIVO** (especificar tarjeta de red adecuada): | ||
+ | |||
+ | sudo ip addr sh eth2 | ||
+ | |||
+ | < | ||
+ | 2: eth2: < | ||
+ | link/ether 00: | ||
+ | inet 10.0.0.15/ | ||
+ | inet 10.0.0.200/ | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Existe la linea con la IP compartida: | ||
+ | |||
+ | inet 10.0.0.200/ | ||
+ | |||
+ | Nodo **FAILOVER** (especificar tarjeta de red adecuada): | ||
+ | |||
+ | sudo ip addr sh eth3 | ||
+ | |||
+ | < | ||
+ | 2: eth3: < | ||
+ | link/ether 00: | ||
+ | inet 10.0.0.17/ | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | </ | ||
+ | |||
+ | 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 / | ||
+ | ps ax | grep heartbeat | ||
+ | Los pings no deberian parar |
informatica/linux/heartbeat.txt · Last modified: 2015/04/13 20:19 by 127.0.0.1