zoukankan      html  css  js  c++  java
  • LVS安装配置

    LVS安装部署

     

    一、LVS安装(CENTOS

    1、LVS模块ip_vs已经内置在LINUX内核中,一般情况下ip_vs并没有启动,可以通过lsmod | grep ip_vs查看,能够看到信息表示模块已经加载,否则用modprobe ip_vs来启动。

     

    2192.168.0.156/200/201上都启动ip_vs模块。

     

    二、VIP服务器IPVSADM安装

    1、ipvsadm下载地址http://www.linuxvirtualserver.org/software/index.html

    2、源代码安装的话请根据内核版本(uname -a)来选择版本,注意对应版本对内核版本的要求。

    3、CentOS 5.5上直接用yum install ipvsadm安装。

    三、VIP服务器配置

    1、添加VIP地址(broadcast/netmask 可以通过ifconfig -a查看)

    ifconfig eth1:0 192.168.0.202 broadcast 192.168.0.255 netmask 255.255.255.0 up

    route add -host 192.168.0.202 dev eth1:0

     

    2、内核参数调整(vi /etc/sysctl.conf)

    net.ipv4.ip_forward = 1

    net.ipv4.conf.all.send_redirects = 0 

    net.ipv4.conf.default.send_redirects = 0

    net.ipv4.conf.eth1.send_redirects = 0

     

    执行/sbin/sysctl -p使内核参数生效

    3、检查VIP 192.168.0.202访问情况

    4、配置ipvsadm

    ipvsadm -A -t 192.168.0.202:http -s rr

    ipvsadm -a -t 192.168.0.202:http -r 192.168.0.200:http -g -w 1

    ipvsadm -a -t 192.168.0.202:http -r 192.168.0.201:http -g -w 1

     

    5、/etc/init.d/ipvsadm start

    6、lvs运行状态查看

       ipvsadm -lcn

      ipvsadm -l --rate

      ipvsadm -l --stats

    注:man ipvsadm

    -s scheduler(指定LVS调度算法)

     

    四、Real Server服务器配置

    1、添加虚拟地址与回环地址的绑定(注意netmask255.255.255.255 broadcastip地址一样)

    a)、ifconfig lo:0 192.168.0.202 up

    b)、ifconfig lo:0 192.168.0.202 broadcast 192.168.0.202 netmask 255.255.255.255 up

    c)、route add -host 192.168.0.202 dev lo:0

    注:在执行a) IP地址)后出现secureCRT192.168.0.200断开情况,此时在VIP服务器上无法ping192.168.0.200;执行完b) (回环IP vip)后,ping正常。

     

    2、内核参数调整

    net.ipv4.ip_forward = 1

    net.ipv4.conf.lo.arp_ignore = 1

    net.ipv4.conf.lo.arp_announce = 2

    net.ipv4.conf.all.arp_ignore = 1

    net.ipv4.conf.all.arp_announce = 2

    3、确保VIP服务器上能ping192.168.0.200/201 Real Server

    3、启动Nginx

    五、总结

    访问比较(1、直接通过Real Server访问,2、通过VIP访问)

    1、http://192.168.0.200/

     

    2、http://192.168.0.202/

  • 相关阅读:
    Swift中的单例的实现方式
    关于iOS自定义UITabBar的几种方法
    iOS数据持久化(三)
    iOS数据持久化(二)SQLite
    iOS数据持久化(一)
    iOS自定义NavigationBar
    UINavigationController基本使用
    UILabel 整理
    [DEMO]AR 1
    [分享]自主行驶小车idea
  • 原文地址:https://www.cnblogs.com/coderyoyo/p/lvs_ipvsadm.html
Copyright © 2011-2022 走看看