Keepalived hot standby

Source: Internet
Author: User

It is very easy to use Keepalived for dual-host hot backup. It is often used with LVS to achieve high-availability load balancing.

1. Master/Slave

First, prepare two test servers and a virtual IP address.

Server A: 192.168.1.10 (master Server)
Server B: 192.168.1.20
Virtual IP: 192.168.1.100
Test Service: Install Nginx on the two servers respectively, and modify the default index.html file to display the IP address of the current server for identification.

1. Install keepalived on the two servers respectively.

$ Sudo apt-get install keepalived
2. Add a configuration file.

Server
$ Sudo vim/etc/keepalived. conf

Global_defs {
Router_id LVS_DEVEL
}

Vrrp_instance VI_1 {
State MASTER
Interface eth0
Virtual_router_id 51 # Keep Master/Slave servers consistent
Priority 100 # priority (master server)
Advert_int 1 # Heartbeat broadcast interval (seconds)

Authentication {
Auth_type PASS
Auth_pass 1111
}

Virtual_ipaddress {
192.168.1.100/24 # multiple virtual IP addresses.
}
}
Server B
$ Sudo vim/etc/keepalived. conf

Global_defs {
Router_id LVS_DEVEL
}

Vrrp_instance VI_1 {
State BACKUP
Interface eth0
Virtual_router_id 51
Priority 99
Advert_int 1

Authentication {
Auth_type PASS
Auth_pass 1111
}

Virtual_ipaddress {
192.168.1.100/24
}
}
Note: In Server B configuration, the state must be changed to BACKUP and the priority must be lowered.

  • Four pages in total:
  • Previous Page
  • 1
  • 2
  • 3
  • 4
  • Next Page

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.