1.简介
windows下安装hadoop,这里采用hadoop-1.2.1其他的版本的都没有安装成功
2.cgywin环境安装及设置jdk软连接
下载安装cgywin:
在Select Packages界面里:
Category展开net,选择如下openssh和openssl两项
在Eclipe上编译Hadoop,需要安装Category为Base下的sed
在Cygwin上直接修改hadoop的配置文件,可以安装Editors下的vim
设置软连接:
在usr/local下执行 ln -s "C:/Program Files/Java/jdk1.7.0_67" jdk1.7 命令设置jdk软连接
3.ssh免登陆
安装sshd服务:在cgywin中执行ssh-host-config -y 命令
配置SSH免密码登录:
执行ssh-keygen命令生成密钥文件:
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa,注意-t -P -f参数区分大小写。
生成authorized_keys文件
cd ~/.ssh/
cp id_dsa.pub authorized_keys
4.hadoop文件配置
这里编辑文件最好用vim编辑,如果用windows系统本身编辑器会出现错误
hadoop-env.sh文件
添加: export JAVA_HOME=/usr/local/jdk1.7
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>mapred.child.tmp</name>
<value>/home/用户名/hadoop/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>
</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>
<property>
<name>mapred.child.tmp</name>
<value>/home/用户名/hadoop/tmp</value>
</property>
</configuration>
5.启动测试hadoop
在hadoop的bin目录下执行: ./hadoop namenode -format 格式化Hadoop的文件系统HDFS
在hadoop的bin目录下执行: ./start-all.sh 启动进程
6.eclipse环境配置hadoop