手动格式化namenode,查看日志:
hdfs namenode -format
************************************************************/
2019-01-28 13:45:10,987 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
2019-01-28 13:45:11,041 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: createNameNode [-format, -clusterId, cluster21, -nonInteractive]
2019-01-28 13:45:11,394 INFO org.apache.hadoop.hdfs.server.namenode.FSEditLog: Edit logging is async:true
2019-01-28 13:45:11,405 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: KeyProvider: null
2019-01-28 13:45:11,406 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: fsLock is fair: true
2019-01-28 13:45:11,406 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: Detailed lock hold time metrics enabled: false
2019-01-28 13:45:11,410 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: fsOwner = hdfs (auth:SIMPLE)
2019-01-28 13:45:11,410 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: supergroup = supergroup
2019-01-28 13:45:11,411 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: isPermissionEnabled = true
2019-01-28 13:45:11,411 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: HA Enabled: false
2019-01-28 13:45:11,441 INFO org.apache.hadoop.hdfs.server.common.Util: dfs.datanode.fileio.profiling.sampling.percentage set to 0. Disabling file IO profiling
2019-01-28 13:45:11,455 WARN org.apache.hadoop.hdfs.util.CombinedHostsFileReader: /var/run/cloudera-scm-agent/process/23-hdfs-NAMENODE-format/dfs_all_hosts.txt has invalid JSON format.Try the old format without top-level token defined.
2019-01-28 13:45:11,483 INFO org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager: dfs.block.invalidate.limit: configured=1000, counted=60, effected=1000
2019-01-28 13:45:11,483 INFO org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true
2019-01-28 13:45:11,487 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000
2019-01-28 13:45:11,487 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: The block deletion will start around 2019 一月 28 13:45:11
2019-01-28 13:45:11,491 INFO org.apache.hadoop.util.GSet: Computing capacity for map BlocksMap
2019-01-28 13:45:11,491 INFO org.apache.hadoop.util.GSet: VM type = 64-bit
2019-01-28 13:45:11,493 INFO org.apache.hadoop.util.GSet: 2.0% max memory 3.9 GB = 79.2 MB
2019-01-28 13:45:11,493 INFO org.apache.hadoop.util.GSet: capacity = 2^23 = 8388608 entries
2019-01-28 13:45:11,520 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: dfs.block.access.token.enable = false
2019-01-28 13:45:11,523 INFO org.apache.hadoop.conf.Configuration.deprecation: No unit for dfs.namenode.safemode.extension(30000) assuming MILLISECONDS
2019-01-28 13:45:11,524 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.threshold-pct = 0.9990000128746033
2019-01-28 13:45:11,524 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.min.datanodes = 1
2019-01-28 13:45:11,524 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManagerSafeMode: dfs.namenode.safemode.extension = 30000
2019-01-28 13:45:11,524 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: defaultReplication = 3
2019-01-28 13:45:11,524 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: maxReplication = 512
2019-01-28 13:45:11,524 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: minReplication = 1
2019-01-28 13:45:11,524 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: maxReplicationStreams = 20
2019-01-28 13:45:11,524 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: redundancyRecheckInterval = 3000ms
2019-01-28 13:45:11,524 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: encryptDataTransfer = false
2019-01-28 13:45:11,525 INFO org.apache.hadoop.hdfs.server.blockmanagement.BlockManager: maxNumBlocksToLog = 1000
2019-01-28 13:45:11,581 INFO org.apache.hadoop.util.GSet: Computing capacity for map INodeMap
2019-01-28 13:45:11,581 INFO org.apache.hadoop.util.GSet: VM type = 64-bit
2019-01-28 13:45:11,581 INFO org.apache.hadoop.util.GSet: 1.0% max memory 3.9 GB = 39.6 MB
2019-01-28 13:45:11,581 INFO org.apache.hadoop.util.GSet: capacity = 2^22 = 4194304 entries
2019-01-28 13:45:11,586 INFO org.apache.hadoop.hdfs.server.namenode.FSDirectory: ACLs enabled? false
2019-01-28 13:45:11,586 INFO org.apache.hadoop.hdfs.server.namenode.FSDirectory: POSIX ACL inheritance enabled? true
2019-01-28 13:45:11,586 INFO org.apache.hadoop.hdfs.server.namenode.FSDirectory: XAttrs enabled? true
2019-01-28 13:45:11,586 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: Caching file names occurring more than 10 times
2019-01-28 13:45:11,592 INFO org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotManager: Loaded config captureOpenFiles: false, skipCaptureAccessTimeOnlyChange: false, snapshotDiffAllowSnapRootDescendant: true
2019-01-28 13:45:11,596 INFO org.apache.hadoop.util.GSet: Computing capacity for map cachedBlocks
2019-01-28 13:45:11,596 INFO org.apache.hadoop.util.GSet: VM type = 64-bit
2019-01-28 13:45:11,596 INFO org.apache.hadoop.util.GSet: 0.25% max memory 3.9 GB = 9.9 MB
2019-01-28 13:45:11,596 INFO org.apache.hadoop.util.GSet: capacity = 2^20 = 1048576 entries
2019-01-28 13:45:11,605 INFO org.apache.hadoop.hdfs.server.namenode.top.metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10
2019-01-28 13:45:11,605 INFO org.apache.hadoop.hdfs.server.namenode.top.metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10
2019-01-28 13:45:11,605 INFO org.apache.hadoop.hdfs.server.namenode.top.metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25
2019-01-28 13:45:11,608 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: Retry cache on namenode is enabled
2019-01-28 13:45:11,608 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
2019-01-28 13:45:11,610 INFO org.apache.hadoop.util.GSet: Computing capacity for map NameNodeRetryCache
2019-01-28 13:45:11,610 INFO org.apache.hadoop.util.GSet: VM type = 64-bit
2019-01-28 13:45:11,610 INFO org.apache.hadoop.util.GSet: 0.029999999329447746% max memory 3.9 GB = 1.2 MB
2019-01-28 13:45:11,610 INFO org.apache.hadoop.util.GSet: capacity = 2^17 = 131072 entries
2019-01-28 13:45:11,628 INFO org.apache.hadoop.util.ExitUtil: Exiting with status 1: ExitException
2019-01-28 13:45:11,631 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at master/10.252.96.50
************************************************************/
问题原因
是由于之前初始化 namenode 在 /dfs/nn 留下了残留数据(失效数据),从而影响再次初始化
解决方法
清空残留数据后,重新初始化
namenode节点:
rm -rf /dfs/nn
datanode节点:
rm -rf /dfs/dn