1.查看日志报如下错:
17/10/23 14:54:32 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000
17/10/23 14:54:32 INFO blockmanagement.BlockManager: The block deletion will start around 2017 十月 23 14:54:32
17/10/23 14:54:32 INFO util.GSet: Computing capacity for map BlocksMap
17/10/23 14:54:32 INFO util.GSet: VM type = 64-bit
17/10/23 14:54:32 INFO util.GSet: 2.0% max memory 966.7 MB = 19.3 MB
17/10/23 14:54:32 INFO util.GSet: capacity = 2^21 = 2097152 entries
17/10/23 14:54:32 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false
17/10/23 14:54:32 INFO blockmanagement.BlockManager: defaultReplication = 2
17/10/23 14:54:32 INFO blockmanagement.BlockManager: maxReplication = 512
17/10/23 14:54:32 INFO blockmanagement.BlockManager: minReplication = 1
17/10/23 14:54:32 INFO blockmanagement.BlockManager: maxReplicationStreams = 2
17/10/23 14:54:32 INFO blockmanagement.BlockManager: shouldCheckForEnoughRacks = false
17/10/23 14:54:32 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000
17/10/23 14:54:32 INFO blockmanagement.BlockManager: encryptDataTransfer = false
17/10/23 14:54:32 INFO blockmanagement.BlockManager: maxNumBlocksToLog = 1000
17/10/23 14:54:32 INFO namenode.FSNamesystem: fsOwner = root (auth:SIMPLE)
17/10/23 14:54:32 INFO namenode.FSNamesystem: supergroup = supergroup
17/10/23 14:54:32 INFO namenode.FSNamesystem: isPermissionEnabled = true
17/10/23 14:54:32 INFO namenode.FSNamesystem: HA Enabled: false
17/10/23 14:54:33 INFO namenode.FSNamesystem: Append Enabled: true
17/10/23 14:54:33 INFO util.GSet: Computing capacity for map INodeMap
17/10/23 14:54:33 INFO util.GSet: VM type = 64-bit
17/10/23 14:54:33 INFO util.GSet: 1.0% max memory 966.7 MB = 9.7 MB
17/10/23 14:54:33 INFO util.GSet: capacity = 2^20 = 1048576 entries
17/10/23 14:54:33 INFO namenode.FSDirectory: ACLs enabled? false
17/10/23 14:54:33 INFO namenode.FSDirectory: XAttrs enabled? true
17/10/23 14:54:33 INFO namenode.FSDirectory: Maximum size of an xattr: 16384
17/10/23 14:54:33 INFO namenode.NameNode: Caching file names occuring more than 10 times
17/10/23 14:54:33 INFO util.GSet: Computing capacity for map cachedBlocks
17/10/23 14:54:33 INFO util.GSet: VM type = 64-bit
17/10/23 14:54:33 INFO util.GSet: 0.25% max memory 966.7 MB = 2.4 MB
17/10/23 14:54:33 INFO util.GSet: capacity = 2^18 = 262144 entries
17/10/23 14:54:33 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.9990000128746033
17/10/23 14:54:33 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 0
17/10/23 14:54:33 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension = 30000
17/10/23 14:54:33 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10
17/10/23 14:54:33 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10
17/10/23 14:54:33 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25
17/10/23 14:54:33 INFO namenode.FSNamesystem: Retry cache on namenode is enabled
17/10/23 14:54:33 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
17/10/23 14:54:33 INFO util.GSet: Computing capacity for map NameNodeRetryCache
17/10/23 14:54:33 INFO util.GSet: VM type = 64-bit
17/10/23 14:54:33 INFO util.GSet: 0.029999999329447746% max memory 966.7 MB = 297.0 KB
17/10/23 14:54:33 INFO util.GSet: capacity = 2^15 = 32768 entries
17/10/23 14:54:33 INFO namenode.FSImage: Allocated new BlockPoolId: BP-560309265-192.168.15.150-1508741673819
17/10/23 14:54:34 INFO common.Storage: Storage directory /home/hadoop/hadoopdata/dfs/name has been successfully formatted.
17/10/23 14:54:34 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
17/10/23 14:54:35 INFO util.ExitUtil: Exiting with status 0
2.看你的hadoop权限 将他修改为最高权限,命令:chmod 777 /home/hadoop
3.格式化你的namenode命令: hadoop namenode -formar
4.启动集群
如果以上不能解决你的问题话,
1.请到%HADOOP_HOME%\etc查看core-site.cml文件
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:8020</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hadoop/hadoopdata</value>
</property>
</configuration>
添加配置存放临时文件的地方,请参看上面代码
2.重启hadoop
希望能帮到你,给点个赞,谢谢