Install keepalived In ubuntu (hot backup)

Source: Internet
Author: User


Install keepalived In ubuntu (hot backup)


Http://www.keepalived.org/software/keepalived-1.1.19.tar.gz


Master Server


$ Sudo apt-Get install libpopt-Dev

$ Sudo apt-Get install daemon

$ Sudo tar zxfv keepalived-1.1.19.tar.gz.

$ Keepalived-1.1.19 CD

$./Configure -- prefix =/usr/local/keepalived

$ Make

$ Sudo make install

$ Sudo mkdir/etc/sysconfig

$ Sudo CP/usr/local/keepalived/etc/sysconfig/

$ Sudo CP/usr/local/keepalived/etc/rc. d/init. d/keepalived/etc/init. d/

$ Sudo CP/usr/local/keepalived/sbin/

$ Sudo mkdir/etc/keepalived

$ Sudo CP/usr/local/keepalived/etc/keepalived. CONF/etc/keepalived/

$ Sudo VI/etc/keepalived. conf

Press a or I to enter the editing mode.

! Configuration file for keepalived
Global_defs {
Notification_email {
[Email protected] (send an email to the specified email address when an IP address migration or other event occurs)
}
Notification_email_from [email protected] (Mail sender)
Smtp_server 127.0.0.1 (external mail server address)
Smtp_connect_timeout 30 (the email timeout time is 30 seconds)
Router_id lvs_devel (ID of an instance)

}
Vrrp_instance vi_1 {
State master (set the server mode, in uppercase)
Interface eth0 (instance Nic, that is, the NIC that provides services)
Virtual_router_id 51

Priority 100 ~ 255)

Advert_int 1 (check time is 1 second)
Authentication {(Password Authentication)
Auth_type pass
Auth_pass 1111
}

Virtual_ipaddress {
10.0.1.10 (10.0.1.10 does not exist)
}

}

You do not need to modify the following content

Press ESC to exit the editing mode.

: WQ


$ Sudo mkdir-P/etc/rc. d/init. d

$ Sudo CP/usr/share/initramfs-tools/scripts/functions/etc/rc. d/init. d/

$ Sudo VI/etc/init. d/keepalived + 23

Press a or I to enter the editing mode.

Daemon keepalived start (default: Daemon keepalived $ {keepalived_options })

Press ESC to exit the editing mode.

: WQ (save and Exit)

$ Sudo mkdir/var/lock/subsys)

$ Service keepalived start

Auto-start

$ Sudo VI/etc/rc. Local

Press a or I to enter the editing mode.

Mkdir/var/lock/subsys

Service keepalived start

Press ESC to exit the editing mode.

: WQ (save and Exit)


$ Sudo ip A (you can see that eth0 has an IP address 10.0.1.10)


Backup Server steps are the same as above. You only need to change master in/etc/keepalived. conf to backup and priority to 50.


The backup server IP address a shows that eth0 does not have the IP address 10.0.1.10. When the master server is down, it will be displayed. When the master server is normal, it will automatically disappear.







This article is from the "Linux" blog and will not be reproduced!

Install keepalived In ubuntu (hot backup)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.