偽分布式hadoop環境搭建

來源:互聯網
上載者:User

標籤:hadoop   分布式   mapreduce   

官網上的教程版本不符,還過於簡單(很多必要的步驟沒提到),

所以自行網上找教程.

在這裡整理一下:


假設java_home已經配置完成,ssh也可連通


1.修改設定檔


以下檔案均在 %HADOOP_HOME%/conf/ 下

core-site.xml:  Hadoop Core的配置項,例如HDFS和MapReduce常用的I/O設定等。
hdfs-site.xml:  Hadoop 守護進程的配置項,包括namenode,輔助namenode和datanode等。
mapred-site.xml: MapReduce 守護進程的配置項,包括jobtracker和tasktracker。   


預先建立好檔案目錄:

~/hadoop$ mkdir tmp
~/hadoop$ mkdir hdfs
~/hadoop$ mkdir hdfs/name
~/hadoop$ mkdir hdfs/data


配置內容:

core-site.xml

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!-- Put site-specific property overrides in this file. --><configuration>        <property>                <name>fs.default.name</name>                <value>hdfs://localhost:9000</value>        </property>        <property>                <name>hadoop.tmp.dir</name>                <value>/usr/hadoop/hadoop-1.2.1/tmp</value>        </property></configuration>


hdfs-site.xml

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!-- Put site-specific property overrides in this file. --><configuration>        <property>                <name>dfs.replication</name>                <value>1</value>        </property>        <property>                <name>dfs.name.dir</name>                <value>/usr/hadoop/hadoop-1.2.1/hdfs/name</value>        </property>        <property>                <name>dfs.data.dir</name>                <value>/usr/hadoop/hadoop-1.2.1/hdfs/data</value>        </property></configuration>


mapred-site.xml

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!-- Put site-specific property overrides in this file. --><configuration>        <property>                <name>mapred.job.tracker</name>                <value>localhost:9001</value>        </property></configuration>


2.格式化


[[email protected] hadoop-1.2.1]# bin/hadoop namenode -format



3.開啟

[[email protected] hadoop-1.2.1]# bin/start-all.sh 


測試:

jps



使用web瀏覽器查看:

http://localhost:50030/ - Hadoop 管理介面
http://localhost:50060/ - Hadoop Task Tracker 狀態
http://localhost:50070/ - Hadoop DFS 狀態


4.執行map-reduce樣本


建立hdfs上的input

[[email protected] hadoop-1.2.1]# bin/hadoop dfs -mkdir input

配置拷上去

[[email protected] hadoop-1.2.1]# hadoop dfs -copyFromLocal conf/* input

執行java檔案

[[email protected] hadoop-1.2.1]# hadoop jar hadoop-examples-1.2.1.jar wordcount input output

完成:




著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

偽分布式hadoop環境搭建

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.