dajobe / hbase-docker

HBase running in Docker
https://hub.docker.com/r/dajobe/hbase/
328 stars 189 forks source link

Windows support for hbase-docker / need for etc/hosts update? #21

Open feenst opened 7 years ago

feenst commented 7 years ago

I've been working on getting hbase-docker to run on both Windows 10 and CentOS 7 and I think I have it working on both.

On Windows, I wasn't able to connect by editing the hosts file. I don't know if Windows / Docker for Windows likes mapping an IP address of a Docker container to a hostname.

What I was able to get working came from the following .batch file

@echo off
set data_dir=%cd%\data
rd /s /q "%data_dir%"
mkdir "%data_dir%"

REM Replace slashes so path is usable by Docker volume mount https://stackoverflow.com/a/2905098
set data_dir=%data_dir:\=/%

docker run -p 8080:8080 -p 8085:8085 -p 9090:9090 -p 9095:9095 -p 2181:2181 -p 16010:16010 --name=hbase-docker -h hbase-docker -d -v "%data_dir%":/data dajobe/hbase

A couple of notes:

I've tested invoking the REST API via CURL on my machine and getting the version number so far and it's working. I'm also able to hit all of the management URLs in the browser with either http://localhost:8085/rest.jsp or http://127.0.0.1:8085/rest.jsp

For the CentOS 7 machine, I modified the existing start-hbase.sh file to be similar to the above batch.

#!/bin/bash
#
# Script to start docker and update the /etc/hosts file to point to
# the hbase-docker container
#
# hbase thrift and master server logs are written to the local
# logs directory
#

echo "Starting HBase container"
data_dir=$PWD/data
rm -rf $data_dir
mkdir -p $data_dir
id=$(docker run -p 8080:8080 -p 8085:8085 -p 9090:9090 -p 9095:9095 -p 2181:2181 -p 16010:16010 --name=hbase-docker -h hbase-docker -d -v $data_dir:/data dajobe/hbase)

The test_hbase.py script (using Thrift) seemed to run fine when I ran that locally ... just changed host value to HOST='localhost'

Also, I could access the HBase REST API running in a container on the CentOS machine from my Windows machine via curl using the CentOS machine's hostname.

Is the Note section in the README still valid? Or is there some functionality that's not here that I just haven't found yet.

Also, I can raise a pull request with the .bat file and some notes in the README about Windows support.

ArtemMe commented 4 years ago

i have the same problem, anybody solved it?