Disaster Recovery
Today we have a few approaches to consider:
- CLI + Configuration Backups + Data Snapshots
- Configuration Management + Data Snapshots
In all scenarios you can perform data snapshots and restores over the NATS protocol. This is good if you do not manage the NATS servers hosting your data, and you wish to do a backup of your data.
The backup includes:
- Stream Consumer configuration and state
- All data including metadata like timestamps and headers
During the backup the Stream is in a state where it’s configuration cannot change and no data will be expired from it based on Limits or Retention Policies.
The backup made above can be restored into another server - but into the same Stream name.
The /data/js-backup/ORDERS.tgz
file can also be extracted into the data dir of a stopped NATS Server.
Progress using the terminal bar can be disabled using , it will then issue log lines instead.
In environments where the nats
CLI is used interactively to configure the server you do not have a desired state to recreate the server from. This is not the ideal way to administer the server, we recommend Configuration Management, but many will use this approach.
This backs up Stream, Consumer and Stream Template configuration.
During the same process the data can also be backed up by passing --data
, this will create files like .
Later the data can be restored, for Streams we support editing the Stream configuration in place to match what was in the backup.
The nats restore
tool does not support restoring data, the same process using nats stream restore
, as outlined earlier, can be used which will also restore Stream and Consumer configurations and state.