准备4台虚拟机,安装好ol7.7,分配固定ip192.168.168.11 12 13 14,其中192.168.168.11作为master,其他3个作为slave,主节点也同时作为namenode的同时也是datanode,192.168.168.14作为datanode的同时也作为secondary namenodes

首先修改/etc/hostname将主机名改为master、slave1、slave2、slave3

然后修改/etc/hosts文件添加

192.168.168.11 master
192.168.168.12 slave1
192.168.168.13 slave2
192.168.168.14 slave3

然后卸载自带openjdk改为sun jdk,参考https://www.jb51.net/article/190489.htm

配置无密码登陆本机

ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub  ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys

配置互信

master上把公钥传输给各个slave

scp ~/.ssh/id_rsa.pub hadoop@slave1:/home/hadoop/
scp ~/.ssh/id_rsa.pub hadoop@slave2:/home/hadoop/
scp ~/.ssh/id_rsa.pub hadoop@slave3:/home/hadoop/

在slave主机上将master的公钥加入各自的节点上

cat ~/id_rsa.pub  ~/.ssh/authorized_keys

master上安装hadoop

sudo tar -xzvf ~/hadoop-3.2.1.tar.gz -C /usr/local
sudo mv hadoop-3.2.1-src/ ./hadoop
sudo chown -R hadoop: ./hadoop

.bashrc添加并使之生效

export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop

集群配置,/usr/local/hadoop/etc/hadoop目录中有配置文件:

修改core-site.xml

<configuration>
 <property>
 <name>hadoop.tmp.dir</name>
 <value>file:/usr/local/hadoop/tmp</value>
 <description>Abase for other temporary directories.</description>
 </property>
 <property>
 <name>fs.defaultFS</name>
 <value>hdfs://master:9000</value>
 </property>
</configuration>

修改hdfs-site.xml

<configuration>
 <property>
 <name>dfs.namenode.name.dir</name>
 <value>/home/hadoop/data/nameNode</value>
 </property>
 
 <property>
 <name>dfs.datanode.data.dir</name>
 <value>/home/hadoop/data/dataNode</value>
 </property>
 
 <property>
 <name>dfs.replication</name>
 <value>3</value>
 </property>
 <property>
 <name>dfs.secondary.http.address</name>
 <value>slave3:50090</value>
 </property>
</configuration>

修改mapred-site.xml

<configuration>
 <property>
 <name>mapreduce.framework.name</name>
 <value>yarn</value>
 </property>
 
 <property>
 <name>yarn.app.mapreduce.am.env</name>
 <value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value>
 </property>
 
 <property>
 <name>mapreduce.map.env</name>
 <value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value>
 </property>
 
 <property>
 <name>mapreduce.reduce.env</name>
 <value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value>
 </property>
</configuration>

修改yarn-site.xml

<configuration>
 <property>
  <name>yarn.resourcemanager.hostname</name>
  <value>master</value>
 </property>
 <property>
  <name>yarn.nodemanager.aux-services</name>
  <value>mapreduce_shuffle</value>
 </property>
</configuration>

修改hadoop-env.sh找到JAVA_HOME的配置将目录修改为

export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_191

修改workers

[hadoop@master /usr/local/hadoop/etc/hadoop]$ vim workers
master
slave1
slave2
slave3

最后将配置好的/usr/local/hadoop文件夹复制到其他节点

sudo scp -r /usr/local/hadoop/ slave1:/usr/local/
sudo scp -r /usr/local/hadoop/ slave2:/usr/local/
sudo scp -r /usr/local/hadoop/ slave3:/usr/local/

并且把文件夹owner改为hadoop

sudo systemctl stop firewalld
sudo systemctl disable firewalld

关闭防火墙

格式化hdfs,首次运行前运行,以后不用,在任意节点执行都可以/usr/local/hadoop/bin/hadoop namenode –format

ol7.7安装部署4节点hadoop 3.2.1分布式集群学习环境的详细教程

看到这个successfuly formatted就是表示成功

start-dfs.sh启动集群hdfs

jps命令查看运行情况

