当前位置:网站首页>搭建全分布式集群全过程
搭建全分布式集群全过程
2020-11-09 08:20:00 【osc_ykahofah】
全分布式全步骤
三台机器,分别为hdp01,hdp02,hdp03
思路是先配置hdp01,再克隆hdp02,hdp03
一.搭建hdp01
1.关闭防火墙(一般会有延迟,即使关闭了防火墙以后查看状态也还是开的,重启可以在看状态是可以的)
systemctl disable firewalld
检查状态
systemctl status firewalld
reboot -h now----重启电脑
2.改ip
vi /etc/sysconfig/network-scripts/ifcfg-ens33
需要改动六个地方
1.BOOTPROTO=static
2.ONBOOT=yes
3.IPADDR=192.168.73.102
4.NETMASK=255.255.255.0
5.GATEWAY=192.168.73.2
6.DNS1=8.8.8.8
DNS2=114.114.114.114
改完ip一定要重启网络,否则不能生效
systemctl restart network
重启完网络再查看ip
ip addr
3.改主机名(第一台不用改)
hostnamectl set-hostname hdp02
可以检查,用hostname命令
4.改映射文件
vi /etc/hosts
5.如果连接远程finalshell软件等,改本地host文件
C:\Windows\System32\drivers\etc\host
6.写秘钥
ssh-keygen -t rsa
cd .ssh可以看到生成了公钥和私钥
如果自己是datenode,也一定要给自己做免密(只要在slaves里面的就都是datenode)
ssh-copy-id localhost
7.安装jdk和hadoop
解压到自己想解压的目录
tar -zxvf hadoop-2.7.6.tar.gz -C /usr/local/
可以改名字,名字太长
mv hadoop-2.7.6/ hadoop
7.1安装ntp ntpdate源,搭集群时,时间同步用
# yum -y install ntp ntpdate
8.配置环境变量
vi /etc/profile
export JAVA_HOME=/usr/local/jdk
export HADOOP_HOME=/usr/local/hadoop
export PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
source /etc/profile(必须刷新,否则环境变量不起作用)
检测是否安装成
java -version
hadoop vesion
9.改配置文件
vi core-site.xml
<configuration>
<property>
<!-- hdfs的地址名称:schame,ip,port 因为我的映射文件呢IP和主机名字映射了-->
<name>fs.defaultFS</name>
<value>hdfs://hdp01:8020</value>
</property>
<property>
<!-- hdfs的基础路径,被其他属性所依赖的一个基础路径 这里面存的是元数据等信息 -->
<name>hadoop.tmp.dir</name>
<value>/usr/local/tmp</value>
</property>
</configuration>
vi hdfs-site.xml
<configuration>
<property>
#存放元数据的fsimage
<name>dfs.namenode.name.dir</name>
<value>file://${hadoop.tmp.dir}/dfs/name</value>
</property>
<property>
#块的存放位置
<name>dfs.datanode.data.dir</name>
<value>file://${hadoop.tmp.dir}/dfs/data</value>
</property>
<property>
#副本的个数
<name>dfs.replication</name>
<value>3</value>
</property>
<property>
#块的大小
<name>dfs.blocksize</name>
<value>134217728</value>
</property>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>hdp02:50090</value>
</property>
<property>
<name>fs.checkpoint.dir</name>
<value>file:///${hadoop.tmp.dir}/checkpoint/dfs/cname</value>
</property>
<property>
<name>fs.checkpoint.edits.dir</name>
<value>file:///${hadoop.tmp.dir}/checkpoint/dfs/cname</value>
</property>
<property>
<name>dfs.http.address</name>
<value>hdp01:50070</value>
</property>
</configuration>
cp mapred-site.xml.template mapred-site.xml 本身这个文件没有
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>hdp01:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>hdp01:19888</value>
</property>
</configuration>
yarn-site.xml
<configuration>
<!-- Site specific YARN configuration properties -->
<property>
<!-- 指定yarn的shuffle技术-->
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<!-- 指定resourcemanager的主机名-->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>qianfeng01</value> </property>
<!--下面的可选--> <!--指定shuffle对应的类 -->
<property>
<name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<!--配置resourcemanager的内部通讯地址-->
<property>
<name>yarn.resourcemanager.address</name>
<value>qianfeng01:8032</value>
</property>
<!--配置resourcemanager的scheduler的内部通讯地址-->
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>qianfeng01:8030</value>
</property>
<!--配置resoucemanager的资源调度的内部通讯地址-->
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>qianfeng01:8031</value>
</property>
<!--配置resourcemanager的管理员的内部通讯地址-->
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>qianfeng01:8033</value>
</property>
<!--配置resourcemanager的web ui 的监控页面-->
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>qianfeng01:8088</value>
</property>
</configuration>
hadoop-env.sh
export JAVA_HOME=/usr/local/jdk
vi slaves(这里边放的是datanode)
hdp01
hdp02
hdp03
二.克隆
尽量记住快照
关闭hdp01,克隆hdp02,hdp03
改ip
改主机名
3.搭建集群
1.时间同步
2.格式化namenode
hdfs namenode -format
3.启动集群
启动脚本 -- start-dfs.sh 用于启动hdfs集群的脚本
start-yarn.sh :用于启动yarn守护进程
start-all.sh :用于启动hdfs和yarn
4.测试
(1)在分布式系统上建input文件夹
hdfs dfs -mkdir /input
(2)随便上传了文件
hdfs dfs -put a.txt /input
(3)测试,用他们给我们封装好的mapreduce小功能,查一下单词的个数
/usr/local/hadoop/share/hadoop/mapreduce(小功能的架包都在这里边)
执行的时候一定看好路径,而且output 不能咱们自己建,得生成,要不然会报错
hadoop jar hadoop-mapreduce-examples-2.7.6.jar wordcount /input /output
版权声明
本文为[osc_ykahofah]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4262068/blog/4708548
边栏推荐
- STS安装
- CSP-S 2020 游记
- Windows环境下如何进行线程Dump分析
- 无法启动此程序,因为计算机中丢失 MSVCP120.dll。尝试安装该程序以解决此问题
- Exception capture and handling in C + +
- After Android solves the setrequested orientation, the rotation of the mobile phone screen does not trigger the onconfigurationchanged method
- 链表
- 为什么我们不使用GraphQL? - Wundergraph
- For the first time open CSDN, this article is for the past self and what is happening to you
- 华为HCIA笔记
猜你喜欢

