HBase 只能内网连接问题

问题描述

HBase操作只能在内网进行,在本地IDE里操作HBase则会报错。
这里我使用了asynchbase客户端:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
13:47:38,201  WARN HBaseClient:3217 - Couldn't connect to the RegionServer @ xx.xx.xx.148:16020
13:47:38,208 ERROR RegionClient:1219 - Unexpected exception from downstream on [id: 0xa853c05b]
java.net.ConnectException: Connection refused: no further information: /xx.xx.xx.148:16020
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
at org.jboss.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152)
at org.jboss.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

查看该机器上16020的端口情况:

1
2
3
4
[root@HADOOP-SLAVE-148 ~]# netstat -anp|grep 16020
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 ::ffff:10.1.6.148:16020 :::* LISTEN 14684/java
tcp 0 0 ::ffff:10.1.6.148:16020 ::ffff:10.128.122.153:39679 ESTABLISHED 14684/java

解读:

::ffff is the IPv6 prefix for an IPv4 address mapped into IPv6 space
(something along those lines).
And it means that it is an IPv6 socket that is used for IPv4
communication. Application and socket-wise, it is IPv6 but network and
packet-wise it is IPv4. This is allowed as a transition mechanism if
net.ipv6.bindv6only=0 and the application didn’t set the socket option
IPV6_V6ONLY.
It seems that some recent OSes disable this option by default so that
IPv6 sockets can handle only real IPv6 communications.

后来询问了下Hadoop群里的大神,

要想让外网访问的话配置hostname为外网,或者通过nginx指向。

之前配置的hostname确实是内网的。怪不得外网无法访问,在开发机开通了内网权限后就能访问了。

无法连接的问题集锦

问题描述:

我现在用10多台物理服务器组建了一个hadoop集群,这10多台服务器组建成一个局域网,其中只有namenode服务器连接到外网
遇到的问题:我在外网无法访问到datanode节点数据
各位大哥,谁有好的解决方案?

外网为什么要访问datanode数据?访问namenode 就是不对的做法,为何不拿出来一台做service