• This repository has been archived on 11/Sep/2018
  • Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cassandra in Docker

cassandra-docker

Cassandra in Docker

Running

This Docker image places all of the important Cassandra data, including data, commitlog, and configuration in the /data directory inside the container. For any data you might care about, /data must be mapped as a volume when you docker run. For situations where the data is disposable (e.g. tests), the volume may be omitted.

docker pull tobert/cassandra
mkdir /srv/cassandra
docker run -d -v /srv/cassandra:/data tobert/cassandra

The above commands will run Cassandra in the default Docker networking with the standard ports mapped. If you don't care about the data (e.g. for testing) the -v/--volume may be ommitted.

Clustering: one host

Running a cluster on a single host using the standard Docker networking is straightforward.

When starting nodes for the first time, the cluster name will need to be set. This can be accomplished by pre-pushing a cassandra.yaml to $VOLUME/conf/cassandra.yaml or by passing the -name "NAME" option to the container on startup.

Caveat: some clients will not work from remote hosts when connecting to the mapped ports since they will not be able to connect to the private IPs assigned to the containers.

# start the cassandra container and capture its ID for later use
ID=$(docker run -d tobert/cassandra -name "Test Cluster")

Adding nodes to the cluster simply requires setting the seeds. Again, this can be done via cassandra.yaml or using a CLI argument to the container.

IP=$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' $ID)
docker run -d tobert/cassandra \
  -name "Test Cluster" \
  -seeds $IP

Clustering: multiple hosts

The easiest way to run across multiple Docker hosts is with --net=host. This tells Docker to leave the container's networking in the host's namespace.

docker run -d --net=host tobert/cassandra -name "My Cluster"

Once the first (seed) node is up, you can start adding peers. In the example below, $IP is the IP of the first node started.

docker run -d --net=host tobert/cassandra -name "My Cluster" -seeds $IP

Accessing Tools

The usual Cassandra tooling is available via both the entrypoint and docker exec.

docker run -it --rm tobert/cassandra cqlsh $HOST
docker run -it --rm tobert/cassandra nodetool -h $HOST status
docker run -it --rm tobert/cassandra cassandra-stress ...
# or
docker exec -it $ID cqlsh
docker exec -it $ID nodetool status
docker exec -it $ID cassandra-stress ...

Memory Settings

You may set memory limits on the container using the -m switch, but this will cause problems if -m is smaller than the heap size configured in $VOL/conf/sproks/cassandra.yaml. All of the JVM arguments for Cassandra are stored there for this Docker image.

Building

It's a simple process. Build the entrypoint then build the image.

# get sprok and goyaml
go get -u github.com/tobert/sprok
go get -u gopkg.in/yaml.v2
# build the entrypoint binary
go build
# build the Docker image
sudo docker build .

More Repositories

1

pcstat

Page Cache stat: get page cache stats for files on Linux
Go
1,213
star
2

perl-ssh-tools

A more capable DSH / cluster ssh suite
Perl
66
star
3

tobert.github.io

@MissAmyTobey Writes
HTML
49
star
4

websocket-terminal

A websocket-based terminal proxy built with Go and term.js
JavaScript
36
star
5

sprok

Simple Proc - start complex processes using a config file
Go
20
star
6

effio

Tools for crunching data from fio, the Flexible IO Tester
JavaScript
19
star
7

containment

Containment is a ruby library for working with Linux kernel cgroups and namespaces.
Ruby
17
star
8

nslite

Lightweight Linux namespace utilities
C
17
star
9

lnxns

Create and use Linux namespaces from Go
Go
14
star
10

skeezy

A simple blog using Go & Cassandra
Go
12
star
11

localdev-observability-stack

examples and configs to bring up an observability stack for local & offline development
7
star
12

gostress-cassandra

Tiny stress generator for Cassandra written in Go
Go
7
star
13

gdsh

Go Distributed SHell
Go
7
star
14

f7u12

A 2048 clone with analytics built on Apache Cassandra & Spark
JavaScript
7
star
15

tobert-omnigraffle

Some custom OmniGraffle stencils
5
star
16

certmaster

Certmaster is a set of tools and a library for easily distributing SSL certificates to applications that need them
Python
5
star
17

initramfs-hacks

A few hacks for initramfs files others might find useful as reference material.
Shell
5
star
18

sh-c-shock

Code for a quick shellshock demo video
Perl
2
star
19

jmxipbind

Java
2
star
20

otel-init-go

an OpenTelemetry tracing init for Go aiming to be minimal
Go
2
star
21

cassandra-summit-cfp-review

An application for streamlining the CFP review process for Cassandra Summit
Go
1
star
22

hastur-ui

Hastur Web Interface
JavaScript
1
star
23

disk-latency-benchmarking

Go
1
star
24

fail

A package of Go functions that fail the program instead of returning errors.
Go
1
star
25

Func-Client

perl interface to func
Perl
1
star
26

nodejs-ubuntu-lucid

debian setup for compiling node.js 0.4.9 on Ubuntu Lucid
Shell
1
star
27

otel-cli-notebook

a quick dockerfile for building a jupyter image with otel-cli running as a server
Dockerfile
1
star
28

disk-latency-graphs

A static site for disk latency graphs using data derived by effio/fio
JavaScript
1
star
29

portacluster-scripts

Scripts & config files for portacluster
Shell
1
star
30

DBIx-Snug

A lightweight, embeddable ORM for perl5
Perl
1
star