热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

F5通过httpclass实现多域名分流进行服务器负载均衡

F5通过httpclass实现多域名分流进行服务器负载均衡武汉通威电子有限公司陈波2012-10-9Technorati标签:f5,url,httpclass,l

F5通过http class实现多域名分流进行服务器负载均衡

武汉通威电子有限公司

陈 波

2012-10-9

Technorati 标签: f5,url,httpclass,loadbalance


一、环境和需求

#---------环境

电子商务平台

BIGIP 1600 LTM 一台,ASA5520 一台

ISP公网ip 5个

IBM服务器刀片10几个

主域名www.aaa.com,二级域名20个(tr.aaa.com/search.aaa.com/……)

#---------需求

由于公网ip有限,不能做到域名和公网ip的一对一绑定,需要通过f5来实现多域名的分流

所有用户都通过域名(80端口)访问业务,而后台每个域名分别为不同端口

每个域名代表一个业务组,后台有多组服务器池对应不同域名


二、设计思路

# 第一步------------------------------------

把5个公网ip的功能进行规划:

IP1=防火墙接口ip

IP2=防火墙预留映射ip,nat给f5的管理ip 443

IP3=业务集合bg

bg_cms.bg.aaa.com

bg_erp.bg.aaa.com

bg_exh.bg.aaa.com

bg_goods.bg.aaa.com

bg_log.bg.aaa.com

bg_member.bg.aaa.com

bg_order.bg.aaa.com

bg_tr.bg.aaa.com

IP4=业务集合main

club.aaa.com

exh.aaa.com

login.aaa.com

member.aaa.com

order.aaa.com

search.aaa.com

tr.aaa.com

www.aaa.com

IP5=业务集合pay

bg_pay.aaa.com

image.aaa.com

pay.aaa.com

# 第二步------------------------------

域名绑定到IP3的一个公网ip上

bg_cms.bg.aaa.com

bg_erp.bg.aaa.com

bg_exh.bg.aaa.com

bg_goods.bg.aaa.com

bg_log.bg.aaa.com

bg_member.bg.aaa.com

bg_order.bg.aaa.com

bg_tr.bg.aaa.com

其他域名类似

# 第三步------------------------------

防火墙做一对一端口映射

其中IP3、4、5映射到F5的3个vs ip 192.168.21.1~3

# 第四步------------------------------

F5上通过http class配置进行对数据包的url进行检查域名来进行分流,到不同的server pool,并把80流量进行目的端口转换到不同业务


三、流量逻辑图

clip_image002


四、相关截图

clip_image004

Vs_bg,vs_main1,vs_pay分别为根据域名url判断的三个分流应用组

Vs forward是内部三层交换

Vs out是服务器主动访问

clip_image006

注:指定网段可以ip forwarding三层交换。

clip_image008

注:不管真实服务器是什么端口,用户都用80端口访问

clip_image010

注:http class的配置,根据vs中接受到包头的url进行判断

clip_image012

注:在vs的resource里面匹配http class


五、配置文件

profile httpclass httpclass {

pool none

redirect none

url rewrite none

asm disable

wa disable

hosts none

paths none

headers none

COOKIEs none

}

profile httpclass bg_cms {

defaults from httpclass

pool pool_bg_cms

redirect none

hosts "cms.bg.aaa.com"

}

profile httpclass bg_erp {

defaults from httpclass

pool pool_bg_erp

redirect none

hosts "erp.bg.aaa.com"

}

profile httpclass bg_exh {

defaults from httpclass

pool pool_bg_exh

redirect none

hosts "exh.bg.aaa.com"

}

profile httpclass bg_goods {

defaults from httpclass

pool pool_bg_goods

redirect none

hosts "goods.bg.aaa.com"

}

profile httpclass bg_log {

defaults from httpclass

pool pool_bg_log

redirect none

hosts "logistics.bg.aaa.com"

}

profile httpclass bg_member {

defaults from httpclass

pool pool_bg_member

redirect none

hosts "member.bg.aaa.com"

}

profile httpclass bg_order {

defaults from httpclass

pool pool_bg_order

redirect none

hosts "order.bg.aaa.com"

}

profile httpclass bg_pay {

defaults from httpclass

pool pool_bg_pay

redirect none

hosts "pay.bg.aaa.com"

}

profile httpclass bg_tr {

defaults from httpclass

pool pool_bg_tr

redirect none

hosts "tr.bg.aaa.com"

}

profile httpclass club {

defaults from httpclass

pool pool_club

redirect none

url rewrite none

hosts "club.aaa.com"

paths none

headers none

COOKIEs none

}

