Hadoop2集群搭建2.docx

上传人:b****7 文档编号:9062170 上传时间:2023-02-03 格式:DOCX 页数:23 大小:23.40KB
下载 相关 举报
Hadoop2集群搭建2.docx_第1页
第1页 / 共23页
Hadoop2集群搭建2.docx_第2页
第2页 / 共23页
Hadoop2集群搭建2.docx_第3页
第3页 / 共23页
Hadoop2集群搭建2.docx_第4页
第4页 / 共23页
Hadoop2集群搭建2.docx_第5页
第5页 / 共23页
点击查看更多>>
下载资源
资源描述

Hadoop2集群搭建2.docx

《Hadoop2集群搭建2.docx》由会员分享,可在线阅读,更多相关《Hadoop2集群搭建2.docx(23页珍藏版)》请在冰豆网上搜索。

Hadoop2集群搭建2.docx

Hadoop2集群搭建2

Hadoop2集群搭建

文档修订摘要

日期

修订号

描述

著者

审阅者

2014.10.9

V1.0

新建

陈云

Hadoop2集群搭建1

〇、前序4

0.1、前景概序4

0.2、搭建环境4

0.3、技术在于分享4

1、基本配置5

1.1、安装JDK5

1.2、设置主机名5

1.3、设置主机名于IP地址的映射5

1.4、关闭防火墙6

1.5、创建专有的用户6

1.6、设置无密码登录6

2、Hadoop2.2.0搭建7

2.1、安装maven7

2.2、编译hadoop2.2.0源码8

2.3、配置节点文件slaves11

2.4、配置Hadoop的core-site.xml文件12

2.5、配置Hadoop的hdfs-site.xml文件13

2.6、配置Hadoop的mapred-site.xml文件14

2.7、配置Hadoop的hadoop-yarn.xml文件15

2.8、配置Hadoop的hadoop-env.sh文件17

2.9、配置Hadoop的yarn-env.sh文件17

2.10、用scp命令拷贝文件到其他机器上面17

2.11、格式化启动hadoop17

2.12、用jps查看进程17

3、zooKepper18

3.1、版本以解压位置18

3.2、配置zoo.config文件18

3.3、拷贝19

3.4、配置myid文件19

3.5、启动19

4、HBase20

4.1、版本及解压20

4.2、修改hbase-env.sh文件20

4.3、修改hbase-site.xml文件20

4.4、修改regionservers文件22

4.5、复制22

4.6、启动23

5、Hive23

5.1、为Hive建立相应的MySql账号23

5.2、建立Hive专用数据库23

5.3、版本及解压24

5.4、配置Hive24

5.5、进入Hive25

6、Sqoop25

6.1、版本及解压25

6.2、重命名配置文件25

6.3、修改配置文件sqoop-env.sh26

〇、前序

0.1、前景概序

由于工作需要,需要搭建hadoop2集群,搞了几天,各种问题,各种版本不兼容,最后终于摸索出自己的一套搭建出hadoop2集群的方法,在此总结成文档.

0.2、搭建环境

由于目前别人只给了4台服务器,一台命为mysql26,另外一台mysql27。

Hadoop28,hadoop29.64位系统的,目前阿帕奇网站上面只提供32为的hadoop版本,所有在搭建的时候还需要重新编译源代码。

版本选择为:

hadoop2.2.0+zooKapper3.4.5+hbase-0.96+Hive0.13+sqoop-1.4.5

0.3、技术在于分享

欢迎广大爱好大数据的朋友一起讨论研究大数据技术,本人网名:

cloudlove。

QQ:

505779259.

 

1、基本配置

1.1、安装JDK

1.1.1、把jdk放到/usr/java目录下,然后cd/usr/java目录下

1.1.2、赋予执行权限chmodu+xjdk-6u24-linux-i586.bin

1.1.3、使用./jdk-6u24-linux-i586.bin进行解压缩

1.1.4、重命名,执行命令mvjdk1.6.0_24jdk1.6

1.1.5、设置环境变量,编辑文件vi/etc/profile,增加两行记录

exportJAVA_HOME=/usr/local/jdk1.6

exportPATH=.:

$JAVA_HOME/bin:

$PATH

保存退出

1.1.6、执行命令source/etc/profile

验证:

执行命令java-version

1.2、设置主机名

