KairosDB in a Docker Swarm

103 views
Skip to first unread message

rosita.ho...@gmail.com

unread,
Nov 8, 2020, 10:31:08 PM11/8/20
to KairosDB
Hello everyone, I am working on a simple deployment of Cassandra nodes and KairosDB nodes using Docker Swarm. So far I have been able to deploy a Cassandra cluster  with one seed node (currently I have the restriction of only using one Cassandra seed, but it doesn't matter for now because we have just 4 hosts).

My compose file is the following (I removed details about host names):

version: "3.8"
services:
    cassandra-seed:
        image: cassandra:3.11.7
        networks:
            - cassandra-net
        environment:
            - CASSANDRA_BROADCAST_ADDRESS=cassandra-seed
        deploy:
            placement:
                constraints:
                    - node.hostname == <a-hostname>
    cassandra-node:
        image: cassandra:3.11.7
        networks:
            - cassandra-net
        environment:
            - CASSANDRA_SEEDS=cassandra-seed
        deploy:
            mode: replicated
            replicas: 3
            placement:
                constraints:
                    - node.hostname != <a-hostname>
        depends_on:
            - cassandra-seed
    kairosdb:
        image: my-own-kairosdb-image:some-tag
        networks:
            - cassandra-net
        environment:
            - "CASSANDRA_HOST_LIST:I-dont-know-what-to-put-here"
        ports:
            - 8080:8080
        deploy:
            mode: replicated
            replicas: 3
networks:
    cassandra-net:
        driver: overlay


My question is, how can I make my nodes of KairosDB have the correct values for the property "kairosdb.datastore.cassandra.cql_host_list"? (which corresponds to the CASSANDRA_HOST_LIST environment variable of my Dockerfile).

I understand that the optimal value for this property is to have each hostname:port for every Cassandra node on the cluster, and not just the Cassandra seeds (which would be very easy to set, given that I only have one Cassandra seed and it has a given broadcast address). Correct me if I am wrong please.

Any help would be very appreciated!

njmor...@gmail.com

unread,
Nov 9, 2020, 9:32:35 AM11/9/20
to KairosDB
Is this more of a Docker Swarm question or a Kairos config option question?

From the kairosdb.properties file here, it looks like the format for multiple hosts is to separate the hosts with commas: kairosdb.datastore.cassandra.cql_host_list=1.1.1.1:9042,1.1.1.2. Since it sounds like you're using Swarm mode (docker stack deploy...), you can reference your containers using their service names. So this should work (I think): kairosdb.datastore.cassandra.cql_host_list=cassandra-seed,cassandra-node.

Also, I don't know what you've done to configure your docker container, but I don't believe there is an automatic mapping of environment variables to .properties file variables (I hope someone can say this is wrong). You probably need to create a docker entrypoint script that writes your environment variable (CASSANDRA_HOST_LIST) to the .properties file (kairosdb.datastore.cassandra.cql_host_list) on startup.

On a side note, I'm not sure if you're aware, but Mirantis, who bought Docker EE, have put all their work into Kubernetes support. They haven't officially killed Docker Swarm, but I'm sure there will be a lot less development on it going forward. It's worth considering if this is a new project.

Nate

Brian Hawkins

unread,
Apr 23, 2021, 10:31:46 AM4/23/21
to KairosDB
Kairos configuration can also be passed as system properties using the -D option to java.  I'm pretty sure docker will do that.  You can pass the host list on the command line and it will override anything in kairosdb.properties.
Reply all
Reply to author
Forward
0 new messages