profile httpclass exh {

defaults from httpclass

pool pool_exh

redirect none

url rewrite none

hosts "exh.aaa.com"

paths none

headers none

COOKIEs none

}

profile httpclass image {

defaults from httpclass

pool pool_image1

redirect none

hosts "image1.aaa.com"

}

profile httpclass login {

defaults from httpclass

pool pool_login

redirect none

hosts "login.aaa.com"

}

profile httpclass member {

defaults from httpclass

pool pool_member

redirect none

hosts "member.aaa.com"

}

profile httpclass order {

defaults from httpclass

pool pool_order

redirect none

hosts "order.aaa.com"

}

profile httpclass pay {

defaults from httpclass

pool pool_pay

redirect none

hosts "pay.aaa.com"

}

profile httpclass search {

defaults from httpclass

pool pool_search

redirect none

hosts "search.aaa.com"

}

profile httpclass tr {

defaults from httpclass

pool pool_tr

redirect none

hosts "tr.aaa.com"

}

profile httpclass www {

defaults from httpclass

pool pool_www

redirect none

hosts "www.aaa.com"

}

pool pool_bg_cms {

monitor all tcp8180

members 192.168.8.121:8180 {}

}

pool pool_bg_erp {

monitor all tcp8080

members 192.168.8.121:webcache {}

}

pool pool_bg_exh {

monitor all tcp8280

members 192.168.8.121:8280 {}

}

pool pool_bg_goods {

monitor all tcp8380

members 192.168.8.121:cruise-update {}

}

pool pool_bg_log {

monitor all tcp8780

members 192.168.8.121:8780 {}

}

pool pool_bg_member {

monitor all tcp8480

members 192.168.8.121:8480 {}

}

pool pool_bg_order {

monitor all tcp8580

members 192.168.8.121:8580 {}

}

pool pool_bg_pay {

monitor all tcp9180

members 192.168.8.221:9180 {}

}

pool pool_bg_tr {

monitor all tcp8680

members 192.168.8.121:8680 {}

}

pool pool_club {

monitor all tcp8080

members {

192.168.8.131:webcache {}

192.168.8.132:webcache {}

192.168.8.133:webcache {}

192.168.8.134:webcache {}

}

}

pool pool_exh {

monitor all tcp8280

members {

192.168.8.131:8280 {}

192.168.8.132:8280 {}

192.168.8.133:8280 {}

192.168.8.134:8280 {}

}

}

pool pool_image1 {

monitor all http

members 192.168.8.161:http {}

}

pool pool_internet {

monitor all gateway_icmp

members 192.168.21.254:any {}

}

pool pool_login {

monitor all tcp8380

members {

192.168.8.131:cruise-update {}

192.168.8.132:cruise-update {}

192.168.8.133:cruise-update {}

192.168.8.134:cruise-update {}

}

}

pool pool_member {

monitor all tcp8480

members {

192.168.8.131:8480 {}

192.168.8.132:8480 {}

192.168.8.133:8480 {}

192.168.8.134:8480 {}

}

}

pool pool_order {

monitor all tcp8580

members {

192.168.8.131:8580 {}

192.168.8.132:8580 {}

192.168.8.133:8580 {}

192.168.8.134:8580 {}

}

}

pool pool_pay {

monitor all tcp9080

members 192.168.8.221:glrpc {}

}

pool pool_search {

monitor all tcp8680

members {

192.168.8.131:8680 {}

192.168.8.132:8680 {}

192.168.8.133:8680 {}

192.168.8.134:8680 {}

}

}

pool pool_tr {

monitor all tcp8780

members {

192.168.8.131:8780 {}

192.168.8.132:8780 {}

192.168.8.133:8780 {}

192.168.8.134:8780 {}

}

}

pool pool_www {

monitor all tcp8180

members {

192.168.8.131:8180 {}

192.168.8.132:8180 {}

192.168.8.133:8180 {}

192.168.8.134:8180 {}

}

}

virtual address any {

mask 0.0.0.0

}

virtual address 192.168.5.0 {

mask 255.255.255.0

}

virtual address 192.168.6.0 {

mask 255.255.255.0

}

virtual address 192.168.8.0 {

mask 255.255.255.0

}

virtual vs_bg {

destination 192.168.21.2:http

ip protocol tcp

httpclass {

bg_cms

bg_erp

bg_exh

bg_goods

bg_log

bg_member

bg_order

bg_tr

}

persist source_addr

profiles {

http {}

tcp {}

}

}

virtual vs_forward {

ip forward

destination 192.168.8.0:any

mask 255.255.255.0

}

virtual vs_forward1 {

ip forward

destination 192.168.6.0:any

mask 255.255.255.0

}

