Blob Blame History Raw
.TH Cassandra container
.PP
This repository contains Dockerfiles for Cassandra images for general usage and OpenShift.
Currently only CentOS based image is available. The CentOS image is then available on
Docker Hub
\[la]https://hub.docker.com/r/centos/cassandra-3-centos7/\[ra] as centos/cassandra\-3\-centos7.

.SH Description
.PP
This container image provides a containerized packaging of the Cassandra daemon
and client application. The cassandra server daemon accepts connections from clients
and provides access to content from Cassandra databases on behalf of the clients.
You can find more information on the Cassandra project from the project Web site
(
\[la]https://cassandra.apache.org/\[ra]).

.SH Usage
.PP
For this, we will assume that you are using the \fB\fCcentos/cassandra\-3\-centos7\fR image.
If you want to set only the mandatory environment variables and store the database
in the \fB\fC/home/user/database\fR directory on the host filesystem, execute the following command:

.PP
.RS

.nf
$ docker run \-d \-e CASSANDRA\_ADMIN\_PASSWORD=<password> \-v /home/user/database:/var/opt/rh/sclo\-cassandra3/lib/cassandra:Z centos/cassandra\-3\-centos7

.fi
.RE

.SH Environment variables and Volumes
.PP
The image recognizes the following environment variables that you can set during
initialization by passing \fB\fC\-e VAR=VALUE\fR to the Docker run command.

.TS
allbox;
l l 
l l .
\fB\fCVariable name\fR	\fB\fCDescription\fR
CASSANDRA\_ADMIN\_PASSWORD	Password for the admin user
.TE

.PP
The following environment variables influence the Cassandra configuration file. They are all optional.

.TS
allbox;
l l l 
l l l .
\fB\fCVariable name\fR	\fB\fCDescription\fR	\fB\fCDefault\fR
CASSANDRA\_CLUSTER\_NAME	The name of the cluster.	\&'Test Cluster'
T{
CASSANDRA\_DISK\_OPTIMIZATION\_STRATEGY
T}	T{
The strategy for optimizing disk reads.
T}	ssd
CASSANDRA\_ENDPOINT\_SNITCH	T{
Cassandra uses the snitch to locate nodes and route requests.
T}	SimpleSnitch
CASSANDRA\_NUM\_TOKENS	T{
Defines the number of tokens randomly assigned to this node.
T}	256
CASSANDRA\_RPC\_ADDRESS	T{
The listen address for client connections.
T}	\&' '
T{
CASSANDRA\_KEY\_CACHE\_SIZE\_IN\_MB
T}	T{
Maximum size of the key cache in memory.
T}	\&' '
CASSANDRA\_CONCURRENT\_READS	T{
Allows operations to queue low enough in the stack so that the OS and drives can reorder them.
T}	32
CASSANDRA\_CONCURRENT\_WRITES	T{
Writes in Cassandra are rarely I/O bound, so the ideal number of concurrent writes depends on the number of CPU cores on the node. The recommended value is 8 × number\_of\_cpu\_cores.
T}	32
T{
CASSANDRA\_MEMTABLE\_ALLOCATION\_TYPE
T}	T{
The method Cassandra uses to allocate and manage memtable memory.
T}	\&'heap\_buffers'
T{
CASSANDRA\_MEMTABLE\_CLEANUP\_THRESHOLD
T}	T{
Ratio used for automatic memtable flush.
T}	0.5
T{
CASSANDRA\_MEMTABLE\_FLUSH\_WRITERS
T}	T{
The number of memtable flush writer threads.
T}	1
T{
CASSANDRA\_CONCURRENT\_COMPACTORS
T}	T{
Number of concurrent compaction processes allowed to run simultaneously on a node.
T}	\&' '
T{
CASSANDRA\_COMPACTION\_THROUGHPUT\_MB\_PER\_SEC
T}	T{
Throttles compaction to the specified Mb/second across the instance.
T}	16
T{
CASSANDRA\_COUNTER\_CACHE\_SIZE\_IN\_MB
T}	T{
Maximum size of the counter cache in memory.
T}	\&' '
T{
CASSANDRA\_INTERNODE\_COMPRESSION
T}	T{
Controls whether traffic between nodes is compressed.
T}	all
T{
CASSANDRA\_GC\_WARN\_THRESHOLD\_IN\_MS
T}	T{
Any GC pause longer than this interval is logged at the WARN level.
T}	1000
CASSANDRA\_AUTO\_BOOTSTRAP	T{
It causes new (non\-seed) nodes migrate the right data to themselves automatically.
T}	true
.TE

.PP
More details about each variable can be found at: 
\[la]http://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/configCassandra_yaml.html\[ra]

.PP
You can also set the following mount points by passing the \fB\fC\-v /host:/container\fR flag to Docker.

.TS
allbox;
l l 
l l .
\fB\fCVolume mount point\fR	\fB\fCDescription\fR
T{
/var/opt/rh/sclo\-cassandra3/lib/cassandra
T}	Cassandra data directory
.TE

.PP
\fBNotice: When mouting a directory from the host into the container, ensure that the mounted
directory has the appropriate permissions and that the owner and group of the directory
matches the user UID or name which is running inside the container.\fP

.SH Ports
.PP
By default, Cassandra uses 7000 for cluster communication (7001 if SSL is enabled), 9042 for native protocol clients,
and 7199 for JMX. The internode communication and native protocol ports are configurable in the Cassandra Configuration
File (cassandra.yaml). The JMX port is configurable in cassandra\-env.sh (through JVM options). All ports are TCP.

.SH Documentation
.PP
See 
\[la]http://cassandra.apache.org/doc/latest/\[ra]

.SH Requirements.IP \(bu 2
Memory: For production 32 GB to 512 GB; the minimum is 8 GB for Cassandra nodes. For development in non\-loading
testing environments: no less than 4 GB.
.IP \(bu 2
CPU: For production 16\-core CPU processors are the current price\-performance sweet spot. For development in
non\-loading testing environments: 2\-core CPU processors are sufficient.
.IP \(bu 2
Disk space: SSDs are recommended for Cassandra nodes. The size depends on the compaction strategy used. With SSDs,
you can use a maximum of 3 to 5 TB per node of disk space for uncompressed data.
.IP \(bu 2
Network: Recommended bandwidth is 1000 Mb/s (gigabit) or greater.

.PP
More on hardware requirements on 
\[la]https://docs.datastax.com/en/landing_page/doc/landing_page/planning/planningHardware.html\[ra]

.SH Custom configuration file
.PP
It is allowed to use custom configuration files for cassandra server.

.PP
To use custom configuration file in container it has to be mounted into \fB\fC/etc/opt/rh/sclo\-cassandra3/cassandra/cassandra.yaml\fR\&.
For example to use configuration file stored in \fB\fC/home/user\fR directory use this option for \fB\fCdocker run\fR command:
\fB\fC\-v /home/user/cassandra.yaml:/etc/opt/rh/sclo\-cassandra3/cassandra/cassandra.yaml:Z\fR\&.

.PP
To configure multiple JVM options a \fB\fCjvm.options\fR file needs to be mounted into the container. For example to use
configuration file stored in \fB\fC/home/user\fR directory use this option for
\fB\fCdocker run\fR command: \fB\fC\-v /home/user/jvm.options:/etc/opt/rh/sclo\-cassandra3/cassandra/jvm.options:Z\fR\&.

.SH Troubleshooting
.PP
The cassandra daemon in the container logs to the standard output, so the log is available in the container log. The log
can be examined by running:

.PP
docker logs <container>

.SH See also
.PP
Dockerfile and other sources for this container image are available on 
\[la]https://github.com/sclorg/cassandra-container\[ra]\&.
In that repository, Dockerfile for CentOS is called Dockerfile, Dockerfile for RHEL (Work\-in\-progress) is called Dockerfile.rhel7.