Search code examples
dockerhbaseapache-phoenix

Mapping hbase ports for phoenix


I am trying to create a docker image with standalone hbase and phoenix. In order to connect to phoenix, it says I need to map all regionserver ports. But they run on different ip. With a local dns in /etc/hosts.

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

This helps, but all links in localhost:16010 still go via /etc/hosts which has a different ip. And ports change every time.

bash-5.0# netstat -lntu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:2181            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:16010           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:34319           0.0.0.0:*               LISTEN
tcp        0      0 172.17.0.2:40207        0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:37433           0.0.0.0:*               LISTEN
bash-5.0# cat /etc/hosts
127.0.0.1   localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2  8474f280b183

According to localhost:16010 regionserver is on 34319 for a paticular container. Is there is way to fix all ports and map them outside container, or how can I connect to phoenix from outside of container?

bash-5.0# hbase version
HBase 1.3.6
Source code repository git://Sakthis-MacBook-Pro-2.local/Users/sakthi/dev/hbase revision=806dc3625c96fe2cfc03048f3c54a0b38bc9e984
Compiled by sakthi on Tue Oct 15 01:55:41 PDT 2019
From source with checksum d587feefff2057a2e5001da5db4a6fac

Solution

  • Apparently standalone mode by implementation can't have fixed ports. Using pseudo-distributed mode but without HDFS seems to fix it.

    <property>
      <name>hbase.cluster.distributed</name>
      <value>true</value>
    </property>
    

    Then manualy start 3 deamons

    CMD hbase-daemon.sh start zookeeper    && \
        hbase-daemon.sh start regionserver && \
        hbase-daemon.sh foreground_start master
    

    Also, adding these 2 properties fix the problem with /etc/hosts

    <property>
      <name>hbase.master.hostname</name>
      <value>localhost</value>
    </property>
    <property>
      <name>hbase.regionserver.hostname</name>
      <value>localhost</value>
    </property>
    

    P.S. Still can't connect with phoenix, but that seems to be a completely different problem.

    P.S. Actually it was related. Also need to add

    <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>