virtual vs_forward2 {

ip forward

destination 192.168.5.0:any

mask 255.255.255.0

}

virtual vs_main1 {

destination 192.168.21.1:http

ip protocol tcp

httpclass {

club

exh

login

member

order

search

tr

www

}

persist source_addr

profiles {

http {}

tcp {}

}

}

virtual vs_out {

snat automap

pool pool_internet

destination any:any

mask 0.0.0.0

}

virtual vs_pay {

destination 192.168.21.3:http

ip protocol tcp

httpclass {

bg_pay

image

pay

}

persist source_addr

profiles {

http {}

tcp {}

}

}


推荐阅读
  • 如何使用Java获取服务器硬件信息和磁盘负载率
    本文介绍了使用Java编程语言获取服务器硬件信息和磁盘负载率的方法。首先在远程服务器上搭建一个支持服务端语言的HTTP服务,并获取服务器的磁盘信息,并将结果输出。然后在本地使用JS编写一个AJAX脚本,远程请求服务端的程序,得到结果并展示给用户。其中还介绍了如何提取硬盘序列号的方法。 ... [详细]
  • 本文介绍了RPC框架Thrift的安装环境变量配置与第一个实例,讲解了RPC的概念以及如何解决跨语言、c++客户端、web服务端、远程调用等需求。Thrift开发方便上手快,性能和稳定性也不错,适合初学者学习和使用。 ... [详细]
  • Nginx使用AWStats日志分析的步骤及注意事项
    本文介绍了在Centos7操作系统上使用Nginx和AWStats进行日志分析的步骤和注意事项。通过AWStats可以统计网站的访问量、IP地址、操作系统、浏览器等信息,并提供精确到每月、每日、每小时的数据。在部署AWStats之前需要确认服务器上已经安装了Perl环境,并进行DNS解析。 ... [详细]
  • 搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的详细步骤
    本文详细介绍了搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的步骤,包括环境说明、相关软件下载的地址以及所需的插件下载地址。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • 如何在服务器主机上实现文件共享的方法和工具
    本文介绍了在服务器主机上实现文件共享的方法和工具,包括Linux主机和Windows主机的文件传输方式,Web运维和FTP/SFTP客户端运维两种方式,以及使用WinSCP工具将文件上传至Linux云服务器的操作方法。此外,还介绍了在迁移过程中需要安装迁移Agent并输入目的端服务器所在华为云的AK/SK,以及主机迁移服务会收集的源端服务器信息。 ... [详细]
  • 本文介绍了在使用Python中的aiohttp模块模拟服务器时出现的连接失败问题,并提供了相应的解决方法。文章中详细说明了出错的代码以及相关的软件版本和环境信息,同时也提到了相关的警告信息和函数的替代方案。通过阅读本文,读者可以了解到如何解决Python连接服务器失败的问题,并对aiohttp模块有更深入的了解。 ... [详细]
  • 本文介绍了在mac环境下使用nginx配置nodejs代理服务器的步骤,包括安装nginx、创建目录和文件、配置代理的域名和日志记录等。 ... [详细]
  • WebSocket与Socket.io的理解
    WebSocketprotocol是HTML5一种新的协议。它的最大特点就是,服务器可以主动向客户端推送信息,客户端也可以主动向服务器发送信息,是真正的双向平等对话,属于服务器推送 ... [详细]
  • 本文介绍了Windows操作系统的版本及其特点,包括Windows 7系统的6个版本:Starter、Home Basic、Home Premium、Professional、Enterprise、Ultimate。Windows操作系统是微软公司研发的一套操作系统,具有人机操作性优异、支持的应用软件较多、对硬件支持良好等优点。Windows 7 Starter是功能最少的版本,缺乏Aero特效功能,没有64位支持,最初设计不能同时运行三个以上应用程序。 ... [详细]
  • 后台自动化测试与持续部署实践
    后台自动化测试与持续部署实践https:mp.weixin.qq.comslqwGUCKZM0AvEw_xh-7BDA后台自动化测试与持续部署实践原创 腾讯程序员 腾讯技术工程 2 ... [详细]
  • NFS文件共享系统
    1、概述:NFS(NetworkFileSystem)意为网络文件系统,它最大的功能就是可以通过网络,让不同的机器不同的操作系统可以共享 ... [详细]
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • Nginx使用(server参数配置)
    本文介绍了Nginx的使用,重点讲解了server参数配置,包括端口号、主机名、根目录等内容。同时,还介绍了Nginx的反向代理功能。 ... [详细]
  • 怎么在PHP项目中实现一个HTTP断点续传功能发布时间:2021-01-1916:26:06来源:亿速云阅读:96作者:Le ... [详细]
author-avatar
大伟
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有