Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mraad committed Feb 2, 2015
1 parent 74a8d8e commit 07b519a
Show file tree
Hide file tree
Showing 19 changed files with 718 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
db.sh
dr.sh
ds.sh
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM sequenceiq/hadoop-docker

MAINTAINER @mraad <[email protected]>

USER root

ENV PATH $PATH:$HADOOP_PREFIX/bin

RUN chown -R root:root $HADOOP_PREFIX

RUN echo -e "\n* soft nofile 65536\n* hard nofile 65536" >> /etc/security/limits.conf

RUN curl -s http://mirror.cc.columbia.edu/pub/software/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz | tar -xz -C /usr/local
RUN ln -s /usr/local/zookeeper-3.4.6 /usr/local/zookeeper;\
chown -R root:root /usr/local/zookeeper-3.4.6;\
mkdir -p /var/zookeeper
ENV ZOOKEEPER_HOME /usr/local/zookeeper
ENV PATH $PATH:$ZOOKEEPER_HOME/bin
ADD zookeeper/* $ZOOKEEPER_HOME/conf/

RUN curl -s http://archive.apache.org/dist/accumulo/1.5.2/accumulo-1.5.2-bin.tar.gz | tar -xz -C /usr/local
RUN ln -s /usr/local/accumulo-1.5.2 /usr/local/accumulo;\
chown -R root:root /usr/local/accumulo-1.5.2
ENV ACCUMULO_HOME /usr/local/accumulo
ENV PATH $PATH:$ACCUMULO_HOME/bin
ADD accumulo/* $ACCUMULO_HOME/conf/

ADD *-all.sh /etc/
RUN chown root:root /etc/*-all.sh;\
chmod 700 /etc/*-all.sh

ADD init-accumulo.sh /tmp/
RUN /tmp/init-accumulo.sh

EXPOSE 2181 9000 50095
103 changes: 101 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,101 @@
# accumulo-docker
Run a single node Accumulo instance
# Single Node [Accumulo](https://accumulo.apache.org/) Instance On Docker

This work is base on [https://github.com/medined/docker-accumulo](https://github.com/medined/docker-accumulo) - Thanks :-)

If you are using [boot2docker](http://boot2docker.io/) you might want to up the memory and storage space.

```shell
boot2docker init -m 8192 -s 32768
```

On Windows, the `C:` drive is mounted on the linux host as `/c`. Copy this folder onto your `C:` drive so you can `cd /c/accumulo-docker`

### vm.swappiness and docker

The `vm.swappiness` system parameter has to be set in the docker host OS to be inherited by the Accumulo container.

If you are using boot2docker then `boot2docker ssh` to login to the host OS.

```shell
sudo sysctl -w vm.swappiness=0
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
```

Check the value using:
```shell
sysctl vm.swappiness
```

### Build the container image

```shell
docker build -t mraad/accumulo .
```

### Run the container

```shell
docker run --name accumulo -i -t -P mraad/accumulo /bin/bash
```

### Start Zookeeper, YARN, HDFS and Accumulo

```shell
/etc/start-all.sh
```

### Stop Accumulo, HDFS, YARN and Zookeeper

```shell
/etc/stop-all.sh
```

### See all exposed ports

```shell
docker port accumulo | sort -t / -n
```


In this line sample `50070/tcp -> 0.0.0.0:49161`, the internal port `50070` is mapped to `49161` on the host OS.

If you are using boot2docker, get the host OS IP using `boot2docker ip`

SERVICE |URL |
---------|--------------------------------|
YARN | http://docker-ip:exposed-8088 |
HDFS | http://docker-ip:exposed-50070 |
ACCUMULO | http://docker-ip:exposed-50095 |


### Sample Accumulo session in the container

```shell
bash-4.1# accumulo shell -u root -p secret

Shell - Apache Accumulo Interactive Shell
-
- version: 1.5.2
- instance name: accumulo
- instance id: 57fdffe2-5a38-48dd-934f-5d2db507027d
-
- type 'help' for a list of available commands
-
root@accumulo> createtable mytable
root@accumulo mytable> tables
!METADATA
mytable
trace
root@accumulo mytable> insert row1 colf colq value1
root@accumulo mytable> scan
row1 colf:colq [] value1
root@accumulo mytable> exit
```

### Extra References

* http://stackoverflow.com/questions/25767224/change-swappiness-for-docker-container
* http://en.wikipedia.org/wiki/Swappiness
* http://www.incrediblemolk.com/sharing-a-windows-folder-with-the-boot2docker-vm/
57 changes: 57 additions & 0 deletions accumulo/accumulo-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#! /usr/bin/env bash

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

###
### Configure these environment variables to point to your local installations.
###
### The functional tests require conditional values, so keep this style:
###
### test -z "$JAVA_HOME" && export JAVA_HOME=/usr/local/lib/jdk-1.6.0
###
###
### Note that the -Xmx -Xms settings below require substantial free memory:
### you may want to use smaller values, especially when running everything
### on a single machine.
###

if [ -z "$HADOOP_HOME" ]
then
test -z "$HADOOP_PREFIX" && export HADOOP_PREFIX=/usr/local/hadoop
else
HADOOP_PREFIX="$HADOOP_HOME"
unset HADOOP_HOME
fi
test -z "$HADOOP_CONF_DIR" && export HADOOP_CONF_DIR="$HADOOP_PREFIX/etc/hadoop"
test -z "$JAVA_HOME" && export JAVA_HOME=/usr/java/default
test -z "$ZOOKEEPER_HOME" && export ZOOKEEPER_HOME=/usr/local/zookeeper
test -z "$ACCUMULO_HOME" && export ACCUMULO_HOME=/usr/local/accumulo
test -z "$ACCUMULO_LOG_DIR" && export ACCUMULO_LOG_DIR=$ACCUMULO_HOME/logs
if [ -f ${ACCUMULO_CONF_DIR}/accumulo.policy ]
then
POLICY="-Djava.security.manager -Djava.security.policy=${ACCUMULO_CONF_DIR}/accumulo.policy"
fi
test -z "$ACCUMULO_TSERVER_OPTS" && export ACCUMULO_TSERVER_OPTS="${POLICY} -Xmx1g -Xms384m"
test -z "$ACCUMULO_MASTER_OPTS" && export ACCUMULO_MASTER_OPTS="${POLICY} -Xmx1g -Xms128m"
test -z "$ACCUMULO_MONITOR_OPTS" && export ACCUMULO_MONITOR_OPTS="${POLICY} -Xmx1g -Xms64m"
test -z "$ACCUMULO_GC_OPTS" && export ACCUMULO_GC_OPTS="-Xmx1g -Xms64m"
test -z "$ACCUMULO_GENERAL_OPTS" && export ACCUMULO_GENERAL_OPTS="-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -Djava.net.preferIPv4Stack=true"
test -z "$ACCUMULO_OTHER_OPTS" && export ACCUMULO_OTHER_OPTS="-Xmx1g -Xms64m"
# what do when the JVM runs out of heap memory
export ACCUMULO_KILL_CMD='kill -9 %p'

# Should the monitor bind to all network interfaces -- default: false
# export ACCUMULO_MONITOR_BIND_ALL="true"
159 changes: 159 additions & 0 deletions accumulo/accumulo-site-template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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>instance.zookeeper.host</name>
<value>HOSTNAME:2181</value>
<description>comma separated list of zookeeper servers</description>
</property>

<property>
<name>logger.dir.walog</name>
<value>/var/lib/accumulo/walogs</value>
<description>The directory used to store write-ahead logs on the
local filesystem. It is possible to specify a comma-separated list
of directories.
</description>
</property>

<property>
<name>instance.secret</name>
<value>secret</value>
</property>

<!-- PLACEHOLDER - do not edit -->

<property>
<name>trace.token.property.password</name>
<!-- change this to the root user's password, and/or change the user below -->
<value>secret</value>
</property>

<!-- profile 3GB -->
<property>
<name>tserver.cache.index.size</name>
<value>128M</value>
</property>

<property>
<name>tserver.memory.maps.max</name>
<value>1G</value>
</property>

<property>
<name>tserver.cache.data.size</name>
<value>128M</value>
</property>

<property>
<name>crypto.cipher.algorithm.name</name>
<value>AES</value>
</property>
<property>
<name>table.cache.block.enable</name>
<value>true</value>
</property>
<property>
<name>crypto.module.class</name>
<value>org.apache.accumulo.core.security.crypto.DefaultCryptoModule</value>
</property>
<property>
<name>crypto.cipher.suite</name>
<value>AES/CFB/NoPadding</value>
</property>
<property>
<name>trace.user</name>
<value>root</value>
</property>
<!-- <property>
<name>instance.security.permissionHandler</name>
<value>com.sqrrl.analytics.extensions.accumulo.security.ShiroAndZookeeperPermissionHandler</value>
</property>
<property>
<name>crypto.secret.key.encryption.strategy.class</name>
<value>org.apache.accumulo.core.security.crypto.CachingHDFSSecretKeyEncryptionStrategy</value>
</property>
<property>
<name>instance.security.authorizor</name>
<value>com.sqrrl.analytics.extensions.accumulo.security.ShiroAndZookeeperAuthorizor</value>
</property>
<property>
<name>instance.security.authenticator</name>
<value>com.sqrrl.analytics.extensions.accumulo.security.ShiroAndZookeeperAuthenticator</value>
</property> -->
<property>
<name>table.cache.index.enable</name>
<value>true</value>
</property>
<property>
<name>crypto.secure.rng.provider</name>
<value>SUN</value>
</property>
<property>
<name>crypto.cipher.key.length</name>
<value>128</value>
</property>
<property>
<name>crypto.secure.rng</name>
<value>SHA1PRNG</value>
</property>
<property>
<name>crypto.default.key.strategy.cipher.suite</name>
<value>AES/ECB/NoPadding</value>
</property>

<property>
<name>general.classpaths</name>
<value>
$HADOOP_CONF_DIR,
$ACCUMULO_HOME/server/target/classes/,
$ACCUMULO_HOME/lib/accumulo-server.jar,
$ACCUMULO_HOME/core/target/classes/,
$ACCUMULO_HOME/lib/accumulo-core.jar,
$ACCUMULO_HOME/start/target/classes/,
$ACCUMULO_HOME/lib/accumulo-start.jar,
$ACCUMULO_HOME/fate/target/classes/,
$ACCUMULO_HOME/lib/accumulo-fate.jar,
$ACCUMULO_HOME/proxy/target/classes/,
$ACCUMULO_HOME/lib/accumulo-proxy.jar,
$ACCUMULO_HOME/lib/[^.].*.jar,
$ZOOKEEPER_HOME/zookeeper[^.].*.jar,
<!-- adding classpath for (hdp-2.2.0) -->
$HADOOP_PREFIX/share/hadoop/common/.*.jar,
$HADOOP_PREFIX/share/hadoop/common/lib/.*.jar,
$HADOOP_PREFIX/share/hadoop/hdfs/.*.jar,
$HADOOP_PREFIX/share/hadoop/mapreduce/.*.jar,
$HADOOP_PREFIX/share/hadoop/yarn/.*.jar,
$HADOOP_PREFIX/share/hadoop/hdfs/lib/.*.jar,
$HADOOP_PREFIX/share/hadoop/mapreduce/lib/.*.jar,
$HADOOP_PREFIX/share/hadoop/yarn/lib/.*.jar
<!-- -->
/usr/local/hadoop/[^.].*.jar,
/usr/local/hadoop/lib/[^.].*.jar,
/usr/local/hadoop-hdfs/[^.].*.jar,
/usr/local/hadoop-hdfs/lib/[^.].*.jar,
/usr/local/hadoop-yarn/[^.].*.jar,
/usr/local/hadoop-yarn/lib/[^.].*.jar,
/usr/local/hadoop-mapreduce/[^.].*.jar,
/usr/local/hadoop-mapreduce/lib/*.jar
</value>
</property>
</configuration>
24 changes: 24 additions & 0 deletions accumulo/configuration.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="configuration">
<html>
<body>
<table border="1">
<tr>
<td>name</td>
<td>value</td>
<td>description</td>
</tr>
<xsl:for-each select="property">
<tr>
<td><a name="{name}"><xsl:value-of select="name"/></a></td>
<td><xsl:value-of select="value"/></td>
<td><xsl:value-of select="description"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
1 change: 1 addition & 0 deletions accumulo/gc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HOSTNAME
Loading

0 comments on commit 07b519a

Please sign in to comment.