转载请注明出处:http://blog.csdn.net/l1028386804/article/details/79429717
daemontools官网地址是:http://cr.yp.to/daemontools.html
一、安装daemontools
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar -zxvf daemontools-0.76.tar.gz
cd admin/daemontools-0.76
cd src
wget http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/daemontools-0.76.errno.patch
patch < daemontools-0.76.errno.patch
cd ..
package/install
二、编写监控脚本
1、nimbus节点监控
1-1、在/service下,新建storm文件夹
rm -rf /service/storm
mkdir -p /service/storm
1-2、创建run文件
分别创建nimbus、ui、drpc的run文件,命令如下:
mkdir -p /service/storm/nimbus
touch /service/storm/nimbus/run
chmod +x /service/storm/nimbus/run
mkdir -p /service/storm/ui
touch /service/storm/ui/run
chmod +x /service/storm/ui/run
mkdir -p /service/storm/drpc
touch /service/storm/drpc/run
chmod +x /service/storm/drpc/run
1-3、编辑nimbus的run文件
vim /service/storm/nimbus/run
#!/bin/sh
exec 2>&1
exec /mapper/r5/storm/bin/storm nimbus
注意:exec /mapper/r5/storm/bin/storm nimbus中的/mapper/r5/storm/bin/storm nimbus 为storm命令的绝对路径+nimbus,这里我storm的安装路径为/mapper/r5/storm/
1-4、编辑ui的run文件
vim /service/storm/ui/run
#!/bin/sh
exec 2>&1
exec /mapper/r5/storm/bin/storm ui
1-5、编辑ui的drpc文件
vim /service/storm/drpc/run
#!/bin/sh
exec 2>&1
exec /mapper/r5/storm/bin/storm drpc
1-6、后台运行进程
nohup supervise /service/storm/nimbus &
nohup supervise /service/storm/ui &
nohup supervise /service/storm/drpc &
2、supervisor节点的监控
2-1、新建storm文件夹在/service下,新建storm文件夹
rm -rf /service/storm
mkdir -p /service/storm
2-2、创建run文件
创建supervisor的run文件,创建的命令如下:
mkdir -p /service/storm/supervisor
touch /service/storm/supervisor/run
chmod +x /service/storm/supervisor/run
2-3、编辑supervisor的run文件
vim /service/storm/supervisor/run
#!/bin/sh
exec 2>&1
exec /mapper/r5/storm/bin/storm supervisor
2-4、后台运行进程
nohup supervise /service/storm/supervisor &
三、验证Storm进程不会死掉
1、首先,查看storm的进程ID
ps -ax | grep storm
然后使用命令kill -9 杀死该进程,再查看时发现storm进程依然存在,但是pid号变了。证明storm进程不会死掉。
2、查看/service/storm进程的ID
查看/service/storm的进程,命令如下:ps -ax | grep /service/storm
3、杀死已经存在的storm进程
使用命令查找出storm进程的id,然后使用kill命令杀死进程。