diff --git a/hbase/1.2.6/README.md b/hbase/1.2.6/README.md index 1717740..d9f30c9 100644 --- a/hbase/1.2.6/README.md +++ b/hbase/1.2.6/README.md @@ -53,9 +53,63 @@ docker service create \ ## Init && Test ```bash +# inside hbase-master container bin/start-hbase.sh ``` -### Browse +## Browse Now you can see HBase cluster in `http://hbase-master:16010` in browser. ([newnius/docker-proxy](https://hub.docker.com/r/newnius/docker-proxy/) needed.) + +## Access outside the swarm + +Start Thrift servuce + +```bash +# inside hbase-master container +bin/hbase-daemon.sh start thrift +``` + +Start another service to expose the thrift port 9090. + +```bash +docker service create \ + --name hbase-forwarder \ + --network swarm-net \ + --replicas 1 \ + --detach=true \ + --env REMOTE_HOST=hbase-master \ + --env REMOTE_PORT=9090 \ + --env LOCAL_PORT=9090 \ + --publish mode=host,published=9090,target=9090 \ + newnius/port-forward +``` + +```python +import happybase +def get_tables_name(host,port): + conn = happybase.Connection(host=host,port=port,protocol='compact',transport='framed') + return conn.tables() +``` + +*Notice: by default, `hbase.regionserver.thrift.framed` and `hbase.regionserver.thrift.compact` is set to `true` for security reasons* + +## Customize the Configuration + +mount your configuration files to `/config/hbase` and the bootstrap script will replace them. + +```bash +docker service create \ + --name hbase-master \ + --hostname hbase-master \ + --network swarm-net \ + --replicas 1 \ + --detach=true \ + --endpoint-mode dnsrr \ + --mount type=bind,source=/etc/localtime,target=/etc/localtime,readonly \ + --mount type=bind,source=/data/hbase/config,target=/config/hbase \ + --mount type=bind,source=/data/hbase/logs/master,target=/usr/local/hbase/logs \ + newnius/hbase:1.2.6 +``` + +You can find the full scripts here at [scripts/hbase](https://github.com/newnius/scripts/tree/master/hbase)