当前位置:   article > 正文

Hadoop3.1.3之完全分布式模式环境搭建

hadoop3.1.3

目录

一:虚拟机准备

1、准备3台虚拟机,静态IP地址,关闭防火墙,设置主机名

2、3台虚机的/etc/hosts全部配置IP对应主机名

3、OK虚拟机准备完毕

二、SSH无密码登录

三、在hadoop20服务器上安装JDK和hadoop

1、安装JDK(跳过,参考之前的即可)

2、安装hadoop

    2.1、将下载的安装包上传到/opt/software/目录下,并解压安装文件到/opt/module下面

    2.2、将Hadoop添加到环境变量

    2.3、 让修改后的文件生效

     2.4、测试是否安装成功

四、同步hadoop20服务的hadoop目录

1、使用之前配置的xsync脚本将hadoop目录同步到hadoop21和hadoop22服务器

2、配置hadoop的环境变量 

五、配置集群

1、集群部署规划

 2、配置文件说明

2.1、默认配置文件

2.2、自定义配置文件

        core-site.xml、hdfs-site.xml、yarn-site.xml、mapred-site.xml四个配置文件存放在$HADOOP_HOME/etc/hadoop这个路径上,用户可以根据项目需求重新进行修改配置 

3、配置集群

3.1、配置core-site.xml、hadoop-env.sh以及yarn-env.sh

​编辑

在上面hadoop-env.sh中配置jdk路径

3.2、配置hdfs-site.xml

3.3、配置yarn-site.xml

3.4、配置mapred-site.xml

3.5、在集群上分发配置好的Hadoop配置文件

3.6、去103和104上查看文件分发情况

六、启动集群

1、配置workers(3台服务器都配置)

2、启动集群

3、Web端查看HDFS的NameNode

4、Web端查看YARN的ResourceManager

 ​编辑

七、集群基本测试

1、上传文件到集群

1.1、上传小文件

 1.2、上传大文件

八、配置历史服务器

1、配置mapred-site.xml

2、分发配置

3、在hadoop102启动历史服务器

4、查看JobHistory

九、配置日志的聚集

1、配置yarn-site.xml

2、分发配置

3、关闭NodeManager 、ResourceManager和HistoryServer

4、启动NodeManager 、ResourceManage和HistoryServer

5、执行WordCount程序

6、查看日志

 十、Hadoop集群常用脚本


一:虚拟机准备

1、准备3台虚拟机,静态IP地址,关闭防火墙,设置主机名

 IP地址,主机名如下:
          192.168.56.20,hadoop20
          192.168.56.21,hadoop21
          192.168.56.22,hadoop22
  注意:记得关闭防火墙
  修改主机名命令:hostnamectl set-hostname xxx
  关闭防火墙命令:systemctl stop firewalld.service
  查看防火墙命令:firewall-cmd --state

2、3台虚机的/etc/hosts全部配置IP对应主机名

  1. [kgf@hadoop20 ~]$ cat /etc/hosts
  2. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  3. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  4. 192.168.56.20 hadoop20
  5. 192.168.56.21 hadoop21
  6. 192.168.56.22 hadoop22
  7. [kgf@hadoop20 ~]$

3、OK虚拟机准备完毕


二、SSH无密码登录

参考之前的hadoop2.X内容即可 


三、在hadoop20服务器上安装JDK和hadoop

1、安装JDK(跳过,参考之前的即可)

