blob: 249750e2204358c575853b9a59aab74d4b69ac2c [file] [log] [blame]
Filip Pytloun4ab64a02015-10-06 16:28:32 +02001==========
2Keepalived
3==========
4
5Keepalived is a routing software written in C. The main goal of this project is to provide simple and robust facilities for loadbalancing and high-availability to Linux system and Linux based infrastructures. Loadbalancing framework relies on well-known and widely used Linux Virtual Server (IPVS) kernel module providing Layer4 loadbalancing. Keepalived implements a set of checkers to dynamically and adaptively maintain and manage loadbalanced server pool according their health. On the other hand high-availability is achieved by VRRP protocol. VRRP is a fundamental brick for router failover. In addition, Keepalived implements a set of hooks to the VRRP finite state machine providing low-level and high-speed protocol interactions. Keepalived frameworks can be used independently or all together to provide resilient infrastructures.
6
7
8Sample pillar
9=============
10
Ales Komarek733b0922016-01-05 16:27:21 +010011Simple virtual IP on an interface
12
Filip Pytloun4ab64a02015-10-06 16:28:32 +020013.. code-block:: yaml
14
15 keepalived:
16 cluster:
17 enabled: True
18 instance:
Ales Komarek733b0922016-01-05 16:27:21 +010019 VIP1:
Jakub Pavlik2680d652016-08-26 17:35:40 +020020 nopreempt: True
Filip Pytloun4ab64a02015-10-06 16:28:32 +020021 priority: 100 (highest priority must be on primary server, different for cluster members)
22 virtual_router_id: 51
23 password: pass
24 address: 192.168.10.1
25 interface: eth0
Ales Komarek733b0922016-01-05 16:27:21 +010026 VIP2:
Jakub Pavlik2680d652016-08-26 17:35:40 +020027 nopreempt: True
Filip Pytloun4ab64a02015-10-06 16:28:32 +020028 priority: 150 (highest priority must be on primary server, different for cluster members)
29 virtual_router_id: 52
30 password: pass
31 address: 10.0.0.5
32 interface: eth1
Ales Komarek733b0922016-01-05 16:27:21 +010033
34Multiple virtual IPs on single interface
35
36.. code-block:: yaml
37
38 keepalived:
39 cluster:
40 enabled: True
41 instance:
42 VIP1:
Jakub Pavlik2680d652016-08-26 17:35:40 +020043 nopreempt: True
44 priority: 100 (highest priority must be on primary server, different for cluster members)
45 virtual_router_id: 51
46 password: pass
47 addresses:
48 - 192.168.10.1
49 - 192.168.10.2
50 interface: eth0
51
52Disable nopreempt mode to have Master. Highest priority is taken in all cases.
53
54.. code-block:: yaml
55
56 keepalived:
57 cluster:
58 enabled: True
59 instance:
60 VIP1:
61 nopreempt: False
62 priority: 100 (highest priority must be on primary server, different for cluster members)
63 virtual_router_id: 51
64 password: pass
65 addresses:
66 - 192.168.10.1
67 - 192.168.10.2
68 interface: eth0
69
70Notify action in keepalived.
71
72.. code-block:: yaml
73
74 keepalived:
75 cluster:
76 enabled: True
77 instance:
78 VIP1:
79 nopreempt: True
Filip Pytloun424120b2016-08-26 19:31:42 +020080 notify_action:
81 master:
82 - /usr/bin/docker start jenkins
83 - /usr/bin/docker start gerrit
84 backup:
85 - /usr/bin/docker stop jenkins
86 - /usr/bin/docker stop gerrit
87 fault:
88 - /usr/bin/docker stop jenkins
89 - /usr/bin/docker stop gerrit
90 priority: 100 # highest priority must be on primary server, different for cluster members
Ales Komarek733b0922016-01-05 16:27:21 +010091 virtual_router_id: 51
92 password: pass
93 addresses:
94 - 192.168.10.1
95 - 192.168.10.2
96 interface: eth0
Filip Pytloun4ab64a02015-10-06 16:28:32 +020097
98Read more
99=========
100
101* https://raymii.org/s/tutorials/Keepalived-Simple-IP-failover-on-Ubuntu.html