猫/ etc / hosts
127.0.0.1 localhost.localdomain localhost #192.168.0.105 UG-BLR-L030.example.com UG-BLR-L030 localhost 192.168.0.105 UG-BLR-L030 localhost.localdomain localhost # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
core-site.xml
<configuration> <property> <name>hadoop.tmp.dir</name> <value>/usr/local/hadoop/hadoop-data</value> <description>A base for other temporary directories.</description> </property> <property> <name>fs.default.name</name> <value>hdfs://UG-BLR-L030:54310</value> <description>The name of the default file system. A URI whose scheme and authority determine the FileSystem implementation. The uri's scheme determines the config property (fs.SCHEME.impl) naming the FileSystem implementation class. The uri's authority is used to determine the host, port, etc. for a filesystem.</description> </property> </configuration>
每当我尝试使用此命令启动hadoop时,start-dfs.sh都会出现以下错误:
start-dfs.sh
2015-05-03 15:59:45,189 INFO org.apache.hadoop.hdfs.server.namenode.DecommissionManager: Interrupted Monitor java.lang.InterruptedException: sleep interrupted at java.lang.Thread.sleep(Native Method) at org.apache.hadoop.hdfs.server.namenode.DecommissionManager$Monitor.run(DecommissionManager.java:65) at java.lang.Thread.run(Thread.java:745) 2015-05-03 15:59:45,195 ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: java.net.BindException: Problem binding to UG-BLR-L030/192.168.0.105:54310 : Cannot assign requested address at org.apache.hadoop.ipc.Server.bind(Server.java:227) at org.apache.hadoop.ipc.Server$Listener.<init>(Server.java:301) at org.apache.hadoop.ipc.Server.<init>(Server.java:1483) at org.apache.hadoop.ipc.RPC$Server.<init>(RPC.java:545) at org.apache.hadoop.ipc.RPC.getServer(RPC.java:506) at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:294) at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:496) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1279) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1288) Caused by: java.net.BindException: Cannot assign requested address at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:463) at sun.nio.ch.Net.bind(Net.java:455) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.hadoop.ipc.Server.bind(Server.java:225) ... 8 more 2015-05-03 15:59:45,196 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: SHUTDOWN_MSG: /************************************************************ SHUTDOWN_MSG: Shutting down NameNode at UG-BLR-L030/192.168.0.105 ************************************************************/
ifconfig
eth0 Link encap:Ethernet HWaddr f0:1f:af:4a:6b:fa UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:340842 errors:0 dropped:0 overruns:0 frame:0 TX packets:197054 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:410705701 (410.7 MB) TX bytes:18456910 (18.4 MB) Interrupt:20 Memory:f7e00000-f7e20000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:1085723 errors:0 dropped:0 overruns:0 frame:0 TX packets:1085723 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:136152053 (136.1 MB) TX bytes:136152053 (136.1 MB) wlan0 Link encap:Ethernet HWaddr 0c:8b:fd:1d:14:ba inet addr:192.168.0.105 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:873934 errors:0 dropped:0 overruns:0 frame:0 TX packets:630943 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:919721448 (919.7 MB) TX bytes:92919940 (92.9 MB)
错误:
ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: java.net.BindException: Problem binding to UG-BLR-L030/192.168.0.105:54310 : Cannot assign requested address
为什么hadoop尝试连接UG-BLR-L030/192.168.0.105:54310而不是UG- BLR-L030:54310或192.168.0.105:54310
UG-BLR-L030/192.168.0.105:54310
UG- BLR-L030:54310
192.168.0.105:54310
我设法通过编辑主机文件使其看起来像这样来使其工作:
127.0.0.1 UG-BLR-L030.example.com UG-BLR-L030 localhost 192.168.0.105 UG-BLR-L030.example.com UG-BLR-L030