This directory contains a Dockerfile
and some additional source files
needed to build a Docker image for KairosDB. The kairosdb container
operates against a back-end Cassandra database cluster. The Cassandra
nodes are passed to the container on launch.
Cassandra nodes can, for example, be started via the official Cassandra Docker image:
docker run --name cassandra -d -v cassandra-data:/var/lib/cassandra -p 9042:9042 cassandra:3.11
To build the Docker image, issue the following command (possibly after
updating the VERSION
variable):
./build.sh
To also push to Docker hub, do
export PUSH=yes
./build.sh
Once the docker image is built for the KairosDB server, it can be run with:
docker run -d --name kairosdb -p 4242:4242 -p 8080:8080 -e CASSANDRA_HOSTS="<hostname/ip>" elastisys/kairosdb:1.2.1
Note that a comma-separated list of back-end Cassandra hosts need to be passed
through the CASSANDRA_HOSTS
environment variable.
This will publish the KairosDB's Telnet port on 4242 and HTTP port on 8080.
There are a number of options that can be used to control the behavior of
KairosDB. For example, you can set a replication strategy that suits your
Cassandra cluster via the CASSANDRA_REPLICATION
environment variable (defaults
to {'class': 'SimpleStrategy','replication_factor' : 1}
). Refer to the
entrypoint.py code for details.
The example directory contains a docker-compose.yml file which starts Docker containers with Grafana (with the KairosDB datasoure plugin installed), KairosDB and Cassandra.
cd example/
docker-compose up
Add a kairosdb
datasource (URL: http://kairosdb:8080
) and you should be
ready to add graphs plotting KairosDB metrics.
To insert some dummy metrics, you can make use of the provided example/ingest.py script.
./example/ingest.py 2018-01-01 2018-01-05