title |
---|
Database Snapshots |
Database snapshots provide a point-in-time view of a database's store. In Sui, the database snapshot captures a running database's view of the Sui network from a particular node at the end of an epoch. While validators can enable snapshots, they are typically most valuable for Full node operators.
Snapshots of the Sui network enable Full node operators a way to bootstrap a Full node without having to execute all the transactions that occurred after genesis. Currently, you can upload snapshots only to the Amazon S3 remote object store, but you can expect other services like Google Cloud Storage and Azure Blob Storage to be available in the future. These services typically run the export process in the background so there is no degradation in performance for your Full node. With snapshots stored in the cloud, you're more easily able to recover quickly from catastrophic failures in your system or hardware.
Full nodes do not take snapshots by default. To enable this feature:
- Stop your node, if it's running.
- Open your node config file. For Full node operators, this file is titled
fullnode.yaml
. If you installed your Full node using thecargo
command, the file location defaults to the.sui/sui_config
directory. If you installed from source, thefullnode.yaml
file is in yoursui
root folder. - Add an entry to the config file for
db-checkpoint-config
. Using Amazon's S3 service as an example:db-checkpoint-config: perform-db-checkpoints-at-epoch-end: true object-store-config: object-store: "S3" bucket: "<BUCKET-NAME>" aws-access-key-id: “<ACCESS-KEY>” aws-secret-access-key: “<SHARED-KEY>” aws-region: "<BUCKET-REGION>" object-store-connection-limit: 20
object-store
: The remote object store to upload snapshots. Set as Amazon'sS3
service in the example.bucket
: The S3 bucket name to store the snapshots.aws-access-key-id
andaws-secret-access-key
: AWS authentication information with write access to the bucket.aws-region
: Region where buck exists.object-store-connection-limit
: Number of simultaneous connections to the object store.
- Save the sui-node.yaml file and restart the node.
To restore from a snapshot, follow these steps:
- Download the snapshot for the epoch you want to restore to your local disk. There is one snapshot per epoch in storage.
- Place the snapshot into the directory that the
db-config
value points to in your node config file. For example, if thedb-config
value points to/opt/sui/db/authorities_db
and you want to restore from epoch 10, then copy the snapshot to the directory with this command:aws s3 cp s3://<BUCKET-NAME>/dir /opt/sio/db/authorities_db/ --recursive —exclude “*” —include “epoch_10*”
- Mark downloaded snapshot as live:
mv /opt/sio/db/authorities_db/epoch_10 /opt/sio/db/authorities_db/live
- Start the Sui node.