우분투 keepalived 설치

Jmnote (토론 | 기여)님의 2016년 4월 19일 (화) 16:46 판 (→‎같이 보기)
우분투 keepalived 설치

1 패키지 설치

apt-get install keepalived

2 설정 파일 작성

vim /etc/keepalived/keepalived.conf
  • 서버 1
vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 50
    priority 100
    advert_int 1
    nopreempt
    authentication {
        auth_type PASS
        auth_pass $ place secure password here.
    }
    virtual_ipaddress {
        10.10.0.20
    }
}
  • 서버 2
vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 50
    priority 99
    advert_int 1
    nopreempt
    authentication {
        auth_type PASS
        auth_pass $ place secure password here.
    }
    virtual_ipaddress {
        10.10.0.20
    }
}
  • 서버 3
vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 50
    priority 98
    advert_int 1
    nopreempt
    authentication {
        auth_type PASS
        auth_pass $ place secure password here.
    }
    virtual_ipaddress {
        10.10.0.20
    }
}

3 서비스 시작

root@server1:~# /etc/init.d/keepalived start
 * Starting keepalived keepalived                                                   [ OK ]

4 확인 2

root@server1:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:46:d8:13:57:9f brd ff:ff:ff:ff:ff:ff
    inet 10.10.0.11/23 brd 10.10.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 10.10.0.20/32 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fa80::402:d4fb:ea68:135c/64 scope link 
       valid_lft forever preferred_lft forever
root@workstation:~# ping 10.10.0.20 -c 2
PING 10.10.0.20 (10.10.0.20) 56(84) bytes of data.
64 bytes from 10.10.0.20: icmp_seq=1 ttl=64 time=0.249 ms
64 bytes from 10.10.0.20: icmp_seq=2 ttl=64 time=0.250 ms

--- 10.10.0.20 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.249/0.249/0.250/0.015 ms

5 같이 보기

6 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}