The Hbase docker container is not accessible under version 2.4.4 but works with same setup under 2.2.6

53 Views Asked by At

There is a testing environment including a dockerised HBase unit which was developed previously and works fine on a Linux machine but doesn't work on Mac locally. In particular, after running the Integration test which uses this container the following errors are displayed:

[2023-12-08 14:21:38,433 ReadOnlyZKClient WARN ] 0x0f1e722c to localhost:53613 failed for get of /hbase/hbaseid, code = CONNECTIONLOSS, retries = 1
[2023-12-08 14:21:40,578 ReadOnlyZKClient WARN ] 0x0f1e722c to localhost:53613 failed for get of /hbase/hbaseid, code = CONNECTIONLOSS, retries = 2
...

Note that instead of default ports the available ones are picked and propagated.

val zookeeperPort: Int
  = TestUtils.getFreePort
  val masterApiPort: Int = TestUtils.getFreePort
  val masterWebPort: Int = TestUtils.getFreePort
  val regionApiPort: Int = TestUtils.getFreePort
  val regionWebPort: Int = TestUtils.getFreePort

  val hbaseConfig: Configuration = {
    val conf = HBaseConfiguration.create()
    conf.set(HConstants.ZOOKEEPER_QUORUM, "localhost")
    conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, zookeeperPort)
    conf.setInt(HConstants.MASTER_PORT, masterApiPort)
    conf.setInt(HConstants.REGIONSERVER_PORT, regionApiPort)
    conf.setInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, 10000)
    conf
  }

I was trying to change the setup and make it work on Mac as well and could accomplish that but only with downgrading HBase to 2.2.6 while I need to use 2.4.4.

That's what I changed:

First of all, the docker container was created in a host mode, which is not accessible on Mac, so I changed that and added mapping of the ports explicitly:

 DockerContainer(image)
//      .withNetworkMode("host") // removed
      .withPorts(                              // added
        zookeeperPort -> Some(zookeeperPort),  // added
        masterApiPort -> Some(masterApiPort),  // added
        masterWebPort -> Some(masterWebPort),  // added
        regionApiPort -> Some(regionApiPort),  // added
        regionWebPort -> Some(regionWebPort))  // added
      .withReadyChecker(HBaseReadyChecker(hbaseConfig).looped(20, 3.second))
      .withHostname("localhost")
      .withCommand(
        zookeeperPort.toString,
        masterApiPort.toString,
        masterWebPort.toString,
        regionApiPort.toString,
        regionWebPort.toString
      )

Then I also added some other setups into hbase-site.xml:

(
cat << EOF
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
EOF
) > /opt/hbase/conf/hbase-site.xml
#   2181 – zookeeper port
#   60000 – master api port
#   60010 – master web port
#   60020 – regionserver api port
#   60030 – regionserver web port
write_config "hbase.zookeeper.property.clientPort" "${1:-2181}"
write_config "hbase.zookeeper.quorum" "localhost:${1:-2181}"           # added
write_config "hbase.master.port" "${2:-60000}"
write_config "hbase.master.info.port" "${3:-60010}"
write_config "hbase.regionserver.port" "${4:-60020}"
write_config "hbase.regionserver.info.port" "${5:-60030}"
write_config "hbase.unsafe.stream.capability.enforce" "${6:-false}"
write_config "zookeeper.znode.parent" "/hbase"                         # added
write_config "hbase.regionserver.ipc.address" "0.0.0.0"                # added
write_config "hbase.master.ipc.address" "0.0.0.0"                      # added

# write XML footer
(
cat << EOF
</configuration>
EOF
) >> /opt/hbase/conf/hbase-site.xml
cat /opt/hbase/conf/hbase-site.xml

Last but not least, I've rebuilt the image under the image with HBase of 2.2.6 version, and apparently it began working:

docker build \
    --force-rm \
    --build-arg hbase_version=2.2.6 \
    -t 060666214564.dkr.ecr.eu-west-1.amazonaws.com/hbase-it:2.2.6 \
    docker/hbase-docker

I suspect that something should be added or changed in hbase-site.xml on top of that. Are you aware of the setup differencies of hbase 2.2.6 version vs 2.4.4?

0

There are 0 best solutions below