Ubuntu13.04下搭建Hadoop+Eclipse開發環境

1.下載hadoop包:wget http://www.fightrice.com/mirrors/apache/hadoop/common/hadoop-1.2.0/hadoop-1.2.0.tar.gz

2. 加壓後,進行hadoop的僞分佈模式的配置

    在conf目錄下,分別需要修改3個配置文件:core-site.xml、mapred-site.xml、hdfs-site.xml

在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>
</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>

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>
</configuration>

3. 修改配置文件conf/hadoop-env.sh ,添加JAVA_HOME

4.免密碼ssh的設置

首先要確定是否安裝過ssh,驗證方法爲:

which ssh

which sshd

which ssh-keygen

如果沒有安裝的話,則使用apt-get install 安裝即可

然後執行ssh-keygen -t rsa 並一直按<Enter>鍵,默認的選項會將生成的密鑰對保存在.ssh/id_rsa文件中。

進入.ssh 目錄,並執行

cp id_rsa.pub authorized_keys

5 格式化分佈式文件系統

bin/hadoop namenode -format

6啓動Hadoop 守護進程

bin/start-all.sh


7停止hadoop守護進程

bin/stop-all.sh

8 eclipse 環境安裝

注意::::要下載標準版而不是EE版本,否則hadoop插件安裝不上。

9.將hadoop插件考到eclipse下的plugins目錄下,在eclipse中,window->open perspective->other->map/reduce即可打開hadoop開發環境

10.在eclipse下設置hdfs等信息,window->show view->other->map/reduce Locations

選擇新添加一個hadooplocation,然後進行配置,按照安裝hadoop時的配置進行。Map/Reduce Master設置爲Host:localhost,Port:9001   DFS Master設置爲port:9000 username隨意起一個

11,添加hadoop本地安裝目錄。

搞定~


eclipse插件的編譯,後續灰這



發佈了32 篇原創文章 · 獲贊 6 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章