Skip to content

Commit

Permalink
update initial
Browse files Browse the repository at this point in the history
  • Loading branch information
aerios committed Oct 3, 2015
0 parents commit a8b0892
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 0 deletions.
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

FROM centos:centos6
MAINTAINER Yunsang Choi <[email protected]>

#=======================
# Install utils
#=======================
COPY install-default.sh install-default.sh
RUN ["/bin/bash", "install-default.sh"]


#=======================
# Install JDK7
#=======================
COPY install-jdk7.sh install-jdk7.sh
RUN ["/bin/bash", "install-jdk7.sh"]

#=======================
# Install CDH 5.1 + HBase
#=======================
# ref : http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH5/latest/CDH5-Quick-Start/cdh5qs_yarn_pseudo.html
COPY install-cdh5-hbase.sh install-cdh5-hbase.sh
RUN ["/bin/bash", "install-cdh5-hbase.sh"]

#=======================
# Configure HBase pseduo-distributed
#=======================

COPY setup.sh setup.sh
COPY hbase-site.xml /etc/hbase/conf/hbase-site.xml
COPY core-site.xml /etc/hadoop/conf/core-site.xml
RUN ["/bin/bash", "setup.sh"]

#=======================
# Start services.
#=======================
COPY start.sh start.sh
# zookeeper
EXPOSE 2181
# HBase master
EXPOSE 65000
# HBase master web UI
EXPOSE 65010
# HBase regionserver
EXPOSE 65020
# HBase regionserver web UI
EXPOSE 65030
CMD ["/bin/bash", "start.sh"]


71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
HBase
=======

HBase docker image for dev pc.

* CDH version : cdh5.1
* java : jdk7u67 (64bit)
* HBase mode : pseudo distributed
* Exposed port
* zookeeper-server: 2181
* hbase-master : 65000
* hbase-master web UI : 65010
* hbase-regionserver : 65020
* hbase-regionserver web UI: 65030


How to Use
===========

For OSX user
-------------

Download and install [boot2docker](https://github.com/boot2docker/boot2docker).

* [boot2docker releases](https://github.com/boot2docker/boot2docker/releases)

configure port forwarding for boot2docker.

```
boot2docker init
boot2docker down
declare PORTS=(2181 65000 65010 65020 65030)
for i in ${PORTS[@]}; do
echo "port forwarding : $i"
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$i,tcp,,$i,,$i";
VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$i,tcp,,$i,,$i";
done
boot2docker up
$(boot2docker shellinit)
```

* ref : [boot2docker port forwarding workarounds](https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md)


Pull image
-----------

```
docker pull oddpoet/hbase-cdh5
```

Run container
-------------

```
docker run -p 2181:2181 -p 65000:65000 -p 65010:65010 -p 65020:65020 -p 65030:65030 -h $(hostname) -d oddpoet/hbase-cdh5
```


Check HBase
-----------

open [http://localhost:65010/](http://localhost:65010/) on your browser.






29 changes: 29 additions & 0 deletions core-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost/</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
49 changes: 49 additions & 0 deletions hbase-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
* Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<configuration>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost/hbase</value>
</property>
<property>
<name>hbase.master.port</name>
<value>65000</value>
</property>
<property>
<name>hbase.master.info.port</name>
<value>65010</value>
</property>
<property>
<name>hbase.regionserver.port</name>
<value>65020</value>
</property>
<property>
<name>hbase.regionserver.info.port</name>
<value>65030</value>
</property>
</configuration>
10 changes: 10 additions & 0 deletions install-cdh5-hbase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

echo "============================="
echo " install CDH5+HBase"
echo "============================="

curl http://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/cloudera-cdh5.repo -o /etc/yum.repos.d/cloudera-cdh5.repo
sed -i 's|cdh/5/|cdh/5.1.0/|' /etc/yum.repos.d/cloudera-cdh5.repo
yum install -y hadoop-conf-pseudo hbase hbase-master hbase-regionserver zookeeper zookeeper-server

9 changes: 9 additions & 0 deletions install-default.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

echo "============================="
echo " install default utils"
echo "============================="

yum install clean all
yum install -y curl wget sudo telnet

22 changes: 22 additions & 0 deletions install-jdk7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

echo "============================="
echo " install jdk7"
echo "============================="

wget --no-cookies \
--no-check-certificate \
--header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.rpm

rpm -ivh jdk-7u65-linux-x64.rpm
rm jdk-7u65-linux-x64.rpm

echo "# set JAVA_HOME" >> ~/.bashrc
echo "export JAVA_HOME=/usr/java/default" >> ~/.bashrc
echo "export PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc

java -version



57 changes: 57 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/sh
echo "-----------------------------"
echo " Remove limit"
echo "-----------------------------"
# remove limit
# ref : https://github.com/ambling/hadoop-docker/commit/cd549b12fc939e12f8afe67cd9050f298e98a4b8
rm -f /etc/security/limits.d/hdfs.conf /etc/security/limits.d/mapreduce.conf /etc/security/limits.d/yarn.conf
rm -f /etc/security/limits.d/hbase.conf

echo "-----------------------------"
echo " Configuration HDFS"
echo "-----------------------------"
# step1: format
su hdfs -c "hdfs namenode -format"

# step2: start HDFS
for x in `cd /etc/init.d ; ls hadoop-hdfs-*` ; do service $x stop ; done
for x in `cd /etc/init.d ; ls hadoop-hdfs-*` ; do service $x start ; done

# step3: Create /tmp, Staging and Log Dir
su hdfs -c "hadoop fs -mkdir -p /tmp/hadoop-yarn/staging/history/done_intermediate"
su hdfs -c "hadoop fs -chown -R mapred:mapred /tmp/hadoop-yarn/staging"
su hdfs -c "hadoop fs -chmod -R 1777 /tmp "
su hdfs -c "hadoop fs -mkdir -p /var/log/hadoop-yarn"
su hdfs -c "hadoop fs -chown yarn:mapred /var/log/hadoop-yarn"


# step4: Verify the HDFS
su hdfs -c "hadoop fs -ls -R /"

echo "-----------------------------"
echo "Setup Zookeeper"
echo "-----------------------------"
mkdir -p /var/lib/zookeeper
chown -R zookeeper /var/lib/zookeeper/
service zookeeper-server init

echo "-----------------------------"
echo "Setup HBase"
echo "-----------------------------"

# stop service
service hbase-master stop
service hbase-regionserver stop

# create /hbase dir in HDFS
su hdfs -c "hadoop fs -mkdir /hbase"
su hdfs -c "hadoop fs -chown hbase /hbase"


echo "-----------------------------"
echo "Cleanup"
echo "-----------------------------"
for x in `cd /etc/init.d ; ls hadoop-hdfs-*` ; do service $x stop ; done
service zookeeper-server stop
service hbase-master stop
service hbase-regionserver stop
12 changes: 12 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

service hadoop-hdfs-datanode start
service hadoop-hdfs-namenode start

service zookeeper-server start

service hbase-master start
service hbase-regionserver start

# infinite loop
while :; do echo "Running Hbase ..."; sleep 5; done

0 comments on commit a8b0892

Please sign in to comment.