`
AliKevin2011
  • 浏览: 119076 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Hadoop 单机部署

    博客分类:
  • DFS
. 
阅读更多
1.下载hadoop [url]wget http://mirror.bjtu.edu.cn/apache/hadoop/common/hadoop-0.20.2/hadoop-0.20.2.tar.gz[/url]
2.配置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.job.tracker</name>
 <value>localhost:9001</value>
 </property>
 <property>
 <name>dfs.replication</name>
 <value>1</value>
 </property>
</configuration>


3.配置marpred-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>


4.修改hadoop-env.xml 增加JAVA_HOME配置
 export JAVA_HOME=/usr/local/java/jdk1.6.0_29 --- java安装路径

5.设置公钥
[root@vm-platform-dev-138113 conf]# ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
Generating public/private dsa key pair.
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
97:75:f9:7e:42:f9:10:13:35:0f:b9:60:a3:9f:da:b7 root@vm-platform-dev-138113
The key's randomart image is:
+--[ DSA 1024]----+
|              o+.|
|            + .+o|
|           o.o=..|


|          .o ..= |
|        S o. .+ .|
|         .  o. + |
|           o  . +|
|          . . ...|
|             .E. |
+-----------------+
[root@vm-platform-dev-138113 conf]# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

6.启动
a.格式化
[root@vm-platform-dev-138115 hadoop-0.20.2]# bin/hadoop namenode -format

12/05/22 08:47:32 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = vm-platform-dev-138115/10.20.138.115
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 0.20.2
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20 -r 911707; compiled by 'chrisdo' on Fri Feb 19 08:07:34 UTC 2010
************************************************************/
12/05/22 08:47:32 INFO namenode.FSNamesystem: fsOwner=root,root,bin,daemon,sys,adm,disk,wheel
12/05/22 08:47:32 INFO namenode.FSNamesystem: supergroup=supergroup
12/05/22 08:47:32 INFO namenode.FSNamesystem: isPermissionEnabled=true
12/05/22 08:47:32 INFO common.Storage: Image file of size 94 saved in 0 seconds.
12/05/22 08:47:32 INFO common.Storage: Storage directory /tmp/hadoop-root/dfs/name has been successfully formatted.
12/05/22 08:47:32 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at vm-platform-dev-138115/10.20.138.115
************************************************************/

b.启动服务
[root@vm-platform-dev-138115 hadoop-0.20.2]# bin/start-all.sh
starting namenode, logging to /root/kevin/hadoop-0.20.2/bin/../logs/hadoop-root-namenode-vm-platform-dev-138115.out
localhost: starting datanode, logging to /root/kevin/hadoop-0.20.2/bin/../logs/hadoop-root-datanode-vm-platform-dev-138115.out
localhost: starting secondarynamenode, logging to /root/kevin/hadoop-0.20.2/bin/../logs/hadoop-root-secondarynamenode-vm-platform-dev-138115.out
starting jobtracker, logging to /root/kevin/hadoop-0.20.2/bin/../logs/hadoop-root-jobtracker-vm-platform-dev-138115.out
localhost: starting tasktracker, logging to /root/kevin/hadoop-0.20.2/bin/../logs/hadoop-root-tasktracker-vm-platform-dev-138115.out

c.校验
[root@vm-platform-dev-138115 hadoop-0.20.2]# bin/hadoop fs -ls /
Found 1 items
drwxr-xr-x   - root supergroup          0 2012-05-22 08:50 /tmp
[root@vm-platform-dev-138115 hadoop-0.20.2]# bin/hadoop fs -mkdir /user/hadoop/t
est
[root@vm-platform-dev-138115 hadoop-0.20.2]# bin/hadoop fs -chmod g+w /tmp
[root@vm-platform-dev-138115 hadoop-0.20.2]# bin/hadoop fs -chmod g+w /user/hadoop/test

[root@vm-platform-dev-138115 hadoop-0.20.2]# bin/hadoop fs -lsr /
drwxrwxr-x   - root supergroup          0 2012-05-22 08:50 /tmp
drwxr-xr-x   - root supergroup          0 2012-05-22 08:50 /tmp/hadoop-root
drwxr-xr-x   - root supergroup          0 2012-05-22 08:50 /tmp/hadoop-root/mapred
drwx-wx-wx   - root supergroup          0 2012-05-22 08:50 /tmp/hadoop-root/mapred/system
-rw-------   3 root supergroup          4 2012-05-22 08:50 /tmp/hadoop-root/mapred/system/jobtracker.info
drwxr-xr-x   - root supergroup          0 2012-05-22 08:52 /user
drwxr-xr-x   - root supergroup          0 2012-05-22 08:52 /user/hadoop
drwxrwxr-x   - root supergroup          0 2012-05-22 08:52 /user/hadoop/test
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics