1. 程式人生 > >2.4 Hadoop單機執行

2.4 Hadoop單機執行

第2章 Hadoop快速入門

2.4 Hadoop單機執行

緊接上一節內容,首先切換到Hadoop根目錄

這裡寫圖片描述 
或者cd /opt/hadoop-2.7.3進入Hadoop根目錄 
通過pwd命令可以知道當前所在目錄

[root@node1 hadoop-2.7.3]# pwd
      
  • 1

這裡寫圖片描述

注意:本節命令都將在/opt/hadoop-2.7.3目錄下執行。

2.4.1 namenode格式化

執行bin/hadoop namenode -format

命令,進行namenode格式化

[root@node1 hadoop-2.7.3]# bin/hadoop namenode -format
      
  • 1

這裡寫圖片描述 
輸出資訊(下半部分):


      
  1. 17/ 05/ 12 05: 59: 11 INFO namenode .NameNode
    : registered UNIX signal handlers for [TERM, HUP, INT]
  2. 17/ 05/ 12 05: 59: 11 INFO namenode .NameNode: createNameNode [-format]
  3. Formatting using clusterid: CID-db9a34c9- 661e-4
    fc0-a273-b554e0cfb32b
  4. 17/ 05/ 12 05: 59: 12 INFO namenode .FSNamesystem: No KeyProvider found.
  5. 17/ 05/ 12 05: 59: 12 INFO namenode .FSNamesystem: fsLock is fair:true
  6. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .DatanodeManager: dfs .block .invalidate .limit= 1000
  7. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .DatanodeManager: dfs .namenode .datanode .registration .ip-hostname- check= true
  8. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: dfs .namenode .startup .delay .block .deletion .sec is set to 000: 00: 00: 00.000
  9. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: The block deletion will start around 2017 May 12 05: 59: 12
  10. 17/ 05/ 12 05: 59: 12 INFO util .GSet: Computing capacity for map BlocksMap
  11. 17/ 05/ 12 05: 59: 12 INFO util .GSet: VM type = 64- bit
  12. 17/ 05/ 12 05: 59: 12 INFO util .GSet: 2.0% max memory 966.7 MB = 19.3 MB
  13. 17/ 05/ 12 05: 59: 12 INFO util .GSet: capacity = 2^ 21 = 2097152 entries
  14. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: dfs .block .access .token .enable= false
  15. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: defaultReplication = 1
  16. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: maxReplication = 512
  17. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: minReplication = 1
  18. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: maxReplicationStreams = 2
  19. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: replicationRecheckInterval = 3000
  20. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: encryptDataTransfer = false
  21. 17/ 05/ 12 05: 59: 12 INFO blockmanagement .BlockManager: maxNumBlocksToLog = 1000
  22. 17/ 05/ 12 05: 59: 12 INFO namenode .FSNamesystem: fsOwner = root (auth:SIMPLE)
  23. 17/ 05/ 12 05: 59: 12 INFO namenode .FSNamesystem: supergroup = supergroup
  24. 17/ 05/ 12 05: 59: 12 INFO namenode .FSNamesystem: isPermissionEnabled = true
  25. 17/ 05/ 12 05: 59: 12 INFO namenode .FSNamesystem: HA Enabled: false
  26. 17/ 05/ 12 05: 59: 12 INFO namenode .FSNamesystem: Append Enabled: true
  27. 17/ 05/ 12 05: 59: 13 INFO util .GSet: Computing capacity for map INodeMap
  28. 17/ 05/ 12 05: 59: 13 INFO util .GSet: VM type = 64- bit
  29. 17/ 05/ 12 05: 59: 13 INFO util .GSet: 1.0% max memory 966.7 MB = 9.7 MB
  30. 17/ 05/ 12 05: 59: 13 INFO util .GSet: capacity = 2^ 20 = 1048576 entries
  31. 17/ 05/ 12 05: 59: 13 INFO namenode .FSDirectory: ACLs enabled? false
  32. 17/ 05/ 12 05: 59: 13 INFO namenode .FSDirectory: XAttrs enabled? true
  33. 17/ 05/ 12 05: 59: 13 INFO namenode .FSDirectory: Maximum size of an xattr: 16384
  34. 17/ 05/ 12 05: 59: 13 INFO namenode .NameNode: Caching file names occuring more than 10 times
  35. 17/ 05/ 12 05: 59: 13 INFO util .GSet: Computing capacity for map cachedBlocks
  36. 17/ 05/ 12 05: 59: 13 INFO util .GSet: VM type = 64- bit
  37. 17/ 05/ 12 05: 59: 13 INFO util .GSet: 0.25% max memory 966.7 MB = 2.4 MB
  38. 17/ 05/ 12 05: 59: 13 INFO util .GSet: capacity = 2^ 18 = 262144 entries
  39. 17/ 05/ 12 05: 59: 13 INFO namenode .FSNamesystem: dfs .namenode .safemode .threshold-pct = 0.9990000128746033
  40. 17/ 05/ 12 05: 59: 13 INFO namenode .FSNamesystem: dfs .namenode .safemode .min .datanodes = 0
  41. 17/ 05/ 12 05: 59: 13 INFO namenode .FSNamesystem: dfs .namenode .safemode .extension = 30000
  42. 17/ 05/ 12 05: 59: 13 INFO metrics .TopMetrics: NNTop conf: dfs .namenode .top .window .num .buckets = 10
  43. 17/ 05/ 12 05: 59: 13 INFO metrics .TopMetrics: NNTop conf: dfs .namenode .top .num .users = 10
  44. 17/ 05/ 12 05: 59: 13 INFO metrics .TopMetrics: NNTop conf: dfs .namenode .top .windows .minutes = 1, 5, 25
  45. 17/ 05/ 12 05: 59: 13 INFO namenode .FSNamesystem: Retry cache on namenode is enabled
  46. 17/ 05/ 12 05: 59: 13 INFO namenode .FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
  47. 17/ 05/ 12 05: 59: 13 INFO util .GSet: Computing capacity for map NameNodeRetryCache
  48. 17/ 05/ 12 05: 59: 13 INFO util .GSet: VM type = 64- bit
  49. 17/ 05/ 12 05: 59: 13 INFO util .GSet: 0.029999999329447746% max memory 966.7 MB = 297.0 KB
  50. 17/ 05/ 12 05: 59: 13 INFO util .GSet: capacity = 2^ 15 = 32768 entries
  51. 17/ 05/ 12 05: 59: 13 INFO namenode .FSImage: Allocated new BlockPoolId: BP - 2055065474 - 192.168 .80 .131 - 1494583153319
  52. 17/ 05/ 12 05: 59: 13 INFO common .Storage: Storage directory /tmp/hadoop-root/dfs/ name has been successfully formatted.
  53. 17/ 05/ 12 05: 59: 13 INFO namenode .FSImageFormatProtobuf: Saving image file /tmp/hadoop-root/dfs/ name/ current/fsimage .ckpt_0000000000000000000 using no compression
  54. 17/ 05/ 12 05: 59: 13 INFO namenode .FSImageFormatProtobuf: Image file /tmp/hadoop-root/dfs/ name/ current/fsimage .ckpt_0000000000000000000 of size 351 bytes saved in 0 seconds.
  55. 17/ 05/ 12 05: 59: 13 INFO namenode .NNStorageRetentionManager: Going to retain 1 images with txid >= 0
  56. 17/ 05/ 12 05: 59: 13 INFO util .ExitUtil: Exiting with status 0
  57. 17/ 05/ 12 05: 59: 13 INFO namenode .NameNode: SHUTDOWN_MSG:
  58. /************************************************************
  59. SHUTDOWN_MSG: Shutting down NameNode at node1/192.168.80.131
  60. ************************************************************/
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60

這裡寫圖片描述

在執行結果中可以找到has been successfully formatted,說明namenode格式化成功了!

2.4.2 啟動HDFS

執行sbin/start-dfs.sh命令啟動HDFS


      
  1. [[email protected] hadoop - 2.7 .3] # sbin/start-dfs.sh
  2. Starting namenodes on [node1]
  3. node1: starting namenode, logging to /opt/hadoop - 2.7 .3/logs/hadoop-root-namenode-node1.out
  4. localhost: starting datanode, logging to /opt/hadoop - 2.7 .3/logs/hadoop-root-datanode-node1.out
  5. Starting secondary namenodes [ 0.0 .0 .0]
  6. The authenticity of host ' 0.0 .0 .0 ( 0.0 .0 .0