千家信息网

怎么配置hadoop

发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,这篇文章将为大家详细讲解有关怎么配置hadoop,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。一、配置hadoop首先去github上面下载源码:http://ha
千家信息网最后更新 2025年12月02日怎么配置hadoop

这篇文章将为大家详细讲解有关怎么配置hadoop,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

一、配置hadoop

首先去github上面下载源码:http://hadoop.apache.org/releases.html#News

在linux中安装jdk和配置ssh免密码登陆,其实最开始我并没有区配置免密码的,后来发现免密码登陆真方便。免密码登陆就是在控制台上面输入:ssh -keygen 然后一路回车就可以了。

我是把hadoop解压后放在/home/admin1/下载/hadoop-2.5.2。我们主要是在etc/hadoop 中配置文件。

1、core-site.xml

         fs.defaultFS      hdfs://ubuntu2:9000             hadoop.tmp.dir      /home/admin1/hadoop/hadoop-2.5.2/tmp/hadoop   



2、hdfs-site.xml

       dfs.replication     1  


3、mapred-site.xml

                    mapreduce.framework.name                yarn    



4、在yarn-site.xml中

                        yarn.resourcemanager.hostname                        ubuntu2                                                yarn.nodemanager.aux-services                        mapreduce_shuffle     


5、在hadoop-env.sh中添加

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64# The jsvc implementation to use. Jsvc is required to run secure datanodes.#export JSVC_HOME=${JSVC_HOME}export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/home/admin1/hadoop/hadoop-2.5.2"}

6、记得把salver改成你主机的名字,我这里就是把localhost改成了ubuntu2.因为我主机名就是ubuntu2

还需要配置一下java_home:在hadoop-env.sh中:(就是改成你的绝对路径就可以了,不要用相对路径)。

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

如果你运行报错的话,那应该就是java_home没有配置了

用命令行输入: sudo gedit /etc/profile

在最末尾加上:

JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64PATH=$JAVA_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOMEexport PATHexport CLASSPATH


这样基本上应该是可以运行了:

启动方式: 在/home/admin1/下载/hadoop-2.5.2 中 使用:
bin/hadoop namenode -format

sbin/start-all.sh

访问地址是:
http://localhost:50070/



http://localhost:8088/cluster


如果想要关闭则:sbin/stop-all.sh


问题:

若hadoop报错,则配置hadoop命令:
export HADOOP_HOME=/home/admin1/下载/hadoop-2.5.2
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH


若datanode未启动
rm -rf /usr/hadoop/tmp/*
rm -rf /tmp/hadoop*
在1之前进行以上两步操作。


二、配置eclipse

因为我是是直接把eclipse安装在linux中的,同时我用的还是4.5版本的,然后出现了各种各样奇奇怪怪的问题。我最开始以为是hadoop-eclipse-plugin-2.5.2.jar有问题,然后我就去下了应该ant和hadoop2x-eclipse-plugin-master来重新编译,编译的方法大致是这样:

1、先去下载hadoop2x-eclipse-plugin-master,https://github.com/winghc/hadoop2x-eclipse-plugin

2、下载ant:http://ant.apache.org/bindownload.cgi

3、分别解压出来,如果你的是在win下面就需要配置一下环境变量,在linux下面不要配置其实也是可以运行的。进入你刚才解压下来的 /hadoop2x-eclipse-plugin-master/src/contrib/eclipse-plugin中。

4、在上面哪个目录下,对以下文件进行修改:

在vxy中:libraries.properties

里面的 版本记得要和你直接版本相对应,如果你不找到你的版本的话可以去你哪个hadoop文件的share/hadoop中找,其实有个很简单的办法,你可以直接把我这段代码复制过去,等下编译的时候汇报哪个jar包的版本不对,然后你可以根据报错提示来改就可以了。

#   Licensed under the Apache License, Version 2.0 (the "License");#   you may not use this file except in compliance with the License.#   You may obtain a copy of the License at##       http://www.apache.org/licenses/LICENSE-2.0##   Unless required by applicable law or agreed to in writing, software#   distributed under the License is distributed on an "AS IS" BASIS,#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.#   See the License for the specific language governing permissions and#   limitations under the License. #This properties file lists the versions of the various artifacts used by hadoop and components.#It drives ivy and the generation of a maven POM# This is the version of hadoop we are generatinghadoop.version=2.5.2hadoop-gpl-compression.version=0.1.0 #These are the versions of our dependencies (in alphabetical order)apacheant.version=1.7.0ant-task.version=2.0.10 asm.version=3.2aspectj.version=1.6.5aspectj.version=1.6.11 checkstyle.version=4.2 commons-cli.version=1.2commons-codec.version=1.4commons-collections.version=3.2.1commons-configuration.version=1.6commons-daemon.version=1.0.13commons-httpclient.version=3.1commons-lang.version=2.6commons-logging.version=1.1.3commons-logging-api.version=1.0.4commons-math.version=3.1.1commons-el.version=1.0commons-fileupload.version=1.2commons-io.version=2.4commons-net.version=3.1core.version=3.1.1coreplugin.version=1.3.2 hsqldb.version=1.8.0.10 ivy.version=2.1.0 jasper.version=5.5.12jackson.version=1.9.13#not able to figureout the version of jsp & jsp-api version to get it resolved throught ivy# but still declared here as we are going to have a local copy from the lib folderjsp.version=2.1jsp-api.version=5.5.12jsp-api-2.1.version=6.1.14jsp-2.1.version=6.1.14jets3t.version=0.6.1jetty.version=6.1.26jetty-util.version=6.1.26jersey-core.version=1.9jersey-json.version=1.9jersey-server.version=1.9junit.version=4.11jdeb.version=0.8jdiff.version=1.0.9json.version=1.0 kfs.version=0.1 log4j.version=1.2.17lucene-core.version=2.3.1 mockito-all.version=1.8.5jsch.version=0.1.42 oro.version=2.0.8 rats-lib.version=0.5.1 servlet.version=4.0.6servlet-api.version=2.5slf4j-api.version=1.7.5slf4j-log4j12.version=1.7.5 wagon-http.version=1.0-beta-2xmlenc.version=0.52xerces.version=1.4.4protobuf.version=2.5.0guava.version=11.0.2netty.version=3.6.2.Final


build.xml

这个也是同理的,如果你版本不对可以按上面的道理来的。 xml的文件头记得要顶格写。

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   


makePlus.sh

ant jar -Dversion=2.5.2 -Declipse.home=/home/admin1/Public/eclipse     -Dhadoop.home=/home/admin1/下载/hadoop-2.5.2


说明:Declipse就是你eclipse的安装目录,Dhadoop就是你hadoop的安装目录。

接着运行 ./makePlus.sh就可以编译了。编译好之后放到eclipse的plugins中,然后重启eclipse就可以了。


好吧,说到这里我的内心崩溃的,这里过程台复杂了有木有,而且最后我重启eclipse居然没有成功,后来我发现弄了这么久居然是eclipse的原因,我的内心简直一万头×××,后来我把4.5版的删了,换成4.4的就可以了。当然中间还有一个小插曲,就是配置后不能右键New Hadoop了,所以我就在命令行输入了:

./eclipse -clean -consolelog -debug


然后重启就没有问题了。

现在来看运行配置:


可以在浏览器上面看到我刚才新建的几个文件夹:




关于"怎么配置hadoop"这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

配置 就是 版本 文件 运行 密码 问题 编译 命令 目录 篇文章 登陆 输入 不对 主机 内心 是在 更多 路径 不错 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 如何在2b2t服务器中生存下去 ccpy代理服务器 长沙牛耳软件开发专业 黎明之海服务器开放时间 软件开发公司管理人才队伍建设 四川网络技术待遇 移动流量软件开发 两个ipad怎么交换数据库 为什么蓝鸟维修服务器注册不了 网络技术公司和科技有限公司 奉贤区智能化软件开发具体地址 c 编写代理服务器 我的世界私人服务器视频 串口联网服务器和通信面板 加强纪检监察网络安全教育 腾讯服务器服务商 什么是数据库的标准语言 建立网络安全信息共享机制 金山区高科技软件开发设计规范 我国网络安全法是世界第几部 xml在服务器上打开和保存 电商erp软件开发公司 软件开发 测试流程详细解读 学校网上阅卷服务器 网页视频上传到服务器 中国有网络安全部队吗 互联网保险经营主体数据库 学堂在线网络安全技术答案 网络安全事件怎么处置 通信网络技术主要包括
0