ol7.7安装部署4节点hadoop 3.2.1分布式集群学习环境的详细教程通过master的9870端口可以网页监控http://192.168.168.11:9870/

ol7.7安装部署4节点hadoop 3.2.1分布式集群学习环境的详细教程

也可以通过命令行查看集群状态hadoop dfsadmin -report

[hadoop@master ~]$ hadoop dfsadmin -report
WARNING: Use of this script to execute dfsadmin is deprecated.
WARNING: Attempting to execute replacement "hdfs dfsadmin" instead.
 
Configured Capacity: 201731358720 (187.88 GB)
Present Capacity: 162921230336 (151.73 GB)
DFS Remaining: 162921181184 (151.73 GB)
DFS Used: 49152 (48 KB)
DFS Used%: 0.00%
Replicated Blocks:
 Under replicated blocks: 0
 Blocks with corrupt replicas: 0
 Missing blocks: 0
 Missing blocks (with replication factor 1): 0
 Low redundancy blocks with highest priority to recover: 0
 Pending deletion blocks: 0
Erasure Coded Block Groups:
 Low redundancy block groups: 0
 Block groups with corrupt internal blocks: 0
 Missing block groups: 0
 Low redundancy blocks with highest priority to recover: 0
 Pending deletion blocks: 0
 
-------------------------------------------------
Live datanodes (4):
 
Name: 192.168.168.11:9866 (master)
Hostname: master
Decommission Status : Normal
Configured Capacity: 50432839680 (46.97 GB)
DFS Used: 12288 (12 KB)
Non DFS Used: 9796546560 (9.12 GB)
DFS Remaining: 40636280832 (37.85 GB)
DFS Used%: 0.00%
DFS Remaining%: 80.58%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Fri Jul 03 11:14:44 CST 2020
Last Block Report: Fri Jul 03 11:10:35 CST 2020
Num of Blocks: 0
 
 
Name: 192.168.168.12:9866 (slave1)
Hostname: slave1
Decommission Status : Normal
Configured Capacity: 50432839680 (46.97 GB)
DFS Used: 12288 (12 KB)
Non DFS Used: 9710411776 (9.04 GB)
DFS Remaining: 40722415616 (37.93 GB)
DFS Used%: 0.00%
DFS Remaining%: 80.75%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Fri Jul 03 11:14:44 CST 2020
Last Block Report: Fri Jul 03 11:10:35 CST 2020
Num of Blocks: 0
 
 
Name: 192.168.168.13:9866 (slave2)
Hostname: slave2
Decommission Status : Normal
Configured Capacity: 50432839680 (46.97 GB)
DFS Used: 12288 (12 KB)
Non DFS Used: 9657286656 (8.99 GB)
DFS Remaining: 40775540736 (37.98 GB)
DFS Used%: 0.00%
DFS Remaining%: 80.85%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Fri Jul 03 11:14:44 CST 2020
Last Block Report: Fri Jul 03 11:10:35 CST 2020
Num of Blocks: 0
 
 
Name: 192.168.168.14:9866 (slave3)
Hostname: slave3
Decommission Status : Normal
Configured Capacity: 50432839680 (46.97 GB)
DFS Used: 12288 (12 KB)
Non DFS Used: 9645883392 (8.98 GB)
DFS Remaining: 40786944000 (37.99 GB)
DFS Used%: 0.00%
DFS Remaining%: 80.87%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Fri Jul 03 11:14:44 CST 2020
Last Block Report: Fri Jul 03 11:10:35 CST 2020
Num of Blocks: 0
 
 
[hadoop@master ~]$

start-yarn.sh可以开启yarn,可以通过master8088端口监控

ol7.7安装部署4节点hadoop 3.2.1分布式集群学习环境的详细教程

启动集群命令,可以同时开启hdfs和yarn /usr/local/hadoop/sbin/start-all.sh

停止集群命令 /usr/local/hadoop/sbin/stop-all.sh

就这样,记录过程,以备后查

标签:
ol7.7安装部署hadoop分布式集群,hadoop分布式集群

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。