Hadoop注册为服务

本文介绍如何将Hadoop注册为Linux系统服务。通过创建init.d脚本,设置JAVA_HOME路径,使用chkconfig添加服务并配置开机自启动,最后通过systemctl命令启动或停止Hadoop集群。步骤包括编写脚本、赋予执行权限、添加到chkconfig列表、查看服务状态。

作者:zhuge···预计阅读 3 分钟·705 阅读·0 评论
Hadoop注册为服务

 cd /etc/init.d

 vim hadoop

输入以下内容

#!/bin/bash
#chkconfig:2345 20 90
#description:hadoop
#processname:hadoop
export JAVA_HOME=/opt/jdk1.8.0_333
case $1 in
    start) su root /opt/hadoop-3.3.3/sbin/start-all.sh;;
    stop) su root /opt/hadoop-3.3.3/sbin/stop-all.sh;;
    *) echo "require start|stop" ;;
esac

#赋予权限

chmod +x hadoop

#设置hadoop服务开机自启动

chkconfig --add hadoop

#查看hadoop服务

chkconfig --list

systemctl start hadoop systemctl stop hadoop

相关文章

评论

加载中...