LDAP: couldn't connect to LDAP server
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
|
wiki:documentation:avance:keep [2020/05/26 17:18] sakher-b |
wiki:documentation:avance:keep [2020/05/26 17:36] (Version actuelle) sakher-b |
||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== Répartition de charge et haute disponibilité avec keepalived ====== | ||
| + | |||
| Nous allons voir comment mettre en place une répartition de charge et de la haute disponibilité entre 2 serveurs à l'aide de Keepalived. | Nous allons voir comment mettre en place une répartition de charge et de la haute disponibilité entre 2 serveurs à l'aide de Keepalived. | ||
| Dans cet exemple il s’agit de deux serveurs de partages Samba 4. | Dans cet exemple il s’agit de deux serveurs de partages Samba 4. | ||
| Ligne 13: | Ligne 15: | ||
| 2 VMs avec keepalived installé (VRRP/HA servers) | 2 VMs avec keepalived installé (VRRP/HA servers) | ||
| - | * 2 adresses IP : Une adresse IP dédiée | + | * 3 adresses IP : Une adresse IP dédiée |
| - | * 1 adresse IP dédiée | + | * 2 adresses IP dédiées |
| === 2 – Les serveurs réels === | === 2 – Les serveurs réels === | ||
| Ligne 120: | Ligne 122: | ||
| Voilà l’accès réseau au serveur est opérationnel. Il faudra répeter cette opération autant de fois qu'il y a de serveurs Keepalived. | Voilà l’accès réseau au serveur est opérationnel. Il faudra répeter cette opération autant de fois qu'il y a de serveurs Keepalived. | ||
| + | |||
| + | == 3.2 – La répartition de charge == | ||
| + | |||
| + | Pour la répartition de charge il faut installer keepalived et ipvsadm | ||
| + | |||
| + | <code bash> | ||
| + | # pacman -S --noconfirm keepalived ipvsadm | ||
| + | resolving dependencies... | ||
| + | looking for conflicting packages... | ||
| + | |||
| + | Packages (2) ipvsadm-1.31-1 keepalived-2.0.20-1 | ||
| + | |||
| + | Total Installed Size: 0.78 MiB | ||
| + | |||
| + | :: Proceed with installation? | ||
| + | (2/2) checking keys in keyring | ||
| + | (2/2) checking package integrity | ||
| + | (2/2) loading package files [######################################################################################## | ||
| + | (2/2) checking for file conflicts | ||
| + | (2/2) checking available disk space [######################################################################################## | ||
| + | :: Processing package changes... | ||
| + | (1/2) installing keepalived | ||
| + | Optional dependencies for keepalived | ||
| + | ipset: ipset support | ||
| + | (2/2) installing ipvsadm | ||
| + | :: Running post-transaction hooks... | ||
| + | (1/2) Reloading system manager configuration... | ||
| + | (2/2) Arming ConditionNeedsUpdate... | ||
| + | </ | ||
| + | |||
| + | Il faut ensuite configurer keepalived pour définir l’adresse IP virtuelle et paramétrer la répartition de charge. | ||
| + | |||
| + | Cette configuration s’effectue dans le fichier / | ||
| + | |||
| + | Sur le premier serveur Keepalived (MASTER) | ||
| + | |||
| + | <code bash> | ||
| + | global_defs { | ||
| + | notification_email { | ||
| + | | ||
| + | } | ||
| + | notification_email_from keepalived1@inspe.univ-nantes.fr | ||
| + | smtp_server 172.20.12.55 | ||
| + | router_id ha-smbqualif | ||
| + | lvs_flush | ||
| + | lvs_flush_onstop | ||
| + | } | ||
| + | |||
| + | vrrp_instance SMB { | ||
| + | virtual_router_id 20 | ||
| + | state MASTER | ||
| + | interface ens4 | ||
| + | priority 150 | ||
| + | advert_int 1 | ||
| + | track_interface { | ||
| + | ens3 | ||
| + | } | ||
| + | unicast_src_ip 192.168.66.23 | ||
| + | unicast_peer { | ||
| + | 192.168.66.24 | ||
| + | } | ||
| + | |||
| + | virtual_ipaddress { | ||
| + | 172.26.127.20/ | ||
| + | } | ||
| + | smtp_alert | ||
| + | |||
| + | garp_master_delay 2 | ||
| + | garp_master_repeat 2 | ||
| + | garp_master_refresh_repeat 1 | ||
| + | } | ||
| + | |||
| + | virtual_server 172.26.127.20 445 { | ||
| + | protocol TCP | ||
| + | lb_algo rr | ||
| + | lb_kind DR | ||
| + | |||
| + | real_server 172.26.127.21 445 { | ||
| + | weight 1 | ||
| + | TCP_CHECK { | ||
| + | connect_timeout 1 | ||
| + | connect_port | ||
| + | } | ||
| + | } | ||
| + | |||
| + | real_server 172.26.127.22 445 { | ||
| + | weight 1 | ||
| + | TCP_CHECK { | ||
| + | | ||
| + | connect_port 445 | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | virtual_server 172.26.127.20 139 { | ||
| + | protocol TCP | ||
| + | lb_algo rr | ||
| + | lb_kind DR | ||
| + | |||
| + | real_server 172.26.127.21 139 { | ||
| + | weight 1 | ||
| + | TCP_CHECK { | ||
| + | connect_timeout 1 | ||
| + | connect_port | ||
| + | } | ||
| + | } | ||
| + | |||
| + | real_server 172.26.127.22 139 { | ||
| + | weight 1 | ||
| + | TCP_CHECK { | ||
| + | connect_timeout 1 | ||
| + | connect_port | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Et sur le second serveur keepalived (BACKUP) | ||
| + | |||
| + | <code bash> | ||
| + | global_defs { | ||
| + | notification_email { | ||
| + | | ||
| + | } | ||
| + | notification_email_from keepalived2@inspe.univ-nantes.fr | ||
| + | smtp_server 172.20.12.55 | ||
| + | router_id ha-smbqualif | ||
| + | lvs_flush | ||
| + | lvs_flush_onstop | ||
| + | } | ||
| + | |||
| + | vrrp_instance SMB { | ||
| + | virtual_router_id 20 | ||
| + | state BACKUP | ||
| + | interface ens4 | ||
| + | priority 50 | ||
| + | advert_int 1 | ||
| + | track_interface { | ||
| + | ens3 | ||
| + | } | ||
| + | unicast_src_ip 192.168.66.24 | ||
| + | unicast_peer { | ||
| + | 192.168.66.23 | ||
| + | } | ||
| + | virtual_ipaddress { | ||
| + | 172.26.127.20/ | ||
| + | } | ||
| + | |||
| + | garp_master_delay 2 | ||
| + | garp_master_repeat 2 | ||
| + | garp_master_refresh_repeat 1 | ||
| + | } | ||
| + | |||
| + | virtual_server 172.26.127.20 445 { | ||
| + | protocol TCP | ||
| + | lb_algo rr | ||
| + | lb_kind DR | ||
| + | |||
| + | real_server 172.26.127.21 445 { | ||
| + | weight 1 | ||
| + | TCP_CHECK { | ||
| + | connect_timeout 1 | ||
| + | connect_port | ||
| + | } | ||
| + | } | ||
| + | |||
| + | real_server 172.26.127.22 445 { | ||
| + | weight 1 | ||
| + | TCP_CHECK { | ||
| + | | ||
| + | connect_port 445 | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | virtual_server 172.26.127.20 139 { | ||
| + | protocol TCP | ||
| + | lb_algo rr | ||
| + | lb_kind DR | ||
| + | |||
| + | real_server 172.26.127.21 139 { | ||
| + | weight 1 | ||
| + | TCP_CHECK { | ||
| + | connect_timeout 1 | ||
| + | connect_port | ||
| + | } | ||
| + | } | ||
| + | |||
| + | real_server 172.26.127.22 139 { | ||
| + | weight 1 | ||
| + | TCP_CHECK { | ||
| + | connect_timeout 1 | ||
| + | connect_port | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | On active keepalived au démarrage des serveurs : | ||
| + | <code bash> | ||
| + | # systemctl enable keepalived.service | ||
| + | Created symlink / | ||
| + | </ | ||
| + | |||
| + | Et on démarre keepalived sur les deux serveurs : | ||
| + | <code bash> | ||
| + | # systemctl start keepalived.service | ||
| + | </ | ||
| + | |||
| + | Si tout se passe bien l’adresse IP 172.66.127.20 doit être visible sur l’interface ens3 du keepalived MASTER. | ||
| + | |||
| + | <code bash> | ||
| + | # ip addr show dev ens3 | ||
| + | 2: ens3: < | ||
| + | link/ether 1a: | ||
| + | altname enp0s3 | ||
| + | inet 172.26.127.23/ | ||
| + | | ||
| + | inet 172.26.127.20/ | ||
| + | | ||
| + | inet6 fe80:: | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Et pour vérifier la répartition de charge : | ||
| + | |||
| + | <code bash> | ||
| + | # ipvsadm -Ln | ||
| + | IP Virtual Server version 1.2.1 (size=32768) | ||
| + | Prot LocalAddress: | ||
| + | -> RemoteAddress: | ||
| + | TCP 172.26.127.20: | ||
| + | -> 172.26.127.21: | ||
| + | -> 172.26.127.22: | ||
| + | TCP 172.26.127.20: | ||
| + | -> 172.26.127.21: | ||
| + | -> 172.26.127.22: | ||
| + | </ | ||
| + | |||
| + | Ici aucune connexion car cette documentation a été réalisée pendant le confinement COVID-19 ; | ||
| + | |||
| + | === 4 – Ressources documentaires === | ||
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||