hadoop 文檔html
http://hadoop.apache.org/docs/java
運行服務node |
服務器IPweb |
NameNodeapache |
192.168.221.100bootstrap |
SecondaryNameNodevim |
192.168.221.100緩存 |
DataNode服務器 |
192.168.221.100架構 |
ResourceManager |
192.168.221.100 |
NodeManager |
192.168.221.100 |
下載連接:
http://archive.apache.org/dist/hadoop/common/hadoop-2.7.5/hadoop-2.7.5.tar.gz
解壓命令
cd /export/softwares
tar -zxvf hadoop-2.7.5.tar.gz -C ../servers/
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim core-site.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://192.168.221.100:8020</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/export/servers/hadoop-2.7.5/hadoopDatas/tempDatas</value>
</property>
<!-- 緩衝區大小,實際工做中根據服務器性能動態調整 -->
<property>
<name>io.file.buffer.size</name>
<value>4096</value>
</property>
<!-- 開啓hdfs的垃圾桶機制,刪除掉的數據能夠從垃圾桶中回收,單位分鐘 -->
<property>
<name>fs.trash.interval</name>
<value>10080</value>
</property>
</configuration>
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim hdfs-site.xml
<configuration>
<!-- NameNode存儲元數據信息的路徑,實際工做中,通常先肯定磁盤的掛載目錄,而後多個目錄用,進行分割 -->
<!-- 集羣動態上下線
<property>
<name>dfs.hosts</name>
<value>/export/servers/hadoop-2.7.4/etc/hadoop/accept_host</value>
</property>
<property>
<name>dfs.hosts.exclude</name>
<value>/export/servers/hadoop-2.7.4/etc/hadoop/deny_host</value>
</property>
-->
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>node01:50090</value>
</property>
<property>
<name>dfs.namenode.http-address</name>
<value>node01:50070</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///export/servers/hadoop-2.7.5/hadoopDatas/namenodeDatas,file:///export/servers/hadoop-2.7.5/hadoopDatas/namenodeDatas2</value>
</property>
<!-- 定義dataNode數據存儲的節點位置,實際工做中,通常先肯定磁盤的掛載目錄,而後多個目錄用,進行分割 -->
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///export/servers/hadoop-2.7.5/hadoopDatas/datanodeDatas,file:///export/servers/hadoop-2.7.5/hadoopDatas/datanodeDatas2</value>
</property>
<property>
<name>dfs.namenode.edits.dir</name>
<value>file:///export/servers/hadoop-2.7.5/hadoopDatas/nn/edits</value>
</property>
<property>
<name>dfs.namenode.checkpoint.dir</name>
<value>file:///export/servers/hadoop-2.7.5/hadoopDatas/snn/name</value>
</property>
<property>
<name>dfs.namenode.checkpoint.edits.dir</name>
<value>file:///export/servers/hadoop-2.7.5/hadoopDatas/dfs/snn/edits</value>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
<property>
<name>dfs.blocksize</name>
<value>134217728</value>
</property>
</configuration>
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim hadoop-env.sh
vim hadoop-env.sh
export JAVA_HOME=/export/servers/jdk1.8.0_181
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.job.ubertask.enable</name>
<value>true</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>node01:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>node01:19888</value>
</property>
</configuration>
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim yarn-site.xml
<configuration>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>node01</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value>
</property>
<property>
<name>yarn.log-aggregation.retain-seconds</name>
<value>604800</value>
</property>
</configuration>
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim mapred-env.sh
export JAVA_HOME=/export/servers/jdk1.8.0_181
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim slaves
localhost
要啓動 Hadoop 集羣,須要啓動 HDFS 和 YARN 兩個模塊。
注意: 首次啓動 HDFS 時,必須對其進行格式化操做。 本質上是一些清理和
準備工做,由於此時的 HDFS 在物理上仍是不存在的。
hdfs namenode -format 或者 hadoop namenode –format
啓動命令:
建立數據存放文件夾
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/tempDatas
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/namenodeDatas
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/namenodeDatas2
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/datanodeDatas
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/datanodeDatas2
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/nn/edits
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/snn/name
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/dfs/snn/edits
準備啓動
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/
bin/hdfs namenode -format
sbin/start-dfs.sh
sbin/start-yarn.sh
sbin/mr-jobhistory-daemon.sh start historyserver
三個端口查看界面
http://node01:50070/explorer.html#/ 查看hdfs
http://node01:8088/cluster 查看yarn集羣
http://node01:19888/jobhistory 查看歷史完成的任務
服務規劃
服務器IP |
192.168.221.100 |
192.168.221.110 |
192.168.221.120 |
主機名 |
node01.hadoop.com |
node02.hadoop.com |
node03.hadoop.com |
NameNode |
是 |
否 |
否 |
Secondary NameNode |
是 |
否 |
否 |
dataNode |
是 |
是 |
是 |
ResourceManager |
是 |
否 |
否 |
NodeManager |
是 |
是 |
是 |
中止單節點集羣,刪除/export/servers/hadoop-2.7.5/hadoopDatas文件夾,而後從新建立文件夾
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5
sbin/stop-dfs.sh
sbin/stop-yarn.sh
sbin/mr-jobhistory-daemon.sh stop historyserver
刪除hadoopDatas而後從新建立文件夾
rm -rf /export/servers/hadoop-2.7.5/hadoopDatas
從新建立文件夾
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/tempDatas
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/namenodeDatas
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/namenodeDatas2
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/datanodeDatas
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/datanodeDatas2
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/nn/edits
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/snn/name
mkdir -p /export/servers/hadoop-2.7.5/hadoopDatas/dfs/snn/edits
修改slaves文件,而後將安裝包發送到其餘機器,從新啓動集羣便可
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim slaves
node01
node02
node03
安裝包的分發
第一臺機器執行如下命令
cd /export/servers/
scp -r hadoop-2.7.5 node02:$PWD
scp -r hadoop-2.7.5 node03:$PWD
啓動集羣
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5
bin/hdfs namenode -format
sbin/start-dfs.sh
sbin/start-yarn.sh
sbin/mr-jobhistory-daemon.sh start historyserver
使用徹底分佈式,實現namenode高可用,ResourceManager的高可用
集羣運行服務規劃
|
192.168.1.100 |
192.168.1.110 |
192.168.1.120 |
zookeeper |
zk |
zk |
zk |
HDFS |
JournalNode |
JournalNode |
JournalNode |
NameNode |
NameNode |
|
|
ZKFC |
ZKFC |
|
|
DataNode |
DataNode |
DataNode |
|
YARN |
|
ResourceManager |
ResourceManager |
NodeManager |
NodeManager |
NodeManager |
|
MapReduce |
|
|
JobHistoryServer |
中止以前的hadoop集羣的全部服務,並刪除全部機器的hadoop安裝包,而後從新解壓hadoop壓縮包
解壓壓縮包
第一臺機器執行如下命令進行解壓
cd /export/softwares
tar -zxvf hadoop-2.7.5.tar.gz -C ../servers/
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim core-site.xml
<configuration>
<!-- 指定NameNode的HA高可用的zk地址 -->
<property>
<name>ha.zookeeper.quorum</name>
<value>node01:2181,node02:2181,node03:2181</value>
</property>
<!-- 指定HDFS訪問的域名地址 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://ns</value>
</property>
<!-- 臨時文件存儲目錄 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/export/servers/hadoop-2.7.5/data/tmp</value>
</property>
<!-- 開啓hdfs垃圾箱機制,指定垃圾箱中的文件七天以後就完全刪掉
單位爲分鐘
-->
<property>
<name>fs.trash.interval</name>
<value>10080</value>
</property>
</configuration>
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim hdfs-site.xml
<configuration>
<!-- 指定命名空間 -->
<property>
<name>dfs.nameservices</name>
<value>ns</value>
</property>
<!-- 指定該命名空間下的兩個機器做爲咱們的NameNode -->
<property>
<name>dfs.ha.namenodes.ns</name>
<value>nn1,nn2</value>
</property>
<!-- 配置第一臺服務器的namenode通訊地址 -->
<property>
<name>dfs.namenode.rpc-address.ns.nn1</name>
<value>node01:8020</value>
</property>
<!-- 配置第二臺服務器的namenode通訊地址 -->
<property>
<name>dfs.namenode.rpc-address.ns.nn2</name>
<value>node02:8020</value>
</property>
<!-- 全部從節點之間相互通訊端口地址 -->
<property>
<name>dfs.namenode.servicerpc-address.ns.nn1</name>
<value>node01:8022</value>
</property>
<!-- 全部從節點之間相互通訊端口地址 -->
<property>
<name>dfs.namenode.servicerpc-address.ns.nn2</name>
<value>node02:8022</value>
</property>
<!-- 第一臺服務器namenode的web訪問地址 -->
<property>
<name>dfs.namenode.http-address.ns.nn1</name>
<value>node01:50070</value>
</property>
<!-- 第二臺服務器namenode的web訪問地址 -->
<property>
<name>dfs.namenode.http-address.ns.nn2</name>
<value>node02:50070</value>
</property>
<!-- journalNode的訪問地址,注意這個地址必定要配置 -->
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://node01:8485;node02:8485;node03:8485/ns1</value>
</property>
<!-- 指定故障自動恢復使用的哪一個java類 -->
<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>
<!-- 指定通訊使用的公鑰 -->
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/root/.ssh/id_rsa</value>
</property>
<!-- journalNode數據存放地址 -->
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/export/servers/hadoop-2.7.5/data/dfs/jn</value>
</property>
<!-- 啓用自動故障恢復功能 -->
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<!-- namenode產生的文件存放路徑 -->
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///export/servers/hadoop-2.7.5/data/dfs/nn/name</value>
</property>
<!-- edits產生的文件存放路徑 -->
<property>
<name>dfs.namenode.edits.dir</name>
<value>file:///export/servers/hadoop-2.7.5/data/dfs/nn/edits</value>
</property>
<!-- dataNode文件存放路徑 -->
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///export/servers/hadoop-2.7.5/data/dfs/dn</value>
</property>
<!-- 關閉hdfs的文件權限 -->
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
<!-- 指定block文件塊的大小 -->
<property>
<name>dfs.blocksize</name>
<value>134217728</value>
</property>
</configuration>
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim yarn-site.xml
<configuration>
<!-- Site specific YARN configuration properties -->
<!-- 是否啓用日誌聚合.應用程序完成後,日誌彙總收集每一個容器的日誌,這些日誌移動到文件系統,例如HDFS. -->
<!-- 用戶能夠經過配置"yarn.nodemanager.remote-app-log-dir"、"yarn.nodemanager.remote-app-log-dir-suffix"來肯定日誌移動到的位置 -->
<!-- 用戶能夠經過應用程序時間服務器訪問日誌 -->
<!-- 啓用日誌聚合功能,應用程序完成後,收集各個節點的日誌到一塊兒便於查看 -->
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value>
</property>
<!--開啓resource manager HA,默認爲false-->
<property>
<name>yarn.resourcemanager.ha.enabled</name>
<value>true</value>
</property>
<!-- 集羣的Id,使用該值確保RM不會作爲其它集羣的active -->
<property>
<name>yarn.resourcemanager.cluster-id</name>
<value>mycluster</value>
</property>
<!--配置resource manager 命名-->
<property>
<name>yarn.resourcemanager.ha.rm-ids</name>
<value>rm1,rm2</value>
</property>
<!-- 配置第一臺機器的resourceManager -->
<property>
<name>yarn.resourcemanager.hostname.rm1</name>
<value>node03</value>
</property>
<!-- 配置第二臺機器的resourceManager -->
<property>
<name>yarn.resourcemanager.hostname.rm2</name>
<value>node02</value>
</property>
<!-- 配置第一臺機器的resourceManager通訊地址 -->
<property>
<name>yarn.resourcemanager.address.rm1</name>
<value>node03:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address.rm1</name>
<value>node03:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address.rm1</name>
<value>node03:8031</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address.rm1</name>
<value>node03:8033</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address.rm1</name>
<value>node03:8088</value>
</property>
<!-- 配置第二臺機器的resourceManager通訊地址 -->
<property>
<name>yarn.resourcemanager.address.rm2</name>
<value>node02:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address.rm2</name>
<value>node02:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address.rm2</name>
<value>node02:8031</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address.rm2</name>
<value>node02:8033</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address.rm2</name>
<value>node02:8088</value>
</property>
<!--開啓resourcemanager自動恢復功能-->
<property>
<name>yarn.resourcemanager.recovery.enabled</name>
<value>true</value>
</property>
<!--在node1上配置rm1,在node2上配置rm2,注意:通常都喜歡把配置好的文件遠程複製到其它機器上,但這個在YARN的另外一個機器上必定要修改,其餘機器上不配置此項-->
<property>
<name>yarn.resourcemanager.ha.id</name>
<value>rm1</value>[a1]
<description>If we want to launch more than one RM in single node, we need this configuration</description>
</property>
<!--用於持久存儲的類。嘗試開啓-->
<property>
<name>yarn.resourcemanager.store.class</name>
<value>org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore</value>
</property>
<property>
<name>yarn.resourcemanager.zk-address</name>
<value>node02:2181,node03:2181,node01:2181</value>
<description>For multiple zk services, separate them with comma</description>
</property>
<!--開啓resourcemanager故障自動切換,指定機器-->
<property>
<name>yarn.resourcemanager.ha.automatic-failover.enabled</name>
<value>true</value>
<description>Enable automatic failover; By default, it is enabled only when HA is enabled.</description>
</property>
<property>
<name>yarn.client.failover-proxy-provider</name>
<value>org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider</value>
</property>
<!-- 容許分配給一個任務最大的CPU核數,默認是8 -->
<property>
<name>yarn.nodemanager.resource.cpu-vcores</name>
<value>4</value>
</property>
<!-- 每一個節點可用內存,單位MB -->
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>512</value>
</property>
<!-- 單個任務可申請最少內存,默認1024MB -->
<property>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>512</value>
</property>
<!-- 單個任務可申請最大內存,默認8192MB -->
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>512</value>
</property>
<!--多長時間聚合刪除一第二天志 此處-->
<property>
<name>yarn.log-aggregation.retain-seconds</name>
<value>2592000</value><!--30 day-->
</property>
<!--時間在幾秒鐘內保留用戶日誌。只適用於若是日誌聚合是禁用的-->
<property>
<name>yarn.nodemanager.log.retain-seconds</name>
<value>604800</value><!--7 day-->
</property>
<!--指定文件壓縮類型用於壓縮彙總日誌-->
<property>
<name>yarn.nodemanager.log-aggregation.compression-type</name>
<value>gz</value>
</property>
<!-- nodemanager本地文件存儲目錄-->
<property>
<name>yarn.nodemanager.local-dirs</name>
<value>/export/servers/hadoop-2.7.5/yarn/local</value>
</property>
<!-- resourceManager 保存最大的任務完成個數 -->
<property>
<name>yarn.resourcemanager.max-completed-applications</name>
<value>1000</value>
</property>
<!-- 逗號隔開的服務列表,列表名稱應該只包含a-zA-Z0-9_,不能以數字開始-->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<!--rm失聯後從新連接的時間-->
<property>
<name>yarn.resourcemanager.connect.retry-interval.ms</name>
<value>2000</value>
</property>
</configuration>
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim mapred-site.xml
<configuration>
<!--指定運行mapreduce的環境是yarn -->
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<!-- MapReduce JobHistory Server IPC host:port -->
<property>
<name>mapreduce.jobhistory.address</name>
<value>node03:10020</value>
</property>
<!-- MapReduce JobHistory Server Web UI host:port -->
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>node03:19888</value>
</property>
<!-- The directory where MapReduce stores control files.默認 ${hadoop.tmp.dir}/mapred/system -->
<property>
<name>mapreduce.jobtracker.system.dir</name>
<value>/export/servers/hadoop-2.7.5/data/system/jobtracker</value>
</property>
<!-- The amount of memory to request from the scheduler for each map task. 默認 1024-->
<property>
<name>mapreduce.map.memory.mb</name>
<value>1024</value>
</property>
<!-- <property>
<name>mapreduce.map.java.opts</name>
<value>-Xmx1024m</value>
</property> -->
<!-- The amount of memory to request from the scheduler for each reduce task. 默認 1024-->
<property>
<name>mapreduce.reduce.memory.mb</name>
<value>1024</value>
</property>
<!-- <property>
<name>mapreduce.reduce.java.opts</name>
<value>-Xmx2048m</value>
</property> -->
<!-- 用於存儲文件的緩存內存的總數量,以兆字節爲單位。默認狀況下,分配給每一個合併流1MB,給個合併流應該尋求最小化。默認值100-->
<property>
<name>mapreduce.task.io.sort.mb</name>
<value>100</value>
</property>
<!-- <property>
<name>mapreduce.jobtracker.handler.count</name>
<value>25</value>
</property>-->
<!-- 整理文件時用於合併的流的數量。這決定了打開的文件句柄的數量。默認值10-->
<property>
<name>mapreduce.task.io.sort.factor</name>
<value>10</value>
</property>
<!-- 默認的並行傳輸量由reduce在copy(shuffle)階段。默認值5-->
<property>
<name>mapreduce.reduce.shuffle.parallelcopies</name>
<value>25</value>
</property>
<property>
<name>yarn.app.mapreduce.am.command-opts</name>
<value>-Xmx1024m</value>
</property>
<!-- MR AppMaster所需的內存總量。默認值1536-->
<property>
<name>yarn.app.mapreduce.am.resource.mb</name>
<value>1536</value>
</property>
<!-- MapReduce存儲中間數據文件的本地目錄。目錄不存在則被忽略。默認值${hadoop.tmp.dir}/mapred/local-->
<property>
<name>mapreduce.cluster.local.dir</name>
<value>/export/servers/hadoop-2.7.5/data/system/local</value>
</property>
</configuration>
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim slaves
node01
node02
node03
第一臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim hadoop-env.sh
export JAVA_HOME=/export/servers/jdk1.8.0_181
將第一臺機器的安裝包發送到其餘機器上
第一臺機器執行如下命令:
cd /export/servers
scp -r hadoop-2.7.5/ node02:$PWD
scp -r hadoop-2.7.5/ node03:$PWD
三臺機器上共同建立目錄
三臺機器執行如下命令
mkdir -p /export/servers/hadoop-2.7.5/data/dfs/nn/name
mkdir -p /export/servers/hadoop-2.7.5/data/dfs/nn/edits
mkdir -p /export/servers/hadoop-2.7.5/data/dfs/nn/name
mkdir -p /export/servers/hadoop-2.7.5/data/dfs/nn/edits
更改node02的rm2
第二臺機器執行如下命令
cd /export/servers/hadoop-2.7.5/etc/hadoop
vim yarn-site.xml
<!--在node3上配置rm1,在node2上配置rm2,注意:通常都喜歡把配置好的文件遠程複製到其它機器上,
但這個在YARN的另外一個機器上必定要修改,其餘機器上不配置此項
注意咱們如今有兩個resourceManager 第三臺是rm1 第二臺是rm2
這個配置必定要記得去node02上面改好
-->
<property>
<name>yarn.resourcemanager.ha.id</name>
<value>rm2</value>
<description>If we want to launch more than one RM in single node, we need this configuration</description>
</property>
node01機器執行如下命令
cd /export/servers/hadoop-2.7.5
bin/hdfs zkfc -formatZK
sbin/hadoop-daemons.sh start journalnode
bin[a2] /hdfs namenode -format
bin/hdfs namenode -initializeSharedEdits -force
sbin/start-dfs.sh
node02上面執行
cd /export/servers/hadoop-2.7.5
bin/hdfs namenode -bootstrapStandby
sbin/hadoop-daemon.sh start namenode
node03上面執行
cd /export/servers/hadoop-2.7.5
sbin/start-yarn.sh
node02上執行
cd /export/servers/hadoop-2.7.5
sbin/start-yarn.sh
node03上面執行
cd /export/servers/hadoop-2.7.5
bin/yarn rmadmin -getServiceState rm1
node02上面執行
cd /export/servers/hadoop-2.7.5
bin/yarn rmadmin -getServiceState rm2
node03機器執行如下命令啓動jobHistory
cd /export/servers/hadoop-2.7.5
sbin/mr-jobhistory-daemon.sh start historyserver
node01機器查看hdfs狀態
http://192.168.221.100:50070/dfshealth.html#tab-overview
node02機器查看hdfs狀態
http://192.168.221.110:50070/dfshealth.html#tab-overview
頁面訪問:
http://192.168.221.120:19888/jobhistory