在对hadoop3.1.3集群初始化之后,启动集群时,报错:
[root@hadoop301 sbin]# ./start-dfs.sh
Starting namenodes on [hadoop301]
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 [hadoop303]
ERROR: Attempting to operate on hdfs secondarynamenode as root
ERROR: but there is no HDFS_SECONDARYNAMENODE_USER defined. Aborting operation.
解决方案:
[root@hadoop301 sbin]# pwd
/usr/local/wyh/software/hadoop-3.1.3/sbin
[root@hadoop301 sbin]# vi start-dfs.sh
[root@hadoop301 sbin]# vi stop-dfs.sh
#修改上面两个文件在文件头部添加如下配置:
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
[root@hadoop303 sbin]# vi start-yarn.sh
[root@hadoop303 sbin]# vi stop-yarn.sh
#修改上面两个文件在文件头部添加如下配置:
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
然后重新启动集群即可。