Dec
11
[原]安装及配置红旗高可用服务器 HA 5.0 [3] - 生成HA策略文件
6、调整应用执行和监控脚本
首先,假设刚才保存的配置文件是放在/root/rfgz目录下。则进入该目录可以看到:
引用
# pwd
/root/rfgz
# ll
总计 28
-rw-r--r-- 1 root root 5711 12-11 18:17 clp.conf
-rw-r--r-- 1 root root 5711 12-11 18:17 clp.conf.bak
-rw-r--r-- 1 root root 5711 12-11 18:17 clp.conf.rep
drwxr-xr-x 3 root root 4096 12-11 18:17 scripts
/root/rfgz
# ll
总计 28
-rw-r--r-- 1 root root 5711 12-11 18:17 clp.conf
-rw-r--r-- 1 root root 5711 12-11 18:17 clp.conf.bak
-rw-r--r-- 1 root root 5711 12-11 18:17 clp.conf.rep
drwxr-xr-x 3 root root 4096 12-11 18:17 scripts
我们需要调整的脚本在scripts目录中,每个组资源有一个子目录,其中包括两个执行脚本:
引用
# pwd
/root/rfgz/scripts/httpd
# ll -R
.:
总计 8
drwxr-xr-x 2 root root 4096 12-11 18:17 exec
drwxr-xr-x 2 root root 4096 12-11 18:17 monexec
./exec:
总计 8
-rw-r--r-- 1 root root 629 12-11 18:17 start.sh
-rw-r--r-- 1 root root 633 12-11 18:17 stop.sh
./monexec:
总计 8
-rw-r--r-- 1 root root 629 12-11 18:17 start.sh
-rw-r--r-- 1 root root 633 12-11 18:17 stop.sh
/root/rfgz/scripts/httpd
# ll -R
.:
总计 8
drwxr-xr-x 2 root root 4096 12-11 18:17 exec
drwxr-xr-x 2 root root 4096 12-11 18:17 monexec
./exec:
总计 8
-rw-r--r-- 1 root root 629 12-11 18:17 start.sh
-rw-r--r-- 1 root root 633 12-11 18:17 stop.sh
./monexec:
总计 8
-rw-r--r-- 1 root root 629 12-11 18:17 start.sh
-rw-r--r-- 1 root root 633 12-11 18:17 stop.sh
a、拷贝启动/关闭应用脚本
还记得我们在安装Trekking Tool的时候,有个叫rfhacluster-monscript-5.0-1.i386.rpm的包吗?这就是我们要拷贝的脚本所在,根据您的应用,例如http,选择对应的脚本即可。
执行:
# cd exec/
# cp /opt/redflag/hatrek/scripts/linux/http/* ./
cp:是否覆盖“./start.sh”? y
cp:是否覆盖“./stop.sh”? y
# cp /opt/redflag/hatrek/scripts/linux/http/* ./
cp:是否覆盖“./start.sh”? y
cp:是否覆盖“./stop.sh”? y
b、拷贝监控应用的脚本
执行:
# cd ../monexec/
# cp /opt/redflag/hatrek/scripts/linux/http-mon/* ./
cp:是否覆盖“./start.sh”? y
cp:是否覆盖“./stop.sh”? y
# cp /opt/redflag/hatrek/scripts/linux/http-mon/* ./
cp:是否覆盖“./start.sh”? y
cp:是否覆盖“./stop.sh”? y
用于监控的脚本,因其需要执行特定的agent命令,所以,还需要根据命令的参数进行调整。
例如,监控httpd的命令是clp_httpmon,其可用参数有:
(请参考HA的帮助文档,或在安装了rfhacluster-httpmon包的服务器上执行不带参数的命令)
引用
# clp_httpmon
clp_httpmon Ver. 5.0-1
Usage: clp_httpmon mon-id [-s server] [-n port] [-r wait] [-c count ] [-i interval] [-v version] [-h Request-URI]
mon-id : monitor id :
server : server name : localhost [hostname | IP address]
port : port number : 80 [1 - 65535]
wait : wait time(sec) : 10 [1 - 10000]
count : retry count : 3 [1 - 10000]
interval : interval time(sec) : 60 [1 - 10000]
version : HTTP version : 1.1 [1.0 | 1.1]
Request-URI : Request-URI : / [ex. /index.html]
clp_httpmon mon-id --stop [wait]
wait : terminate wait time(sec) : 60 [1 - 10000]
clp_httpmon mon-id --pause
clp_httpmon mon-id --continue
clp_httpmon mon-id --disp
clp_httpmon mon-id --del
clp_httpmon Ver. 5.0-1
Usage: clp_httpmon mon-id [-s server] [-n port] [-r wait] [-c count ] [-i interval] [-v version] [-h Request-URI]
mon-id : monitor id :
server : server name : localhost [hostname | IP address]
port : port number : 80 [1 - 65535]
wait : wait time(sec) : 10 [1 - 10000]
count : retry count : 3 [1 - 10000]
interval : interval time(sec) : 60 [1 - 10000]
version : HTTP version : 1.1 [1.0 | 1.1]
Request-URI : Request-URI : / [ex. /index.html]
clp_httpmon mon-id --stop [wait]
wait : terminate wait time(sec) : 60 [1 - 10000]
clp_httpmon mon-id --pause
clp_httpmon mon-id --continue
clp_httpmon mon-id --disp
clp_httpmon mon-id --del
所以,我们需要修改监控的启动脚本,也就是/root/rfgz/scripts/httpd/monexec目录中的start.sh脚本。
把原来:
引用
clp_httpmon httpwatch
修改为:
引用
clp_httpmon httpwatch -s "192.168.228.223" -n 80 -c 3 -i 10
至此,两套脚本即可配置完成。
※ 关于如何编写自定义的应用启动和关闭脚本,请参考以前的日志:
[原]编写红旗HA 4.1启动、关闭和监控脚本
[原]红旗HA 4.1监控Oracle的脚本(new)
带miiw网卡监控的配置文件:

不带miiw网卡监控的配置文件:
