HBaseおよびHadoopは初めてです。 HBaseを完全にセットアップし、完全に開始しました。 Javaクライアントを使用してp1からHBase(HBaseセットアップがオンになっているp2)に接続しようとすると、スローされます奇妙な例外。
12/04/17 14:36:37 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=192.168.15.20:2181 sessionTimeout=180000 watcher=hconnection
12/04/17 14:36:38 INFO zookeeper.ClientCnxn: Opening socket connection to server /192.168.15.20:2181
12/04/17 14:36:38 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
Java.net.ConnectException: Connection refused
at Sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.Java:567)
at org.Apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.Java:1119)
12/04/17 14:36:39 INFO zookeeper.ClientCnxn: Opening socket connection to server hbase.local/192.168.15.20:2181
12/04/17 14:36:39 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
Java.net.ConnectException: Connection refused
at Sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.Java:567)
at org.Apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.Java:1119)
12/04/17 14:36:41 INFO zookeeper.ClientCnxn: Opening socket connection to server hbase.local/192.168.15.20:2181
12/04/17 14:36:41 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
Java.net.ConnectException: Connection refused
at Sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.Java:567)
at org.Apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.Java:1119)
12/04/17 14:36:43 INFO zookeeper.ClientCnxn: Opening socket connection to server hbase.local/192.168.15.20:2181
12/04/17 14:36:43 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
Java.net.ConnectException: Connection refused
at Sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.Java:567)
at org.Apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.Java:1119)
12/04/17 14:36:44 INFO zookeeper.ClientCnxn: Opening socket connection to server hbase.local/192.168.15.20:2181
12/04/17 14:36:44 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
Java.net.ConnectException: Connection refused
at Sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.Java:567)
at org.Apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.Java:1119)
12/04/17 14:36:45 INFO zookeeper.ClientCnxn: Opening socket connection to server hbase.local/192.168.15.20:2181
12/04/17 14:36:45 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
Java.net.ConnectException: Connection refused
at Sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.Java:567)
at org.Apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.Java:1119)
12/04/17 14:36:47 INFO zookeeper.ClientCnxn: Opening socket connection to server hbase.local/192.168.15.20:2181
12/04/17 14:36:47 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
Java.net.ConnectException: Connection refused
at Sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.Java:567)
at org.Apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.Java:1119)
12/04/17 14:36:48 INFO zookeeper.ClientCnxn: Opening socket connection to server hbase.local/192.168.15.20:2181
12/04/17 14:36:48 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
Java.net.ConnectException: Connection refused
at Sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.Java:567)
at org.Apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.Java:1119)
12/04/17 14:36:49 INFO zookeeper.ClientCnxn: Opening socket connection to server hbase.local/192.168.15.20:2181
12/04/17 14:36:49 INFO zookeeper.ZooKeeper: Session: 0x0 closed
org.Apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to connect to ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default). Consider inspecting your ZK server logs for that error and then make sure you are reusing HBaseConfiguration as often as you can. See HTable's javadoc for more information.
at org.Apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.Java:155)
at org.Apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getZooKeeperWatcher(HConnectionManager.Java:1002)
at org.Apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.setupZookeeperTrackers(HConnectionManager.Java:304)
at org.Apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.Java:295)
at org.Apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.Java:157)
at org.Apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.Java:90)
at org.Apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.Java:1258)
at HBaseDemo.main(HBaseDemo.Java:55)
Caused by: org.Apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
at org.Apache.zookeeper.KeeperException.create(KeeperException.Java:90)
at org.Apache.zookeeper.KeeperException.create(KeeperException.Java:42)
at org.Apache.zookeeper.ZooKeeper.exists(ZooKeeper.Java:809)
at org.Apache.zookeeper.ZooKeeper.exists(ZooKeeper.Java:837)
at org.Apache.hadoop.hbase.zookeeper.ZKUtil.createAndFailSilent(ZKUtil.Java:903)
at org.Apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.Java:133)
... 7 more
12/04/17 14:36:49 INFO zookeeper.ClientCnxn: EventThread shut down
Execution script exiting
/04/17 17:41:35 INFO zookeeper.ZooKeeper: Client environment:user.name=xyz
12/04/17 17:41:35 INFO zookeeper.ZooKeeper: Client environment:user.home=/home/xyz
12/04/17 17:41:35 INFO zookeeper.ZooKeeper: Client environment:user.dir=/opt/xyz/hbase-sample
12/04/17 17:41:35 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=192.168.15.169:2181 sessionTimeout=180000 watcher=hconnection
12/04/17 17:41:35 INFO zookeeper.ClientCnxn: Opening socket connection to server /192.168.15.169:2181
12/04/17 17:41:35 INFO zookeeper.ClientCnxn: Socket connection established to hbase.xyz.com/192.168.15.169:2181, initiating session
12/04/17 17:41:35 INFO zookeeper.ClientCnxn: Session establishment complete on server hbase.xyz.com/192.168.15.169:2181, sessionid = 0x136c00d59ac0009, negotiated timeout = 180000
12/04/17 17:41:36 INFO client.HConnectionManager$HConnectionImplementation: getMaster attempt 0 of 1 failed; no more retrying.
Java.net.ConnectException: Connection refused
at Sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at Sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.Java:567)
at org.Apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.Java:206)
at org.Apache.hadoop.net.NetUtils.connect(NetUtils.Java:604)
at org.Apache.hadoop.hbase.ipc.HBaseClient$Connection.setupIOstreams(HBaseClient.Java:328)
at org.Apache.hadoop.hbase.ipc.HBaseClient.getConnection(HBaseClient.Java:883)
at org.Apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.Java:750)
at org.Apache.hadoop.hbase.ipc.HBaseRPC$Invoker.invoke(HBaseRPC.Java:257)
at $Proxy4.getProtocolVersion(Unknown Source)
at org.Apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.Java:419)
at org.Apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.Java:393)
at org.Apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.Java:444)
at org.Apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.Java:360)
at org.Apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.Java:94)
at org.Apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.Java:1258)
at HBaseDemo.main(HBaseDemo.Java:55)
HBase is not running!
Execution script exiting
私は解決策を見つけました。
localhostエントリを/etc/hosts
から削除するだけです。これで、ローカルホストのエントリは192.169.19.5 [これは私のhbaseIPです] = 127.0.0.1ローカルホストではなくローカルホストのようになります。
ここで受け入れられた答えはうまくいくかもしれませんが、副作用としてのみです。
問題は、HBaseが、外部に面したインターフェイスではなく、ローカルホスト(つまり、ループバック)でリッスンしているポートを開いていることです。/etc/hostsのlocalhostエントリを削除すると、HBaseは外部インターフェイスにバインドされますが、これはlocalhostが見つからないためです。これは、一部のデーモンがローカルホストのみを合法的にリッスンまたは接続したい場合に問題になる可能性があります。
Telnetを使用してローカルホストまたはマシンに割り当てられたIPを介してポート60000に接続することにより、この問題があることをテストできます。 IPではなくローカルホスト(HBaseがバインドされている場所であるため)を介して接続できる可能性があります。
HBaseconfでマシン名を使用することをお勧めします。
HBaseの構成をインスタンス化したと仮定して、hbaseマスター、zookeeperクォーラム、およびznode親を設定します。ちょっとこんな感じ-
import org.Apache.hadoop.hbase.HBaseConfiguration;
public class CLASS_NAME{
Configuration configuration = new HBaseConfiguration.Create();
configuration.set(hbase master, "");
configuration.set(zookeeper quorum, "");
configuration.set(znode parent, "");
}