赞
踩
今天在使用hadoop时遇到了下面这个问题,看报错信息是用户问题,于是上网查了下解决方案,找到两种方式,我使用的是方法1,下面将两种方式都列给大家参考。
hadoop-3.1.3启动HDFS时报错,具体错误信息如下:
[root@hadoop10 hadoop-3.1.3]# sbin/start-dfs.sh
Starting namenodes on [hadoop10]
ERROR: Attempting to operate on hdfs namenode as root
ERROR: but there is no HDFS_NAMENODE_USER defined. Aborting operation.
Starting datanodes
ERROR: Attempting to operate on hdfs datanode as root
ERROR: but there is no HDFS_DATANODE_USER defined. Aborting operation.
Starting secondary namenodes [hadoop12]
ERROR: Attempting to operate on hdfs secondarynamenode as root
ERROR: but there is no HDFS_SECONDARYNAMENODE_USER defined. Aborting operation.
直接在环境变量中添加配置
vim /etc/profile.d/my_env.sh
*my_env.sh是自己添加的文件,不建议直接修改profile.d
添加的配置如下:
export HDFS_NAMENODE_USER=root
export HDFS_DATANODE_USER=root
export HDFS_SECONDARYNAMENODE_USER=root
export YARN_RESOURCEMANAGER_USER=root
export YARN_NODEMANAGER_USER=root
修改完成后,需要执行以下命令立即生效
source /etc/profile.d/my_env.sh
*文件在hadoop安装目录的sbin目录下
在start-dfs.sh,stop-dfs.sh 两个文件顶部添加以下参数
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
在start-yarn.sh,stop-yarn.sh两个文件顶部添加以下参数
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
修改完成后,将修改的配置文件copy到其他的节点
重新启动即可
sbin/start-dfs.sh
Starting namenodes on [hadoop10]
上一次登录:四 12月 10 10:15:53 CST 2020从 192.168.157.1pts/0 上
Starting datanodes
上一次登录:四 12月 10 10:53:50 CST 2020pts/0 上
hadoop12: Warning: Permanently added 'hadoop12,192.168.157.12' (ECDSA) to the list of known hosts.
localhost: Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
hadoop11: WARNING: /opt/module/hadoop-3.1.3/logs does not exist. Creating.
hadoop12: WARNING: /opt/module/hadoop-3.1.3/logs does not exist. Creating.
Starting secondary namenodes [hadoop12]
上一次登录:四 12月 10 10:53:53 CST 2020pts/0 上
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。