2、安装hadoop

    2.1、将下载的安装包上传到/opt/software/目录下,并解压安装文件到/opt/module下面

  1. [kgf@hadoop20 software]$ ll
  2. total 330156
  3. -rw-rw-r--. 1 kgf kgf 338075860 Jun 14 12:18 hadoop-3.1.3.tar.gz
  4. [kgf@hadoop20 software]$ tar -zxvf hadoop-3.1.3.tar.gz -C ../module/
  5. [kgf@hadoop20 module]$ ll
  6. total 0
  7. drwxr-xr-x. 9 kgf kgf 149 Sep 12 2019 hadoop-3.1.3
  8. drwxr-xr-x. 7 kgf kgf 245 Oct 6 2018 jdk1.8.0_191
  9. [kgf@hadoop20 module]$ pwd
  10. /opt/module
  11. [kgf@hadoop20 module]$

    2.2、将Hadoop添加到环境变量

       sudo vim  /etc/profile 

  1. ##HADOOP_HOME
  2. export HADOOP_HOME=/opt/module/hadoop-3.1.3
  3. export PATH=$PATH:$HADOOP_HOME/bin
  4. export PATH=$PATH:$HADOOP_HOME/sbin

    2.3、 让修改后的文件生效

source /etc/profile

     2.4、测试是否安装成功

  1. [kgf@hadoop20 module]$ hadoop version
  2. Hadoop 3.1.3
  3. Source code repository https://gitbox.apache.org/repos/asf/hadoop.git -r ba631c436b806728f8ec2f54ab1e289526c90579
  4. Compiled by ztang on 2019-09-12T02:47Z
  5. Compiled with protoc 2.5.0
  6. From source with checksum ec785077c385118ac91aadde5ec9799
  7. This command was run using /opt/module/hadoop-3.1.3/share/hadoop/common/hadoop-common-3.1.3.jar
  8. [kgf@hadoop20 module]$

四、同步hadoop20服务的hadoop目录

1、使用之前配置的xsync脚本将hadoop目录同步到hadoop21和hadoop22服务器

  1. [kgf@hadoop20 module]$ pwd
  2. /opt/module
  3. [kgf@hadoop20 module]$ xsync hadoop-3.1.3/

2、配置hadoop的环境变量 

五、配置集群

1、集群部署规划

 注意:

  • NameNode和SecondaryNameNode不要安装在同一台服务器
  • ResourceManager也很消耗内存,不要和NameNode、SecondaryNameNode配置在同一台机器上

 2、配置文件说明

        Hadoop配置文件分两类:默认配置文件和自定义配置文件,只有用户想修改某一默认配置值时,才需要修改自定义配置文件,更改相应属性值

2.1、默认配置文件

2.2、自定义配置文件

        core-site.xml、hdfs-site.xml、yarn-site.xml、mapred-site.xml四个配置文件存放在$HADOOP_HOME/etc/hadoop这个路径上,用户可以根据项目需求重新进行修改配置 

3、配置集群

3.1、配置core-site.xml、hadoop-env.sh以及yarn-env.sh

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!--
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License. See accompanying LICENSE file.
  13. -->
  14. <!-- Put site-specific property overrides in this file. -->
  15. <configuration>
  16. <!-- 指定NameNode的地址 -->
  17. <property>
  18. <name>fs.defaultFS</name>
  19. <value>hdfs://hadoop20:8020</value>
  20. </property>
  21. <!-- 指定hadoop数据的存储目录 -->
  22. <property>
  23. <name>hadoop.tmp.dir</name>
  24. <value>/opt/module/hadoop-3.1.3/data</value>
  25. </property>
  26. <!-- 配置HDFS网页登录使用的静态用户为atguigu -->
  27. <property>
  28. <name>hadoop.http.staticuser.user</name>
  29. <value>kgf</value>
  30. </property>
  31. </configuration>

在上面hadoop-env.sh中配置jdk路径

在上面yarn-env.sh中配置jdk路径

3.2、配置hdfs-site.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!--
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License. See accompanying LICENSE file.
  13. -->
  14. <!-- Put site-specific property overrides in this file. -->
  15. <configuration>
  16. <!-- nn web端访问地址-->
  17. <property>
  18. <name>dfs.namenode.http-address</name>
  19. <value>hadoop20:9870</value>
  20. </property>
  21. <!-- 2nn web端访问地址-->
  22. <property>
  23. <name>dfs.namenode.secondary.http-address</name>
  24. <value>hadoop22:9868</value>
  25. </property>
  26. </configuration>

