您的位置:首页 > 运维架构

Hadoop学习之FileSystem

2016-04-13 22:55 417 查看
今天学习Hadoop,遇到了个问题,问题trace大致如下:

FileSystem fSystem =FileSystem.get(new URI("hdfs://itcast:9000"), new Configuration());

java.net.ConnectException: Call From MS-201205221007/192.168.8.100 to itcast:9000 failed on connection exception: java.net.ConnectException: Connection refused: no further information; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:783)

。。。。。。。。

Caused by: java.net.ConnectException: Connection refused: no further information

at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)

at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)

at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:529)

at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:493)

at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:604)

at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:699)

at org.apache.hadoop.ipc.Client$Connection.access$2800(Client.java:367)

at org.apache.hadoop.ipc.Client.getConnection(Client.java:1462)

at org.apache.hadoop.ipc.Client.call(Client.java:1381)

... 47 more

FileSystem.get(new URI("hdfs://itcast:9000"), new Configuration());

在确认了start-dfs.sh和start-yarn.sh都成功启动的前提下(如果将hdfs://itcast:9000的itcast换成ip地址可以成功访问),就是ip地址和主机名对应关系没有正确配置成功

查看一下windows下虚拟机的ip地址和主机的对应关系:C:\Windows\System32\drivers\etc\hosts,发现对应的主机名为it;可是在FileSystem.get(new URI("hdfs://itcast:9000"), new Configuration());中的主机名却为itcast
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: