Hadoop学习---CentOS中hadoop伪分布式集群安装

注意:此次搭建是在ssh无密码配置、jdk环境已经配置好的情况下进行的

可以参考: Hadoop完全分布式安装教程

CentOS环境下搭建hadoop伪分布式集群

1.更改主机名

执行命令:vi  /etc/sysconfig/network

Hadoop学习---CentOS中hadoop伪分布式集群安装

2.设置hosts中ip与主机名的绑定

执行命令 vi  /etc/hosts

在里面添加选项设置你的主机名与ip的对应关系

Hadoop学习---CentOS中hadoop伪分布式集群安装

3.安装hadoop

执行命令,将压缩包解压到/usr/local/hadoop文件夹下

tar -zxvf hadoop-2.6.0-cdh5.7.0.tar.gz -C /usr/local/hadoop

4.进入hadoop安装目录,进入etc/hadoop目录下

Hadoop学习---CentOS中hadoop伪分布式集群安装

修改etc/hadoop目录下的几个文件:

1).core-site.xml

<property>
<name>fs.defaultFS</name>
<value>hdfs://hadoop1:8020</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop/tmp</value>
</property>
<property>
<name>io.file.buffer.size</name>
<value>131702</value>
</property>

Hadoop学习---CentOS中hadoop伪分布式集群安装

2).hdfs-site.xml

<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/usr/local/hadoop/hdfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/usr/local/hadoop/hdfs/data</value>
</property>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>hadoop1:9001</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>

Hadoop学习---CentOS中hadoop伪分布式集群安装

3).mapred-site.xml

<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>hadoop1:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>hadoop1:19888</value>
</property>

Hadoop学习---CentOS中hadoop伪分布式集群安装

4)yarn-site.xml

<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>

Hadoop学习---CentOS中hadoop伪分布式集群安装

5.设置hadoop-env.sh和yarn-env.sh的JAVA_HOME

export JAVA_HOME=/root/software/jdk1.7.0_79

6.修改slaves文件,将hadoop集群主机名称添加进去

Hadoop学习---CentOS中hadoop伪分布式集群安装

7.修改环境变量:vi /etc/profile

Hadoop学习---CentOS中hadoop伪分布式集群安装

hadoop namenode -format

1)初始化,输入命令,bin/hadoop namenode -format

(2)全部启动sbin/start-all.sh,

报错及解决办法:

1).启动hadoop是报如下错:

Hadoop学习---CentOS中hadoop伪分布式集群安装

解决办法是直接在log4j日志中去除告警信息:

在//usr/local/hadoop-2.5.2/etc/hadoop/log4j.properties文件中添加

log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR

参考网址:http://blog.csdn.net/l1028386804/article/details/51538611

上一篇:php 利用转转法去除重复数组


下一篇:Hadoop(三)搭建Hadoop全分布式集群