当前位置:网站首页>搭建全分布式集群全过程
搭建全分布式集群全过程
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
边栏推荐
- 1. What does the operating system do?
- Android 解决setRequestedOrientation之后手机屏幕的旋转不触发onConfigurationChanged方法
- 20201108编程练习——练习3
- AQS 都看完了,Condition 原理可不能少!
- GDI 及OPENGL的区别
- 商品管理系统——整合仓库服务以及获取仓库列表
- App crashed inexplicably. At first, it thought it was the case of the name in the header. Finally, it was found that it was the fault of the container!
- Finally, the python project is released as exe executable program process
- AQS 都看完了,Condition 原理可不能少!
- Get the first cover image of video through canvas
猜你喜欢

首次开通csdn,这篇文章送给过去的自己和正在发生的你

How does FC game console work?

C/C++编程笔记:指针篇!从内存理解指针,让你完全搞懂指针

For the first time open CSDN, this article is for the past self and what is happening to you

Factory pattern pattern pattern (simple factory, factory method, abstract factory pattern)

平台商业化能力的另一种表现形式SAAS

How to reduce the resource consumption of istio agent through sidecar custom resource

Talk about my understanding of FAAS with Alibaba cloud FC

5 个我不可或缺的开源工具

First development of STC to stm32
随机推荐
作业2020.11.7-8
如何通过Sidecar自定义资源减少Istio代理资源消耗
android开发中提示:requires permission android.permission write_settings解决方法
图节点分类与消息传递 - 知乎
20201108编程练习——练习3
20201108 programming exercise exercise 3
23张图,带你入门推荐系统
LeetCode-11:盛水最多的容器
对象
ubuntu 上使用微信的新方案——手机投屏
Leetcode-11: container with the most water
Get the first cover image of video through canvas
How to reduce the resource consumption of istio agent through sidecar custom resource
链表
C + + adjacency matrix
First development of STC to stm32
C / C + + Programming Notes: pointer! Understand pointer from memory, let you understand pointer completely
Linked blocking queue based on linked list
After Android solves the setrequested orientation, the rotation of the mobile phone screen does not trigger the onconfigurationchanged method
Android 解决setRequestedOrientation之后手机屏幕的旋转不触发onConfigurationChanged方法