7. 格式化namenode
--分别在各节点进行格式化
[grid@rac2 bin]$ pwd
/home/grid/Hadoop-0.20.2/bin
[grid@gc bin]$ ./hadoop namenode –format
12/10/31 08:03:31 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = gc.localdomain/192.168.2.100
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/10/31 08:03:31 INFO namenode.FSNamesystem: fsOwner=grid,hadoop
12/10/31 08:03:31 INFO namenode.FSNamesystem: supergroup=supergroup
12/10/31 08:03:31 INFO namenode.FSNamesystem: isPermissionEnabled=true
12/10/31 08:03:32 INFO common.Storage: Image file of size 94 saved in 0 seconds.
12/10/31 08:03:32 INFO common.Storage: Storage directory /tmp/hadoop-grid/dfs/name has been successfully formatted.
12/10/31 08:03:32 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at gc.localdomain/192.168.2.100
************************************************************/
8. 启动hadoop
--在master节点启动hadoop守护进程
[grid@gc bin]$ pwd
/home/grid/hadoop-0.20.2/bin
[grid@gc bin]$./start-all.sh
starting namenode, logging to /home/grid/hadoop-0.20.2/bin/../logs/hadoop-grid-namenode-gc.localdomain.out
rac2: starting datanode, logging to /home/grid/hadoop-0.20.2/bin/../logs/hadoop-grid-datanode-rac2.localdomain.out
rac1: starting datanode, logging to /home/grid/hadoop-0.20.2/bin/../logs/hadoop-grid-datanode-rac1.localdomain.out
The authenticity of host 'gc (192.168.2.100)' can't be established.
RSA key fingerprint is 8e:47:42:44:bd:e2:28:64:10:40:8e:b5:72:f9:6c:82.
Are you sure you want to continue connecting (yes/no)? yes
gc: Warning: Permanently added 'gc,192.168.2.100' (RSA) to the list of known hosts.
gc: starting secondarynamenode, logging to /home/grid/hadoop-0.20.2/bin/../logs/hadoop-grid-secondarynamenode-gc.localdomain.out
starting jobtracker, logging to /home/grid/hadoop-0.20.2/bin/../logs/hadoop-grid-jobtracker-gc.localdomain.out
rac2: starting tasktracker, logging to /home/grid/hadoop-0.20.2/bin/../logs/hadoop-grid-tasktracker-rac2.localdomain.out
rac1: starting tasktracker, logging to /home/grid/hadoop-0.20.2/bin/../logs/hadoop-grid-tasktracker-rac1.localdomain.out
9. 用jps检验各后台进程是否成功启动
--在master节点查看后台进程
[grid@gc bin]$ /usr/java/jdk1.6.0_18/bin/jps
27462 NameNode
29012 Jps
27672 JobTracker
27607 SecondaryNameNode
--在slave节点查看后台进程
[grid@rac1 conf]$/usr/java/jdk1.6.0_18/bin/jps
16722 Jps
16672 TaskTracker
16577 DataNode
[grid@rac2 conf]$/usr/java/jdk1.6.0_18/bin/jps
31451 DataNode
31547 TaskTracker
31608 Jps