您好,登錄后才能下訂單哦!
HDFS只是Hadoop最基本的一個服務,很多其他服務,都是基于HDFS展開的。所以部署一個HDFS集群,是很核心的一個動作,也是大數據平臺的開始。
安裝Hadoop集群,首先需要有Zookeeper才可以完成安裝。如果沒有Zookeeper,請先部署一套Zookeeper。另外,JDK以及物理主機的一些設置等。請參考:
Hadoop集群(一) Zookeeper搭建
Hadoop集群(三) Hbase搭建
Hadoop集群(四) Hadoop升級
下面開始HDFS的安裝
HDFS主機分配
1 2 3 | 192.168.67.101 c6701 --Namenode+datanode 192.168.67.102 c6702 --datanode 192.168.67.103 c6703 --datanode |
1. 安裝HDFS,解壓hadoop-2.6.0-EDH-0u2.tar.gz
我同時下載2.6和2.7版本的軟件,先安裝2.6,然后在執行2.6到2.7的升級步驟
useradd hdfs echo "hdfs:hdfs" | chpasswd su - hdfs cd /tmp/software tar -zxvf hadoop-2.6.0-EDH-0u2.tar.gz -C /home/hdfs/ mkdir -p /data/hadoop/temp mkdir -p /data/hadoop/journal mkdir -p /data/hadoop/hdfs/name mkdir -p /data/hadoop/hdfs/data chown -R hdfs:hdfs /data/hadoop chown -R hdfs:hdfs /data/hadoop/temp chown -R hdfs:hdfs /data/hadoop/journal chown -R hdfs:hdfs /data/hadoop/hdfs/name chown -R hdfs:hdfs /data/hadoop/hdfs/data $ pwd /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop
2. 修改core-site.xml對應的參數
$ cat core-site.xml <configuration> <!-- 指定hdfs的nameservice為ns --> <property> <name>fs.defaultFS</name> <value>hdfs://ns</value> </property> <!--指定hadoop數據臨時存放目錄--> <property> <name>hadoop.tmp.dir</name> <value>/data/hadoop/temp</value> </property> <property> <name>io.file.buffer.size</name> <value>4096</value> </property> <!--指定zookeeper地址--> <property> <name>ha.zookeeper.quorum</name> <value>c6701:2181,c6702:2181,c6703:2181</value> </property> </configuration>
3. 修改hdfs-site.xml對應的參數
cat hdfs-site.xml <configuration> <!--指定hdfs的nameservice為ns,需要和core-site.xml中的保持一致,并且ns如果改,整個文件中,全部的ns要都修改,保持統一 --> <property> <name>dfs.nameservices</name> <value>ns</value> </property> <!-- ns下面有兩個NameNode,分別是nn1,nn2 --> <property> <name>dfs.ha.namenodes.ns</name> <value>nn1,nn2</value> </property> <!-- nn1的RPC通信地址 --> <property> <name>dfs.namenode.rpc-address.ns.nn1</name> <value>c6701:9000</value> </property> <!-- nn1的http通信地址 --> <property> <name>dfs.namenode.http-address.ns.nn1</name> <value>c6701:50070</value> </property> <!-- nn2的RPC通信地址 --> <property> <name>dfs.namenode.rpc-address.ns.nn2</name> <value>c6702:9000</value> </property> <!-- nn2的http通信地址 --> <property> <name>dfs.namenode.http-address.ns.nn2</name> <value>c6702:50070</value> </property> <!-- 指定NameNode的元數據在JournalNode上的存放位置 --> <property> <name>dfs.namenode.shared.edits.dir</name> <value>qjournal://c6701:8485;c6702:8485;c6703:8485/ns</value> </property> <!-- 指定JournalNode在本地磁盤存放數據的位置 --> <property> <name>dfs.journalnode.edits.dir</name> <value>/data/hadoop/journal</value> </property> <!-- 開啟NameNode故障時自動切換 --> <property> <name>dfs.ha.automatic-failover.enabled</name> <value>true</value> </property> <!-- 配置失敗自動切換實現方式 --> <property> <name>dfs.client.failover.proxy.provider.ns</name> <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value> </property> <!-- 配置隔離機制 --> <property> <name>dfs.ha.fencing.methods</name> <value>sshfence</value> </property> <!-- 使用隔離機制時需要ssh免登陸 --> <property> <name>dfs.ha.fencing.ssh.private-key-files</name> <value>/home/hdfs/.ssh/id_rsa</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>/data/hadoop/hdfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>/data/hadoop/hdfs/data</value> </property> <property> <name>dfs.replication</name> <value>2</value> </property> <!-- 在NN和DN上開啟WebHDFS (REST API)功能,不是必須 --> <property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property> </configuration>
4. 添加slaves文件
$ more slaves c6701 c6702 c6703
--- 安裝C6702的hdfs---
5. 創建c6702的用戶,并為hdfs用戶ssh免密
ssh c6702 "useradd hdfs" ssh c6702 "echo "hdfs:hdfs" | chpasswd" ssh-copy-id hdfs@c6702
6. 拷貝軟件
scp -r /tmp/software/hadoop-2.6.0-EDH-0u2.tar.gz root@c6702:/tmp/software/. ssh c6702 "chmod 777 /tmp/software/*"
7. 創建目錄,解壓軟件
ssh hdfs@c6702 "mkdir hdfs" ssh hdfs@c6702 "tar -zxvf /tmp/software/hadoop-2.6.0-EDH-0u2.tar.gz -C /home/hdfs" ssh hdfs@c6702 "ls -al hdfs" ssh hdfs@c6702 "ls -al hdfs/hadoop*"
復制配置文件
ssh hdfs@c6702 "rm -rf /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/core-site.xml" ssh hdfs@c6702 "rm -rf /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/hdfs-site.xml" scp -r /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/core-site.xml hdfs@c6702:/home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/core-site.xml scp -r /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/hdfs-site.xml hdfs@c6702:/home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/hdfs-site.xml scp -r /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/slaves hdfs@c6702:/home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/slaves
創建hdfs需要的目錄
ssh root@c6702 "mkdir -p /data/hadoop" ssh root@c6702 " chown -R hdfs:hdfs /data/hadoop" ssh hdfs@c6702 "mkdir -p /data/hadoop/temp" ssh hdfs@c6702 "mkdir -p /data/hadoop/journal" ssh hdfs@c6702 "mkdir -p /data/hadoop/hdfs/name" ssh hdfs@c6702 "mkdir -p /data/hadoop/hdfs/data"
--- 安裝C6703的hdfs---
8. 創建c6703的用戶,并為hdfs用戶ssh免密
ssh c6703 "useradd hdfs" ssh c6703 "echo "hdfs:hdfs" | chpasswd" ssh-copy-id hdfs@c6703
9. 拷貝軟件
scp -r /tmp/software/hadoop-2.6.0-EDH-0u2.tar.gz root@c6703:/tmp/software/. ssh c6703 "chmod 777 /tmp/software/*" 10. 創建目錄,解壓軟件 ssh hdfs@c6703 "mkdir hdfs" ssh hdfs@c6703 "tar -zxvf /tmp/software/hadoop-2.6.0-EDH-0u2.tar.gz -C /home/hdfs" ssh hdfs@c6703 "ls -al hdfs" ssh hdfs@c6703 "ls -al hdfs/hadoop*"
復制配置文件
ssh hdfs@c6703 "rm -rf /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/core-site.xml" ssh hdfs@c6703 "rm -rf /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/hdfs-site.xml" scp -r /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/core-site.xml hdfs@c6703:/home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/core-site.xml scp -r /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/hdfs-site.xml hdfs@c6703:/home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/hdfs-site.xml scp -r /home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/slaves hdfs@c6703:/home/hdfs/hadoop-2.6.0-EDH-0u2/etc/hadoop/slaves
創建hdfs需要的目錄
ssh root@c6703 "mkdir -p /data/hadoop" ssh root@c6703 " chown -R hdfs:hdfs /data/hadoop" ssh hdfs@c6703 "mkdir -p /data/hadoop/temp" ssh hdfs@c6703 "mkdir -p /data/hadoop/journal" ssh hdfs@c6703 "mkdir -p /data/hadoop/hdfs/name" ssh hdfs@c6703 "mkdir -p /data/hadoop/hdfs/data"
11. 啟動HDFS,先啟動三個節點的journalnode
/home/hdfs/hadoop-2.6.0-EDH-0u2/sbin/hadoop-daemon.sh start journalnode
檢查狀態
$ jps 3958 Jps 3868 JournalNode
12. 然后啟動namenode,首次啟動namenode之前,先在其中一個節點(主節點)format namenode信息,信息會存在于dfs.namenode.name.dir指定的路徑中
<name>dfs.namenode.name.dir</name> <value>/data/hadoop/hdfs/name</value>
$ ./hdfs namenode -format 17/09/26 07:52:17 INFO namenode.NameNode: STARTUP_MSG: /************************************************************ STARTUP_MSG: Starting NameNode STARTUP_MSG: host = c6701.python279.org/192.168.67.101 STARTUP_MSG: args = [-format] STARTUP_MSG: version = 2.6.0-EDH-0u2 STARTUP_MSG: classpath = /home/hdfs/hadoop-2.6.0-EDHxxxxxxxxxx STARTUP_MSG: build = http://gitlab-xxxxx STARTUP_MSG: java = 1.8.0_144 ************************************************************/ 17/09/26 07:52:17 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT] 17/09/26 07:52:17 INFO namenode.NameNode: createNameNode [-format] 17/09/26 07:52:18 WARN common.Util: Path /data/hadoop/hdfs/name should be specified as a URI in configuration files. Please update hdfs configuration. 17/09/26 07:52:18 WARN common.Util: Path /data/hadoop/hdfs/name should be specified as a URI in configuration files. Please update hdfs configuration. Formatting using clusterid: CID-b2f01411-862f-44b2-a6dc-7d17bd48d522 17/09/26 07:52:18 INFO namenode.FSNamesystem: No KeyProvider found. 17/09/26 07:52:18 INFO namenode.FSNamesystem: fsLock is fair:true 17/09/26 07:52:18 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit=1000 17/09/26 07:52:18 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true 17/09/26 07:52:18 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000 17/09/26 07:52:18 INFO blockmanagement.BlockManager: The block deletion will start around 2017 Sep 26 07:52:18 17/09/26 07:52:18 INFO util.GSet: Computing capacity for map BlocksMap 17/09/26 07:52:18 INFO util.GSet: VM type = 64-bit 17/09/26 07:52:18 INFO util.GSet: 2.0% max memory 966.7 MB = 19.3 MB 17/09/26 07:52:18 INFO util.GSet: capacity = 2^21 = 2097152 entries 17/09/26 07:52:18 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false 17/09/26 07:52:18 INFO blockmanagement.BlockManager: defaultReplication = 2 17/09/26 07:52:18 INFO blockmanagement.BlockManager: maxReplication = 512 17/09/26 07:52:18 INFO blockmanagement.BlockManager: minReplication = 1 17/09/26 07:52:18 INFO blockmanagement.BlockManager: maxReplicationStreams = 2 17/09/26 07:52:18 INFO blockmanagement.BlockManager: shouldCheckForEnoughRacks = false 17/09/26 07:52:18 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000 17/09/26 07:52:18 INFO blockmanagement.BlockManager: encryptDataTransfer = false 17/09/26 07:52:18 INFO blockmanagement.BlockManager: maxNumBlocksToLog = 1000 17/09/26 07:52:18 INFO namenode.FSNamesystem: fsOwner = hdfs (auth:SIMPLE) 17/09/26 07:52:18 INFO namenode.FSNamesystem: supergroup = supergroup 17/09/26 07:52:18 INFO namenode.FSNamesystem: isPermissionEnabled = true 17/09/26 07:52:18 INFO namenode.FSNamesystem: Determined nameservice ID: ns 17/09/26 07:52:18 INFO namenode.FSNamesystem: HA Enabled: true 17/09/26 07:52:18 INFO namenode.FSNamesystem: Append Enabled: true 17/09/26 07:52:18 INFO util.GSet: Computing capacity for map INodeMap 17/09/26 07:52:18 INFO util.GSet: VM type = 64-bit 17/09/26 07:52:18 INFO util.GSet: 1.0% max memory 966.7 MB = 9.7 MB 17/09/26 07:52:18 INFO util.GSet: capacity = 2^20 = 1048576 entries 17/09/26 07:52:18 INFO namenode.NameNode: Caching file names occuring more than 10 times 17/09/26 07:52:18 INFO util.GSet: Computing capacity for map cachedBlocks 17/09/26 07:52:18 INFO util.GSet: VM type = 64-bit 17/09/26 07:52:18 INFO util.GSet: 0.25% max memory 966.7 MB = 2.4 MB 17/09/26 07:52:18 INFO util.GSet: capacity = 2^18 = 262144 entries 17/09/26 07:52:18 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.9990000128746033 17/09/26 07:52:18 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 0 17/09/26 07:52:18 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension = 30000 17/09/26 07:52:18 INFO namenode.FSNamesystem: Retry cache on namenode is enabled 17/09/26 07:52:18 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis 17/09/26 07:52:18 INFO util.GSet: Computing capacity for map NameNodeRetryCache 17/09/26 07:52:18 INFO util.GSet: VM type = 64-bit 17/09/26 07:52:18 INFO util.GSet: 0.029999999329447746% max memory 966.7 MB = 297.0 KB 17/09/26 07:52:18 INFO util.GSet: capacity = 2^15 = 32768 entries 17/09/26 07:52:18 INFO namenode.NNConf: ACLs enabled? false 17/09/26 07:52:18 INFO namenode.NNConf: XAttrs enabled? true 17/09/26 07:52:18 INFO namenode.NNConf: Maximum size of an xattr: 16384 17/09/26 07:52:19 INFO namenode.FSImage: Allocated new BlockPoolId: BP-144216011-192.168.67.101-1506412339757 17/09/26 07:52:19 INFO common.Storage: Storage directory /data/hadoop/hdfs/name has been successfully formatted. 17/09/26 07:52:20 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0 17/09/26 07:52:20 INFO util.ExitUtil: Exiting with status 0 17/09/26 07:52:20 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************ SHUTDOWN_MSG: Shutting down NameNode at c6701.python279.org/192.168.67.101 ************************************************************/
13. standby namenode需要先執行bootstrapstandby,輸出如下
[hdfs@c6702 sbin]$ ../bin/hdfs namenode -bootstrapstandby 17/09/26 09:44:58 INFO namenode.NameNode: STARTUP_MSG: /************************************************************ STARTUP_MSG: Starting NameNode STARTUP_MSG: host = c6702.python279.org/192.168.67.102 STARTUP_MSG: args = [-bootstrapstandby] STARTUP_MSG: version = 2.6.0-EDH-0u2 STARTUP_MSG: classpath = /home/hdfs/haxxx STARTUP_MSG: build = http://gitlab-xxxx STARTUP_MSG: java = 1.8.0_144 ************************************************************/ 17/09/26 09:44:58 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT] 17/09/26 09:44:58 INFO namenode.NameNode: createNameNode [-bootstrapstandby] 17/09/26 09:44:59 WARN common.Util: Path /data/hadoop/hdfs/name should be specified as a URI in configuration files. Please update hdfs configuration. 17/09/26 09:44:59 WARN common.Util: Path /data/hadoop/hdfs/name should be specified as a URI in configuration files. Please update hdfs configuration. ===================================================== About to bootstrap Standby ID nn2 from: Nameservice ID: ns Other Namenode ID: nn1 Other NN's HTTP address: http://c6701:50070 Other NN's IPC address: c6701/192.168.67.101:9000 Namespace ID: 793662207 Block pool ID: BP-144216011-192.168.67.101-1506412339757 Cluster ID: CID-b2f01411-862f-44b2-a6dc-7d17bd48d522 Layout version: -60 ===================================================== Re-format filesystem in Storage Directory /data/hadoop/hdfs/name ? (Y or N) y 17/09/26 09:45:16 INFO common.Storage: Storage directory /data/hadoop/hdfs/name has been successfully formatted. 17/09/26 09:45:16 WARN common.Util: Path /data/hadoop/hdfs/name should be specified as a URI in configuration files. Please update hdfs configuration. 17/09/26 09:45:16 WARN common.Util: Path /data/hadoop/hdfs/name should be specified as a URI in configuration files. Please update hdfs configuration. 17/09/26 09:45:17 INFO namenode.TransferFsImage: Opening connection to http://c6701:50070/imagetransfer?getimage=1&txid=0&storageInfo=-60:793662207:0:CID-b2f01411-862f-44b2-a6dc-7d17bd48d522 17/09/26 09:45:17 INFO namenode.TransferFsImage: Image Transfer timeout configured to 60000 milliseconds 17/09/26 09:45:17 INFO namenode.TransferFsImage: Transfer took 0.01s at 0.00 KB/s 17/09/26 09:45:17 INFO namenode.TransferFsImage: Downloaded file fsimage.ckpt_0000000000000000000 size 351 bytes. 17/09/26 09:45:17 INFO util.ExitUtil: Exiting with status 0 17/09/26 09:45:17 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************ SHUTDOWN_MSG: Shutting down NameNode at c6702.python279.org/192.168.67.102 ************************************************************/
14. 檢查狀態,namenode還沒有啟動
[hdfs@c6702 sbin]$ jps 4539 Jps 3868 JournalNode
15. 啟動standby namenode,命令和master啟動的方式相同
[hdfs@c6702 sbin]$ ./hadoop-daemon.sh start namenode starting namenode, logging to /home/hdfs/hadoop-2.6.0-EDH-0u2/logs/hadoop-hdfs-namenode-c6702.python279.org.out
16. 再次檢查,namenode已經啟動
[hdfs@c6702 sbin]$ jps 4640 Jps 4570 NameNode 3868 JournalNode
17. 格式化zkfc,讓在zookeeper中生成ha節點,在master上執行如下命令,完成格式化
[hdfs@c6701 bin]$ ./hdfs zkfc -formatZK 17/09/26 09:59:20 INFO tools.DFSZKFailoverController: Failover controller configured for NameNode NameNode at c6701/192.168.67.101:9000 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:host.name=c6701.python279.org 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:java.version=1.8.0_144 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:java.home=/usr/local/jdk1.8.0_144/jre 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:java.class.path=/home/hdfs/hadoop-2.6.0-EDH-0u2/exxxx 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/home/hdfs/hadoop-2.6.0-EDH-0u2/lib/native 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA> 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:os.version=2.6.32-573.el6.x86_64 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:user.name=hdfs 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:user.home=/home/hdfs 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Client environment:user.dir=/home/hdfs/hadoop-2.6.0-EDH-0u2/bin 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=c6701:2181,c6702:2181,c6703:2181 sessionTimeout=5000 watcher=org.apache.hadoop.ha.ActiveStandbyElector$WatcherWithClientRef@20deea7f 17/09/26 09:59:20 INFO zookeeper.ClientCnxn: Opening socket connection to server c6703.python279.org/192.168.67.103:2181. Will not attempt to authenticate using SASL (unknown error) 17/09/26 09:59:20 INFO zookeeper.ClientCnxn: Socket connection established to c6703.python279.org/192.168.67.103:2181, initiating session 17/09/26 09:59:20 INFO zookeeper.ClientCnxn: Session establishment complete on server c6703.python279.org/192.168.67.103:2181, sessionid = 0x35ebc5163710000, negotiated timeout = 5000 17/09/26 09:59:20 INFO ha.ActiveStandbyElector: Session connected. 17/09/26 09:59:20 INFO ha.ActiveStandbyElector: Successfully created /hadoop-ha/ns in ZK. 17/09/26 09:59:20 INFO zookeeper.ZooKeeper: Session: 0x35ebc5163710000 closed 17/09/26 09:59:20 INFO zookeeper.ClientCnxn: EventThread shut down
18. 格式化完成的檢查
格式成功后,查看zookeeper中可以看到 <<<<<<<<<<<命令沒確認
[zk: localhost:2181(CONNECTED) 1] ls /hadoop-ha
19. 啟動zkfc,這個就是為namenode使用的
./hadoop-daemon.sh start zkfc starting zkfc, logging to /home/hdfs/hadoop-2.6.0-EDH-0u2/logs/hadoop-hdfs-zkfc-c6701.python279.org.out $ jps 4272 DataNode 4402 JournalNode 6339 Jps 6277 DFSZKFailoverController 4952 NameNode
20. 另一個節點啟動zkfc,
ssh hdfs@c6702 /home/hdfs/hadoop-2.6.0-EDH-0u2/sbin/hadoop-daemon.sh start zkfc $ jps 4981 Jps 4935 DFSZKFailoverController 4570 NameNode 3868 JournalNode
21. 注意:進行初始化的時候,必須保證zk集群已經啟動了。
1、在ZK中創建znode來存儲automatic Failover的數據,任選一個NN執行完成即可:
sh bin/hdfs zkfc -formatZK
2、啟動zkfs,在所有的NN節點中執行以下命令:
sh sbin/hadoop-daemon.sh start zkfc
22. 啟動datanode
最后啟動集群
/home/hdfs/hadoop-2.6.0-EDH-0u2/sbin/hadoop-daemon.sh start zkfc sh sbin/start-dfs.sh
HDFS安裝過程中的重點,最后在軟件啟動過程中,一些初始化操作,很重要。
1. 啟動全部的journalnode
2. 在namenode1上執行, hdfs namenode -format
3. 在namenode1上執行, 啟動namenode1,命令hadoop-daemon.sh start namenode
4. 在namenode2上執行, hdfs namenode -bootstrapstandby
5. 在namenode1上執行,格式化zkfc,在zookeeper中生成HA節點, hdfs zkfc -formatZK
6. 啟動zkfc,hadoop-daemon.sh start zkfc。 有namenode運行的節點,都要啟動ZKFC
7. 啟動 datanode
HDFS只是Hadoop最基本的一個模塊,這里已經安裝完成,可以為后面的Hbase提供服務了。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。