Categories
SysOps

How to create Consul snapshots for disaster recovery

Create HasiCorp Consul snapshots for disaster recovery.

Create backup snapshot.

$ consul snapshot save backup.snapshot
Saved and verified snapshot to index 228462

Inspect snapshot.

$ file backup.snapshot 
backup.snapshot: gzip compressed data, original size modulo 2^32 56832
$ consul snapshot inspect backup.snapshot 
 ID           77479-228462-1660165996971
 Size         53121
 Index        228462
 Term         77479
 Version      1

 Type                        Count      Size
 ----                        ----       ----
 KVS                         61         37.7KB
 Register                    9          5.6KB
 ACLToken                    7          2.7KB
 ACLPolicy                   4          1.8KB
 ConnectCA                   1          1.2KB
 ConnectCAProviderState      1          1.2KB
 Index                       21         658B
 CoordinateBatchUpdate       2          344B
 SystemMetadata              3          203B
 Autopilot                   1          199B
 ConnectCAConfig             1          199B
 FederationState             1          156B
 ChunkingState               1          12B
 ----                        ----       ----
 Total                                  51.9KB

Restore snapshot.

$ consul snapshot restore backup.snapshot 
Restored snapshot