聚会的主要目的:
* 熟悉 relayd(8) 的配置,能用 relayd(8) 和 PF 搭建出基本的 Web
负载均衡集群,分别测试 NAT 模式和 DSR (Direct Server Return)
模式
* 腐败;
测试环境:
* 共 3 台 HP Servers
* A, B 两台安装 Windows 2003 系统,各自跑 VMware Server,在
VMware 里部署多台 OpenBSD -snapshots,作为实际提供 web 服务
的节点,使用自带的 Apache-1.3.x 提供 Web 服务。
* C 安装 OpenBSD -snapshots(双网卡),作为负载均衡调度器。
聚会总人数:3 人。
* zmoon
* Yuan YiJun
* Bibby
聚会成果:
* 基本实现期望的负载均衡集群的需求,但仍有待深入学习。
* 腐败,感谢 zmoon 的盛情款待 ^_^
上午前半部分是互相认识和各个系统的安装。所有 OpenBSD 系统都是使用 PXE
网络安装。PXE 网络安装服务器的安装与配置可以参考以下文档:
* PXE 网络安装服务器的配置文档:
[url]http://bbs.chinaunix.net/viewthread.php?tid=754661[/url]
使用 relayd(8) 实现负载均衡的网络拓扑和各系统的配置,可以参考 OpenBSD
Journal 的帖子,
* Direct Server Return support in OpenBSD
[url]http://undeadly.org/cgi?action=article&sid=20080617010016[/url]
NAT 模式的负载均衡较简单,但调度器容易成为整个集群方案的瓶颈和单点
故障(因为所有进出的网络数据都必须经过调度器),所以主要还是测试 DSR
模式的负载均衡方案。
在测试 DSR 模式成功之后,使用 FluxBB 论坛程序测试负载均衡集群对于
需要用户验证的程序是否可以很好的支持。最终从 relayd(8) Manuals Page
里挖到 'sticky-address' 参数,很好地实现了需求。但对于有大量用户并发
访问的类似论坛程序这样的应用,是否可以很好的支持,还有待测试。
FluxBB 论坛程序的主页: [url]http://fluxbb.org/[/url]
使用到的 relayd.conf 文件附在帖子后面,供大家参考。
对于您所喜欢的开源软件,如果您觉得它确实很不错,建议您在任何合适的
场合为它做一些小小的宣传,以支持它的持续发展。
开源,需要您的举手之劳。
----cut<---------------------------
# $OpenBSD: relayd.conf,v 1.13 2008/03/03 16:58:41 reyk Exp $
#
# Macros
#
#ext_addr="192.168.1.1"
#webhost1="10.0.0.1"
#webhost2="10.0.0.2"
ext_addr="192.168.7.13"
webhost1="10.0.0.41"
webhost2="10.0.0.42"
webhost3="10.0.0.43"
#
# Global Options
#
# interval 10
# timeout 1000
# prefork 5
#
# Each table will be mapped to a pf table.
#
table <webhosts> { $webhost1 $webhost2 $webhost3 }
table <fallback> { 127.0.0.1 }
#
# Services will be mapped to a rdr rule.
#
redirect www {
listen on $ext_addr port http
# tag every packet that goes thru the rdr rule with RELAYD
#tag RELAYD
#forward to <webhosts> check http "/" code 200
#forward to <fallback> check icmp
# DSR.
route to <webhosts> port www check http "/" code 200 interface vic0
}
----cut<---------------------------
----cut<---------------------------
# $OpenBSD: pf.conf,v 1.37 2008/05/09 06:04:08 reyk Exp $
#
# See pf.conf(5) for syntax and examples.
# Remember to set net.inet.ip.forwarding=1 and/or net.inet6.ip6.forwarding=1
# in /etc/sysctl.conf if packets are to be forwarded between interfaces.
#ext_if="ext0"
#int_if="int0"
#table <spamd-white> persist
#set skip on lo
#scrub in
#nat-anchor "ftp-proxy/*"
#rdr-anchor "ftp-proxy/*"
#rdr-anchor "relayd/*"
rdr-anchor "relayd/*"
#nat on $ext_if from !($ext_if) -> ($ext_if:0)
#rdr pass on $int_if proto tcp to port ftp -> 127.0.0.1 port 8021
#no rdr on $ext_if proto tcp from <spamd-white> to any port smtp
#rdr pass on $ext_if proto tcp from any to any port smtp \
# -> 127.0.0.1 port spamd
#anchor "ftp-proxy/*"
anchor "relayd/*"
#block in
#pass out
#pass quick on $int_if no state
#antispoof quick for { lo $int_if }
#pass in on $ext_if proto icmp to ($ext_if)
#pass in on $ext_if proto tcp to ($ext_if) port ssh
#pass in log on $ext_if proto tcp to ($ext_if) port smtp
#pass out log on $ext_if proto tcp from ($ext_if) to port smtp
----cut<---------------------------
--
Best Regards.
Zhang Huangbin
- iRedMail: Mail Server Solution for Red Hat(R) Enterprise Linux &
CentOS 5.x: [url]http://iRedMail.googlecode.com/[/url]