Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
feenst opened this issue Sep 16, 2017 · 1 comment
Open

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

feenst opened this issue Sep 16, 2017 · 1 comment

Comments

@feenst
Copy link

feenst commented Sep 16, 2017

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 got a variety of errors initially related to the .sh files which I think came from git clone converting the line endings on the file to Windows style. Converting the endings back to Unix style resolved those errors
  • I was also getting some errors about Failed to fetch during the Docker build process that turned out to be related to corporate proxy. I added ENV https_proxy=my.proxy.com:8080 for http and https to resolve those errors
  • I had to expose the ports via the -p switch of docker run

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

ArtemMe commented Nov 17, 2019

i have the same problem, anybody solved it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants