Hadoop 单机部署

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.设置公钥
[code="java"]
# 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=..|[code="java"][/code]
| .o ..= |
| S o. .+ .|
| . o. + |
| o . +|
| . . ...|
| .E. |
+-----------------+
# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
[/code]
6.启动
a.格式化
[code="java"]
# 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
************************************************************/
[/code]
b.启动服务
[code="java"]
# 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
[/code]
c.校验
[code="java"]
# bin/hadoop fs -ls /
Found 1 items
drwxr-xr-x - root supergroup 0 2012-05-22 08:50 /tmp
# bin/hadoop fs -mkdir /user/hadoop/t
est
# bin/hadoop fs -chmod g+w /tmp
# bin/hadoop fs -chmod g+w /user/hadoop/test

# 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
[/code]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值