Hadoop-3.1.3 startup error: Attempting to operate on hdfs namenode as root

1. Problem description

Hadoop-3.1.3 will report the following error when starting the hadoop cluster:

[root@bigdata111 hadoop-3.1.3]# sbin/start-dfs.sh
Starting namenodes on [bigdata111]
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 [bigdata113]
ERROR: Attempting to operate on hdfs secondarynamenode as root
ERROR: but there is no HDFS_SECONDARYNAMENODE_USER defined. Aborting operation.

2. Solution

Enter the command at the command line:

vim /etc/profile

Then add the following to the environment variable:

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

Finally, source the environment variables

source /etc/profile

3. Results

Restart will not report an error
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43520450/article/details/127613047