> Hadoop3.2 集群新版本的搭建详细讲解过程,从下面第一张官方的图来看,最新版是3.2,所以大猪将使用3.2的版本来演示,过程中遇到的坑留给自己,把路留给你们,IT之路还有大猪。
![](https://upload-images.jianshu.io/upload_images/9028759-c4659c34208ffcde.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/9028759-cb9430d57d76ca64.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
大猪 为了把文章压缩极简方便小伙伴阅读,将使用root帐号进行所有操作。
1. 准备两台主机`10.211.55.11`、`10.211.55.12`
2. 对应的hostname为`m1.example.com`、`m2.example.com`
具体命令操作如下
![](https://upload-images.jianshu.io/upload_images/9028759-b82786e88b8504d1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
3. 主机免密钥登录
![](https://upload-images.jianshu.io/upload_images/9028759-ca321d58d2247fcd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
4. 同步hosts
![](https://upload-images.jianshu.io/upload_images/9028759-ebc6270f0359b844.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/9028759-328e3846ba699265.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
1. 下载 [jdk1.8](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
![](https://upload-images.jianshu.io/upload_images/9028759-67b4138ad2dcd864.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2. 配置Java环境
![](https://upload-images.jianshu.io/upload_images/9028759-bc6f7889946acdb4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
3. 环境变量生效 *source /etc/profile*
![](https://upload-images.jianshu.io/upload_images/9028759-ef8b933763328942.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
1. 两台主机创建好hadoop的文件夹
![](https://upload-images.jianshu.io/upload_images/9028759-ee5a56d1fcbc4c67.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2. 环境配置 [hadoop-3.2.0.tar.gz](https://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-3.2.0/hadoop-3.2.0.tar.gz)
![](https://upload-images.jianshu.io/upload_images/9028759-748d816c7cc2d3ba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
3. 参数配置
运行用户操作,添加如下几句到 */soft/hadoop/etc/hadoop/hadoop-env.sh*
![](https://upload-images.jianshu.io/upload_images/9028759-5e5c28655ec89441.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
4. 环境变量生效 *source /etc/profile*
5. hadoop 配置文件
core-site.xml 配置
![](https://upload-images.jianshu.io/upload_images/9028759-9535bbf3952403b7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
hdfs-site.xml 配置
![](https://upload-images.jianshu.io/upload_images/9028759-e5aa0a5eb5dcc97d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
yarn-site.xml 配置
![](https://upload-images.jianshu.io/upload_images/9028759-95af37bfb6fd32ca.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
mapred-site.xml 配置
![](https://upload-images.jianshu.io/upload_images/9028759-a41a9c5008674032.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
6. 格式化name文件夹 *hadoop namenode -format*
7. 启动 *start-all.sh*
成功结果如下
![](https://upload-images.jianshu.io/upload_images/9028759-de5c809303a4c8b8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
8. 访问 [http://m1.example.com:8088/cluster](http://m1.example.com:8088/cluster)
![](https://upload-images.jianshu.io/upload_images/9028759-53feb49c8046edb8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
心明眼亮的你、从此刻开始。
![](https://upload-images.jianshu.io/upload_images/9028759-7586fee586f2075b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/9028759-07315bb8dadcd082.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)