3.3、配置yarn-site.xml

  1. <?xml version="1.0"?>
  2. <!--
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License. See accompanying LICENSE file.
  12. -->
  13. <configuration>
  14. <!-- 指定MR走shuffle -->
  15. <property>
  16. <name>yarn.nodemanager.aux-services</name>
  17. <value>mapreduce_shuffle</value>
  18. </property>
  19. <!-- 指定ResourceManager的地址-->
  20. <property>
  21. <name>yarn.resourcemanager.hostname</name>
  22. <value>hadoop21</value>
  23. </property>
  24. <!-- 环境变量的继承 -->
  25. <property>
  26. <name>yarn.nodemanager.env-whitelist</name>
  27. <value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value>
  28. </property>
  29. </configuration>

3.4、配置mapred-site.xml

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
  3. <!--
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License. See accompanying LICENSE file.
  13. -->
  14. <!-- Put site-specific property overrides in this file. -->
  15. <configuration>
  16. <!-- 指定MapReduce程序运行在Yarn上 -->
  17. <property>
  18. <name>mapreduce.framework.name</name>
  19. <value>yarn</value>
  20. </property>
  21. </configuration>

3.5、在集群上分发配置好的Hadoop配置文件

[kgf@hadoop20 hadoop]$ xsync /opt/module/hadoop-3.1.3/etc/hadoop/

3.6、去103和104上查看文件分发情况

  1. [kgf@hadoop21 hadoop-3.1.3]$ pwd
  2. /opt/module/hadoop-3.1.3
  3. [kgf@hadoop21 hadoop-3.1.3]$ cat etc/hadoop/core-site.xml
  4. [kgf@hadoop22 hadoop-3.1.3]$ pwd
  5. /opt/module/hadoop-3.1.3
  6. [kgf@hadoop22 hadoop-3.1.3]$ cat etc/hadoop/core-site.xml

六、启动集群

1、配置workers(3台服务器都配置)

  1. [kgf@hadoop20 hadoop-3.1.3]$ vim etc/hadoop/workers
  2. [kgf@hadoop20 hadoop-3.1.3]$ cat etc/hadoop/workers
  3. hadoop20
  4. hadoop21
  5. hadoop22
  6. [kgf@hadoop20 hadoop-3.1.3]$

注意:该文件中添加的内容结尾不允许有空格,文件中不允许有空行。

