hbaseapache-phoenix

Can't connect to HBase with Apache Phoenix


I am trying to connect to HBase running in docker with phoenix. I have mapped all the ports. Here is my hbase-site.xml

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///tmp/hbase</value>
    </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/tmp/zookeeper</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
  </property>
  <property>
    <name>phoenix.schema.isNamespaceMappingEnabled</name>
    <value>true</value>
  </property>
  <property>
    <name>phoenix.schema.mapSystemTablesToNamespace</name>
    <value>true</value>
    </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
  <property>
    <name>hbase.master.hostname</name>
    <value>localhost</value>
  </property>
  <property>
    <name>hbase.regionserver.hostname</name>
    <value>localhost</value>
  </property>
</configuration>

sqlline.py works inside the container, but when I try to connect from outside of the container I get

$ sqlline.py localhost:2181:/hbase
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:localhost:2181:/hbase none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:localhost:2181:/hbase
19/12/30 12:35:32 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Error: Failed after attempts=36, exceptions:
Mon Dec 30 12:44:53 MSK 2019, null, java.net.SocketTimeoutException: callTimeout=60000, callDuration=68480: Call to localhost/127.0.0.1:16020 failed on local exception: org.apache.hadoop.hbase.exceptions.ConnectionClosingException: Connection to localhost/127.0.0.1:16020 is closing. Call id=46, waitTime=2 row 'SYSTEM.CATALOG,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=localhost,16020,1577698456194, seqNum=0 (state=08000,code=101)
org.apache.phoenix.exception.PhoenixIOException: Failed after attempts=36, exceptions:
Mon Dec 30 12:44:53 MSK 2019, null, java.net.SocketTimeoutException: callTimeout=60000, callDuration=68480: Call to localhost/127.0.0.1:16020 failed on local exception: org.apache.hadoop.hbase.exceptions.ConnectionClosingException: Connection to localhost/127.0.0.1:16020 is closing. Call id=46, waitTime=2 row 'SYSTEM.CATALOG,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=localhost,16020,1577698456194, seqNum=0

        at org.apache.phoenix.util.ServerUtil.parseServerException(ServerUtil.java:144)
        at org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(ConnectionQueryServicesImpl.java:1197)
        at org.apache.phoenix.query.ConnectionQueryServicesImpl.createTable(ConnectionQueryServicesImpl.java:1491)
        at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:2731)
        at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:1115)
        at org.apache.phoenix.compile.CreateTableCompiler$1.execute(CreateTableCompiler.java:192)
        at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:408)
        at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:391)
        at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
        at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:390)
        at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:378)
        at org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1806)
        at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2536)
        at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2499)
        at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:76)
        at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:2499)
        at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:255)
        at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:147)
        at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
        at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
        at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)
        at sqlline.Commands.connect(Commands.java:1064)
        at sqlline.Commands.connect(Commands.java:996)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
        at sqlline.SqlLine.dispatch(SqlLine.java:809)
        at sqlline.SqlLine.initArgs(SqlLine.java:588)
        at sqlline.SqlLine.begin(SqlLine.java:661)
        at sqlline.SqlLine.start(SqlLine.java:398)
        at sqlline.SqlLine.main(SqlLine.java:291)
Caused by: org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=36, exceptions:
Mon Dec 30 12:44:53 MSK 2019, null, java.net.SocketTimeoutException: callTimeout=60000, callDuration=68480: Call to localhost/127.0.0.1:16020 failed on local exception: org.apache.hadoop.hbase.exceptions.ConnectionClosingException: Connection to localhost/127.0.0.1:16020 is closing. Call id=46, waitTime=2 row 'SYSTEM.CATALOG,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=localhost,16020,1577698456194, seqNum=0

        at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.throwEnrichedException(RpcRetryingCallerWithReadReplicas.java:276)
        at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:210)
        at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:60)
        at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:212)
        at org.apache.hadoop.hbase.client.ClientScanner.call(ClientScanner.java:314)
        at org.apache.hadoop.hbase.client.ClientScanner.nextScanner(ClientScanner.java:289)
        at org.apache.hadoop.hbase.client.ClientScanner.initializeScannerInConstruction(ClientScanner.java:164)
        at org.apache.hadoop.hbase.client.ClientScanner.<init>(ClientScanner.java:159)
        at org.apache.hadoop.hbase.client.HTable.getScanner(HTable.java:796)
        at org.apache.hadoop.hbase.MetaTableAccessor.fullScan(MetaTableAccessor.java:602)
        at org.apache.hadoop.hbase.MetaTableAccessor.tableExists(MetaTableAccessor.java:366)
        at org.apache.hadoop.hbase.client.HBaseAdmin.tableExists(HBaseAdmin.java:408)
        at org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(ConnectionQueryServicesImpl.java:1084)
        ... 31 more
Caused by: java.net.SocketTimeoutException: callTimeout=60000, callDuration=68480: Call to localhost/127.0.0.1:16020 failed on local exception: org.apache.hadoop.hbase.exceptions.ConnectionClosingException: Connection to localhost/127.0.0.1:16020 is closing. Call id=46, waitTime=2 row 'SYSTEM.CATALOG,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=localhost,16020,1577698456194, seqNum=0
        at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:171)
        at org.apache.hadoop.hbase.client.ResultBoundedCompletionService$QueueingFuture.run(ResultBoundedCompletionService.java:65)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.hadoop.hbase.exceptions.ConnectionClosingException: Call to localhost/127.0.0.1:16020 failed on local exception: org.apache.hadoop.hbase.exceptions.ConnectionClosingException: Connection to localhost/127.0.0.1:16020 is closing. Call id=46, waitTime=2
        at org.apache.hadoop.hbase.ipc.AbstractRpcClient.wrapException(AbstractRpcClient.java:289)
        at org.apache.hadoop.hbase.ipc.RpcClientImpl.call(RpcClientImpl.java:1274)
        at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:227)
        at org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.callBlockingMethod(AbstractRpcClient.java:336)
        at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$BlockingStub.scan(ClientProtos.java:35396)
        at org.apache.hadoop.hbase.client.ScannerCallable.openScanner(ScannerCallable.java:404)
        at org.apache.hadoop.hbase.client.ScannerCallable.call(ScannerCallable.java:211)
        at org.apache.hadoop.hbase.client.ScannerCallable.call(ScannerCallable.java:65)
        at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:212)
        at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas$RetryingRPC.call(ScannerCallableWithReplicas.java:364)
        at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas$RetryingRPC.call(ScannerCallableWithReplicas.java:338)
        at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:137)
        ... 4 more
Caused by: org.apache.hadoop.hbase.exceptions.ConnectionClosingException: Connection to localhost/127.0.0.1:16020 is closing. Call id=46, waitTime=2
        at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.cleanupCalls(RpcClientImpl.java:1087)
        at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.close(RpcClientImpl.java:863)
        at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.run(RpcClientImpl.java:580)
sqlline version 1.2.0

I am using HBase - 1.3.6, Phoenix - 4.14.2-HBase-1.3. Ports mapped -p 2181:2181 -p 16000:16000 -p 16010:16010 -p 16020:16020 -p 16030:16030


Solution

  • The problem was with the wrong ports being mapped. I had to add to hbase-site.xml.

    <property>
      <name>hbase.master.ipc.address</name>
      <value>0.0.0.0</value>
    </property>
    <property>
      <name>hbase.regionserver.ipc.address</name>
      <value>0.0.0.0</value>
    </property>