###### tags: `linux` `cluster` `keepalived` # keepalived ile HA (shared ip) ... VRRP : virtual router redundancy protocol - Her iki sunucuda ```bash= sudo apt update && sudo apt install -y keepalived systemctl enable --now keepalived ``` ## vagrantfile ```yaml= Vagrant.configure(2) do |config1| config1.vm.box = "generic/ubuntu1804" config1.vm.define :server1 do |a1| a1.vm.hostname = "server1" a1.vm.network :private_network, ip: "10.10.10.251" a1.vm.provider :virtualbox do |vb| vb.name = "server1" vb.customize ["modifyvm", :id, "--groups", "/keepalive"] vb.memory = "4096" vb.gui = false vb.cpus = 4 end end config1.vm.box = "generic/ubuntu1804" config1.vm.define :server2 do |a1| a1.vm.hostname = "server2" a1.vm.network :private_network, ip: "10.10.10.252" a1.vm.provider :virtualbox do |vb| vb.name = "server2" vb.customize ["modifyvm", :id, "--groups", "/keepalive"] vb.memory = "4096" vb.gui = false vb.cpus = 4 end end end ``` ## server1 - /etc/keepalived/keepalived.conf ```conf= vrrp_instance VI_1 { state MASTER interface eth1 virtual_router_id 51 priority 255 advert_int 1 authentication { auth_type PASS auth_pass 12345 } virtual_ipaddress { 10.10.10.70/24 } } ``` ## server2 - /etc/keepalived/keepalived.conf ```conf= vrrp_instance VI_1 { state BACKUP interface eth1 virtual_router_id 51 priority 254 advert_int 1 authentication { auth_type PASS auth_pass 12345 } virtual_ipaddress { 10.10.10.70/24 } } ``` - vrrp_instance çalışan instance a bir isim veriyoruz. - virtual_router_id unique bir id, biz seçiyoruz. - Priority : master iin 255, backup için 254 ve altı olması gerekiyor ama en yüksek olanı otomatik seçiyor. yani master a 255 vermesek de oluyor. - advert_int : advertise interval ne kadar sık heartbeat yapacaklar. - virtual_ipaddress : paylaşılan ip adresi, <mark> birden fazla olabilir. </mark> - keepalived HA yapabiliği gibi <mark>load balancing</mark> de yapabiliyor. Load-balancing için <mark>IPVS</mark> kullanıyor.
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up