#准备工作
准备3台机器,建立相同的用户名和密码,如:root/jiexi_test
分别如下:
10.2.112.31 #namenode
10.2.112.30 #datanode
10.2.112.34 #datanode
重点:
1、使用ssh-keygen生成id_rsa.pub文件,使3台机器可以相互ssh而不需要输入密码。
2、关闭掉防火墙。
参照文章:
http://qinlong.blog.51cto.com/1130504/323086 设置ssh-keygen
========================================================
cd /opt
wget http://ftp.meisei-u.ac.jp/mirror/apache/dist/hadoop/common/hadoop-1.0.2/hadoop-1.0.2.tar.gz
tar -zxvf hadoop-1.0.2.tar.gz
cd /opt/hadoop-1.0.2/conf
vim hadoop-env.sh
#加入
export JAVA_HOME=/opt/j2sdk
vim hadoop-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://10.2.112.31:9110</value>
<description>The name of the default file system. Either the literal string "local" or a host:port for DFS.</description>
</property>
<property>
<name>mapred.job.tracker</name>
<value>hdfs://10.2.112.31:9111</value>
<description>The host and port that the MapReduce job tracker runs at. If "local", then jobs are run in-process as a single map and reduce task.</description>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/hadoop/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>dfs.name.dir</name>
<value>/opt/hadoop/filesystem/name</value>
<description>Determines where on the local filesystem the DFS name node should store the name table. If this is a comma-delimited list of directories then the name table is replicated in all of the directories, for redundancy. </description>
</property>
<property>
<name>dfs.data.dir</name>
<value>/opt/hadoop/filesystem/data</value>
<description>Determines where on the local filesystem an DFS data node should store its blocks. If this is a comma-delimited list of directories, then data will be stored in all named directories, typically on different devices. Directories that do not exist are ignored.</description>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>Default block replication. The actual number of replications can be specified when the file is created. The default is used if replication is not specified in create time.</description>
</property>
</configuration>
vim masters
#加入namenode
10.2.112.31
vim slaves
#加入datanode
10.2.112.30
10.2.112.34
scp -r /opt/hadoop-1.0.2 root@10.2.112.30:/opt/
scp -r /opt/hadoop-1.0.2 root@10.2.112.34:/opt/
ln -s /opt/hadoop-1.0.2 /opt/hadoop
=======================================================
#在namenode上启动
cd /opt/hadoop
./bin/hadoop namenode -format
./bin/start-all.sh
#查看是否ok?
http://10.2.112.31:50030 #查看jobs
http://10.2.112.3*:50075 #查看hdfs文件
#在namenode上检查运行状况
./bin/hadoop dfsadmin -report
Configured Capacity: 301634404352 (280.92 GB)
Present Capacity: 228165107712 (212.5 GB)
DFS Remaining: 227872616448 (212.22 GB)
DFS Used: 292491264 (278.94 MB)
DFS Used%: 0.13%
Under replicated blocks: 1
Blocks with corrupt replicas: 0
Missing blocks: 0
-------------------------------------------------
Datanodes available: 2 (2 total, 0 dead)
Name: 10.2.112.30:50010
Decommission Status : Normal
Configured Capacity: 150817202176 (140.46 GB)
DFS Used: 142901248 (136.28 MB)
Non DFS Used: 36415545344 (33.91 GB)
DFS Remaining: 114258755584(106.41 GB)
DFS Used%: 0.09%
DFS Remaining%: 75.76%
Last contact: Wed Apr 11 19:26:10 CST 2012
Name: 10.2.112.34:50010
Decommission Status : Normal
Configured Capacity: 150817202176 (140.46 GB)
DFS Used: 149590016 (142.66 MB)
Non DFS Used: 37053751296 (34.51 GB)
DFS Remaining: 113613860864(105.81 GB)
DFS Used%: 0.1%
DFS Remaining%: 75.33%
Last contact: Wed Apr 11 19:26:11 CST 2012
提示2个datanode,包括使用情况。