zoukankan      html  css  js  c++  java
  • Nginx+Keepalived 做负载均衡器

    1.安装 keepalived

     
    1
    2
    3
    4
    5
    6
    7
    8
    9
    tar zxvf keepalived-XXXX.tar.gz
    ./configure --prefix=/usr/local/keepalived --with-kernel-dir=/usr/src/kernels/2.6.XXXXXXXX/
    make && make install
    cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
    cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
    mkdir /etc/keepalived
    cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
    cp /usr/local/keepalived/sbin/keepalived /usr/sbin/
    service keepalived start

    2.Master与Backup 的配置文件

    Master:
     
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    ! Configuration File for keepalived
    global_defs {
       notification_email {
          15251076067@163.com
       }
       notification_email_from king_819@163.com
       smtp_server smtp.163.com
       smtp_connect_timeout 30
       router_id LVS_DEVEL
    }
    # VIP1
    vrrp_instance VI_1 {
        state MASTER
        interface eth0
        virtual_router_id 51
        mcast_src_ip 192.168.18.211
        priority 100
        advert_int 5
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
            192.168.18.200
        }
    }
     
     
     
    BackUP:
     
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    ! Configuration File for keepalived
    global_defs {
       notification_email {
          15251076067@163.com
       }
       notification_email_from king_819@163.com
       smtp_server smtp.163.com
       smtp_connect_timeout 30
       router_id LVS_DEVEL
    }
    # VIP1
    vrrp_instance VI_1 {
        state BACKUP
        interface eth0
        virtual_router_id 51
        mcast_src_ip 192.168.18.212
        priority 90
        advert_int 5
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
            192.168.18.200
        }
    }
  • 相关阅读:
    Python 标准库 BaseHTTPServer 中文翻译
    DBA Scripts
    cordova开发自己定义插件
    ASUS主板ALC887声卡,RTL81XX网卡,黑苹果驱动安装
    com.apple.installer.pagecontroller 错误 -1 pkg安装错误
    Apple 远程推送APNS 服务
    bitbucket git push 项目503失败
    在xcode5下利用Source Control 做 git 项目管理
    iOS设备定位服务开启判定
    has been modified since the precompiled header地图错误
  • 原文地址:https://www.cnblogs.com/timssd/p/4333059.html
Copyright © 2011-2022 走看看