Storm之——使用daemontools监控Storm进程

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/l1028386804/article/details/89165161

转载请注明出处:https://blog.csdn.net/l1028386804/article/details/89165161

一、安装daemontools

在Linux终端安装daemontools命令

cd ~/Downloads
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.新建storm文件件

在/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 a+x /service/storm/nimbus/run

mkdir -p /service/storm/ui
touch /service/storm/ui/run
chmod a+x /service/storm/ui/run

mkdir -p /service/storm/drpc
touch /service/storm/drpc/run
chmod a+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

1-4.编辑ui的run文件

vim /service/storm/ui/run

#!/bin/sh
exec 2>&1
exec /mapper/r5/storm/bin/storm ui

1-5.编辑drpc的run文件

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文件

mkdir -p /service/storm/supervisor
touch /service/storm/supervisor/run
chmod a+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 &

3.验证storm进程不会死掉

首先,查看storm进程的ID。

ps -ax | grep storm

使用kill -9 命令杀死进程,再查看时发现storm进程依然存在,但是pid号变了,证明storm进程不会死掉。

4.查看/service/storm进程的ID

ps -ax | grep /service/storm

5.杀死已经存在的storm进程

使用命令查找出storm进程的id,使用kill命令杀死进程。

猜你喜欢

转载自blog.csdn.net/l1028386804/article/details/89165161