当前位置:   article > 正文

ERROR: Attempting to operate on hdfs namenode as root ......

error: attempting to operate on hdfs namenode as root error: but there is no

环境:hadoop-3.1.3

报错信息:

hadoop-3.1.3启动hadoop集群时还有可能可能会报如下错误信息:

[root@hadoop hadoop]# start-all.sh 
Starting namenodes on [iZbp13pwlxqwiu1xxb6szsZ]
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 [iZbp13pwlxqwiu1xxb6szsZ]
ERROR: Attempting to operate on hdfs secondarynamenode as root
ERROR: but there is no HDFS_SECONDARYNAMENODE_USER defined. Aborting operation.
Starting resourcemanager
ERROR: Attempting to operate on yarn resourcemanager as root
ERROR: but there is no YARN_RESOURCEMANAGER_USER defined. Aborting operation.
Starting nodemanagers
ERROR: Attempting to operate on yarn nodemanager as root
ERROR: but there is no YARN_NODEMANAGER_USER defined. Aborting operation.
[root@hadoop hadoop]#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

报错原因:

使用root账号启动服务,但没预先定义,缺少用户定义造成的。

解决方法:

分别编辑开始和关闭脚本

进入hadoop sbin目录

cd $HADOOP_HOME/sbin

vim start-dfs.sh
vim stop-dfs.sh
头部添加以下内容

#!/usr/bin/env bash
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
  • 1
  • 2
  • 3
  • 4
  • 5

在这里插入图片描述

vim start-yarn.sh
vim stop-yarn.sh
头部添加以下内容

#!/usr/bin/env bash
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
  • 1
  • 2
  • 3
  • 4

在这里插入图片描述

修改完重启即可

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/629409
推荐阅读
相关标签
  

闽ICP备14008679号