informatica:linux:keepalived
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
informatica:linux:keepalived [2021/06/03 11:26] – created javi | informatica:linux:keepalived [2021/06/03 12:08] (current) – javi | ||
---|---|---|---|
Line 18: | Line 18: | ||
En este ejemplo la IP flotante será ' | En este ejemplo la IP flotante será ' | ||
- | |||
- | ==== 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 / | ||
+ | |||
+ | Con el siguiente contenido: | ||
+ | |||
+ | < | ||
+ | #!/bin/sh | ||
+ | |||
+ | errorExit() { | ||
+ | echo "*** $*" 1>&2 | ||
+ | exit 1 | ||
+ | } | ||
+ | |||
+ | curl --silent --max-time 2 --insecure http:// | ||
+ | if ip addr | grep -q 8.8.8.8; then | ||
+ | curl --silent --max-time 2 --insecure http:// | ||
+ | fi | ||
+ | </ | ||
+ | |||
+ | Reemplazar ' | ||
+ | |||
+ | 3. Dar permisos de ejecución: | ||
+ | |||
+ | sudo chmod +x / | ||
+ | |||
+ | 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:// | ||
+ | | ||
+ | Reemplazar ' | ||
+ | |||
+ | 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.3. Repetir el paso 6.1. |
- | ${INTERFACE} is the network interface taking part in the negotiation of the virtual IP, e.g. eth0. | + | |
- | ${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