一、修改配置(core-site.xml、hdfs-site.xml、mapred-site.xml、yarn-site.xml)
hadoop-2.7.1/etc/hadoop/core-site.xml
fs.default.name
hdfs://127.0.0.1:9000
hadoop.tmp.dir
file:/tmp
io.file.buffer.size
131702
hadoop-2.7.1/etc/hadoop/hdfs-site.xml
dfs.namenode.name.dir
file:/tmp/dfs/name
dfs.datanode.data.dir
file:/tmp/dfs/data
dfs.replication
1
dfs.namenode.secondary.http-address
127.0.0.1:9001
dfs.webhdfs.enabled
true
hadoop-2.7.1/etc/hadoop/mapred-site.xml
mapreduce.framework.name
yarn
mapreduce.jobhistory.address
127.0.0.1:10020
mapreduce.jobhistory.webapp.address
127.0.0.1:19888
hadoop-2.7.1/etc/hadoop/yarn-site.xml
yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.resourcemanager.webapp.address
127.0.0.1:8088
二、配置本机密码登录
输入命令:ssh-keygen后一致按回车健
输入命令:cp id_rsa.pub authorized_keys;复制之前检测是否已存在authorized_keys文件,若存在需要将id_rsa.pub的内容复制到 authorized_keys中
另外可能需要服务器上
~/.ssh权限设置为700
~/.ssh/authorized_keys的权限设置为600
三、启动
先格式化:hadoop-2.7.1/bin/hdfs namenode -format
启动:hadoop-2.7.1/sbin/start-dfs.sh
启动:hadoop-2.7.1/sbin/start-yarn.sh
[img]http://dl2.iteye.com/upload/attachment/0118/6576/23307006-f7e9-3dc8-a9f7-027e07872f20.png[/img]
四:验证
在浏览器中输入:
http://127.0.0.1:8088
[img]http://dl2.iteye.com/upload/attachment/0118/6572/66bb5660-dbf8-3655-9ff2-1c0408c7efc2.png[/img]
http://127.0.0.1:50070
[img]http://dl2.iteye.com/upload/attachment/0118/6574/82ababec-345a-3269-878c-e91f107941a3.png[/img]
PS:在Window上启动时出现了如下错误:
org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z
时需要下载源代码重新编译,如下:将610行注释掉,直接返回true
[img]http://dl2.iteye.com/upload/attachment/0118/6568/f91068bd-b46f-3ead-a95e-6dc7c151d0d8.png[/img]
若出现下面的错误需要下载winutils.exe文件放入D:\Tools\hadoop-2.7.1\bin目录下
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.
15/12/04 19:18:12 ERROR util.Shell: Failed to locate the winutils binary in the
hadoop binary path
java.io.IOException: Could not locate executable D:\Tools\hadoop-2.7.1\bin\winutils.exe in the Hadoop binaries.
at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:356)
at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:371)
at org.apache.hadoop.util.Shell.
(Shell.java:364)
at org.apache.hadoop.util.StringUtils.(StringUtils.java:80)
at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.j
ava:2483)
at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:2508)
hadoop-common-2.2.0-bin-master.zip下载地址:https://codeload.github.com/srccodes/hadoop-common-2.2.0-bin/zip/master