执行hadoop的start-all.sh命令式启动报如下的错误
[root@iZbp13pwlxqwiu1xxb6szsZ hadoop-3.2.1]# 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@iZbp13pwlxqwiu1xxb6szsZ hadoop-3.2.1]#
解决方法:
方法一、
在Hadoop安装目录下找到sbin文件夹
在里面修改四个文件
1、对于start-dfs.sh和stop-dfs.sh文件,添加下列参数:
#!/usr/bin/env bash
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
2、对于start-yarn.sh和stop-yarn.sh文件,添加下列参数:
#!/usr/bin/env bash
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
然后重新启动
方法二、(推荐)
The root cause of this problem,
- hadoop install for different user and you start yarn service for different user. OR
- in hadoop config's hadoop-env.sh specified HDFS_NAMENODE_USER and HDFS_DATANODE_USER user is something else.
hadoop-env.sh
file and add the user-name for which you want to start the yarn service. So go ahead and edit $HADOOP_HOME/etc/hadoop/hadoop-env.sh
by adding the following linesexport HDFS_NAMENODE_USER=root
export HDFS_DATANODE_USER=root
export HDFS_SECONDARYNAMENODE_USER=root
export YARN_RESOURCEMANAGER_USER=root
export YARN_NODEMANAGER_USER=root
Now save and start yarn, hdfs service and check that it works.
我们在hadoop-env.sh文件中也可以找到如下的描述
To prevent accidents, shell commands be (superficially) locked to only allow certain users to execute certain subcommands.
为了防止发生意外,仅(部分)锁定shell命令以仅允许某些用户执行某些子命令。
It uses the format of (command)_(subcommand)_USER.For example, to limit who can execute the namenode command,export HDFS_NAMENODE_USER=hdfs
使用“命令_子命令_用户”,例如,通过使用export HDFS_NAMENODE_USER=hdfs来限制哪个用户可以执行namenode命令。
【#|ERROR: but there is no HDFS_NAMENODE_USER defined. Aborting operation.】参考stackoverflow上的相关讨论
HDFS_NAMENODE_USER, HDFS_DATANODE_USER & HDFS_SECONDARYNAMENODE_USER not defined
推荐阅读
- 运维|HBase、Kudu 和 ClickHouse 全视角对比
- #|MATLB|基于改进教学的优化算法(TLSBO)的最优功率优化
- #|暑假加餐|有钱人和你想的不一样(第3天)+多目标杜鹃优化算法(MOCS)(Matlab代码)
- #|Redis 如何实现库存扣减操作和防止被超卖((荣耀典藏版))
- #|请问Redis 如何实现库存扣减操作和防止被超卖()
- #|详解MySQL架构设计及SQL执行流程
- mysql|大数据处理与开发课程设计——纽约出租车大数据分析
- #|【攻防世界WEB】难度四星12分进阶题(Confusion1)
- #|【攻防世界WEB】难度三星9分入门题(下)(shrine、lottery)