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插件的编译,后续灰这

猜你喜欢

转载自blog.csdn.net/e6894853/article/details/19422151