hadoop startup error: Attempting to operate on hdfs namenode as root

Insert image description here
In the /hadoop/sbin path of the hadoop installation path:
add the following parameters to the top of the start-dfs.sh and stop-dfs.sh files.

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

Also, add the following to the top of start-yarn.sh and stop-yarn.sh :

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

After modification, restart ./start-dfs.sh, success!

Guess you like

Origin blog.csdn.net/agatha_aggie/article/details/132836795