User Tools

Site Tools


informatica:linux:keepalived

Differences

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

Link to this comparison view

Next revision
Previous revision
informatica:linux:keepalived [2021/06/03 11:26] – created javiinformatica:linux:keepalived [2021/06/03 12:08] (current) javi
Line 18: Line 18:
  
 En este ejemplo la IP flotante será '8.8.8.8'. En este ejemplo la IP flotante será '8.8.8.8'.
- 
-==== Master ==== 
  
 1. Crear archivo: 1. Crear archivo:
Line 61: Line 59:
 Comentarios: Comentarios:
  
 +  * State. Is MASTER for one and BACKUP for all other hosts, hence the virtual IP will initially be assigned to the MASTER.
 +  * Interface. Is the network interface taking part in the negotiation of the virtual IP, e.g. eth0.
 +  * Virtual_router_id. Should be the same for all keepalived cluster hosts while unique amongst all clusters in the same subnet. Many distros pre-configure its value to 51.
 +  * Priority. Should be higher on the control plane node than on the backups. Hence 101 and 100 respectively will suffice.
 +  * Auth_pass. Should be the same for all keepalived cluster hosts, e.g. 42
 +  * Virtual_ipaddress. Is the virtual IP address negotiated between the keepalived cluster hosts.
 +
 +2. Crear archivo:
 +
 +  sudo vim /etc/keepalived/check_apiserver.sh
 +
 +Con el siguiente contenido:
 +
 +<code>
 +#!/bin/sh
 +
 +errorExit() {
 +    echo "*** $*" 1>&2
 +    exit 1
 +}
 +
 +curl --silent --max-time 2 --insecure http://localhost/ -o /dev/null || errorExit "Error GET https://localhost/"
 +if ip addr | grep -q 8.8.8.8; then
 +    curl --silent --max-time 2 --insecure http://8.8.8.8/ -o /dev/null || errorExit "Error GET http://8.8.8.8/"
 +fi
 +</code>
 +
 +Reemplazar '8.8.8.8' por la IP flotante a usar.
 +
 +3. Dar permisos de ejecución:
 +
 +  sudo chmod +x /etc/keepalived/check_apiserver.sh
 +
 +4. Habilitar el servicio keepalived:
 +
 +  sudo systemctl enable keepalived --now
 +
 +5. Repetir los pasos 1 a 4 para el resto de nodos, ajustando los valores según los comentarios de cada paso
 +
 +6. Probar:
 +
 +6.1. Ejecutar:
 +
 +  wget http://8.8.8.8
 +  
 +Reemplazar '8.8.8.8' por la IP flotante a usar.  
 +
 +6.2. Apagar el nodo que tenga la IP flotante en ese momento
  
-    ${STATE} is MASTER for one and BACKUP for all other hosts, hence the virtual IP will initially be assigned to the MASTER. +6.3Repetir el paso 6.1.
-    ${INTERFACE} is the network interface taking part in the negotiation of the virtual IP, e.geth0. +
-    ${ROUTER_ID} should be the same for all keepalived cluster hosts while unique amongst all clusters in the same subnet. Many distros pre-configure its value to 51. +
-    ${PRIORITY} should be higher on the control plane node than on the backups. Hence 101 and 100 respectively will suffice. +
-    ${AUTH_PASS} should be the same for all keepalived cluster hosts, e.g. 42 +
-    ${APISERVER_VIP} is the virtual IP address negotiated between the keepalived cluster hosts.+
  
informatica/linux/keepalived.1622719617.txt.gz · Last modified: 2021/06/03 11:26 by javi