日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達(dá)者為師

網(wǎng)站首頁 編程語言 正文

ERROR: but there is no HDFS_NAMENODE_USER defined. Aborting operation.

作者:yaoshengting 更新時(shí)間: 2022-02-17 編程語言

執(zhí)行hadoop的start-all.sh命令式啟動(dòng)報(bào)如下的錯(cuò)誤

[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文件夾

在里面修改四個(gè)文件

1、對(duì)于start-dfs.sh和stop-dfs.sh文件,添加下列參數(shù):

#!/usr/bin/env bash
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root

2、對(duì)于start-yarn.sh和stop-yarn.sh文件,添加下列參數(shù):

#!/usr/bin/env bash
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root

然后重新啟動(dòng)

方法二、(推薦)

The root cause of this problem,

  1. hadoop install for different user and you start yarn service for different user. OR
  2. in hadoop config's hadoop-env.sh specified HDFS_NAMENODE_USER and HDFS_DATANODE_USER user is something else.

Hence we need to correct and make it consistent at every place. So a simple solution of this problem is to edit your?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 lines

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

Now save and start yarn, hdfs service and check that it works.

我們?cè)趆adoop-env.sh文件中也可以找到如下的描述

To prevent accidents, shell commands be (superficially) locked to only allow certain users to execute certain subcommands.

為了防止發(fā)生意外,僅(部分)鎖定shell命令以僅允許某些用戶執(zhí)行某些子命令。

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來限制哪個(gè)用戶可以執(zhí)行namenode命令。

參考stackoverflow上的相關(guān)討論

HDFS_NAMENODE_USER, HDFS_DATANODE_USER & HDFS_SECONDARYNAMENODE_USER not defined

原文鏈接:https://blog.csdn.net/ystyaoshengting/article/details/103026872

欄目分類
最近更新