User Tools

Site Tools


сервис_keepalived

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
сервис_keepalived [2022/08/19 13:20]
val [Настройка балансировки нагрузки]
сервис_keepalived [2024/02/26 17:11]
val [Настройка балансировки нагрузки]
Line 3: Line 3:
   * [[https://​winitpro.ru/​index.php/​2019/​09/​09/​keepalived-ha-balansirovka-plavayushhiy-ip-adres/​|Keepalived:​ настройка высокой доступности и плавающих IP адресов в CentOS 7]]   * [[https://​winitpro.ru/​index.php/​2019/​09/​09/​keepalived-ha-balansirovka-plavayushhiy-ip-adres/​|Keepalived:​ настройка высокой доступности и плавающих IP адресов в CentOS 7]]
   * [[https://​habr.com/​ru/​post/​524688/​|Отказоустойчивый кластер с балансировкой нагрузки с помощью keepalived]]   * [[https://​habr.com/​ru/​post/​524688/​|Отказоустойчивый кластер с балансировкой нагрузки с помощью keepalived]]
 +
  
 ===== Установка ==== ===== Установка ====
Line 11: Line 12:
  
 ===== Настройка VRRP ==== ===== Настройка VRRP ====
 +
 +  * Разобраться:​ как ведет себя в случае link down eth1/2
 +  * [[https://​github.com/​acassen/​keepalived/​blob/​master/​doc/​samples/​keepalived.conf.vrrp.routes]]
 +
 <​code>​ <​code>​
 nodeN# cat /​etc/​keepalived/​keepalived.conf nodeN# cat /​etc/​keepalived/​keepalived.conf
Line 28: Line 33:
 #        172.16.2.X/​24 dev eth2 #        172.16.2.X/​24 dev eth2
     }     }
 +#    virtual_routes {
 +#        0.0.0.0/0 via 172.16.1.254 dev eth1
 +#    }
     notify_backup "/​usr/​local/​bin/​vrrp.sh BACKUP"​     notify_backup "/​usr/​local/​bin/​vrrp.sh BACKUP"​
     notify_master "/​usr/​local/​bin/​vrrp.sh MASTER"​     notify_master "/​usr/​local/​bin/​vrrp.sh MASTER"​
Line 63: Line 71:
 gate# cat /​etc/​keepalived/​keepalived.conf gate# cat /​etc/​keepalived/​keepalived.conf
 </​code><​code>​ </​code><​code>​
 +# prod_nodes
 virtual_server 172.16.1.X 1194 { virtual_server 172.16.1.X 1194 {
-  delay_loop 1 
   protocol UDP   protocol UDP
-  lb_algo ​wrr # makes no difference +  lb_algo ​wlc 
-  lb_kind NAT # no difference too+  lb_kind NAT
   real_server 192.168.X.201 1194 {   real_server 192.168.X.201 1194 {
     weight 1     weight 1
     TCP_CHECK {     TCP_CHECK {
-        connect_timeout 3 
         connect_port 7505         connect_port 7505
     }     }
Line 78: Line 85:
     weight 1     weight 1
     TCP_CHECK {     TCP_CHECK {
-        connect_timeout 3 
         connect_port 7505         connect_port 7505
     }     }
   }   }
-#  real_server 192.168.X.203 1194 { 
-#    weight 1 
-#    TCP_CHECK { 
-#        connect_timeout 3 
-#        connect_port 7505 
-#    } 
-#  } 
 } }
  
- +# test_nodes 
-virtual_server 172.16.1.X ​80 { +virtual_server 172.16.1.X ​2194 
-  protocol TCP +  real_server 192.168.X.203 1194 
-  real_server 192.168.X.20N NNNNN {} +    ​TCP_CHECK ​{ 
-  ​real_server 192.168.X.20N NNNNN {} +        connect_port 7505 
-  ​real_server 192.168.X.20N NNNNN {}+    ​
 +  }
 } }
 +
 +
 +#​virtual_server 172.16.1.X 80 {
 +#  protocol TCP
 +#  lb_algo wlc
 +#  lb_kind NAT
 +
 +#  real_server 192.168.X.10 82 {}
 +#  real_server 192.168.X.10 8000 {}
 +
 +#  real_server 192.168.X.10 NNNNN {TCP_CHECK {}}
 +#  ...
 +
 +#  real_server 192.168.X.201 NNNNN {TCP_CHECK {}}
 +#  ...
 +#  real_server 192.168.X.203 NNNNN {TCP_CHECK {}}
 +#  ...
 +#  real_server 192.168.X.10 80 {}
 +#}
 </​code>​ </​code>​
  
Line 108: Line 127:
 # watch "​service keepalived status | cat" # watch "​service keepalived status | cat"
  
-# ipvsadm -L -n+watch ipvsadm -L -n 
 + 
 +# ipvsadm -L -n -c
 </​code>​ </​code>​
сервис_keepalived.txt · Last modified: 2024/04/09 11:27 by val