2、启动集群

        如果集群是第一次启动,需要在hadoop102节点格式化NameNode(注意:格式化NameNode,会产生新的集群id,导致NameNodeDataNode的集群id不一致,集群找不到已往数据。如果集群在运行过程中报错,需要重新格式化NameNode的话,一定要先停止namenodedatanode进程,并且要删除所有机器的datalogs目录,然后再进行格式化。

[kgf@hadoop20 hadoop-3.1.3]$ hdfs namenode -format

启动HDFS:

  1. [kgf@hadoop20 hadoop-3.1.3]$ sbin/start-dfs.sh
  2. Starting namenodes on [hadoop20]
  3. Starting datanodes
  4. hadoop21: WARNING: /opt/module/hadoop-3.1.3/logs does not exist. Creating.
  5. hadoop22: WARNING: /opt/module/hadoop-3.1.3/logs does not exist. Creating.
  6. Starting secondary namenodes [hadoop22]
  7. [kgf@hadoop20 hadoop-3.1.3]$ jps
  8. 3009 DataNode
  9. 2854 NameNode
  10. 3225 Jps
  11. [kgf@hadoop20 hadoop-3.1.3]$
  1. [kgf@hadoop21 hadoop-3.1.3]$ jps
  2. 1872 Jps
  3. 1804 DataNode
  4. [kgf@hadoop21 hadoop-3.1.3]$
  1. [kgf@hadoop22 module]$ jps
  2. 1922 SecondaryNameNode
  3. 2004 Jps
  4. 1850 DataNode
  5. [kgf@hadoop22 module]$

在配置了ResourceManager的节点(hadoop21启动YARN

  1. [kgf@hadoop21 hadoop-3.1.3]$ sbin/start-yarn.sh
  2. Starting resourcemanager
  3. Starting nodemanagers
  4. [kgf@hadoop21 hadoop-3.1.3]$ jps
  5. 2072 ResourceManager
  6. 2472 Jps
  7. 2203 NodeManager
  8. 1804 DataNode
  9. [kgf@hadoop21 hadoop-3.1.3]$
  1. [kgf@hadoop22 module]$ jps
  2. 1922 SecondaryNameNode
  3. 2211 Jps
  4. 2104 NodeManager
  5. 1850 DataNode
  6. [kgf@hadoop22 module]$
  1. [kgf@hadoop20 hadoop-3.1.3]$ jps
  2. 3009 DataNode
  3. 2854 NameNode
  4. 3303 NodeManager
  5. 3402 Jps
  6. [kgf@hadoop20 hadoop-3.1.3]$

3、Web端查看HDFS的NameNode

              (a)浏览器中输入:http://hadoop20:9870/

              (b)查看HDFS上存储的数据信息

        

4、Web端查看YARN的ResourceManager

       (a)浏览器中输入:http://hadoop21:8088/cluster

       (b)查看YARN上运行的Job信息

 

七、集群基本测试

1、上传文件到集群

1.1、上传小文件

  1. [kgf@hadoop20 hadoop-3.1.3]$ hadoop fs -mkdir /input
  2. [kgf@hadoop20 hadoop-3.1.3]$ ll wcinput/
  3. total 4
  4. -rw-rw-r--. 1 kgf kgf 60 Jun 14 13:20 hello.txt
  5. [kgf@hadoop20 hadoop-3.1.3]$ pwd
  6. /opt/module/hadoop-3.1.3
  7. [kgf@hadoop20 hadoop-3.1.3]$
  8. [kgf@hadoop20 hadoop-3.1.3]$ hadoop fs -put wcinput/hello.txt /input
  9. 2022-06-14 13:21:17,764 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
  10. [kgf@hadoop20 hadoop-3.1.3]$

 1.2、上传大文件

  1. [kgf@hadoop20 hadoop-3.1.3]$ hadoop fs -put /opt/software/hadoop-3.1.3.tar.gz /
  2. 2022-06-14 13:24:12,505 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
  3. 2022-06-14 13:24:14,059 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
  4. 2022-06-14 13:24:16,001 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
  5. [kgf@hadoop20 hadoop-3.1.3]$

八、配置历史服务器

 为了查看程序的历史运行情况,需要配置一下历史服务器。具体配置步骤如下:

1、配置mapred-site.xml

在该文件里面增加如下配置。

  1. <!-- 历史服务器端地址 -->
  2. <property>
  3. <name>mapreduce.jobhistory.address</name>
  4. <value>hadoop20:10020</value>
  5. </property>
  6. <!-- 历史服务器web端地址 -->
  7. <property>
  8. <name>mapreduce.jobhistory.webapp.address</name>
  9. <value>hadoop21:19888</value>
  10. </property>

2、分发配置

  1. [kgf@hadoop20 hadoop-3.1.3]$ xsync etc/hadoop/mapred-site.xml
  2. fname=mapred-site.xml
  3. pdir=/opt/module/hadoop-3.1.3/etc/hadoop
  4. ----------hadoop21--------
  5. sending incremental file list
  6. mapred-site.xml
  7. sent 579 bytes received 43 bytes 414.67 bytes/sec
  8. total size is 1194 speedup is 1.92
  9. ------hadoop22--------
  10. sending incremental file list
  11. mapred-site.xml
  12. sent 579 bytes received 43 bytes 1244.00 bytes/sec
  13. total size is 1194 speedup is 1.92
  14. [kgf@hadoop20 hadoop-3.1.3]$

3、在hadoop102启动历史服务器

  1. [kgf@hadoop20 hadoop-3.1.3]$ mapred --daemon start historyserver
  2. [kgf@hadoop20 hadoop-3.1.3]$ jps
  3. 3009 DataNode
  4. 2854 NameNode
  5. 3734 JobHistoryServer
  6. 3303 NodeManager
  7. 3759 Jps
  8. [kgf@hadoop20 hadoop-3.1.3]$ pwd
  9. /opt/module/hadoop-3.1.3
  10. [kgf@hadoop20 hadoop-3.1.3]$

4、查看JobHistory

九、配置日志的聚集

 日志聚集概念:应用运行完成以后,将程序运行日志信息上传到HDFS系统上

日志聚集功能好处:可以方便的查看到程序运行详情,方便开发调试

注意:开启日志聚集功能,需要重新启动NodeManager ResourceManagerHistoryServer

开启日志聚集功能具体步骤如下:

1、配置yarn-site.xml

 在该文件里面增加如下配置

  1. <!-- 开启日志聚集功能 -->
  2. <property>
  3. <name>yarn.log-aggregation-enable</name>
  4. <value>true</value>
  5. </property>
  6. <!-- 设置日志聚集服务器地址 -->
  7. <property>
  8. <name>yarn.log.server.url</name>
  9. <value>http://hadoop20:19888/jobhistory/logs</value>
  10. </property>
  11. <!-- 设置日志保留时间为7天 -->
  12. <property>
  13. <name>yarn.log-aggregation.retain-seconds</name>
  14. <value>604800</value>
  15. </property>

2、分发配置

  1. [kgf@hadoop20 hadoop-3.1.3]$ xsync etc/hadoop/yarn-site.xml
  2. fname=yarn-site.xml
  3. pdir=/opt/module/hadoop-3.1.3/etc/hadoop
  4. ----------hadoop21--------
  5. sending incremental file list
  6. yarn-site.xml
  7. sent 1028 bytes received 43 bytes 2142.00 bytes/sec
  8. total size is 1645 speedup is 1.54
  9. ------hadoop22--------
  10. sending incremental file list
  11. yarn-site.xml
  12. sent 1028 bytes received 43 bytes 2142.00 bytes/sec
  13. total size is 1645 speedup is 1.54
  14. [kgf@hadoop20 hadoop-3.1.3]$

3、关闭NodeManager 、ResourceManager和HistoryServer

  1. [kgf@hadoop21 hadoop-3.1.3]$ jps
  2. 3304 ResourceManager
  3. 3131 DataNode
  4. 3436 NodeManager
  5. 3726 Jps
  6. [kgf@hadoop21 hadoop-3.1.3]$ sbin/stop-yarn.sh
  7. Stopping nodemanagers
  8. Stopping resourcemanager
  9. [kgf@hadoop21 hadoop-3.1.3]$ jps
  10. 3131 DataNode
  11. 4093 Jps
  12. [kgf@hadoop21 hadoop-3.1.3]$
  1. [kgf@hadoop20 hadoop-3.1.3]$ mapred --daemon stop historyserver
  2. [kgf@hadoop20 hadoop-3.1.3]$ jps
  3. 5317 Jps
  4. 4662 DataNode
  5. 4505 NameNode
  6. [kgf@hadoop20 hadoop-3.1.3]$

4、启动NodeManager 、ResourceManage和HistoryServer

  1. [kgf@hadoop21 hadoop-3.1.3]$ sbin/start-yarn.sh
  2. Starting resourcemanager
  3. Starting nodemanagers
  4. [kgf@hadoop21 hadoop-3.1.3]$ jps
  5. 4641 Jps
  6. 4218 ResourceManager
  7. 3131 DataNode
  8. 4351 NodeManager
  9. [kgf@hadoop21 hadoop-3.1.3]$
  1. [kgf@hadoop20 hadoop-3.1.3]$ mapred --daemon start historyserver
  2. [kgf@hadoop20 hadoop-3.1.3]$ jps
  3. 4662 DataNode
  4. 5542 JobHistoryServer
  5. 5383 NodeManager
  6. 4505 NameNode
  7. 5567 Jps
  8. [kgf@hadoop20 hadoop-3.1.3]$

5、执行WordCount程序

  1. [kgf@hadoop20 hadoop-3.1.3]$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar wordcount /input /output
  2. 2022-06-14 13:58:29,712 INFO client.RMProxy: Connecting to ResourceManager at hadoop21/192.168.56.21:8032
  3. 2022-06-14 13:58:30,343 INFO mapreduce.JobResourceUploader: Disabling Erasure Coding for path: /tmp/hadoop-yarn/staging/kgf/.staging/job_1655215095011_0001
  4. 2022-06-14 13:58:30,423 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
  5. 2022-06-14 13:58:30,551 INFO input.FileInputFormat: Total input files to process : 1
  6. 2022-06-14 13:58:30,574 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
  7. 2022-06-14 13:58:30,602 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
  8. 2022-06-14 13:58:30,621 INFO mapreduce.JobSubmitter: number of splits:1
  9. 2022-06-14 13:58:30,732 INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostTrusted = false
  10. 2022-06-14 13:58:30,763 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1655215095011_0001
  11. 2022-06-14 13:58:30,763 INFO mapreduce.JobSubmitter: Executing with tokens: []
  12. 2022-06-14 13:58:30,906 INFO conf.Configuration: resource-types.xml not found
  13. 2022-06-14 13:58:30,906 INFO resource.ResourceUtils: Unable to find 'resource-types.xml'.
  14. 2022-06-14 13:58:31,091 INFO impl.YarnClientImpl: Submitted application application_1655215095011_0001
  15. 2022-06-14 13:58:31,121 INFO mapreduce.Job: The url to track the job: http://hadoop21:8088/proxy/application_1655215095011_0001/
  16. 2022-06-14 13:58:31,121 INFO mapreduce.Job: Running job: job_1655215095011_0001
  17. 2022-06-14 13:58:41,290 INFO mapreduce.Job: Job job_1655215095011_0001 running in uber mode : false
  18. 2022-06-14 13:58:41,291 INFO mapreduce.Job: map 0% reduce 0%
  19. 2022-06-14 13:58:47,396 INFO mapreduce.Job: map 100% reduce 0%
  20. 2022-06-14 13:58:52,453 INFO mapreduce.Job: map 100% reduce 100%
  21. 2022-06-14 13:58:52,462 INFO mapreduce.Job: Job job_1655215095011_0001 completed successfully
  22. 2022-06-14 13:58:52,767 INFO mapreduce.Job: Counters: 53

6、查看日志

 查看任务运行日志:

 十、Hadoop集群常用脚本

  1. #!/bin/bash
  2. if [ $# -lt 1 ]
  3. then
  4. echo "No Args Input..."
  5. exit ;
  6. fi
  7. case $1 in
  8. "start")
  9. echo " =================== 启动 hadoop集群 ==================="
  10. echo " --------------- 启动 hdfs ---------------"
  11. ssh hadoop102 "/opt/module/hadoop-3.1.3/sbin/start-dfs.sh"
  12. echo " --------------- 启动 yarn ---------------"
  13. ssh hadoop103 "/opt/module/hadoop-3.1.3/sbin/start-yarn.sh"
  14. echo " --------------- 启动 historyserver ---------------"
  15. ssh hadoop102 "/opt/module/hadoop-3.1.3/bin/mapred --daemon start historyserver"
  16. ;;
  17. "stop")
  18. echo " =================== 关闭 hadoop集群 ==================="
  19. echo " --------------- 关闭 historyserver ---------------"
  20. ssh hadoop102 "/opt/module/hadoop-3.1.3/bin/mapred --daemon stop historyserver"
  21. echo " --------------- 关闭 yarn ---------------"
  22. ssh hadoop103 "/opt/module/hadoop-3.1.3/sbin/stop-yarn.sh"
  23. echo " --------------- 关闭 hdfs ---------------"
  24. ssh hadoop102 "/opt/module/hadoop-3.1.3/sbin/stop-dfs.sh"
  25. ;;
  26. *)
  27. echo "Input Args Error..."
  28. ;;
  29. esac

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/380981
推荐阅读
相关标签
  

闽ICP备14008679号