nats-io / nats-server

High-Performance server for NATS.io, the cloud and edge native messaging system.
https://nats.io
Apache License 2.0
15.91k stars 1.41k forks source link

How to backup whole nats-server with every users data #2477

Open masudur-rahman opened 3 years ago

masudur-rahman commented 3 years ago

Hello, I have a jetstream enabled nats-server with multiple accounts and some Streams.

Now, I want to start the nats-server with clustering enabled.

But the problem I'm facing is how can I backup everything (with every streams of every users) from my previous nats-server to my new nats-server with clustering enabled.

I have tried https://docs.nats.io/jetstream/disaster_recovery#data-backup, but it only backs up data of a specified user but I want everything to be backed up. Any idea or suggestion how can I achieve this ?

ripienaar commented 3 years ago

We do not currently have a tool for this, but shutting down one server in a cluster and taking a snapshot should work well and ensure you have a point in time. It will catch up when it starts again.

derekcollison commented 3 years ago

I may be wrong here but can't you just change the config on the single server to be clustered and start the new servers? The system should do the right thing.

tpihl commented 1 year ago

@derekcollison,

I think this topic should be revisited. We need some way to backup a server/cluster without bringing it down to support backing up a 24/7 running cluster.

Restoring the full backup should naturally be offline before restarting the server(s)

I'm fine with something in nats-cli and/or something that is a signal to the server to dump a full consistent snapshot of all accounts and their data to some folder that normal backup can capture when the dump is complete.

Sry if this already exist, been looking for it. /T

derekcollison commented 1 year ago

We allow backing up all assets in an account via the NATS cli, but not cross accounts.

By default we do not have the ability to operate on an account owner's behalf to issue the snapshot / backup calls.

Some of the team has been working on opt-in solutions for SCP to allow a system account to operate in this manner if a user wants to chose to do so.