Centos Install keepalived

Source: Internet
Author: User

  1. keepalived Introduction
    Keepalived's role is to detect the status of the Web server, if a Web server crashes, or work fails, keepalived will detect and remove the failed Web server from the system, when the Web server is working properly keepalived automatically b servers joined to the server farm, all of these tasks are completed automatically, do not require manual intervention, need to manually do is to repair the failed Web server.

    Keepalived can also do dual-machine, when the primary keepalived server down, can automatically switch to the backup keepalived server to provide services.
  2. Installation
    Yum-y Install Kernel-headers Kernel-devel
    Yum-y Install popt LIBNL libnl-devel popt-static
    Yum-y Install Ipvsadm
    Yum-y Install keepalived
  3. Modifying a configuration file
    Vi/etc/keepalived/keepalived.conf
    ! Configuration File forKeepalivedglobal_defs {notification_email {616043155@qq. com #设置报警邮件地址, you can set multiple, 1 per line, [email protected] #需开启邮件报警及本机的Sendmail服务. } #notification_email_from616043155@qq. com #smtp_server smtp.qq.com #设置SMTP server address; #smtp_connect_timeout -router_id Lvs_devel} ####### #VRRP instance####### #vrrp_instance vi_1 {State MASTER #指定Keepalived的角 The master is the host server, backup is the standby server interface eth0 virtual_router_idWuyi#虚拟路由的id号, generally not more than 255 of the priority -#定义优先级, the higher the number, the higher the priority, the primary Dr must be larger than the standby Dr. Advert_int1Authentication {Auth_type Pass #设置验证类型, mainly have pass and ah two kinds of auth_pass Passwd #设置验证密码} virtual_ipad Dress {10.10.0.116#设置主DR的虚拟IP地址 (Virtual IP), multi-set, but must be 1} per line
    keepalived Code

    Note:

    When Keepalived is started, the VIP is not visible through ifconfig, but can be seen through the IP a command
    When Master is down, BACKUP is upgraded to master, and these vrrp_instance state transitions can be recorded in/var/log/message

    Copy the configuration file to the backup server and modify the initial status to priority

    vrrp_instance vi_1 {State    BACKUP    // initialization status     interface eth0               #定义优先级, must be 1 lower than Master's priority          Authentication {        Auth_type PASS          auth_pass Passwd      }    virtual_ipaddress {        10.10 . 0.116       }}
    keepalived Backup Code

    Start the service
    Service keepalived Restart
    Check the keepalived log file
    Stop or shut down the keepalived service, tail-f/var/log/message check log condition in master server

  4. Reference links
    http://lanlian.blog.51cto.com/6790106/1303195
    http://beyondhdf.blog.51cto.com/229452/1331874

Centos Install keepalived

Related Article

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.