手机版
你好,游客 登录 注册
背景:
阅读新闻

LVS在大流量下基于OSPF的负载均衡实施方案

[日期:2013-06-08] 来源:51cto  作者:rfyiamcool [字体:大 中 小]

4. 编译和安装

make ;make install

5. 添加test组和用户

groupadd test;

useradd test -g test

6. 改变权限 //最好写入启动脚本

chown test:test /var/run/quagga

chmod 777 /var/run/quagga

chown test:test /etc/quagga //需要将配置写入操作系统

chmod 777 /etc/quagga/*

7. 增加log权限//最好写入启动脚本

Mkdir /var/log/quagga/

Vi /var/log/quagga/zebra.log

Chmod 777 /var/log/quagga/zebra.log

 

8. 修改 /etc/services //just for telnet

zebrasrv 2600/tcp # zebra service

zebra 2601/tcp # zebra vty

ripd 2602/tcp # RIPd vty

ripngd 2603/tcp # RIPngd vty

ospfd 2604/tcp # OSPFd vty

bgpd 2605/tcp # BGPd vty

ospf6d 2606/tcp # OSPF6d vty

ospfapi 2607/tcp # ospfapi

isid 2608/tcp # ISISd vty

 

 

9. 编辑配置文件

copy /etc/quagga/zebra.conf.example /etc/quagga/zebra.conf

! -*- zebra -*-

!

! zebra sample configuration file

!

hostname Router

password zebra

enable password zebra

log file /var/log/quagga/zebra.log//注意zebra.conf启用log,这样便于查找错误 zebra –d

如果启动不成功,察看/var/log/quagga/zebra.log

一般由于权限设置会出现以下错误:

2008/10/22 16:59:22 ZEBRA: Could not lock pid_file /var/run/quagga/zebra.pid, exiting

11. 登陆

telnet localhost zebra(0r 2601)

[root@localhost quagga-0.99.10]# telnet localhost 2601

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

 

Hello, this is Quagga (version 0.99.10).

Copyright 1996-2005 Kunihiro Ishiguro, et al.

 

 

User Access Verification

 

Password:

Router> enable

Password:

Router# help

Quagga VTY provides advanced help feature. When you need help,

anytime at the command line please press '?'.

 

If nothing matches, the help list will be empty and you must backup

until entering a '?' shows the available options.

Two styles of help are provided:

1. Full help is available when you are ready to enter a

command argument (e.g. 'show ?') and describes each possible

argument.

2. Partial help is provided when an abbreviated argument is entered

and you want to know what arguments match the input

(e.g. 'show me?'.)

 

Router#

在lvs server上的配置

安装

Web服务器192.168.0.14、192.168.0.15上安装quagga软件

配置

1). 配置web服务器quagga

使用root用户登录192.168.0.14和192.168.0.15

cd /etc/quagga

cp ospfd.conf.sample ospfd.conf

chkconfig zebra on

chkconfig ospfd on

service zebra start

service ospfd start

telnet localhost ospfd

输入默认密码zebra

ospfd> en

ospfd# conf t

ospfd(config)# router ospf

ospfd(config-router)# router-id 192.168.2.64

ospfd(config-router)# network 192.168.0.23/32 area 0.0.0.0(lo IP)

ospfd(config-router)# network 192.168.2.64/24 area 0.0.0.0(接口IP)

ospfd(config-router)#end

ospfd#wr

2). 配置交换机端

根据交换机类型配置ospf与主机quagga建立ospf邻居关系

3). 配置主机

使用root用户分别在2台web服务上执行以下命令

ifconfig lo:0 192.168.0.23 netmask 255.255.255.255 up

验证

多次访问http://192.168.0.23显示相应页面即说明负载成功

 

3.2 功能测试

负载均衡测试

多次访问http://192.168.0.23显示realserver ip address 在192.168.0.14和

192.168.0.15之间切换

服务切换测试

Down掉192.168.0.14/15上的服务IP 192.168.0.23可以正常访问应用

总结,淘宝的lvs已经做了fullnat的技术,原理也是ospf的负载的,腾讯不少业务也早已经用这样的方案了,知道腾讯的dns为啥能抗住几百万的流量请求并发,10g网压力测试能保持在1800w 流量请求并发, 除了dns的性能牛逼外,网络的框架用的就是这个方案。当然里面有些具体的流程方案不方便向大家show出来,比如 各种情况下的健康度检查,ospf的hello包的判断,自动化的ospf的配置,定时的负载调整。 但这些东西可以自己用shell配合网络组的同学们一起搞定制的。

这样的方案,在上一家公司用过很多次,qugga的性能和稳定是没有问题的~大家可以放心用。 还有一点 用之前一直要搞清楚ospf的cost负载的原理,或者公司有专门的网络的同学,要是没有的话最好别冲动去线上尝试,不然会。。。。你懂的。

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款