使用service管理hdfs,yarn

将hdfs设置为服务项
vim /etc/rc.d/init.d/hdfs #!/bin/bash #chkconfig: 345 99 99 #description:hdfs server #processname:hdfs case $1 in start) /usr/apps/hadoop/hadoop-2.6.4/sbin/./start-dfs.sh;; # 开启hdfs的命令 stop) /usr/apps/hadoop/hadoop-2.6.4/sbin/stop-dfs.sh start;; # 关闭hdfs进程的脚本 *) echo "require start|stop" ;; esac chmod 777 /etc/rc.d/init.d/hdfs 增加到chkconfig中进行管理 chkconfig --add hdfs chkconfig --list hdfs service hdfs start service hsfs stop



将yarn设置为服务项


vim /etc/rc.d/init.d/yarn



#!/bin/bash
#chkconfig: 345 99 99
#description:yarn server
#processname:yarn
case $1 in
start) /usr/apps/hadoop/hadoop-2.6.4/sbin/./start-yarn.sh;; # 开启hdfs的命令
stop) /usr/apps/hadoop/hadoop-2.6.4/sbin/stop-yarn.sh start;; # 关闭hdfs进程的脚本
*) echo "require start|stop" ;;
esac


 


chmod 777 /etc/rc.d/init.d/yarn


增加到chkconfig中进行管理
chkconfig --add yarn
chkconfig --list yarn


使用service管理
service yarn start
service yarn stop



备注

#!/bin/bash
#chkconfig: 345 99 99

  第二行的参数 345 是指在系统启动等级为 3 4 5 的时候 自动启动。99 是启动优先级。99是关闭优先级




 

posted @ 2020-09-05 11:37  尼姑哪里跑  阅读(200)  评论(0编辑  收藏  举报