Platform in architecture

1.操作系统是干什么的?

The vowels in the inverted string of leetcode

centos7下安装iperf时出现 make: *** No targets specified and no makefile found. Stop.的解决方案

Bifrost 之 文件队列(一)
![[Python从零到壹] 五.网络爬虫之BeautifulSoup基础语法万字详解](/img/e8/dd70ddf3c2027907f64674676d676e.jpg)
[Python从零到壹] 五.网络爬虫之BeautifulSoup基础语法万字详解

When iperf is installed under centos7, the solution of make: * no targets specified and no makefile found. Stop

Tips in Android Development: requires permission android.permission write_ Settings solution

14. Introduction to kubenetes

The difference between GDI and OpenGL
随机推荐
How does pipedrive support quality publishing with 50 + deployments per day?
The vowels in the inverted string of leetcode
自然语言处理(NLP)路线图 - kdnuggets
操作系统之bios
Finally, the python project is released as exe executable program process
第五章编程
老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”
Five design patterns frequently used in development
如何通过Sidecar自定义资源减少Istio代理资源消耗
几行代码轻松实现跨系统传递 traceId,再也不用担心对不上日志了!
通过canvas获取视频第一帧封面图
Factory pattern pattern pattern (simple factory, factory method, abstract factory pattern)
首次开通csdn,这篇文章送给过去的自己和正在发生的你
基于LabVIEW实现的几种滚动字幕
Talk about my understanding of FAAS with Alibaba cloud FC
android开发中提示:requires permission android.permission write_settings解决方法
EasyNTS上云网关设备在雪亮工程项目中的实战应用
B. protocal has 7000eth assets in one week!
华为HCIA笔记
Platform in architecture