Hadoop's ERROR: Attempting to operate on yarn resourcemanager as root solution

created at 10-27-2021 views: 2

error

When Hadoop executes start-yarn.sh, it will report the error "ERROR: Attempting to operate on yarn resourcemanager as root"

method one

sudo vim ~/.bashrc

Add the following parameters at the end:

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

Method Two

Add the following parameters to the top of the start-dfs.sh and stop-dfs.sh files:

HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root

Add the following parameters to the top of the start-yarn.sh and stop-yarn.sh files:

YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
  • The above files are all in the sbin directory of the Hadoop root directory.
  • The official recommendation is to create a separate account for Yarn to start.
created at:10-27-2021
edited at: 12-15-2021: