msgbartop
世界上的一队小小的漂泊者呀,请留下你们的足印在我的文字里
msgbarbottom

02 三 07 LVS On FreeBSD Project

khan.chan {at} virest.org

http://blog.virest.org

LVS Project 是章文嵩博士创始的开源项目,   之前我写的一篇简单应用LVS 负载均衡Web Services的文章, 有关原理部分信息我想还是请出章老师的文章犒劳大家吧 .

http://www.ibm.com/developerworks/cn/linux/cluster/lvs/part1/index.html

http://www.ibm.com/developerworks/cn/linux/cluster/lvs/part2/index.html

http://www.ibm.com/developerworks/cn/linux/cluster/lvs/part3/index.html

http://www.ibm.com/developerworks/cn/linux/cluster/lvs/part4/index.html

今天给大家些tips 有关ipvsadm(IPVS)在FreeBSD下的应用.

Links articles from here: http://dragon.linux-vs.org/~dragonfly/htm/lvs_freebsd.htm

不太喜欢赘言, 给个大概的README:

dragonfly said:

Install:
1.        Patch the FreeBSD kernel:
cp patch/OS-RELEASE/* /usr/src;
cd /usr/src;
patch -p0 < uipc_socket.c.patch
patch -p0 < ip_input.c.patch
patch -p0 < socketvar.h.patch
patch -p0 < sys_conf_options.patch
patch -p0 < sys_i386_conf_GENERIC.patch
2.        Rebuilding FreeBSD kernel:
cd /usr/src/sys/arch/i386/conf;
config GENERIC;
cd ../compile/GENERIC;
make depend;
make;
make install;
3.        Compile ipvs module:
cd ipvs/
make;
cd ipvsadm/
make install;
4.        Compile ipvs scheduler module:
cd ipvs/
cd schedulers/
cd SCHEDULER-NAME/
make
5.        Reboot with new kernel:
reboot;
Let’s assume your cluster has the following configuration:
Workstation with address:192.168.1.23 runs as dispatcher(FE:front end),
Workstations with address:192.168.1.33 and 192.168.1.38 run as real server(BE:back
end).
Thay all share address:192.168.1.36,which is saw by client.
Start:

Assume using ‘rr’ schedule algorithm(optional: dh, lblc, lblcr, lc, nq, rr,
sed, sh, wlc, wrr).

LVS/DR:
1.        kldload ./ipvs.ko
2.        kldload schedulers/rr/ip_vs_rr.ko
3.        ./ipvsadm -A -t 192.168.1.36:80 -s rr
4.        ./ipvsadm -a -t 192.168.1.36:80 -r 192.168.1.33:80 -g
5.        ./ipvsadm -a -t 192.168.1.36:80 -r 192.168.1.38:80 -g

LVS/TUN:
1.   kldload ./ipvs.ko
2.        kldload schedulers/rr/ip_vs_rr.ko
3.   ./ipvsadm -A -t 192.168.1.36:80 -s rr
4.   ./ipvsadm -a -t 192.168.1.36:80 -r 192.168.1.33:80 -i
5.   ./ipvsadm -a -t 192.168.1.36:80 -r 192.168.1.38:80 -i

Stop:
1.        ./ipvsadm -C
2.        kldunload ip_vs_rr
3.        kldunload ipvs

Note: Do not use other commands of ipvsadm,for maybe it is not implemented.
Feedback
——–
Welcome your comments, bug reports, bug fixes, and ideas

Thanks,

Li Wang
[email protected]

Tags: