最新已经到0.4了,安装也比较简单,可惜家里就一台,那位兄弟给测试一下,给大家说一下效果。
LVS on FreeBSD Version 0.4.0
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


wenew 于 2009-07-14 18:38:30发表:
我有三台服务器,安装的都是freebsd7.0
因为每一台服务器的带宽限制在10M,原来使用nginx做proxy,发现根本行不通,因为另外两台服务器的数据都要经过nginx proxy,
所以想选择lvs或pf来做,
我不需要双机热备,所以应该不需要carp吧!
我安装lvs的步骤是:
1.安装freebsd源代码,选择了base与sys,
2.在./usr/ports/net/ipvs下面 make patch-system (我想应该是打内核的补丁吧
3.make depend
make
make install
reboot
4./usr/ports/net/ipvs make
就会出现错误:===> Building for ipvs-0.4.0_2
===> ipvs
Warning: Object directory not changed from original /usr/ports/net/ipvs/work/ipvs-0.4.0_2/ipvs
cc -O2 -fno-strict-aliasing -pipe -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -c ip_vs_core.c
In file included from ip_vs.h:246,
from ip_vs_core.c:33:
@/sys/socketvar.h:391: error: field 'cv' has incomplete type
@/sys/socketvar.h:406: error: redefinition of 'struct nf_sockopt_ops'
@/sys/socketvar.h:422: error: field 'cv' has incomplete type
@/sys/socketvar.h:426: warning: redundant redeclaration of 'nf_register_sockopt'
@/sys/socketvar.h:395: warning: previous declaration of 'nf_register_sockopt' was here
@/sys/socketvar.h:427: warning: redundant redeclaration of 'nf_unregister_sockopt'
@/sys/socketvar.h:396: warning: previous declaration of 'nf_unregister_sockopt' was here
@/sys/socketvar.h:428: warning: redundant redeclaration of 'nf_sockopt_init'
@/sys/socketvar.h:397: warning: previous declaration of 'nf_sockopt_init' was here
请问这是为什么?我的步骤有错吗?
实在不行,非得要我安装linux吗?
谢谢!
另外,我想实现的是LVS/TU集群,因为我的机器在电信的不同的机房,这样是否可行!
PF有没有办法来实现?好像PF都没有什么资料可以找到!