1.2.1、通过vi /etc/sysconfig/network设置hostname

我们这是hadoop26,hadoop27,hadoop28,hadoop29

1.3、设置主机名于IP地址的映射

1.3.1、通过vi/etc/hosts  

hadoop26:

132.121.86.26

hadoop27:

132.121.86.27

hadoop28:

132.121.86.28

hadoop29:

132.121.86.29

1.4、关闭防火墙

1.4.1、执行命令serviceiptablesstop

1.4.2、执行命令chkconfigiptablesoff

1.4.3、执行命令chkconfig--list|grepiptables

看看是否全是off

1.5、创建专有的用户

一般是建专有的hadoop用户,不在root用户上面搭建

1.5.1、先创建组:

groupaddhadoop,

然后创建用户:

useradd-ghadoopcloud,然后修改

hadoop用户的密码:

passwdcloud,建议将密码设置

的短点(2边都要创建)。

1.5.2、将cloud用户加到sodu列表

vi/etc/sudoers (cloud ALL=(ALL)   ALL)

1.6、设置无密码登录

1.6.1、用cloud用户登入hadoop26,cd到用户目录下,如/home/cloud/运行ssh-keygen–trsa  (连续

3次回车即可)

1.6.2、.ssh拷贝到其他server上

scp~/.ssh/id_rsa.pubcloud@hadoop27:

~/temp_key

scp~/.ssh/id_rsa.pubcloud@hadoop28:

~/temp_key

scp~/.ssh/id_rsa.pubcloud@hadoop29:

~/temp_key

1.6.3、改变.ssh权限 chmod 700 ~/.ssh

1.6.4、对端服务器执行cat~/temp_key>>~/.ssh/authorized_keys

    chmod 600 ~/.ssh/authorized_keys

1.6.5、在其他服务器上面在执行上面的步骤,也要配置面验证

1.6.6、然后配置其他机器到hadoop26的免密码登陆

(注意:

由于系统的不同,可能有些命令不同,如果有些命令不能用。

则查相应版本的系统命令)

2、Hadoop2.2.0搭建

2.1、安装maven

2.1.1、下载maven

wget

2.1.2、配置环境变量

同样在/etc/profie里配置环境变量

export MAVEN_HOME=/opt/maven

export PATH=$PATH:

$MAVEN_HOME/bin

每个人安装的位置不同,下面配置路径也不同

2.1.3、验证版本

mvn-version

2.2、编译hadoop2.2.0源码

2.2.1、下载源码

wget 

2.2.2、maven的settings.xml文件新增配置

由于maven国外服务器可能连不上,先给maven

配置一下国内镜像,在maven目录下,

conf/settings.xml,在里添加,原本

的不要动

  

nexus-osc  

    *  

 Nexusosc  

 

s/public/  

  

同样,在内新添加

jdk-1.6

1.6

nexus

localprivatenexus

true

false

nexus

localprivatenexus

true

false

2.2.3、编译clean

cdhadoop2.2.0-src

mvncleaninstall–DskipTests

发现异常:

[ERROR]Failedtoexecutegoalorg.apache.hadoop:

hadoop-maven-plugins:

2.2.0:

protoc(compile-protoc)onprojecthadoop-common:

org.apache.maven.plugin.MojoExecutionException:

'protoc--version'didnotreturnaversion->[Help1]

[ERROR]

[ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-eswitch.

[ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging.

[ERROR]

[ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,pleasereadthefollowingarticles:

[ERROR][Help1]http:

//cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

[ERROR]

[ERROR]Aftercorrectingtheproblems,youcanresumethebuildwiththecommand

[ERROR]mvn-rf:

hadoop-common

原因:

由于hadoop2.2.0有漏洞需要patch一下:

2.2.4、下载安装protoc2.5.0

2.2.4.1、下载地址

地址:

要下载2.5.0版本

2.2.4.2、安装依赖包

(不同的系统安装不同。

Suse系统可以陪住zypper的源

源为:

zypperaropenSUSE-12.2-Oss-sohu-mirror

yuminstallgcc

yumintallgcc-c++

yuminstallmake

yuminstallcmake

yuminstallopenssl-devel

yuminstallncurses-devel

yuminstallzlib

2.2.4.3、安装protoc2.5.0

tar-xvfprotobuf-2.5.0.tar.bz2

cdprotobuf-2.5.0

./configure--prefix=/opt/protoc/

make&&makeinstall

2.2.5、配置环境变量不多说和上面一样

2.3.6、patch

由于hadoop2.2.0有漏洞需要patch

Patch:

https:

//issues.apache.org/jira/browse/HADOOP-10110

2.3.7、可以编译了

mvnpackage-Pdist,native-DskipTests-Dtar

2.3.8、编译后代码文件位置

编译后的路径

在:

hadoop-2.2.0-src/hadoop-dist/target/hadoop-2.2.0

(注意:

如果编译失败,大部分是系统版本的原因,不同的系统带的套件不同,如果失败,看看失败的原因,缺少什么组件就装什么)

2.3、配置节点文件slaves

加入DataNode:

vi/home/cloud/hadoop-2.2.0/etc/hadoop/slaves

输入:

hadoop27

Hadoop28

Hadoop29

2.4、配置Hadoop的core-site.xml文件

vi/home/cloud/hadoop2.2/etc/hadoop/core-site.xml

输入以下内容:

--

LicensedundertheApacheLicense,Version2.0(the"License");

youmaynotusethisfileexceptincompliancewiththeLicense.

YoumayobtainacopyoftheLicenseat

http:

//www.apache.org/licenses/LICENSE-2.0

Unlessrequiredbyapplicablelaworagreedtoinwriting,software

distributedundertheLicenseisdistributedonan"ASIS"BASIS,

WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.

SeetheLicenseforthespecificlanguagegoverningpermissionsand

limitationsundertheLicense.SeeaccompanyingLICENSEfile.

-->

--Putsite-specificpropertyoverridesinthisfile.-->

fs.defaultFS

hdfs:

//hadoop26:

9000

io.file.buffer.size

131072

 

hadoop.tmp.dir

file:

/home/cloud/hadoop2.2/temp

Abaseforothertemporarydirectories.

hadoop.proxyuser.hduser.hosts

*

hadoop.proxyuser.hduser.groups

*

2.5、配置Hadoop的hdfs-site.xml文件

vi/home/cloud/hadoop2.2/etc/hadoop/hdfs-site.xml

输入以下文本:

xmlversion="1.0"encoding="UTF-8"?

>

xml-stylesheettype="text/xsl"href="configuration.xsl"?

>

--

LicensedundertheApacheLicense,Version2.0(the"License");

youmaynotusethisfileexceptincompliancewiththeLicense.

YoumayobtainacopyoftheLicenseat

http:

//www.apache.org/licenses/LICENSE-2.0

Unlessrequiredbyapplicablelaworagreedtoinwriting,software

distributedundertheLicenseisdistributedonan"ASIS"BASIS,

WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.

SeetheLicenseforthespecificlanguagegoverningpermissionsand

limitationsundertheLicense.SeeaccompanyingLICENSEfile.

-->

--Putsite-specificpropertyoverridesinthisfile.-->

dfs.namenode.secondary.http-address

hadoop26:

9001

dfs.namenode.name.dir

file:

/home/hadoop/hadoop2.2/dfs/name

dfs.datanode.data.dir

file:

/data1,/data2,/data3,/data4,/data5,/data6,/data7,

/data8,/data9,/data10,/data11,/data12

dfs.replication

1

dfs.webhdfs.enabled

true

2.6、配置Hadoop的mapred-site.xml文件

vi/home/cloud/hadoop2.2/etc/hadoop/mapred-site.xml

输入:

xmlversion="1.0"?

>

xml-stylesheettype="text/xsl"href="configuration.xsl"?

>

--

LicensedundertheApacheLicense,Version2.0(the"License");

youmaynotusethisfileexceptincompliancewiththeLicense.

YoumayobtainacopyoftheLicenseat

http:

//www.apache.org/licenses/LICENSE-2.0

Unlessrequiredbyapplicablelaworagreedtoinwriting,software

distributedundertheLicenseisdistributedonan"ASIS"BASIS,

WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.

SeetheLicenseforthespecificlanguagegoverningpermissionsand

limitationsundertheLicense.SeeaccompanyingLICENSEfile.

-->

--Putsite-specificpropertyoverridesinthisfile.-->

mapreduce.framework.name

yarn

mapreduce.jobhistory.address

hadoop26:

10020

mapreduce.jobhistory.webapp.address

hadoop26:

19888

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 院校资料

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1