在 IP 负载均衡技术中,主要有通过网络地址转换(Network Address Translation)
将一组服务器构成一个高性能的、高可用的虚拟服务器,我们称之为 VS/NAT 技
术(Virtual Server via Network Address Translation)。还有通过 IP 隧道实现虚拟服务
器的方法 VS/TUN (Virtual Server via IP Tunneling),和通过直接路由实现虚拟服
务器的方法 VS/DR(Virtual Server via Direct Routing),它们都可以极大地提高系统
的伸缩性。用户需要根据自己的应用和网络配置情况来选择其中一种方式。
1)第一类:VS/NAT
VS/NAT 的优点是服务器可以运行任何支持 TCP/IP 的操作系统,它只需要一
个 IP 地址配置在调度器上,服务器组可以用私有的 IP 地址。缺点是它的伸缩能力
有限,当服务器结点数目升到 20 时,调度器本身有可能成为系统的新瓶颈,因为
在 VS/NAT 中请求和响应报文都需要通过负载调度器。
如果您想让调度节点也作为真实服务器使用,那么请在“Do you want to use
the director as a real server? ”时选择 yes,否则选择 no。如果您选择结果
为 no,那么就不会出现让您选择负载均衡技术的选项。
例如:
[root@test1 root]# mount /dev/cdrom /mnt/cdrom
[root@test1 root]# cd /mnt/cdrom
[root@test1 cdrom]# ./install_lb
Following RPMs will be installed or upgraded to newer version if
necessary:
7
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
*) pdksh
*) lsof
*) sg_utils
*) GreatTurbo Load Balance Server
*) GreatTurbo Load Balance Server realserver agents
Please select the operatating system version you are using:
0) GreatTurbo Enterprise Server 10 SP1 (x86_32, kernel:2.6.9-5.15)
1) GreatTurbo Enterprise Server 10 SP1 (x86_64, kernel:2.6.9-5.15)
2) GreatTurbo Enterprise Server 10 SP1 (OpenPower ppc64, kernel: 2.6.9
-5.15)
3) GreatTurbo Enterprise Server 10 SP1 (IA64, kernel:2.6.9-5.15)
4) cancel
Please select an OS version, then the installation procedure will begin.
Select 4 to abort [0/1/2/3/4]: 1
Do you want to use the director as a real server? (y/n) [y]: y
Please select the network forwarding method you want to use:
0) direct routing
1) NAT
2) IP tunnel
Please select a network forwarding method [0/1/2]: 0
[root@test1 iso]# ./install_realserver
The real server agents will be installed or upgraded to newer version.
Please select the network forwarding method you want to use:
0) direct routing
1) NAT
2) IP tunnel
3) cancel
Please select a network method, then the installation procedure will
begin. Select 3 to abort [0/1/2/3]: 0
-----------------------------------Cluster Member Configuration Utility
-----------------------------------Version: 10.0 Built: Sat Apr 29 18:11:19 CST 2006
This utility sets up the member systems of a 2-node HA cluster,
or the 2-node director members of a Load Balancing cluster.
It prompts you for the following information:
o Hostname
o Number of heartbeat channels
o Information about the type of channels and their names
o Power switch type and device name
12
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
o Information about the routers and network type of the Load Balancer
In addition, it performs checks to make sure that the information
entered is consistent with the hardware, the Ethernet ports, the raw
partitions and the character device files.
After the information is entered, it initializes the configure file
and saves the configuration information to the configure file
- Checking that cluster daemons are stopped: done
- Configuration file exists already.
Would you like to use those prior settings as defaults? (yes/no)
[yes]:yes
如果以前运行过 member_config 命令,那么配置文件中会保存我们的配置结
果,该选项就是问我们是否使用以前的配置结果作为缺省值,通常回答 yes。
注意:如果是第一次配置,则不会出现该选项。
2)配置本地节点名称
接下来,输入本地节点的名称。GreatTurbo Load Balance Server 会自动的从
---------------------------------------Setting information for cluster member 0
---------------------------------------Enter name of cluster member [test1]: test1
Looking for host test1 (may take a few seconds)...
Host test1 found
Cluster member name set to: test1
Enter number of heartbeat channels (minimum = 1) [1]: 4
You selected 4 channels
Information about channel 0:
Channel type: net or serial [net]:
Channel type set to: net
Enter hostname of cluster member test1 on heartbeat channel 0 [test1]:
hb11
Looking for host hb11 (may take a few seconds)...
Host hb11 found
Hostname corresponds to an interface on member 0
Channel name set to: hb11
Information about channel 1:
Channel type: net or serial [net]:
Channel type set to: net
Enter hostname of cluster member test1 on heartbeat channel 1: hb12
Looking for host hb12 (may take a few seconds)...
Host hb12 found
Hostname corresponds to an interface on member 0
Channel name set to: hb12
Information about channel 2:
Channel type: net or serial [net]:
Channel type set to: net
Enter hostname of cluster member test1 on heartbeat channel 2: test1
Looking for host test1 (may take a few seconds)...
Host test1 found
Hostname corresponds to an interface on member 0
Channel name set to: test1
Information about channel 3:
Channel type: net or serial [net]: serial
Channel type set to: serial
Enter device name: /dev/ttyS0
Device /dev/ttyS0 found and no getty running on it
Device name set to: /dev/ttyS0
Information about power switch connected to member 0
Specify one of the following switches (NONE/RSA/RPS10/APC) [NONE]: NONE
Power switch type set to NONE
Information about watchdog to member 0
Choose one of the following watchdog drivers: NONE/softdog/...) [NONE] :
softdog
5)配置对方节点信息
对方节点信息包括节点的机器名,heartbeat 的设置,watchdog driver 等。
设置方法和本地完全一样。
---------------------------------------Setting information for cluster member 1
---------------------------------------Enter name of cluster member: test2
Looking for host test2 (may take a few seconds)...
Host test2 found
Cluster member name set to: test2
You previously selected 4 channels
Information about channel 0:
Channel type selected as net
Enter hostname of cluster member test2 on heartbeat channel 0: hb21
Looking for host hb21 (may take a few seconds)...
Host hb21 found
Channel name set to: hb21
Information about channel 1:
Channel type selected as net
Enter hostname of cluster member test2 on heartbeat channel 1: hb22
Looking for host hb22 (may take a few seconds)...
Host hb22 found
Channel name set to: hb22
Information about channel 2:
Channel type selected as net
Enter hostname of cluster member test2 on heartbeat channel 2: test2
Looking for host test2 (may take a few seconds)...
Host test2 found
Channel name set to: test2
Information about channel 3:
Channel type selected as serial
15
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Enter device name [/dev/ttyS0]: /dev/ttyS0
Device name set to: /dev/ttyS0
Information about power switch connected to member 1
Specify one of the following switches (NONE/RSA/RPS10/APC) [NONE]: NONE
Power switch type set to NONE
Information about watchdog to member 1
Choose one of the following watchdog drivers(NONE/softdog/...) [NONE]:
softdog
6)配置第三方 IP 地址
您需要配置两个节点都可以连接的第三方IP地址(要求能ping通,一般选择网
关作为第三方IP)。如果条件具备,建议您配置第三方IP。
如果条件实在不具备,输入 no,然后回车。
Do you want GreatTurbo Load Balance Server to determin network status?
(yes/no) []: yes
The IP address of a third computer is needed to determin network status.
The third computer should be up all the time, so it is recommend to use
gateway IP address here. Please use IP address instead of domain name.
Enter the IP address of a third computer []: 172.16.68.1
Looking for host 172.16.68.1 (may take a few seconds)...
Host 172.16.68.1 found
---------------------------------------Enter load balancer primary server IP [172.16.70.76]:
16
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Looking for IP address 172.16.70.76 (may take a few seconds)...
IP address 172.16.70.76 found
Load balancer primary server IP set to: 172.16.70.76
Enter load balancer backup server IP [172.16.70.138]:
Looking for IP address 172.16.70.138 (may take a few seconds)...
IP address 172.16.70.138 found
IP address corresponds to an interface on member 1
Load balancer backup server IP set to: 172.16.70.138
Enter load balancer network forwarding type(direct/nat/tunnel) [nat]:
Load balancer network forwarding type set to: nat
Enter NAT router IP address [192.168.0.88]:
NAT router IP address set to: 192.168.0.88
Enter NAT router netmask [255.255.255.0]:
NAT router netmask set to: 255.255.255.0
Enter NAT router device(e.g. eth1:1) [eth1:1]:
8)保存配置
如果以上内容全部配置完毕,member_config 将会询问是否保存改动。如果
刚才的配置没有错误,请输入"yes"或直接回车;
然后程序还会询问是否运行"diskutil -I"来初始化配置文件,这里请选择
"yes"。
注意:当GreatTurbo Load Balance Server的守护进程正在运行时,请不
要选择运行diskutil -I 来初始化配置文件,以免造成不可预知的后果。
Save changes? yes/no [yes]: yes
Writing to output configuration file...done.
Changes have been saved to /etc/opt/cluster/cluster.conf
---------------------------Setting up Quorum Partitions
---------------------------Run diskutil -I to set up the configure file now?
- Select 'yes' to clean up a previous install
- Select 'no' if you have just set them up on other member
and have not started the cluster services on that member
- Select 'no' if you are running it on other cluster member
Warning: Do not run 'diskutil -I' on a running cluster, because it would
have severe consequences. yes/no [no]: yes
Saving configuration information to configure file: done
help
cluster status
cluster monitor
cluster loglevel
cluster loglevel syncd
cluster loglevel svcmgr
cluster loglevel svccheck
cluster loglevel powerd
cluster loglevel heartbeat
cluster loglevel clumon
cluster heartbeat
cluster mail from
cluster mail to
cluster mail smtpserver
cluster mail level
cluster reload
cluster name
cluster edit
cluster backup
cluster restore
cluster saveas
cluster restorefrom
service add
service show state
service show config
service show services
service modify
service disable
service enable
service relocate
service delete
nbd add
nbd delete
nbd show
help apropos
help clear
help exit
help help
help cluster status
help cluster monitor
help cluster loglevel
help cluster reload
help cluster name
help cluster edit
21
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
help cluster backup
help cluster restore
help cluster saveas
help cluster restorefrom
help service add
help service show state
help service show config
help service show services
help service modify
help service disable
help service enable
help service relocate
help service delete
help nbd add
help nbd delete
help nbd show
6.配置单端口服务
1) 执行 cluadmin
[root@test1 root]# cluadmin
Sat May 9 17:48:57 CST 2006
…
2) 执行 service add(GreatTurbo Load Balance Server10 最多只支持 256
个服务)
cluadmin> service add
…
Currently defined services:
3) 输入服务的名字(如果有多个服务,服务的名字不能重复)
Service name: svc01
4) 输入服务的类别(只能选择 lb)
Service type (ha/lb): lb
22
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
5) 配置服务的优先节点
如果服务有优先节点,当优先节点启动 LB 时或者优先节点的网卡故障
恢复时,这个服务将会自动迁移到优先节点上运行。
优先节点缺省值为 None。直接回车表示选择 None,即不选择优先节点。
否则输入优先节点的 hostname 名称。
如果配置优先节点,那么所有服务必须选择同一优先节点。
Preferred member [None]: test1
6) 配置服务的用户脚本
服务的用户脚本是启动和停止应用程序的脚本。配置服务的用户脚本
时,请输入全路径名。所有 lb 服务的用户脚本需要保持相同。
如 果 两 个 调 度 节 点 同 时 作 为 realserver 使 用 , 那 么 使 用
/opt/cluster/bin/lbdirector-real-dr 作为用户脚本。
User script (required, e.g., /opt/cluster/bin/lbdirector-dr):
/opt/cluster/bin/lbdirector-dr
7) 配置服务检测脚本
所有 lb 服务只能使用同一指定脚本:/opt/cluster/bin/lbcheck
配置服务检测脚本时还需要指定如下的参数:
¾ “Check interval”是检测服务的时间间隔,建议根据用户应用
要求的切换时间设定合适的值,一般输入 5 秒,表示每隔 5 秒时间执
行一次检测脚本。
¾ “Check timeout”是检测脚本执行的超时时间,执行用户检测脚
本的超时时间,建议输入 30 秒。
¾ “Max error count”是允许服务连续错误的次数,一般输入 3 次,
表示出错 3 次后,服务进行切换。
Do you want to add a check script to the service (yes/no/?) [no]:
yes
Check Script Information
Check script (e.g., "/opt/cluster/bin/lbcheck" or None) [None]:
/opt/cluster/bin/lbcheck
Check interval (in seconds) [None]: 5
Check timeout (in seconds) [None]: 30
Max error count [None]: 3
8) 配置服务的端口号
23
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
对于单端口服务只需要输入实际服务运行的端口号即可。如 http 为 80,
ssh 为 22。
Application port(e.g., 80 or None) [None]: 22
9) 配置服务的协议
Protocol(tcp/udp) [tcp]: tcp
10) 配置服务的浮动 IP
服务可以绑定浮动 IP,浮动 IP 随着服务而浮动,也就是说这个 IP 所
在的节点也就是服务所在的节点。
注意:配置浮动IP时必须正确输入如下参数,注意随着IP地址的不同,
相应的子网掩码需与之对应。
¾ “address”是浮动 IP 的地址。
¾ “netmask”是浮动 IP 的子网掩码。
¾ “device” 是浮动 IP 所要绑定的网卡。
Virtual IP address(required): 172.16.71.111
Virtual IP network mask(optional) [None]: 255.255.255.0
Virtual IP device(required, e.g., eth0:1): eth0:1
Do you want to add server to the service (yes/no/?) [no]: y
Server Information
Server name(required): server1
Server address(required): 172.16.70.211
Server weight [None]: 1
Server active(yes/no) [yes]: yes
Do you want to (a)dd, (m)odify, (d)elete or (s)how a server, or
are you (f)inished adding servers: f
22) 设置停止服务失败时是否 reboot 机器
如果设为“yes”,当服务停止失败时,为了释放服务的资源,将自动 reboot
机器。
26
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
如果设为“no”,当服务停止失败时,不会自动 reboot 机器,需要用户手
动干预。
Reboot system if stop the service failed (yes/no/?) [yes]: yes
You will be prompted for information about the service.
Enter a question mark (?) at a prompt to obtain help.
Enter a colon (:) and a single-character command at a prompt to
do
one of the following:
c - Cancel and return to the top-level cluadmin command
r - Restart to the initial prompt while keeping previous responses
p - Proceed with the next prompt
27
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
0) svc01
c) cancel
Choose service to modify: 0
Modifying: svc01
Service is not disabled. Disable it? (yes/no/?) yes
8. 删除服务
如果要删除服务,请执行 cluadmin 的 service delete 命令。
然后输入列表中的服务的编号即可。
cluadmin> service delete
0) svc01
c) cancel
Choose service to delete: 0
Deleting svc01, are you sure? (yes/no/?): yes
Service svc01 disabled
Svc01 deleted.
9. 启动服务
如果在添加服务时没有启动服务,需要手动启动服务,请执行 cluadmin 的 service
enable 命令。
首先要求选择需要启动的服务,请输入列表中的服务的编号。
然后要求选择在哪个节点上启动服务,请输入节点的编号。
注意:启动一个服务的同时,所有的服务都将被启动。
cluadmin> service enable
0) svc01
c) cancel
Choose service to enable: 0
Are you sure? (yes/no/?) yes
0) test1
1) test2
c) cancel
28
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Choose member: 0
Enabling svc01 on member test1. Service enabled.
10. 停止服务
如果需要停止服务,请执行 cluadmin 的 service disable 命令。
首先选择要停止的服务,请输入列表中的服务的编号。
然后要求确认,请输入 yes。
注意: 停止一个服务的同时,所有的服务都将被停止。
cluadmin> service disable
0) svc01
c) cancel
Choose service to disable: 0
Are you sure? (yes/no/?) yes
Disabling svc01. Service disabled.
11. 切换服务
如果需要把在一个节点上运行的服务切换到另一个节点上,请执行 cluadmin 的
service relocate 命令。
首先选择要切换的服务,请输入列表中的服务的编号。
然后要求确认,请输入 yes。
注意:切换一个服务的同时,所有的服务都将被切换。
cluadmin> service relocate
0) svc01
c) cancel
Choose service to relocate: 0
Are you sure? (yes/no/?) yes
Relocating svc01. Service relocated.
29
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
如果所有的服务添加完成,请直接到第八章继续阅读随后内容。
30
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
第5章
配置 TUN 方式的服务
配置服务前要求用户在安装软件和初始化过程中均选择 tun 作为负载均衡技术。
GreatTurbo Load Balance Server10 在调度节点正常启动后,就可以开始将用
户的应用配置成负载均衡的服务了。本章说明如何配置使用 tun 方式的服务,
对服务进行配置的过程如下:
(1) 配置 realserver 环境
(2) 配置 director 环境
(3) 在 director 上配置服务
cluadmin>[Tab] [Tab]
apropos
clear
exit
help
cluster status
cluster monitor
cluster loglevel
cluster loglevel syncd
cluster loglevel svcmgr
cluster loglevel svccheck
cluster loglevel powerd
cluster loglevel heartbeat
cluster loglevel clumon
cluster heartbeat
cluster mail from
cluster mail to
cluster mail smtpserver
cluster mail level
cluster reload
cluster name
cluster edit
cluster backup
cluster restore
cluster saveas
cluster restorefrom
service add
service show state
service show config
service show services
service modify
service disable
service enable
service relocate
service delete
nbd add
nbd delete
nbd show
help apropos
help clear
help exit
help help
help cluster status
help cluster monitor
33
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
help cluster loglevel
help cluster reload
help cluster name
help cluster edit
help cluster backup
help cluster restore
help cluster saveas
help cluster restorefrom
help service add
help service show state
help service show config
help service show services
help service modify
help service disable
help service enable
help service relocate
help service delete
help nbd add
help nbd delete
help nbd show
6.配置单端口服务
1) 执行 cluadmin
[root@test1 root]# cluadmin
Sat May 9 17:48:57 CST 2006
…
2) 执行 service add(GreatTurbo Load Balance Server10 最多只支持 256
个服务)
cluadmin> service add
…
Currently defined services:
3) 输入服务的名字(如果有多个服务,服务的名字不能重复)
Service name: svc01
4) 输入服务的类别(只能选择 lb)
34
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Service type (ha/lb): lb
5) 配置服务的优先节点
如果服务有优先节点,当优先节点启动 LB 时或者优先节点的网卡故障
恢复时,这个服务将会自动迁移到优先节点上运行。
优先节点缺省值为 None。直接回车表示选择 None,即不选择优先节点。
否则输入优先节点的 hostname 名称。
如果配置优先节点,那么所有服务必须选择同一优先节点。
Preferred member [None]: test1
6) 配置服务的用户脚本
服务的用户脚本是启动和停止应用程序的脚本。配置服务的用户脚本
时,请输入全路径名。所有 lb 服务的用户脚本需要保持相同。
如 果 两 个 调 度 节 点 同 时 作 为 realserver 使 用 , 那 么 使 用
/opt/cluster/bin/lbdirector-real-tun 作为用户脚本。
User script (required, e.g., /opt/cluster/bin/lbdirector-dr):
/opt/cluster/bin/lbdirector-tun
7) 配置服务检测脚本
所有 lb 服务只能使用同一指定脚本:/opt/cluster/bin/lbcheck
配置服务检测脚本时还需要指定如下的参数:
¾ “Check interval”是检测服务的时间间隔,建议根据用户应用
要求的切换时间设定合适的值,一般输入 5 秒,表示每隔 5 秒时间执
行一次检测脚本。
¾ “Check timeout”是检测脚本执行的超时时间,执行用户检测脚
本的超时时间,建议输入 30 秒。
¾ “Max error count”是允许服务连续错误的次数,一般输入 3 次,
表示出错 3 次后,服务进行切换。
Do you want to add a check script to the service (yes/no/?) [no]:
yes
Check Script Information
Check script (e.g., "/opt/cluster/bin/lbcheck" or None) [None]:
/opt/cluster/bin/lbcheck
Check interval (in seconds) [None]: 5
Check timeout (in seconds) [None]: 30
35
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Max error count [None]: 3
8) 配置服务的端口号
对于单端口服务只需要输入实际服务运行的端口号即可。如 http 为 80,
ssh 为 22。
Application port(e.g., 80 or None) [None]: 22
9) 配置服务的协议
Protocol(tcp/udp) [tcp]: tcp
10) 配置服务的浮动 IP
服务可以绑定浮动 IP,浮动 IP 随着服务而浮动,也就是说这个 IP 所
在的节点也就是服务所在的节点。
注意:配置浮动IP时必须正确输入如下参数,注意随着IP地址的不同,
相应的子网掩码需与之对应。
¾ “address”是浮动 IP 的地址。
¾ “netmask”是浮动 IP 的子网掩码。
¾ “device” 是浮动 IP 所要绑定的网卡。
Virtual IP address(required): 172.16.71.111
Virtual IP network mask(optional) [None]: 255.255.255.0
Virtual IP device(required, e.g., eth0:1): eth0:1
You will be prompted for information about the service.
Enter a question mark (?) at a prompt to obtain help.
39
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Enter a colon (:) and a single-character command at a prompt to
do
one of the following:
c - Cancel and return to the top-level cluadmin command
r - Restart to the initial prompt while keeping previous responses
p - Proceed with the next prompt
0) svc01
c) cancel
Choose service to modify: 0
Modifying: svc01
Service is not disabled. Disable it? (yes/no/?) yes
8. 删除服务
如果要删除服务,请执行 cluadmin 的 service delete 命令。
然后输入列表中的服务的编号即可。
cluadmin> service delete
0) svc01
c) cancel
Choose service to delete: 0
Deleting svc01, are you sure? (yes/no/?): yes
Service svc01 disabled
Svc01 deleted.
9. 启动服务
如果在添加服务时没有启动服务,需要手动启动服务,请执行 cluadmin 的 service
enable 命令。
首先要求选择需要启动的服务,请输入列表中的服务的编号。
然后要求选择在哪个节点上启动服务,请输入节点的编号。
注意:启动一个服务的同时,所有的服务都将被启动。
cluadmin> service enable
40
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
0) svc01
c) cancel
Choose service to enable: 0
Are you sure? (yes/no/?) yes
0) test1
1) test2
c) cancel
Choose member: 0
Enabling svc01 on member test1. Service enabled.
10. 停止服务
如果需要停止服务,请执行 cluadmin 的 service disable 命令。
首先选择要停止的服务,请输入列表中的服务的编号。
然后要求确认,请输入 yes。
注意: 停止一个服务的同时,所有的服务都将被停止。
cluadmin> service disable
0) svc01
c) cancel
Choose service to disable: 0
Are you sure? (yes/no/?) yes
Disabling svc01. Service disabled.
11. 切换服务
如果需要把在一个节点上运行的服务切换到另一个节点上,请执行 cluadmin 的
service relocate 命令。
首先选择要切换的服务,请输入列表中的服务的编号。
然后要求确认,请输入 yes。
注意:切换一个服务的同时,所有的服务都将被切换。
cluadmin> service relocate
0) svc01
c) cancel
41
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Choose service to relocate: 0
Are you sure? (yes/no/?) yes
Relocating svc01. Service relocated.
cluadmin>[Tab] [Tab]
apropos
clear
exit
help
cluster status
cluster monitor
cluster loglevel
cluster loglevel syncd
cluster loglevel svcmgr
cluster loglevel svccheck
cluster loglevel powerd
cluster loglevel heartbeat
cluster loglevel clumon
cluster heartbeat
cluster mail from
cluster mail to
cluster mail smtpserver
cluster mail level
cluster reload
cluster name
cluster edit
cluster backup
cluster restore
cluster saveas
cluster restorefrom
service add
service show state
service show config
service show services
service modify
service disable
service enable
service relocate
service delete
nbd add
nbd delete
nbd show
help apropos
45
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
help clear
help exit
help help
help cluster status
help cluster monitor
help cluster loglevel
help cluster reload
help cluster name
help cluster edit
help cluster backup
help cluster restore
help cluster saveas
help cluster restorefrom
help service add
help service show state
help service show config
help service show services
help service modify
help service disable
help service enable
help service relocate
help service delete
help nbd add
help nbd delete
help nbd show
6.配置单端口服务
1) 执行 cluadmin
[root@test1 root]# cluadmin
Sat May 9 17:48:57 CST 2006
…
2) 执行 service add(GreatTurbo Load Balance Server10 最多只支持 256
个服务)
cluadmin> service add
…
Currently defined services:
3) 输入服务的名字(如果有多个服务,服务的名字不能重复)
46
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Service name: svc01
4) 输入服务的类别(只能选择 lb)
Service type (ha/lb): lb
5) 配置服务的优先节点
如果服务有优先节点,当优先节点启动 LB 时或者优先节点的网卡故障
恢复时,这个服务将会自动迁移到优先节点上运行。
优先节点缺省值为 None。直接回车表示选择 None,即不选择优先节点。
否则输入优先节点的 hostname 名称。
如果配置优先节点,那么所有服务必须选择同一优先节点。
Preferred member [None]: test1
6) 配置服务的用户脚本
服务的用户脚本是启动和停止应用程序的脚本。配置服务的用户脚本
时,请输入全路径名。所有 lb 服务的用户脚本需要保持相同。
如 果 两 个 调 度 节 点 同 时 作 为 realserver 使 用 , 那 么 使 用
/opt/cluster/bin/lbdirector-real-nat 作为用户脚本。
User script (required, e.g., /opt/cluster/bin/lbdirector-dr):
/opt/cluster/bin/lbdirector-nat
7) 配置服务检测脚本
所有 lb 服务只能使用同一指定脚本:/opt/cluster/bin/lbcheck
配置服务检测脚本时还需要指定如下的参数:
¾ “Check interval”是检测服务的时间间隔,建议根据用户应用
要求的切换时间设定合适的值,一般输入 5 秒,表示每隔 5 秒时间执
行一次检测脚本。
¾ “Check timeout”是检测脚本执行的超时时间,执行用户检测脚
本的超时时间,建议输入 30 秒。
¾ “Max error count”是允许服务连续错误的次数,一般输入 3 次,
表示出错 3 次后,服务进行切换。
Do you want to add a check script to the service (yes/no/?) [no]:
yes
47
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Check Script Information
Check script (e.g., "/opt/cluster/bin/lbcheck" or None) [None]:
/opt/cluster/bin/lbcheck
Check interval (in seconds) [None]: 5
Check timeout (in seconds) [None]: 30
Max error count [None]: 3
8) 配置服务的端口号
对于单端口服务只需要输入实际服务运行的端口号即可。如 http 为 80,
ssh 为 22。
Application port(e.g., 80 or None) [None]: 22
9) 配置服务的协议
Protocol(tcp/udp) [tcp]: tcp
10) 配置服务的浮动 IP
服务可以绑定浮动 IP,浮动 IP 随着服务而浮动,也就是说这个 IP 所
在的节点也就是服务所在的节点。
注意:配置浮动IP时必须正确输入如下参数,注意随着IP地址的不同,
相应的子网掩码需与之对应。
¾ “address”是浮动 IP 的地址。
¾ “netmask”是浮动 IP 的子网掩码。
¾ “device” 是浮动 IP 所要绑定的网卡。
Virtual IP address(required): 172.16.71.111
Virtual IP network mask(optional) [None]: 255.255.255.0
Virtual IP device(required, e.g., eth0:1): eth0:1
Do you want to add server to the service (yes/no/?) [no]: y
Server Information
Server name(required): server1
50
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Server address(required): 192.168.0.18
Server weight [None]: 1
Server active(yes/no) [yes]: yes
Do you want to (a)dd, (m)odify, (d)elete or (s)how a server, or
are you (f)inished adding servers: f
22) 设置停止服务失败时是否 reboot 机器
如果设为“yes”,当服务停止失败时,为了释放服务的资源,将自动 reboot
机器。
如果设为“no”,当服务停止失败时,不会自动 reboot 机器,需要用户手
动干预。
Reboot system if stop the service failed (yes/no/?) [yes]: yes
You will be prompted for information about the service.
Enter a question mark (?) at a prompt to obtain help.
Enter a colon (:) and a single-character command at a prompt to
do
one of the following:
c - Cancel and return to the top-level cluadmin command
r - Restart to the initial prompt while keeping previous responses
p - Proceed with the next prompt
0) svc01
c) cancel
Choose service to modify: 0
Modifying: svc01
Service is not disabled. Disable it? (yes/no/?) yes
8. 删除服务
如果要删除服务,请执行 cluadmin 的 service delete 命令。
然后输入列表中的服务的编号即可。
cluadmin> service delete
0) svc01
c) cancel
Choose service to delete: 0
Deleting svc01, are you sure? (yes/no/?): yes
Service svc01 disabled
Svc01 deleted.
9. 启动服务
如果在添加服务时没有启动服务,需要手动启动服务,请执行 cluadmin 的 service
enable 命令。
首先要求选择需要启动的服务,请输入列表中的服务的编号。
然后要求选择在哪个节点上启动服务,请输入节点的编号。
52
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
注意:启动一个服务的同时,所有的服务都将被启动。
cluadmin> service enable
0) svc01
c) cancel
Choose service to enable: 0
Are you sure? (yes/no/?) yes
0) test1
1) test2
c) cancel
Choose member: 0
Enabling svc01 on member test1. Service enabled.
10. 停止服务
如果需要停止服务,请执行 cluadmin 的 service disable 命令。
首先选择要停止的服务,请输入列表中的服务的编号。
然后要求确认,请输入 yes。
注意: 停止一个服务的同时,所有的服务都将被停止。
cluadmin> service disable
0) svc01
c) cancel
Choose service to disable: 0
Are you sure? (yes/no/?) yes
Disabling svc01. Service disabled.
11. 切换服务
如果需要把在一个节点上运行的服务切换到另一个节点上,请执行 cluadmin 的
service relocate 命令。
首先选择要切换的服务,请输入列表中的服务的编号。
然后要求确认,请输入 yes。
注意:切换一个服务的同时,所有的服务都将被切换。
cluadmin> service relocate
53
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
0) svc01
c) cancel
Choose service to relocate: 0
Are you sure? (yes/no/?) yes
Relocating svc01. Service relocated.
如果所有的服务添加完成,请到第八章继续阅读随后内容。
54
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
第7章
配置 DR 方式的多端口服务
配置服务前要求用户在安装软件和初始化过程中均选择 dr 作为负载均衡技术。
GreatTurbo Load Balance Server10 在调度节点正常启动后,就可以开始将用
户的应用配置成负载均衡的服务了。本章说明如何配置使用 dr 方式的多端口服
务,对服务进行配置的过程如下:
cluadmin>[Tab] [Tab]
apropos
clear
exit
help
cluster status
cluster monitor
cluster loglevel
cluster loglevel syncd
cluster loglevel svcmgr
cluster loglevel svccheck
cluster loglevel powerd
cluster loglevel heartbeat
cluster loglevel clumon
cluster heartbeat
cluster mail from
cluster mail to
cluster mail smtpserver
cluster mail level
cluster reload
cluster name
cluster edit
cluster backup
cluster restore
cluster saveas
cluster restorefrom
service add
service show state
service show config
service show services
service modify
service disable
service enable
service relocate
service delete
nbd add
nbd delete
57
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
nbd show
help apropos
help clear
help exit
help help
help cluster status
help cluster monitor
help cluster loglevel
help cluster reload
help cluster name
help cluster edit
help cluster backup
help cluster restore
help cluster saveas
help cluster restorefrom
help service add
help service show state
help service show config
help service show services
help service modify
help service disable
help service enable
help service relocate
help service delete
help nbd add
help nbd delete
help nbd show
6.配置多端口服务
1) 执行 cluadmin
[root@test1 root]# cluadmin
Sat May 9 17:48:57 CST 2006
…
2) 执行 service add(GreatTurbo Load Balance Server10 最多只支持 256
个服务)
cluadmin> service add
…
Currently defined services:
58
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
3) 输入服务的名字(如果有多个服务,服务的名字不能重复)
Service name: svc01
4) 输入服务的类别(只能选择 lb)
Service type (ha/lb): lb
5) 配置服务的优先节点
如果服务有优先节点,当优先节点启动 LB 时或者优先节点的网卡故障
恢复时,这个服务将会自动迁移到优先节点上运行。
优先节点缺省值为 None。直接回车表示选择 None,即不选择优先节点。
否则输入优先节点的 hostname 名称。
如果配置优先节点,那么所有服务必须选择同一优先节点。
Preferred member [None]: test1
6) 配置服务的用户脚本
服务的用户脚本是启动和停止应用程序的脚本。配置服务的用户脚本
时,请输入全路径名。所有 lb 服务的用户脚本需要保持相同。
如 果 两 个 调 度 节 点 同 时 作 为 realserver 使 用 , 那 么 使 用
/opt/cluster/bin/lbdirector-real-fwm-dr 作为用户脚本。
User script (required, e.g., /opt/cluster/bin/lbdirector-dr):
/opt/cluster/bin/lbdirector-fwm-dr
7) 配置服务检测脚本
所有 lb 服务只能使用同一指定脚本:/opt/cluster/bin/lbcheck
配置服务检测脚本时还需要指定如下的参数:
¾ “Check interval”是检测服务的时间间隔,建议根据用户应用
要求的切换时间设定合适的值,一般输入 5 秒,表示每隔 5 秒时
间执行一次检测脚本。
¾ “Check timeout”是检测脚本执行的超时时间,执行用户检测脚
本的超时时间,建议输入 30 秒。
¾ “Max error count”是允许服务连续错误的次数,一般输入 3 次,
表示出错 3 次后,服务进行切换。
59
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Do you want to add a check script to the service (yes/no/?) [no]:
yes
Check Script Information
Check script (e.g., "/opt/cluster/bin/lbcheck" or None) [None]:
/opt/cluster/bin/lbcheck
Check interval (in seconds) [None]: 5
Check timeout (in seconds) [None]: 30
Max error count [None]: 3
8) 配置服务的端口号
对于多端口服务该项可以不用填写。
Application port(e.g., 80 or None) [None]:
9) 配置服务的协议
Protocol(tcp/udp) [tcp]: tcp
10) 配置服务的浮动 IP
服务可以绑定浮动 IP,浮动 IP 随着服务而浮动,也就是说这个 IP 所
在的节点也就是服务所在的节点。
注意:配置浮动IP时必须正确输入如下参数,注意随着IP地址的不同,
相应的子网掩码需与之对应。
¾ “address”是浮动 IP 的地址。
¾ “netmask”是浮动 IP 的子网掩码。
¾ “device” 是浮动 IP 所要绑定的网卡。
Virtual IP address(required): 172.16.71.111
Virtual IP network mask(optional) [None]: 255.255.255.0
Virtual IP device(required, e.g., eth0:1): eth0:1
Do you want to add server to the service (yes/no/?) [no]: y
Server Information
62
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
Server name(required): server1
Server address(required): 172.16.70.211
Server weight [None]: 1
Server active(yes/no) [yes]: yes
Do you want to (a)dd, (m)odify, (d)elete or (s)how a server, or
are you (f)inished adding servers: f
22) 设置停止服务失败时是否 reboot 机器
如果设为“yes”,当服务停止失败时,为了释放服务的资源,将自动 reboot
机器。
如果设为“no”,当服务停止失败时,不会自动 reboot 机器,需要用户手
动干预。
Reboot system if stop the service failed (yes/no/?) [yes]: yes
You will be prompted for information about the service.
Enter a question mark (?) at a prompt to obtain help.
Enter a colon (:) and a single-character command at a prompt to
do
one of the following:
c - Cancel and return to the top-level cluadmin command
r - Restart to the initial prompt while keeping previous responses
p - Proceed with the next prompt
0) svc01
c) cancel
Choose service to modify: 0
Modifying: svc01
Service is not disabled. Disable it? (yes/no/?) yes
8. 删除服务
如果要删除服务,请执行 cluadmin 的 service delete 命令。
然后输入列表中的服务的编号即可。
cluadmin> service delete
0) svc01
c) cancel
Choose service to delete: 0
Deleting svc01, are you sure? (yes/no/?): yes
Service svc01 disabled
Svc01 deleted.
9. 启动服务
如果在添加服务时没有启动服务,需要手动启动服务,请执行 cluadmin 的 service
enable 命令。
首先要求选择需要启动的服务,请输入列表中的服务的编号。
64
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
然后要求选择在哪个节点上启动服务,请输入节点的编号。
注意:启动一个服务的同时,所有的服务都将被启动。
cluadmin> service enable
0) svc01
c) cancel
Choose service to enable: 0
Are you sure? (yes/no/?) yes
0) test1
1) test2
c) cancel
Choose member: 0
Enabling svc01 on member test1. Service enabled.
10. 停止服务
如果需要停止服务,请执行 cluadmin 的 service disable 命令。
首先选择要停止的服务,请输入列表中的服务的编号。
然后要求确认,请输入 yes。
注意: 停止一个服务的同时,所有的服务都将被停止。
cluadmin> service disable
0) svc01
c) cancel
Choose service to disable: 0
Are you sure? (yes/no/?) yes
Disabling svc01. Service disabled.
11. 切换服务
如果需要把在一个节点上运行的服务切换到另一个节点上,请执行 cluadmin 的
service relocate 命令。
首先选择要切换的服务,请输入列表中的服务的编号。
65
GREATTURBO LOAD BALANCE SERVER10 用户快速安装手册
然后要求确认,请输入 yes。
注意:切换一个服务的同时,所有的服务都将被切换。
cluadmin> service relocate
0) svc01
c) cancel
Choose service to relocate: 0
Are you sure? (yes/no/?) yes
Relocating svc01. Service relocated.
可以利用以下的命令检查各守护进程的运行状态:
/etc/init.d/cluster status
GreatTurbo Load Balance Server10 启动后,正常的运行状态为:
[root@test1 root]# /etc/init.d/cluster status
clumon (pid 32244) is running.
hb (pid 32269) is running.
svcmgr (pid 32251) is running.
syncd (pid 32228) is running.
powerd (pid 32273) is running.
svccheck (pid 32278) is running.
[root@test1 root]# uninstall_lb
Following RPMs will be uninstalled:
*) GreatTurbo Load Balance Server
*) GreatTurbo Load Balance Server real server Agents
Do you want to continue? [y/n] y
Turbolinux GreatTurbo Load Balance Server uninstallation finished.