当前位置:网站首页>搭建全分布式集群全过程
搭建全分布式集群全过程
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
边栏推荐
- 14.Kubenetes简介
- 非阻塞的无界线程安全队列 —— ConcurrentLinkedQueue
- 如何通过Sidecar自定义资源减少Istio代理资源消耗
- 架构中台图
- Review of API knowledge
- 几行代码轻松实现跨系统传递 traceId,再也不用担心对不上日志了!
- When we talk about data quality, what are we talking about?
- 23 pictures, take you to the recommended system
- Tips in Android Development: requires permission android.permission write_ Settings solution
- The vowels in the inverted string of leetcode
猜你喜欢
A few lines of code can easily transfer traceid across systems, so you don't have to worry about losing the log!
2 普通模式
LeetCode-11:盛水最多的容器
OpenGL ES 框架详细解析(八) —— OpenGL ES 设计指南
使用递增计数器的线程同步工具 —— 信号量,它的原理是什么样子的?
linx7.5 初始安装
3.你知道计算机是如何启动的吗?
LeetCode-15:三数之和
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!
基于链表的有界阻塞队列 —— LinkedBlockingQueue
随机推荐
老大问我:“建表为啥还设置个自增 id ?用流水号当主键不正好么?”
架构中台图
GDI 及OPENGL的区别
OpenGL ES 框架详细解析(八) —— OpenGL ES 设计指南
The vowels in the inverted string of leetcode
Do you know how the computer starts?
How to get started with rabbitmq
Finally, the python project is released as exe executable program process
理论与实践相结合彻底理解CORS
平台商业化能力的另一种表现形式SAAS
C++邻接矩阵
无法启动此程序,因为计算机中丢失 MSVCP120.dll。尝试安装该程序以解决此问题
How does semaphore, a thread synchronization tool that uses an up counter, look like?
六家公司CTO讲述曾经历的“宕机噩梦”
Huawei HCIA notes
A brief introduction of C code to open or close the firewall example
Installation record of SAP s / 4hana 2020
After Android solves the setrequested orientation, the rotation of the mobile phone screen does not trigger the onconfigurationchanged method
Review of API knowledge
Bifrost 之 文件队列(一)