Skip to content

Questions/Proposal on how to achieve high availability with docker swarms #68

Description

@Musholic

Hello,

I'm interested in contributing to this plugin to achieve true high availability with a Docker Swarm setup in case of node/disk failures or maintenance (with minimal data loss). I would like your input regarding the following points, in case I'm missing anything.

The assumption is that I have two hosts hA and hB that should hold the most recent data (duplicated in case one of them is not available). The goal is that a service running on hC will periodically replicate its data, and if it moves to hD, it will continue with the most recently available data on hA and hB.

  • The current sync has a few issues: it's less efficient than a btrfs send, it does not check if the remote data is actually newer, and it does not delete local data (could be fixed with -u or --delete flags, I think).
  • The replicate command does not send the same snapshot to multiple hosts at once, and will create a snapshot even if there is no change (so if I schedule a replicate every minute on two different hosts, it will create two snapshots every minute).
    • It's actually not a big deal as they can be purged.

To make my scenario work, I will have to implement some kind of snapshot_sync command that would execute automatically before the container starts, and will:

  • Check the most recent snapshots on the given list of remote hosts.
  • Check if one of them is more recent than its own snapshots.
  • If yes, create a snapshot (as backup), fetch the remote snapshot, and restore it.
  • Before the service exits, it should replicate a new snapshot to the given remote hosts (an additional replicate schedule, during the lifetime of the service, should probably be automated to avoid data loss).

For context, I'm really happy to have found your plugin as I tested a lot of replicated storage solutions (SeaweedFS, Garage, JuiceFS, rclone, ...), but all of them don't work well with async operations or with high latency between nodes; they divide the performance of my small nodes by a lot and use a lot of resources. Some don't work well with databases data. While this solution does not prevent the complete loss of data, I think it's currently the best compromise for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions