2008.07.19,深圳 OpenBSD 聚会小记

0 views
Skip to first unread message

Zhang Huangbin

unread,
Jul 20, 2008, 5:03:12 AM7/20/08
to sz...@googlegroups.com, openb...@googlegroups.com
聚会的主要目的:

* 熟悉 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 网络安装服务器的配置文档:
http://bbs.chinaunix.net/viewthread.php?tid=754661

使用 relayd(8) 实现负载均衡的网络拓扑和各系统的配置,可以参考 OpenBSD
Journal 的帖子,

* Direct Server Return support in OpenBSD
http://undeadly.org/cgi?action=article&sid=20080617010016

NAT 模式的负载均衡较简单,但调度器容易成为整个集群方案的瓶颈和单点
故障(因为所有进出的网络数据都必须经过调度器),所以主要还是测试 DSR
模式的负载均衡方案。

在测试 DSR 模式成功之后,使用 FluxBB 论坛程序测试负载均衡集群对于
需要用户验证的程序是否可以很好的支持。最终从 relayd(8) Manuals Page
里挖到 'sticky-address' 参数,很好地实现了需求。但对于有大量用户并发
访问的类似论坛程序这样的应用,是否可以很好的支持,还有待测试。

FluxBB 论坛程序的主页: http://fluxbb.org/

使用到的 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: http://iRedMail.googlecode.com/

Zoom.Quiet

unread,
Jul 20, 2008, 5:52:28 AM7/20/08
to sz...@googlegroups.com, ks...@googlegroups.com
great sharing!......
learing continue

2008/7/20 Zhang Huangbin <michae...@gmail.com>:

--

http://zoomquiet.org'''
过程改进乃是催生可促生靠谱的人的组织!
PE keeps evolving organizations which promoting people be good!'''

Jiahua Huang

unread,
Jul 20, 2008, 5:59:31 AM7/20/08
to sz...@googlegroups.com
2008/7/20 Zhang Huangbin <michae...@gmail.com>:

> 在测试 DSR 模式成功之后,使用 FluxBB 论坛程序测试负载均衡集群对于
> 需要用户验证的程序是否可以很好的支持。最终从 relayd(8) Manuals Page
> 里挖到 'sticky-address' 参数,很好地实现了需求。但对于有大量用户并发
> 访问的类似论坛程序这样的应用,是否可以很好的支持,还有待测试。
>

用 memcache 代替 php 自己的 session,就没必要 sticky-address 了吧

嗯,聚会的相片呢呢呢?

Faris Xiao

unread,
Jul 20, 2008, 11:10:36 AM7/20/08
to sz...@googlegroups.com

>
> 用 memcache 代替 php 自己的 session,就没必要 sticky-address 了吧
PHP 的 memcache 可以实现不同物理服务器间, PHP session 信息共享吗?
有个 session pool ?不同物理机器,可以互相实现通讯?


Jiahua Huang

unread,
Jul 20, 2008, 11:44:49 AM7/20/08
to sz...@googlegroups.com
2008/7/20 Faris Xiao <atzl...@gmail.com>:

> PHP 的 memcache 可以实现不同物理服务器间, PHP session 信息共享吗?
> 有个 session pool ?不同物理机器,可以互相实现通讯?
>

使用 memcache 或数据库的都可以

Reply all
Reply to author
Forward
0 new messages