ITPub博客

首页 > 大数据 > Hadoop > hadoop在linux上的初实验:环境搭建和伪分布模式搭建

hadoop在linux上的初实验:环境搭建和伪分布模式搭建

Hadoop 作者:escbread 时间:2013-11-29 13:50:55 0 删除 编辑

 hadoop在linux上的初真验:环境搭建战伪分布模式搭建光是那个便差没有多把我的耐性耗没了,逢到了无数坚苦。。。别人皆开端叫我电脑杀手了汗。。。
话没有多讲
起首是安拆系统咯,我用的是Ubuntu 10.04 LTS - Lucid Lynx。
由于钝捷那个客户端相比血腥,同时我们卧室区的效劳器貌似也战我没丰年夜对盘,便直接买了无线往用。。。没有过而今软件中央完齐没有能用的讲。。完端赖手动安拆啊。。。
jdk的安拆曾让我也很头痛。。。嘿嘿   有个好网站,其他体式格局我用那皆没有止,那个网址给的体式格局最管用!
http://www.linuxdiyf.com/viewarticle.php?id=216845
我也在虚拟机下弄过,可是真的很慢,很费事,后期会更疾苦吧。。。
所以我又回回了。。。
感触感染最年夜的误区借是看了hadoop快速进门那个中文官方网站!看了英文的才发明,那个中文的网站上次更新时间完齐是猴年马月的工作了!!我失败了那么多次。。。。苍莽了那么多次。。。完齐是在绕圈子!!!
下载hadoop完齐没有效苍莽啦!http://mirror.bit.edu.cn/apache//hadoop/common/hadoop-1.0.0/
由于我的是Ubuntu,所以直接只下hadoop-1.0.0.tar.gz 便好>
其他的linux系统貌似redhat是rmp结尾的那个。
hadoop-0.20.2.tar.gz 配置conf/hadoop-env.sh文件。 增加 export JAVA_HOME =/usr/lib/jvm/java-6-sun 那边那边建改为你的jdk的安拆位置。
~/.bashrc里也要增加PATH,在现有的前面加    :/hadoop的安拆目次/bin(:是需要的)

 查抄是可运止:source ~/.bashrc

                        hadoop version

hadoop 呈现版本疑息的时刻便成功了~
然后是单机模式战伪分布模式的搭建
完齐便靠英文版的hadoop网站啦
1单机模式
$ mkdir input
$ cp conf/*.xml input
$ bin/hadoop jar hadoop-examples-*.jar grep input output "dfs[a-z.]+"
$ cat output/*
当时刻只闪现一个 1    dfsadmin 是准确的!
2伪分布,建改配置
例子:gedit conf/core-site.xml          便可以打开文件,以下代码复制粘贴便可(格局没丰年夜对,也懒得弄,往官网哦!)
conf/core-site.xml:

     
         fs.default.name
         hdfs://localhost:9000
     


conf/hdfs-site.xml:


     
         dfs.replication
         1
     


conf/mapred-site.xml:


     
         mapred.job.tracker
         localhost:9001
     


3配置ssh
我直接
ssh localhost  便成功了,没有需要稀码
若是没有止的话试试那个
$ ssh-keygen -t dsa -P "" -f ~/.ssh/id_dsa
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
然后再 ssh localhost

4格局化HDFS
$ bin/hadoop namenode -format

5 开启hadoop回护进程:
$ bin/start-all.sh
那边那边要是提醒
  1. his script is Deprecated. Instead use start-dfs.sh and start-mapred.sh  
  2. namenode running as process ***x. Stop it first.  
  3. localhost: datanode running as process ***x. Stop it first.  
  4. localhost: secondarynamenode running as process ***x. Stop it first.  
  5. jobtracker running as process ***x. Stop it first.  
  6. localhost: tasktracker running as process ***x. Stop it first.
便输进$bin/stop-all.sh
然后再$bin/start-all.sh便止啦!

6将hadoop安拆目次下的conf文件夹及内容复制到hdfs中往:
$ bin/hadoop fs -put conf input

7运止供给的例子
$ bin/hadoop jar hadoop-examples-*.jar grep input output "dfs[a-z.]+"

使效果闪现:$ bin/hadoop fs -cat output/*
若是输出是:1    dfs.replication
           1    dfs.server.namenode.
           1    dfsadmin
便成功啦!

以上完齐是出于记实目标。。。。小我记性没丰年夜好。。。。

 

附:逢到此类弊端:

碰着弊端:

 

11/08/18 14:56:37 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 0 time(s).
11/08/18 14:56:39 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 1 time(s).
11/08/18 14:56:41 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 2 time(s).
11/08/18 14:56:43 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 3 time(s).
11/08/18 14:56:45 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 4 time(s).
11/08/18 14:56:47 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 5 time(s).
11/08/18 14:56:49 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 6 time(s).
11/08/18 14:56:51 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 7 time(s).
11/08/18 14:56:53 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 8 time(s).
11/08/18 14:56:55 INFO ipc.Client: Retrying connect to server: localhost/127.0.0
.1:8888. Already tried 9 time(s).
Bad connection to FS. command aborted. exception: Call to localhost/127.0.0.1:88
88 failed on connection exception: java.net.ConnectException: Connection refused
: no further information


弊端提醒“Bad connection to FS. command aborted. exception: Call to localhost/127.0.0.1:88

88 failed on connection exception: java.net.ConnectException: Connection refused

: no further information”

重新格局化namenode,便可以了。

格局化指令以下

 bin/hadoop namenode -format

成功 之后重启hadoop便可以了



参考:1http://hadoop.apache.org/common/docs/stable/single_node_setup.html
     2http://www.linuxdiyf.com/viewarticle.php?id=216845
      3 http://www.bwkeji.com/a/wangzhanjichu/kaifa/20110819/1643.html>



       

<!-- 正文结束 -->

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23394887/viewspace-1119949/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2010-02-24