HADOOP 启动时 HDFS格式化后启动dfs出现以下错误:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

错误信息:

2018-07-27 00:48:23,616 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0

2018-07-27 00:48:23,627 INFO namenode.NameNode: SHUTDOWN_MSG:

/************************************************************

SHUTDOWN_MSG: Shutting down NameNode at bigdata/192.168.240.129

************************************************************/

[root@bigdata ~]# /opt/hadoop-3.0.2/sbin/start-all.sh

Starting namenodes on [bigdata]

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 [bigdata]

ERROR: Attempting to operate on hdfs secondarynamenode as root

ERROR: but there is no HDFS_SECONDARYNAMENODE_USER defined. Aborting operation.

2018-07-27 00:50:24,338 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

Starting resourcemanager

ERROR: Attempting to operate on yarn resourcemanager as root

ERROR: but there is no YARN_RESOURCEMANAGER_USER defined. Aborting operation.

Starting nodemanagers

ERROR: Attempting to operate on yarn nodemanager as root

ERROR: but there is no YARN_NODEMANAGER_USER defined. Aborting operation.

[root@bigdata ~]# cd /opt/hadoop-3.0.2/etc/hadoop/

[root@bigdata hadoop]# ll

解决方案:

1、master,slave都需要修改start-dfs.sh,stop-dfs.sh,start-yarn.sh,stop-yarn.sh四个文件

2、如果你的Hadoop是另外启用其它用户来启动,记得将root改为对应用户

在/hadoop/sbin路径下:

将start-dfs.sh,stop-dfs.sh两个文件顶部添加以下参数

#!/usr/bin/env bash

HDFS_DATANODE_USER=root

HADOOP_SECURE_DN_USER=hdfs

HDFS_NAMENODE_USER=root

HDFS_SECONDARYNAMENODE_USER=root

还有,start-yarn.sh,stop-yarn.sh顶部也需添加以下:

#!/usr/bin/env bash

YARN_RESOURCEMANAGER_USER=root

HADOOP_SECURE_DN_USER=yarn

YARN_NODEMANAGER_USER=root

# Licensed to the Apache Software Foundation (ASF) under one or more

修改后重启 ./start-dfs.sh,成功!

你可能感兴趣的:(HADOOP 启动时 HDFS格式化后启动dfs出现以下错误:)