2

I hope to receive some tips and assistance.

I have three virtual machines running Ubuntu 22.04, and each one has Cassandra deployed via docker-compose, forming a cluster.

My current task is to organize an automatic backup of all keyspaces and schema to a remote server.

Has anyone already solved a similar problem? I cannot find any official information on this matter.

I currently see it in the following form, but I'm not sure if it's efficient:

    docker exec -it container_id /bin/bash
    nodetool snapshot
    docker cp container_id:/data/keyspace_name/table_name-UUID/snapshots/snapshot_name /path/on/host/

1 Answer 1

0

The steps you outlined is effectively the way you would do it.

If you've mapped a host directory with -v, for example:

$ docker run \
    -v /path/to/host/directory:/container/directory \
    ...

then you can work on the snapshots directly from the host, i.e. archive to a remote file storage or tape. Cheers!

4
  • Not really suitable for my case as in my case: 1. Catalog /var/lib/cassandra/data connected as a volume 2. The path is always unique for each table and they can change from time to time (keyspace_name/table_name-UUID/snapshots) If there are no other options, in this case, either refuse to use docker containers, or perform a double copy from docker to the host system and then to a remote server. Inside docker, I can't copy directly from the container, because of it doesn't contain the necessary tools. I certainly did not understand the approach to backup in Cassandra.
    – Dmitriy
    Commented Apr 27, 2023 at 4:55
  • 1
    I get the sense that you misunderstood my answer. 🙂 Lots of enterprises deploy Cassandra in a Docker environment in production. Your approach works as I said. But I just meant that you could simplify it without using docker cp by using the approach I suggested. Cheers! Commented Apr 27, 2023 at 5:27
  • I apologize, I didn't understand you correctly. Thank you for your response! Could I ask a simple question, the official Cassandra container lacks rsync and scp tools. For example, I published a directory for archiving in the container, how can I copy snapshots inside the container? What would you recommend? Thank you in advance!
    – Dmitriy
    Commented Apr 27, 2023 at 5:44
  • 1
    @Dmitriy The official Cassandra Docker container also lacks user auth. I hope that is not being used in production, or that you've managed to secure it some other way. My advice with running containerized Cassandra is to ALWAYS build your own Docker image.
    – Aaron
    Commented Apr 28, 2023 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.