|
|
41dba18 |
.TH Cassandra container
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
This repository contains Dockerfiles for Cassandra images for general usage and OpenShift.
|
|
|
41dba18 |
Currently only CentOS based image is available. The CentOS image is then available on
|
|
|
41dba18 |
Docker Hub
|
|
|
41dba18 |
\[la]https://hub.docker.com/r/centos/cassandra-3-centos7/\[ra] as centos/cassandra\-3\-centos7.
|
|
|
41dba18 |
|
|
|
41dba18 |
.SH Description
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
This container image provides a containerized packaging of the Cassandra daemon
|
|
|
41dba18 |
and client application. The cassandra server daemon accepts connections from clients
|
|
|
41dba18 |
and provides access to content from Cassandra databases on behalf of the clients.
|
|
|
41dba18 |
You can find more information on the Cassandra project from the project Web site
|
|
|
41dba18 |
(
|
|
|
41dba18 |
\[la]https://cassandra.apache.org/\[ra]).
|
|
|
41dba18 |
|
|
|
41dba18 |
.SH Usage
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
For this, we will assume that you are using the \fB\fCcentos/cassandra\-3\-centos7\fR image.
|
|
|
41dba18 |
If you want to set only the mandatory environment variables and store the database
|
|
|
41dba18 |
in the \fB\fC/home/user/database\fR directory on the host filesystem, execute the following command:
|
|
|
41dba18 |
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
.RS
|
|
|
41dba18 |
|
|
|
41dba18 |
.nf
|
|
|
41dba18 |
$ docker run \-d \-e CASSANDRA\_ADMIN\_PASSWORD=<password> \-v /home/user/database:/var/opt/rh/sclo\-cassandra3/lib/cassandra:Z centos/cassandra\-3\-centos7
|
|
|
41dba18 |
|
|
|
41dba18 |
.fi
|
|
|
41dba18 |
.RE
|
|
|
41dba18 |
|
|
|
41dba18 |
.SH Environment variables and Volumes
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
The image recognizes the following environment variables that you can set during
|
|
|
41dba18 |
initialization by passing \fB\fC\-e VAR=VALUE\fR to the Docker run command.
|
|
|
41dba18 |
|
|
|
41dba18 |
.TS
|
|
|
41dba18 |
allbox;
|
|
|
41dba18 |
l l
|
|
|
41dba18 |
l l .
|
|
|
41dba18 |
\fB\fCVariable name\fR \fB\fCDescription\fR
|
|
|
41dba18 |
CASSANDRA\_ADMIN\_PASSWORD Password for the admin user
|
|
|
41dba18 |
.TE
|
|
|
41dba18 |
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
The following environment variables influence the Cassandra configuration file. They are all optional.
|
|
|
41dba18 |
|
|
|
41dba18 |
.TS
|
|
|
41dba18 |
allbox;
|
|
|
41dba18 |
l l l
|
|
|
41dba18 |
l l l .
|
|
|
41dba18 |
\fB\fCVariable name\fR \fB\fCDescription\fR \fB\fCDefault\fR
|
|
|
41dba18 |
CASSANDRA\_CLUSTER\_NAME The name of the cluster. \&'Test Cluster'
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_DISK\_OPTIMIZATION\_STRATEGY
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
The strategy for optimizing disk reads.
|
|
|
41dba18 |
T} ssd
|
|
|
41dba18 |
CASSANDRA\_ENDPOINT\_SNITCH T{
|
|
|
41dba18 |
Cassandra uses the snitch to locate nodes and route requests.
|
|
|
41dba18 |
T} SimpleSnitch
|
|
|
41dba18 |
CASSANDRA\_NUM\_TOKENS T{
|
|
|
41dba18 |
Defines the number of tokens randomly assigned to this node.
|
|
|
41dba18 |
T} 256
|
|
|
41dba18 |
CASSANDRA\_RPC\_ADDRESS T{
|
|
|
41dba18 |
The listen address for client connections.
|
|
|
41dba18 |
T} \&' '
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_KEY\_CACHE\_SIZE\_IN\_MB
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
Maximum size of the key cache in memory.
|
|
|
41dba18 |
T} \&' '
|
|
|
41dba18 |
CASSANDRA\_CONCURRENT\_READS T{
|
|
|
41dba18 |
Allows operations to queue low enough in the stack so that the OS and drives can reorder them.
|
|
|
41dba18 |
T} 32
|
|
|
41dba18 |
CASSANDRA\_CONCURRENT\_WRITES T{
|
|
|
41dba18 |
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.
|
|
|
41dba18 |
T} 32
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_MEMTABLE\_ALLOCATION\_TYPE
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
The method Cassandra uses to allocate and manage memtable memory.
|
|
|
41dba18 |
T} \&'heap\_buffers'
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_MEMTABLE\_CLEANUP\_THRESHOLD
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
Ratio used for automatic memtable flush.
|
|
|
41dba18 |
T} 0.5
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_MEMTABLE\_FLUSH\_WRITERS
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
The number of memtable flush writer threads.
|
|
|
41dba18 |
T} 1
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_CONCURRENT\_COMPACTORS
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
Number of concurrent compaction processes allowed to run simultaneously on a node.
|
|
|
41dba18 |
T} \&' '
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_COMPACTION\_THROUGHPUT\_MB\_PER\_SEC
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
Throttles compaction to the specified Mb/second across the instance.
|
|
|
41dba18 |
T} 16
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_COUNTER\_CACHE\_SIZE\_IN\_MB
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
Maximum size of the counter cache in memory.
|
|
|
41dba18 |
T} \&' '
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_INTERNODE\_COMPRESSION
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
Controls whether traffic between nodes is compressed.
|
|
|
41dba18 |
T} all
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
CASSANDRA\_GC\_WARN\_THRESHOLD\_IN\_MS
|
|
|
41dba18 |
T} T{
|
|
|
41dba18 |
Any GC pause longer than this interval is logged at the WARN level.
|
|
|
41dba18 |
T} 1000
|
|
|
41dba18 |
CASSANDRA\_AUTO\_BOOTSTRAP T{
|
|
|
41dba18 |
It causes new (non\-seed) nodes migrate the right data to themselves automatically.
|
|
|
41dba18 |
T} true
|
|
|
41dba18 |
.TE
|
|
|
41dba18 |
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
More details about each variable can be found at:
|
|
|
41dba18 |
\[la]http://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/configCassandra_yaml.html\[ra]
|
|
|
41dba18 |
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
You can also set the following mount points by passing the \fB\fC\-v /host:/container\fR flag to Docker.
|
|
|
41dba18 |
|
|
|
41dba18 |
.TS
|
|
|
41dba18 |
allbox;
|
|
|
41dba18 |
l l
|
|
|
41dba18 |
l l .
|
|
|
41dba18 |
\fB\fCVolume mount point\fR \fB\fCDescription\fR
|
|
|
41dba18 |
T{
|
|
|
41dba18 |
/var/opt/rh/sclo\-cassandra3/lib/cassandra
|
|
|
41dba18 |
T} Cassandra data directory
|
|
|
41dba18 |
.TE
|
|
|
41dba18 |
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
\fBNotice: When mouting a directory from the host into the container, ensure that the mounted
|
|
|
41dba18 |
directory has the appropriate permissions and that the owner and group of the directory
|
|
|
41dba18 |
matches the user UID or name which is running inside the container.\fP
|
|
|
41dba18 |
|
|
|
41dba18 |
.SH Ports
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
By default, Cassandra uses 7000 for cluster communication (7001 if SSL is enabled), 9042 for native protocol clients,
|
|
|
41dba18 |
and 7199 for JMX. The internode communication and native protocol ports are configurable in the Cassandra Configuration
|
|
|
41dba18 |
File (cassandra.yaml). The JMX port is configurable in cassandra\-env.sh (through JVM options). All ports are TCP.
|
|
|
41dba18 |
|
|
|
41dba18 |
.SH Documentation
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
See
|
|
|
41dba18 |
\[la]http://cassandra.apache.org/doc/latest/\[ra]
|
|
|
41dba18 |
|
|
|
41dba18 |
.SH Requirements.IP \(bu 2
|
|
|
41dba18 |
Memory: For production 32 GB to 512 GB; the minimum is 8 GB for Cassandra nodes. For development in non\-loading
|
|
|
41dba18 |
testing environments: no less than 4 GB.
|
|
|
41dba18 |
.IP \(bu 2
|
|
|
41dba18 |
CPU: For production 16\-core CPU processors are the current price\-performance sweet spot. For development in
|
|
|
41dba18 |
non\-loading testing environments: 2\-core CPU processors are sufficient.
|
|
|
41dba18 |
.IP \(bu 2
|
|
|
41dba18 |
Disk space: SSDs are recommended for Cassandra nodes. The size depends on the compaction strategy used. With SSDs,
|
|
|
41dba18 |
you can use a maximum of 3 to 5 TB per node of disk space for uncompressed data.
|
|
|
41dba18 |
.IP \(bu 2
|
|
|
41dba18 |
Network: Recommended bandwidth is 1000 Mb/s (gigabit) or greater.
|
|
|
41dba18 |
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
More on hardware requirements on
|
|
|
41dba18 |
\[la]https://docs.datastax.com/en/landing_page/doc/landing_page/planning/planningHardware.html\[ra]
|
|
|
41dba18 |
|
|
|
41dba18 |
.SH Custom configuration file
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
It is allowed to use custom configuration files for cassandra server.
|
|
|
41dba18 |
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
To use custom configuration file in container it has to be mounted into \fB\fC/etc/opt/rh/sclo\-cassandra3/cassandra/cassandra.yaml\fR\&.
|
|
|
41dba18 |
For example to use configuration file stored in \fB\fC/home/user\fR directory use this option for \fB\fCdocker run\fR command:
|
|
|
41dba18 |
\fB\fC\-v /home/user/cassandra.yaml:/etc/opt/rh/sclo\-cassandra3/cassandra/cassandra.yaml:Z\fR\&.
|
|
|
41dba18 |
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
To configure multiple JVM options a \fB\fCjvm.options\fR file needs to be mounted into the container. For example to use
|
|
|
41dba18 |
configuration file stored in \fB\fC/home/user\fR directory use this option for
|
|
|
41dba18 |
\fB\fCdocker run\fR command: \fB\fC\-v /home/user/jvm.options:/etc/opt/rh/sclo\-cassandra3/cassandra/jvm.options:Z\fR\&.
|
|
|
41dba18 |
|
|
|
41dba18 |
.SH Troubleshooting
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
The cassandra daemon in the container logs to the standard output, so the log is available in the container log. The log
|
|
|
41dba18 |
can be examined by running:
|
|
|
41dba18 |
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
docker logs <container>
|
|
|
41dba18 |
|
|
|
41dba18 |
.SH See also
|
|
|
41dba18 |
.PP
|
|
|
41dba18 |
Dockerfile and other sources for this container image are available on
|
|
|
41dba18 |
\[la]https://github.com/sclorg/cassandra-container\[ra]\&.
|
|
|
41dba18 |
In that repository, Dockerfile for CentOS is called Dockerfile, Dockerfile for RHEL (Work\-in\-progress) is called Dockerfile.rhel7.
|