GreatTurbo Cluster Server 10 目前只支持 GTES10/TDS10 操作系统平台。
GreatTurbo Cluster Server 10 暂不支持并行处理的应用。也就是说不支
持同一个应用在两个节点同时并发运行的应用。例如:Oracle 9i RAC。
GreatTurbo Cluster Server 10 配置的所有负载均衡(LB)服务都必须采用
同一种 ip 负载均衡技术。
GreatTurbo Cluster Server 10 配置的所有 LB 服务都必须运行在同一调度
节点,并且只能对全部服务进行统一操作,如 Enable、Disable、Relocate
等。
GreatTurbo Cluster Server 10 的稳定性需要 OS 提供支撑。如果当操作系
统宕机时,可能会出现因 OS 没有彻底释放资源而导致 GreatTurbo Cluster Server 10 系统丧失高可用功能。在这种情况下,除非有额外的硬件设备,
否则 GreatTurbo Cluster Server 10 并不能够完全保证能够自动恢复操作
系统。此时需要用户手工干预操作系统,对崩溃的操作系统进行复位操作。
也就是说,当 OS 宕机时(尽管这种可能性很小),如果用户没有以下硬件
作为保障,仍然有可能会出现用户业务中断的可能:
1)采用电子开关。
2)服务器节点采用支持硬件 watchdog 功能的主板。
配置 GreatTurbo Cluster Server 10 的两台计算机节点的心跳方式时,必
须保证至少一条心跳通道正常工作。如果两台节点之间的所有心跳通道都发
1
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
生故障而不能正常连通,有可能会导致 GreatTurbo Cluster Server 10 发
生裂脑(split-brain),发生裂脑后,GreatTurbo Cluster Server 10 有
可能会导致用户的资源不一致。为了完全杜绝裂脑现象的发生,可以采取如
下方法:
1) 采用电子开关。
2) 使用第三方参考 IP,有关第三方参考 IP 的介绍将在第三章详述。
其中第一种办法是使用硬件的办法,由于电子开关是额外的电子硬件设
备,需要用户自行购买,所以实际中采用这种方式并不多;而第二种方式是
软件的方法,可以保证 GreatTurbo Cluster Server 10 发生裂脑时,用户
的资源不受损失。这需要用户提供一个能长期(永久性)正常工作的参考 IP
地址。
2.GreatTurbo Cluster Server 10 的相关术语
节点 : 指运行 GreatTurbo Cluster Server 10 程序的计算机。
服务 : 也叫做资源组,指用户应用相关的一组资源的集合, 包括用户应用的
进程资源,磁盘资源,网卡资源,浮动 IP 资源,drbd 镜像资源等。服务可以是其
中几种资源或者全部资源的组合。 服务也可以为空,即不包括任何资源。通常用户
的一个应用与 GreatTurbo Cluster Server 10 的一个服务对应。GreatTurbo Cluster Server 10 的服务分为两种:高可用服务(HA 服务)和负载均衡服务(LB
服务)。HA 服务针对高可用集群确保高可用的对象。LB 服务是负载均衡系统进行
调度的具体应用,例如 Oracle 服务。HA 服务也可以是具体商业应用。
负载调度器(load balancer):也成为调度节点,它是整个负载均衡集群对
外的前端机。负责将客户的请求发送到一组真实服务器上执行, 而客户认为服务是
来自一个 IP 地址(我们可称之为虚拟 IP 地址)上的。在 GreatTurbo Cluster Server 10 典型应用中,负载调度器需要 2 个或多个,GreatTurbo Cluster Server 10 的
高可用方案保证负载调度器能稳定、24×7 不间断的运行。
真实服务器 (real server)
:也叫服务器池(server pool),是负载均衡
集群中真正执行客户请求的服务器,执行的服务有 WEB、MAIL、FTP 和 DNS 等。用
户请求由调度节点分发给真实服务器,由真实服务器来处理用户请求。
例如:服务在 A 节点发生故障的时刻为 T(a),服务自动迁移到 B 节点并在 B
节点成功运行的时刻为 T(b),那么服务的迁移时间 T(relocate)=T(b)-T(a)。另一
方面, 从整个迁移的子过程来看, 服务迁移的时间 (近似等于)≈服务在 A 节点检
测到错误的时间+服务在 A 节点停止的时间+服务在 B 节点启动的时间。其中,服
务的启动/停止时间是由用户的应用来决定的,一般不能够进行调整,而服务检测
到错误的时间可以通过 GreatTurbo Cluster Server 10 的配置参数来进行调整。
服务检测到错误的时间 = 服务检查的间隔时间(check interval) * 服务
连续检查到错误的次数(check count)。Check interval 和 check count 参数可
以在配置服务的检测脚本时进行指定。这样,只有当 GreatTurbo Cluster Server 10 检测到连续出错次数达到指定的次数后,GreatTurbo Cluster Server 10 才认
为服务确实出错。服务确实出错后,会自动触发 GreatTurbo Cluster Server 10
进行服务的迁移。
裂脑(split-brain): 所谓裂脑,是指 GreatTurbo Cluster Server 10 的
高可用主备节点之间彼此失去了联系,但是单个节点的 GreatTurbo Cluster Server 10 仍然运行正常。发生裂脑的充要条件是:1. 系统的主备节点之间的所有心跳通
道都发生了故障,导致系统的两个节点失去了任何联系。2. 两个节点的 GreatTurbo Cluster Server 10 软件仍在正常运行。
其中 hb11、hb12、hb13 对应节点 A 的eth1、eth2、eth3 三个网卡;hb21、hb22、
hb23 对应节点 B 的eth1、eth2、eth3 三个网卡。
10
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
第2章
安装 GreatTurbo Cluster Server 10
在做好了第一章中所列的各项准备工作之后,现在就可以安装 GreatTurbo Cluster Server 10 软件了。
安装过程如下:
1) 确认您所使用的 GreatTurbo Cluster Server 10 产品的功能级别
2) 安装 GreatTurbo Cluster Server 10
3) 注册 GreatTurbo Cluster Server 10
1.确认您所使用的 GreatTurbo Cluster Server 10 产品的类型
GreatTurbo Cluster Server 10 产品分为两个功能级别,请确认您购买的产
品属于哪一个级别。第一级别只能够满足第一章提到的 HA 应用的第一类和第二类
的用户应用,第二级别能够全部满足第一章提到的三类 HA 应用。也就是说,第一
级别不支持磁盘镜像设备(drbd)功能,第二级别支持 drbd 功能。
当然,具体选购何种级别功能的 GreatTurbo Cluster Server 10,完全取决于
您需要满足的应用类型。确认了 GreatTurbo Cluster Server 10 的功能级别之后,
就可以开始安装 GreatTurbo Cluster Server 10 了。
2.安装 GreatTurbo Cluster Server 10
请分别在节点 A 和节点 B 安装 GreatTurbo Cluster Server 10 软件。
1)如果您购买的是正版的 GreatTurbo Cluster Server 10 产品,GreatTurbo
Cluster Server 10 会附带软件的安装光盘。插入安装光盘到节点的光驱并 mount
后,光盘根目录中有一个安装文件 install_cluster,请运行如下命令进行安装。
根据您的操作系统版本并参照其提示完成 GreatTurbo Cluster Server 10 的安装。
如果您的 GreatTurbo Cluster Server 10 产品支持 drbd,请在“Do you want
to use drbd ?”时选择 yes,否则选择 no。
例如:
[root@test1 root]# mount /dev/cdrom /mnt/cdrom
[root@test1 root]# cd /mnt/cdrom
[root@test1 cdrom]# ./install_cluster
Following RPMs will be installed or upgraded to newer version if
necessary:
11
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
*) pdksh
*) lsof
*) sg_utils
*) drbd
*) GreatTurbo Cluster Server
*) GreatTurbo Cluster Server Agents
Please select the operatating system version you are using:
0) GreatTurbo Enterprise Server 10 (x86_32)
1) GreatTurbo Enterprise Server 10 (x86_64)
2) GreatTurbo Enterprise Server 10 (OpenPower ppc64)
3) GreatTurbo Enterprise Server 10 (IA64)
4) cancel
Please select an OS version, then the installation procedure will begin.
Select 4 to abort [0/1/2/3/4]: 0
Do you want to use drbd? (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]: 1
2)如果您是从拓林思公司下载的试用产品(使用有效期为 1 个月),您下载的
GreatTurbo Cluster Server 10 将是一个 ISO 文件和 md5 检验文件。ISO 文件的名称一般为 greatturbocluster-10.x-x.iso , md5文件的名称一般为
greatturbocluster-10.x-x.iso.md5。为了验证您下载的 iso 文件是否正确,可以
先对您的 iso 文件进行 md5sum 操作, 如果发现 md5sum 运行命令所得结果,和您下
载的 md5 文件的内容一致,则表明您下载的 ISO 文件正确无误。
证明您下载的 ISO 文件正确之后, 请先将 ISO 文件 mount 到某一个目录, 然后
运行这个目录下的 install_cluster 安装程序进行安装,接下来的过程同从光盘安
装时介绍的一样。
[root@test1 root]# mount –o loop ./ greatturbocluster-10.0-1.iso
/mnt/iso
[root@test1 root]# cd /mnt/iso
[root@test1 iso]# ./install_cluster
12
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
3.注册 GreatTurbo Cluster Server 10 产品
安装完GreatTurbo Cluster Server 10 的软件之后,您需要注册GreatTurbo Cluster Server 10 产品,也就是说需要安装 GreatTurbo Cluster Server 10
的 license,以保证 GreatTurbo Cluster Server 10 正常运行。
-----------------------------------Cluster Member Configuration Utility
Version:10.0 Built: Fri Jun 9 16:51:41 CST 2006
This utility sets up the member systems of a 2-node GreatTurbo Cluster
Server 10 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
16
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
o Information about the type of channels and their names
o Power switch type and device name
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]:
---------------------------------------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
3)配置本地节点的heartbeat 选项:
GreatTurbo Cluster Server 10 的 heartbeat 通道有两类:网络(net)和串口
(serial)。 对于网络,您需要配置 heartbeat 使用的网络设备对应的别名;对于串
口,您需要配置 heartbeat 使用的串口的设备名,例如 /dev/ttyS0。
注意:为了获得更高的可用性,GreatTurbo Cluster Server 10 建议配置一
条串口通道以及至少两条直连网络心跳通道,并且必须将应用所在的网卡配置成通
17
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
道,配置通道的顺序为:先配置所有的直连网线通道,再配置应用所在网卡的通道,
最后配置串口通道。
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
4)配置本地节点的power switch 和 watchdog 选项:
如果没有硬件电子开关设备,请输入 NONE。如果有硬件电子开关,输入相应的
电子开关对应的类型,如:RSA、RPS10 或者是 APC。
软件级的 watchdog 可以用来保证 GreatTurbo Cluster Server 10 程序的健壮
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
19
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
Channel name set to: test2
Information about channel 3:
Channel type selected as serial
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)配置磁盘心跳设备
利用共享 raw 磁盘分区作为心跳通道后,只要主备节点能够访问共享数据,就
不会发生裂脑, 从而有效的确保了共享数据的一致性。如果需要配置磁盘心跳,请
选择 yes 继续配置。如果条件实在不具备,输入 no,然后回车。
---------------------------Setting up raw disk heartbeat
----------------------------
Do you want add raw disk heartbeat device? (yes/no) [yes]:
The raw disk heartbeat device must be a raw disk device.
To enhance redundancy, need to configure two raw disk devices.
Enter the name of first raw disk heartbeat device [/dev/raw/raw1]:
/dev/raw/raw1
Enter the name of second raw disk heartbeat device [/dev/raw/raw2]:
/dev/raw/raw1
Now begin to initialize the raw disk heartbeat device, it will cause the
data in the devices lost.
Are you sure to initialize the raw devices which you input? (yes/no)
[yes]:yes
7)配置第三方IP 地址
您需要配置两个节点都可以连接的第三方 IP 地址 (要求能ping 通, 一般选择
网关作为第三方 IP)。第三方 IP 能配置多个,以进一步提高系统高可用性。如果
20
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
要使配置的第三方 IP 生效,必须将两个节点的对外网络设置为备用心跳。如果条
件具备,建议您配置第三方 IP。
如果条件实在不具备,输入 no,然后回车。
------------------------------Setting up the third partner ip
-------------------------------
Do you want cluster to determine network status? (yes/no) [yes]:
The IP address of third computer is needed to determine 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.
If you want input multiple third part IP, please use comma to separate.
For example, 192.168.0.1,192.168.0.3,192.168.0,10
Enter the IP address of third computer [172.16.76.1]:
---------------------------------------Enter load balancer primary 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 0
Load balancer primary server IP set to: 172.16.70.138
Enter load balancer backup server IP [172.16.70.76]:
Looking for IP address 172.16.70.76 (may take a few seconds)...
IP address 172.16.70.76 found
Load balancer backup server IP set to: 172.16.70.76
Enter load balancer network forwarding type(direct/nat/tunnel)
[direct]: nat
Load balancer network forwarding type set to: nat
Enter NAT router IP address: 172.16.70.76
21
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
NAT router IP address set to: 172.16.70.76
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
NAT router device set to: eth1:1
-----------------------------------The following choices will be saved:
----------------------------------- ……
9)保存配置
如果以上内容全部配置完毕,member_config 将会询问是否保存改动。如果
刚才的配置没有错误,请输入"yes"或直接回车;
然后程序还会询问是否运行"diskutil -I"来初始化配置文件,这里请选择
"yes"。
注意:当 GreatTurbo Cluster Server 10 的守护进程正在运行时,请不要
选择运行 diskutil -I 来初始化配置文件,以免造成不可预知的后果。
Save changes? yes/no [yes]:
Writing to output configuration file...done.
Changes have been saved to /etc/opt/cluster/cluster.conf.
---------------------------Setting up Configure File
---------------------------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
---------------------------------------------------------------Setup on this member is complete. If errors have been reported,
correct them.
If you have not already set up the other cluster member, before
running member_config, invoke the following operation on the
22
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
other cluster member:
copy /etc/opt/cluster/cluster_raw.conf to another node with the same path.
cluster daemons on each cluster member by invoking the cluster start
script located in the System V init directory. For example:
# /etc/rc.d/init.d/cluster start
LOG_EMERG=0 # system is unusable
LOG_ALERT=1 # action must be taken immediately
LOG_CRIT=2 # critical conditions
LOG_ERR=3 # error conditions
LOG_WARNING=4 # warning conditions
LOG_NOTICE=5 # normal but significant condition
# start your application, put actual start actions here
su - oracle -c "dbstart"
if [ $? -eq 0 ]; then
# should check application process here
pmon=`ps -ef | egrep ora_pmon_$ORACLE_SID | grep -v grep`
if [ "$pmon" = "" ];
then
clulog $LOG_ERR " oracle d atabase start failed, process not exist."
# must return 1 here
exit 1
fi
clulog $LOG_INFO " dbstart succeeded."
else
clulog $LOG_ERR " dbstart failed, ret=$?."
# must return 1 here
exit 1
fi
su - oracle -c "lsnrctl start"
if [ $? -eq 0 ]; then
clulog $LOG_INFO " lsnrctl start succeeded."
# must return 0 here
exit 0
else
clulog $LOG_ERR " lsnrctl start failed, ret=$?."
# must return 1 here
exit 1
fi
;;
stop)
#stop your application, put act ual stop actions here
su - oracle -c "lsnrctl stop"
if [ $? -eq 0 ]; then
clulog $LOG_INFO " lsnrctl stop succeeded."
else
clulog $LOG_ERR " lsnrctl stop failed, ret=$?."
26
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
#must return 1 here
exit 1
fi
su - oracle -c "dbshut"
if [ $? -eq 0 ]; then
pmon=`ps -ef | egrep ora_pmon_$ORACLE_SID | grep -v grep`
if [ "$pmon" != "" ];
then
clulog $LOG_ERR " oracle database shut failed, process still exist."
# must return 1 here
exit 1
fi
clulog $LOG_INFO " dbshut succeeded."
# must return 0 here
exit 0
else
clulog $LOG_ERR " dbshut failed, ret =$?."
# must return 1 here
exit 1
fi
;;
esac
2.检测脚本
服务的检测脚本是一个 shell 的脚本,用来检测 HA 服务是否正常运行,一个
HA 服务只能配置一个检测脚本。
根据应用的实际情况,您可以自己编写检测脚本,也可以使用 GreatTurbo
Cluster Server 10 自带的位于/opt/cluster/usercheck/目录下的 agent 脚本。
(1) 编写检测脚本
请参照下面的例子来编写检测脚本,在 GreatTurbo Cluster Server 10 安装光
# check applications'process parts, you can add or delete part to check your actual
processes
/opt/cluster/usercheck/oracleCheck 172.16.74.127 1521
if [ $? -ne 0 ]
then
# please add log information here
clulog $LOG_ERR "oracleCheck failed, ret=$?."
exit 1
fi
ps -ef | grep ora_pmon_ora10g | grep -v $0 | grep -v grep > /dev/null
if [ $? -ne 0 ]
then
# please add log information here
clulog $LOG_ERR "check oracle instance proc ess failed."
exit 2
fi
ps -ef | grep tnslsnr | grep -v $0 | grep -v grep > /dev/null
if [ $? -ne 0 ]
then
# please add log information here
clulog $LOG_ERR " check oracle listener process failed."
exit 3
fi
# if all checks aren't wrong, then ret urn 0
exit 0
脚本编写完成并检查无误后, 就可以配置HA 服务了。依照每个应用类型的不
同,可以分别按照第五章、第六章、第七/八章的内容进行配置。
1)第一类 HA 应用的用户(需要使用共享磁盘阵列的应用)直接按照第五章进
行配置。
2)第二类 HA 应用的用户(不需要使用共享磁盘阵列并且也不需要存取共享数
据的应用)直接按照第六章进行配置。
3)第三类 HA 应用的用户(需要使用共享磁盘阵列但是不具备磁盘阵列硬件条
件的应用)直接按照第七/八章进行配置。
29
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
第5章
配置 HA 服务--使用共享磁盘
GreatTurbo Cluster Server 10 在两个节点均正常启动后,就可以开始将用户
的应用配置成高可用的服务了。本章说明如何在 GreatTurbo Cluster Server 10
里面配置使用共享磁盘阵列的服务,对服务进行配置的过程如下:
1) 配置服务的名字、优先节点
2) 配置服务的用户脚本
3) 配置服务的检测脚本
4) 配置服务的浮动 IP
5) 配置共享磁盘设备的信息
6) 设置是否 disable 服务
1.配置工具
GreatTurbo Cluster Server 10 有两个配置工具:文本界面的 cluadmin 工具和图形界面的 guiadmin 工具。
这里主要介绍 cluadmin 的使用方法,guiadmin 的使用方法请参照第十三章。
/opt/cluster/bin/cluadmin 是文本界面的管理工具,使用它可以很方便地配
置服务。cluadmin 类似 bash,可以使用 TAB 键进行命令补全。
注意:如果您使用的是 Turbolinux 中文版, 则在运行cluadmin 之前,请先在
bash 下执行“unset LC_CTYPE”。
2.配置条件
请在 GreatTurbo Cluster Server 10 运行时执行 cluadmin 配置服务。
注意:GreatTurbo Cluster Server 10 采用时间戳来判断两个节点的配置是
否同步,所以不要轻易修改系统时间。如果确实需要修改系统时间,请先停止
GreatTurbo Cluster Server 10,修改完系统时间后,再重新启动 GreatTurbo
Cluster Server 10。
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
31
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
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
4.配置服务
利用 cluadmin 的 service add 命令添加服务。
(1) 执行 cluadmin
[root@test1 root]# cluadmin
Sat Apr 9 17:48:57 CST 2005
…
(2) 执行 service add(GreatTurbo Cluster Server 10 最多只支持 16 个 HA
服务)
cluadmin> service add
…
Currently defined services:
(3) 输入服务的名字(如果有多个服务,服务的名字不能重复)
Service name: svc01
32
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
(4) 输入服务的类别(只能选择 ha)
Service type (ha/lb): ha
(5) 配置服务的优先节点
如果一个服务有优先节点,当优先节点启动 GreatTurbo Cluster
Server 10 时或者优先节点的网卡故障恢复时,这个服务将会自动迁移到优
先节点上运行。
优先节点缺省值为 None。直接回车表示选择 None,即不选择优先节点。
否则输入优先节点的 hostname 名称。
Preferred member [None]: test1
(6) 配置服务的用户脚本
服务的用户脚本是启动和停止应用程序的脚本。一个服务最多只能配
置一个用户脚本。配置服务的用户脚本时,请输入全路径名。
User script (e.g., /usr/foo/script or None) [None]: /etc/init.d/
httpd
Do you want to add floating IP address to the service (yes/no/?)
[no]: yes
IP Address Information
IP address: 172.16.70.100
Net interface [None]: eth0
Netmask (e.g. 255.255.255.0 or None) [None]: 255.255.255.0
Broadcast (e.g. X.Y.Z.255 or None) [None]: 172.16.71.255
Do you want to (a)dd, (m)odify, (d)elete or (s)how an IP address,
or are you (f)inished adding IP addresses: f
(9) 配置共享磁盘设备的信息
因为我们在这里使用共享磁盘阵列,所以这里选择 yes。
GreatTurbo Cluster Server 10 最多可以支持 16 个磁盘设备。
我们支持两种类型的磁盘设备:一种是需要用户手动 mount 的磁盘设
备;另外一种是不需要 mount 的裸设备。
对于第一种磁盘设备,我们必须按照下述要求输入相应参数。(以下
例子假设用户需要 mount 的磁盘阵列的共享分区为/dev/sdb0)
必须指定的参数如下:
34
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
¾ “Device special file”是磁盘分区的设备名。
¾ “Check service device”指定是否检查磁盘设备,默认为yes。
¾ “Device is SCSI”指定磁盘设备是否是SCSI 设备,默认为 yes,
Do you want to add a disk device to the service (yes/no/?) [no]:
yes
Disk Device Information
Device special file (e.g., /dev/sda1): /dev/sdb0
Check service device (yes/no/?) [yes]:
Device is SCSI (yes/no/?) [yes]:
Device check timeout (in seconds) [120]:
Filesystem type (e.g., ext2, reiserfs, ext3 or None): ext3
Mount point (e.g., /usr/mnt/service1) [None]: /mnt/userData
Mount options (e.g., rw,nosuid): rw
Forced unmount support (yes/no/?) [no]: yes
Device owner (e.g., root): root
Device group (e.g., root): root
Device mode (e.g., 755): 755
Do you want to (a)dd, (m)odify, (d)elete or (s)how devices, or
are you (f)inished adding devices: f
Do you want to add a disk device to the service (yes/no/?) [no]:
yes
Disk Device Information
Device special file (e.g., /dev/sda1): /dev/sdc
Check service device (yes/no/?) [yes]:
Device is SCSI (yes/no/?) [yes]:
Device check timeout (in seconds) [120]:
Filesystem type (e.g., ext2, reiserfs, ext3 or None):
Mount point (e.g., /usr/mnt/service1) [None]:
Mount options (e.g., rw,nosuid):
Forced unmount support (yes/no/?) [no]:
Device owner (e.g., root):
Device group (e.g., root):
Device mode (e.g., 755):
Do you want to (a)dd, (m)odify, (d)elete or (s)how devices, or
are you (f)inished adding devices: f
同样一次只能输入一个裸设备的名字,如果有多个裸设备,可以在结
束提示时,不选择 f,而选择 a 继续增加分区设备。
(10) 设置启动服务的超时时间
建议此处直接回车,以选择服务默认启动超时时间 3600 秒。
Service start timeout (in seconds) [None]:
(11) 设置停止服务的超时时间
建议此处直接回车,以选择服务默认停止超时时间 3600 秒。
Service stop timeout (in seconds) [None]:
(12) 设置停止服务失败时是否 reboot 机器
如果设为“yes”,当服务停止失败时,为了释放服务的资源,将自动 reboot
机器。
如果设为“no” ,当服务停止失败时, 不会自动 reboot 机器,需要用户手
动干预。
Reboot system if stop the service failed (yes/no/?) [yes]: yes
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
help cluster loglevel
41
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
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
4.配置服务
利用 cluadmin 的 service add 命令添加服务。
(1) 执行cluadmin
[root@test1 root]# cluadmin
Sat Apr 9 17:48:57 CST 2005
…
(2) 执行service add(GreatTurbo Cluster Server 10 最多只支持 16 个
HA 服务)
cluadmin> service add
…
Currently defined services:
(3) 输入服务的名字(如果有多个服务,服务的名字不能重复)
Service name: svc01
42
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
(4) 输入服务的类别(只能选择ha)
Service type (ha/lb): ha
(5) 配置服务的优先节点
如果一个服务有优先节点,当优先节点启动时,这个服务将会首先选
择在优先节点上运行。
优先节点缺省值为 None。直接回车表示选择 None,即不选择优先节点。
Preferred member [None]: test1
(6) 配置服务的用户脚本
服务的用户脚本是启动和停止应用程序的脚本。一个服务最多只能配
置一个用户脚本。配置服务的用户脚本时,必须输入全路径名。
User script (e.g., /usr/foo/script or None) [None]: /etc/init.d/
httpd
172.16.69.200 80" or None) [None]:
/opt/cluster/usercheck/httpCheck 172.16.70.100 80
Check interval (in seconds) [None]: 5
Check timeout (in seconds) [None]: 30
Max error count [None]: 3
(8) 配置服务的浮动IP
服务可以绑定浮动 IP,浮动 IP 随着服务而浮动,也就是说这个 IP 所
在的节点也就是服务所在的节点。一个服务最多可以配置 16 个浮动 IP。
注意:配置浮动 IP 时必须正确输入如下参数,注意随着 IP 地址的不
同,相应的子网掩码以及广播地址的值需与之对应。
¾ “Net interface”是浮动IP 绑定的网卡。
¾ “Netmask”是浮动IP 的子网掩码。
¾ “Broadcast”是浮动IP 的广播地址。
Do you want to add floating IP address to the service (yes/no/?)
[no]: yes
IP Address Information
IP address: 172.16.70.100
Net interface [None]: eth0
Netmask (e.g. 255.255.255.0 or None) [None]: 255.255.255.0
Broadcast (e.g. X.Y.Z.255 or None) [None]: 172.16.71.255
Do you want to (a)dd, (m)odify, (d)elete or (s)how an IP address,
or are you (f)inished adding IP addresses: f
(9) 配置共享磁盘设备的信息
由于服务不使用共享磁盘设备,所有在此必须选择 no,直接回车。
Do you want to add a disk device to the service (yes/no/?) [no]:
(10) 设置启动服务的超时时间
建议此处直接回车,以选择服务默认启动超时时间 3600 秒。
Service start timeout (in seconds) [None]:
44
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
(11) 设置停止服务的超时时间
建议此处直接回车,以选择服务默认停止超时时间 3600 秒。
Service stop timeout (in seconds) [None]:
(12) 设置停止服务失败时是否 reboot 机器
如果设为“yes”,当服务停止失败时,为了释放服务的资源,将自动 reboot
机器。
如果设为“no” ,当服务停止失败时, 不会自动 reboot 机器,需要用户手
动干预。
Reboot system if stop the service failed (yes/no/?) [yes]: yes
如果需要修改服务的配置,请执行 cluadmin 的 service modify 命令。首先要求选择需要修改的服务,请输入列表中的服务的编号。如果服务正在运行,将要求先停止服务,请输入 yes。然后所有的操作都和添加服务相同。
45
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
cluadmin> service modify
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
6. 删除服务
如果要删除服务,请执行 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.
7. 启动服务
如果在添加服务时没有启动服务,需要手动启动服务,请执行 cluadmin 的
service enable 命令。
首先要求选择需要启动的服务,请输入列表中的服务的编号。
46
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
然后要求选择在哪个节点上启动服务,请输入节点的编号。
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.
8. 停止服务
如果需要停止服务,请执行 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.
9. 切换服务
如果需要把在一个节点上运行的服务切换到另一个节点上,请执行 cluadmin
的service relocate 命令。
首先选择要切换的服务,请输入列表中的服务的编号。
然后要求确认,请输入 yes。
cluadmin> service relocate
0) svc01
c) cancel
47
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
Choose service to relocate: 0
Are you sure? (yes/no/?) yes
Relocating svc01. Service relocated.
如果所有的服务添加完成,请直接到第十三章继续阅读随后内容。
48
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
第7章
配置HA 服务--使用磁盘镜像设备kernel2.4
GreatTurbo Cluster Server 10 提供了虚拟的共享磁盘阵列的功能,使用磁盘
镜像设备来保证应用数据的一致性。您可以使用节点本地普通的 IDE 或 SCSI 硬
盘来构建磁盘镜像。
本章说明在 Linux kernel2.4 的环境下,如何在 GreatTurbo Cluster Server 10
中配置具有磁盘镜像设备的服务。
配置具有磁盘镜像设备的服务过程如下:
1) 安装磁盘镜像软件(drbd)。
2) 注册具有磁盘镜像功能的 license。
3) 配置磁盘镜像设备。
4) 添加使用磁盘镜像设备的服务。
1.安装磁盘镜像软件(drbd)
在 GreatTurbo Cluster Server 10 安装时,会提示是否安装磁盘镜像软件,
如果需要使用磁盘镜像软件,这时应当选择安装。
Test1:/mnt/cdrom # ./install_cluster
…
Do you want to use drbd? (y/n) [y]: y
1) 执行 nbd add,输入 nbd ID。nbd ID 是镜像设备的编号,必须是 0-15
之间的整数。
Cluadmin> nbd add
Currently defined nbds:
Nbd ID(nbd identifier. e.g. 0): 0
2) 配置节点 A 的nbd 信息。
Nbd configuration on member0:
name(nbd member ip address. e.g. 192.168.0.1): 192.168.1.11
device(block device used by nbd. e.g. /dev/hda14): /dev/hda7
port(port number used by nbd service. e.g. 8787): 8787
deviceNode(nbd block device. e.g. /dev/nb0): /dev/nb0
注意:
节点 A(member0)必须是执行 member_config 配置 GreatTurbo
Cluster Server 10 时配置的第 1 个节点。
3) 配置节点 B 的nbd 信息。
Nbd configuration on member1:
name(nbd member ip address. e.g. 192.168.0.1): 192.168.1.21
device(block device used by nbd. e.g. /dev/hda14): /dev/hda7
port(port number used by nbd service. e.g. 8787): 8787
50
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
deviceNode(
+nbd block device. e.g. /dev/nb0): /dev/nb0
Do you want to add floating IP address to the service (yes/no/?)
[no]: yes
IP Address Information
IP address: 172.16.70.100
Net interface [None]: eth0
Netmask (e.g. 255.255.255.0 or None) [None]: 255.255.255.0
Broadcast (e.g. X.Y.Z.255 or None) [None]: 172.16.70.255
Do you want to (a)dd, (m)odify, (d)elete or (s)how an IP address,
名。
¾ “Check service device”指定是否检测磁盘设备,这里请选择no。
注意: 由于磁盘镜像设备自身有检测磁盘设备的功能,因此在配置磁盘镜
像设备时请不要设置为检测磁盘设备。
Do you want to add a nbd mirror disk device to the service
(yes/no/?) [no]: yes
Nbd Information
Nbd device ID: 0
Do you want to (a)dd, (m)odify, (d)elete or (s)how nbds, or are
you (f)inished add nbds: f
Do you want to add a disk device to the service (yes/no/?) [no]:
yes
Disk Device Information
Device special file (e.g., /dev/sda1): /dev/nb0
Check service device (yes/no/?) [yes]: no
Filesystem type (e.g., ext2, reiserfs, ext3 or None): ext3
Mount point (e.g., /usr/mnt/service1) [None]: /mnt/hda7
Mount options (e.g., rw,nosuid): rw
Forced unmount support (yes/no/?) [no]: yes
Device owner (e.g., root): root
Device group (e.g., root): root
Device mode (e.g., 755): 755
Do you want to (a)dd, (m)odify, (d)elete or (s)how devices, or
are you (f)inished adding devices: f
(11) 设置启动服务的超时时间
启动服务的时间 = 启动 nbd 的时间 + mount 设备的时间 + 启动 IP 的时间
+ 启动用户脚本的时间
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
6. 删除服务
如果要删除服务,请执行 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.
在安装 GreatTurbo Cluster Server 10 时,会安装 drbd 的配置文件:
/etc/drbd.conf,安装后的 drbd 的配置文件的内容如下所示:
#
# /etc/drbd.conf
#
# this is an example of drbd.conf
# please modify the following items according to your real
environment.
# - hostname
# - device
# - disk
# - address
# if no particular reasons, you no need to modify other items.
resource drbd0 {
protocol C;
startup {
wfc-timeout 30;
degr-wfc-timeout 60;
}
syncer {
rate 600M;
group 0;
}
on hostname1 {
device /dev/drbd0;
disk /dev/hda6;
62
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
address 192.168.0.1:7788;
meta-disk internal;
}
on hostname2 {
device /dev/drbd0;
disk /dev/hda6;
address 192.168.0.2:7788;
meta-disk internal;
}
}
Do you want to add floating IP address to the service (yes/no/?)
[no]: yes
IP Address Information
IP address: 172.16.70.100
Net interface [None]: eth0
Netmask (e.g. 255.255.255.0 or None) [None]: 255.255.255.0
67
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
Broadcast (e.g. X.Y.Z.255 or None) [None]: 172.16.70.255
Do you want to (a)dd, (m)odify, (d)elete or (s)how an IP address,
or are you (f)inished adding IP addresses: f
(9) 配置磁盘设备。
在配置磁盘设备时,请指定相应的drbd 设备。例如:/dev/drbd0。一个服
务最多可以配置 16 个磁盘设备。
Do you want to add a disk device to the service (yes/no/?) [no]:
yes
Filesystem type (e.g., ext2, reiserfs, ext3 or None): ext3
Mount point (e.g., /usr/mnt/service1) [None]: /mnt/hda7
Mount options (e.g., rw,nosuid): rw
Forced unmount support (yes/no/?) [no]: yes
Device owner (e.g., root): root
Device group (e.g., root): root
Device mode (e.g., 755): 755
Do you want to (a)dd, (m)odify, (d)elete or (s)how devices, or
are you (f)inished adding devices: f
(11) 设置启动服务的超时时间。
68
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
启动服务的时间 = 启动 drbd 的时间 + mount 设备的时间 + 启动 IP 的时
间 + 启动用户脚本的时间
如果需要修改服务的配置,请执行 cluadmin 的 service modify 命令。首先要求选择需要修改的服务,请输入列表中服务的编号。如果服务正在运行,将要求先停止服务,请输入 yes。然后所有的操作都和添加服务相同。
Cluadmin> service modify
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
70
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
0) svc01
c) cancel
Choose service to modify: 0
Modifying: svc01
Service is not disabled. Disable it? (yes/no/?) yes
6. 删除服务
如果要删除服务,请执行 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.
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.
71
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
8. 停止服务
如果需要停止服务,请执行 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.
9. 切换服务
如果需要把在一个节点上运行的服务切换到另一个节点上,请执行 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.
如果所有的服务添加完成,请到第十三章继续阅读随后内容。
72
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
第9章
配置 LB 服务--DR 方式
配置服务前要求用户在安装软件和初始化过程中均选择 dr 作为负载均衡技术。
GreatTurbo Cluster Server 10 在调度节点正常启动后,就可以开始将用户的
应用配置成负载均衡的服务了。本章说明如何配置使用 dr 方式的服务,对服务
进行配置的过程如下:
7) 配置 realserver 环境
8) 配置 director 环境
9) 在director 上配置服务
1.配置工具
GreatTurbo Cluster Server 10 使用 cluadmin 进行配置服务。
/opt/cluster/bin/cluadmin 是文本界面的管理工具,使用它可以很方便地配
置服务。cluadmin 类似 bash,可以使用 TAB 键进行命令补全。
注意:如果您使用的是 Turbolinux 中文版, 则在运行cluadmin 之前,请先在
bash 下执行“unset LC_CTYPE”。
2.配置条件
¾ 请在 GreatTurbo Cluster Server 10 运行时执行 cluadmin 配置服务。
注意:GreatTurbo Cluster Server 10 采用时间戳来判断两个调度节点
的配置是否同步,所以不要轻易修改系统时间。如果确实需要修改系统时间,
请先停止 GreatTurbo Cluster Server 10,修改完系统时间后,再重新启动
GreatTurbo Cluster Server 10。
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
help cluster loglevel
help cluster reload
help cluster name
75
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
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 Cluster Server 10 最多只支持 256 个服
务)
cluadmin> service add
…
Currently defined services:
3) 输入服务的名字(如果有多个服务,服务的名字不能重复)
Service name: svc01
4) 输入服务的类别(只能选择 lb)
Service type (ha/lb): lb
76
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
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
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
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
机器。
80
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
如果设为“no” ,当服务停止失败时, 不会自动 reboot 机器,需要用户手
动干预。
Reboot system if stop the service failed (yes/no/?) [yes]: yes
如果需要修改服务的配置,请在 cluadmin 下执行 service modify 命令。首先要求选择需要修改的服务,请输入列表中的服务的编号。如果服务正在运行,将要求先停止服务,请输入 yes。然后所有的操作都和添加服务相同。
cluadmin> service modify
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
81
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
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.
Choose service to relocate: 0
Are you sure? (yes/no/?) yes
Relocating svc01. Service relocated.
83
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
如果所有的服务添加完成,请直接到第十三章继续阅读随后内容。
84
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
第10章
配置 LB 服务--TUN 方式
配置服务前要求用户在安装软件和初始化过程中均选择tun作为负载均衡技术。
GreatTurbo Cluster Server 10 在调度节点正常启动后,就可以开始将用户的
应用配置成负载均衡的服务了。本章说明如何配置使用 tun 方式的服务,对服
务进行配置的过程如下:
(1) 配置 realserver 环境
(2) 配置 director 环境
(3) 在 director 上配置服务
1.配置工具
GreatTurbo Cluster Server 10 使用 cluadmin 进行配置服务。
/opt/cluster/bin/cluadmin 是文本界面的管理工具,使用它可以很方便地配
置服务。cluadmin 类似 bash,可以使用 TAB 键把命令补全。
注意:如果您使用的是 Turbolinux 中文版, 则在运行cluadmin 之前,请先在
bash 下执行“unset LC_CTYPE”。
2.配置条件
¾ 请在 GreatTurbo Cluster Server 10 运行时执行 cluadmin 配置服务。
注意:GreatTurbo Cluster Server 10 采用时间戳来判断两个调度节点
的配置是否同步,所以不要轻易修改系统时间。如果确实需要修改系统时间,
请先停止 GreatTurbo Cluster Server 10,修改完系统时间后,再重新启动
GreatTurbo Cluster Server 10。
¾该方式要求所有节点能够加载 ipip 模块。
3.配置 realserver 环境
1) 以下 2-4 项操作要求在所有的 realserver 上都执行。
2) 根据业务需要修改/etc/init.d/lbrealserver-tun 文件。
如果 realserver 上需要运行的服务没有在机器启动后自动运行,那
么需要在上述文件 start、stop 部分的指定位置添加该服务的启动
和停止脚本。
85
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
如果 realserver 上运行的服务在机器启动后自动运行,那么不需要
修改上述文件。
3) 根据 realserver 上运行的服务个数及配置,修改
/opt/cluster/lb/lbrealserver-conf-tun 文件。
i. 如果 realserver 上运行多个服务,那么需要在 start 部分添加每个
服务的浮动 ip 和路由设置,在 stop 部分添加取消路由设置的内容。
添加完毕后参考下例对所添加的项目进行修改;如果仅有一个服务,
那么只需要修改脚本中已经存在的项既可。
ii. 例,文件中 start 部分有如下项:
ifconfig tunl0:0 172.16.70.100 broadcast 172.16.70.100
netmask 255.255.255.255 up
route add -host 172.16.70.100 dev tunl0
将每个服务的浮动 ip 都建立在 tunl0 设备上,分别为 tunl0:0,
tunl0:1….。
修改其中的 ip 地址“172.16.70.100”和 broadcast 地址为服务
的实际浮动 ip 地址。
修改路由设置中的 ip 地 址,将“ 172.16.70.100”修改为服务的
真实浮动 ip 地址。
iii. 例,文件中 stop 部分有如下项:
route del -host 172.16.70.100 dev tunl0
ifconfig tunl0:0 down
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
87
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
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 Cluster Server 10 最多只支持 256 个服
务)
cluadmin> service add
…
Currently defined services:
3) 输入服务的名字(如果有多个服务,服务的名字不能重复)
88
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
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-tun 作为用户脚本。
User script (required, e.g., /opt/cluster/bin/lbdirector-dr):
/opt/cluster/bin/lbdirector-tun
Do you want to add server to the service (yes/no/?) [no]: y
Server Information
Server name(required): server1
92
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
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
如果需要修改服务的配置,请在 cluadmin 下执行 service modify 命令。首先要求选择需要修改的服务,请输入列表中的服务的编号。如果服务正在运行,将要求先停止服务,请输入 yes。然后所有的操作都和添加服务相同。
cluadmin> service modify
93
GREATTURBO CLUSTER SERVER 10 用户快速安装手册
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.