初次在VM上配置Hadoop,开了三台虚拟机,一个作namenode,jobtracker
另外两台机子作datanode,tasktracker
配置好后,启动集群
通过http://localhost:50700查看cluster状况
Hadoop配置datanode无法连接到master
发现没有datanode
检查结点,发现datanode 进程已经启动,查看datanode机器上的日志
2014-03-01 22:11:17,473 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: Master/10.207.160.34:9000. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
2014-03-01 22:11:18,477 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: Master/10.207.160.34:9000. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
2014-03-01 22:11:19,481 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: Master/10.207.160.34:9000. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
2014-03-01 22:11:20,485 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: Master/10.207.160.34:9000. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
2014-03-01 22:11:21,489 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: Master/10.207.160.34:9000. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
发现datanode 无法连接到master ,但是经过尝试,可以ping通,到结点查看,9000端口也处于监听状态,百思不得其解
最终发现core-site.xml 中
<property> <name>fs.default.name</name> <value>hdfs://localhost:9000</value> </property>
才意识到监听127.0.0.1端口,并不能被外机访问
改为主机名,一切正常
<property> <name>fs.default.name</name> <value>hdfs://Master:9000</value> </property>
hosts:
10.207.160.34 Master
不要以为这样就好了, 其实这是个坑来的..不信你试试:
root@VM_160_34_centos:~> netstat -an | grep 9000 tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:9000 127.0.0.1:45889 ESTABLISHED tcp 0 0 127.0.0.1:45889 127.0.0.1:9000 ESTABLISHED
这里要直接写IP, 反正我是被坑了.
<value>hdfs://10.207.160.34:9000</value>
看现在就好了
hadoop@VM_160_34_centos:/usr/local/hadoop-2.4.0> netstat -nlpa|grep 9000 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 10.207.160.34:9000 0.0.0.0:* LISTEN 5753/java tcp 0 0 10.207.160.34:36093 10.207.160.34:9000 TIME_WAIT - tcp 0 0 10.207.160.34:9000 10.221.32.234:44229 ESTABLISHED 5753/java
我们再 report 一下:
hadoop@VM_160_34_centos:/usr/local/hadoop-2.4.0> hadoop dfsadmin -report DEPRECATED: Use of this script to execute hdfs command is deprecated. Instead use the hdfs command for it. Configured Capacity: 8452341760 (7.87 GB) Present Capacity: 4833366016 (4.50 GB) DFS Remaining: 4833341440 (4.50 GB) DFS Used: 24576 (24 KB) DFS Used%: 0.00% Under replicated blocks: 0 Blocks with corrupt replicas: 0 Missing blocks: 0 ------------------------------------------------- Datanodes available: 1 (1 total, 0 dead) Live datanodes: Name: 10.221.32.234:50010 (Node1) Hostname: TENCENT64.site Decommission Status : Normal Configured Capacity: 8452341760 (7.87 GB) DFS Used: 24576 (24 KB) Non DFS Used: 3618975744 (3.37 GB) DFS Remaining: 4833341440 (4.50 GB) DFS Used%: 0.00% DFS Remaining%: 57.18% Configured Cache Capacity: 0 (0 B) Cache Used: 0 (0 B) Cache Remaining: 0 (0 B) Cache Used%: 100.00% Cache Remaining%: 0.00% Last contact: Fri Aug 29 15:39:54 CST 2014