阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Hadoop 0.20.2 在Mac OS 10.9 环境下 pseudo distributed 配置

103次阅读
没有评论

共计 2408 个字符,预计需要花费 7 分钟才能阅读完成。

1. 下载 Hadoop-0.20.2 版本并解压, tar -xvzf

2. edit the file conf/hadoop-env.sh to define at least JAVA_HOME to be the root of your Java installation.

加上这一句 export JAVA_HOME=/Library/Java/Home

3.Try the following command: $ bin/hadoop  This will display the usage documentation for the hadoop script.

4. 更改 conf 文件夹里的 配置文件

conf/core-site.xml:

<configuration>
    <property>
        <name>fs.default.name</name>
        <value>hdfs://localhost:9000</value>
    </property>
</configuration>

conf/hdfs-site.xml:

<configuration>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
</configuration>

conf/mapred-site.xml:

<configuration>
    <property>
        <name>mapred.job.tracker</name>
        <value>localhost:9001</value>
    </property>
</configuration>

5. 配置 ssh

Now check that you can ssh to the localhost without a passphrase:
$ ssh localhost

If you cannot ssh to localhost without a passphrase, execute the following commands:
$ ssh-keygen -t dsa -P ” -f ~/.ssh/id_dsa
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

6. 执行 Hadoop

Format a new distributed-filesystem:
$ bin/hadoop namenode -format

Start the hadoop daemons:
$ bin/start-all.sh

The hadoop daemon log output is written to the ${HADOOP_LOG_DIR} directory (defaults to ${HADOOP_HOME}/logs).

Browse the web interface for the NameNode and the JobTracker; by default they are available at:

NameNode – http://localhost:50070/
JobTracker – http://localhost:50030/

7. 运行 hadoop 的 hello word 程序

mkdir input

并在里面放置你想统计的文本文件

将文件夹放入 hdfs 里面

bin/hadoop dfs -put input input

执行 example word count 程序,输入文件夹为 hdfs 里面名字为 input 的,输出文件夹为 output

bin/hadoop jar hadoop-0.20.2-examples.jar wordcount input output

将 hdfs 里面的 output 文件夹取出到本地命名为 output
bin/hadoop -dfs get output output

查看里面的词频统计内容

cat output/*

8. helpful link
http://www.cs.brandeis.edu/~rshaull/cs147a-fall-2008/hadoop-troubleshooting/

里面列出来了一些安装出现的简单问题,譬如当我运行 eamples 时遇见过

java.io.IOException: Not a file:
  hdfs://localhost:9000/user/ross/input/conf

里面列出来了是因为在 hdfs 里面的 input 文件夹没有删除,我们需要

bin/hadoop dfs -rmr input
bin/hadoop dfs -put conf input

9. 引用

安装流程参考 https://hadoop.apache.org/docs/r1.2.1/single_node_setup.html

相关阅读

Ubuntu 13.04 上搭建 Hadoop 环境 http://www.linuxidc.com/Linux/2013-06/86106.htm

Ubuntu 12.10 +Hadoop 1.2.1 版本集群配置 http://www.linuxidc.com/Linux/2013-09/90600.htm

Ubuntu 上搭建 Hadoop 环境(单机模式 + 伪分布模式)http://www.linuxidc.com/Linux/2013-01/77681.htm

Ubuntu 下 Hadoop 环境的配置 http://www.linuxidc.com/Linux/2012-11/74539.htm

单机版搭建 Hadoop 环境图文教程详解 http://www.linuxidc.com/Linux/2012-02/53927.htm

搭建 Hadoop 环境(在 Winodws 环境下用虚拟机虚拟两个 Ubuntu 系统进行搭建)http://www.linuxidc.com/Linux/2011-12/48894.htm

更多 Hadoop 相关信息见 Hadoop 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=13

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计2408字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中