hadoop2.*环境安装

0. Hadoop源码包下载
http://mirror.bit.edu.cn/apache/hadoop/common

1. 集群环境
Master 172.16.11.97
Slave1 172.16.11.98
Slave2 172.16.11.99

2. 下载安装包
#Master
wget http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-2.8.2/hadoop-2.8.2.tar.gz
tar zxvf hadoop-2.8.2.tar.gz

3. 修改Hadoop配置文件
#Master
cd hadoop-2.8.2/etc/hadoop
vim hadoop-env.sh
export JAVA_HOME=/usr/local/src/jdk1.8.0_152

vim yarn-env.sh
export JAVA_HOME=/usr/local/src/jdk1.8.0_152

vim slaves
slave1
slave2

vim core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://172.16.11.97:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/usr/local/src/hadoop-2.8.2/tmp</value>
</property>
</configuration>

vim hdfs-site.xml
<configuration>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>master:9001</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/local/src/hadoop-2.8.2/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/local/src/hadoop-2.8.2/dfs/data</value>
</property>
<property>
<name>dfs.repliction</name>
<value>3</value>
</property>
</configuration>

vim mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>

vim yarn-site.xml
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<property>
<name>yarn.resourcemanager.address</name>
<value>master:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>master:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>master:8035</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>master:8033</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>master:8088</value>
</property>
</configuration>
#创建临时目录和文件目录
mkdir /usr/local/src/hadoop-2.8.2/tmp
mkdir -p /usr/local/src/hadoop-2.8.2/dfs/name
mkdir -p /usr/local/src/hadoop-2.8.2/dfs/data


4. 配置环境变量
方法一:
#Master、Slave1、Slave2
vim ~/.bashrc
HADOOP_HOME=/usr/local/src/hadoop-2.8.2
export PATH=$PATH:$HADOOP_HOME/bin
#刷新环境变量
source ~/.bashrc

方法二:

#cd /etc

#vi profile 

添加

HADOOP_HOME=/usr/local/src/hadoop-2.8.2
export PATH=$PATH:$HADOOP_HOME/bin

#source profile

***************************************集群互信机制配置--开始********************************************

1、一定要关闭防火墙

firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

2、#ssh-keygen


3、

然后进入隐藏目录

#cd ~/.ssh

#ls


Id_rsa.pub是公钥文件,id_rsa是密钥文件

我们要对id_rsa.pub这个公钥文件的内容拷贝到authorized_keys个文件(在此说明:如果没有authorized_keys这个文件,

请自己创建!!)

4、然后在slave1、slave2重复上面1、2、3步骤,把集群Id_rsa.pub文件中公钥全部放进authorized_keys文件,然后slave1、

slave2,#scp -rp authorized_keys slave1:~/.ssh


***************************************集群互信机制配置--结束********************************************

5. 拷贝安装包
#Master
scp -r /usr/local/src/hadoop-2.8.2 root@slave1:/usr/local/src/hadoop-2.8.2
scp -r /usr/local/src/hadoop-2.8.2 root@slave2:/usr/local/src/hadoop-2.8.2

6. 启动集群
#Master
#初始化Namenode
hadoop namenode -format


#启动集群
./sbin/start-all.sh

6. 集群状态
jps
#Master
#Slave1
#Slave2

7.监控网页
http://master:8088

8. 操作命令
#和Hadoop1.0操作命令是一样的

9. 关闭集群
./sbin/hadoop stop-all.sh
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/DoveYoung8/article/details/79957668
文章标签: Hadoop
个人分类: hadoop
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