在操作过程中遇到Attempting to operate on hdfs namenode as root报错
HDFS格式化后启动dfs出现以下错误:
[root@hadoop101 sbin]# start-dfs.sh
Starting namenodes on [hadoop101]
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 [hadoop103]
ERROR: Attempting to operate on hdfs secondarynamenode as root
ERROR: but there is no HDFS_SECONDARYNAMENODE_USER defined. Aborting operation.
在/hadoop/sbin路径下:
将start-dfs.sh,stop-dfs.sh两个文件顶部添加以下参数
vim start-dfs.sh
#!/usr/bin/env bash
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
-------------------------------------
vim stop-dfs.sh
还有,start-yarn.sh,stop-yarn.sh顶部也需添加以下:
vim start-yarn.sh
#!/usr/bin/env bash
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
-----------------------------------
vim stop-yarn.sh
修改后重启 start-dfs.sh
[root@hadoop101 sbin]# start-dfs.sh
标签:hdfs,Attempting,dfs,start,sh,报错,USER,root
From: https://www.cnblogs.com/docker-mo/p/17725452.html