Skip to content

Commit

Permalink
Adding snapshot document (MystenLabs#10039)
Browse files Browse the repository at this point in the history
## Description 

Database snapshot document.

## Test Plan 

Locally

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
ronny-mysten authored Mar 29, 2023
1 parent 2ba47f6 commit 341a116
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
44 changes: 44 additions & 0 deletions doc/src/build/snapshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
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.


## Enabling snapshots

Full nodes do not take snapshots by default. To enable this feature:

1. Stop your node, if it's running.
1. Open your node config file. For Full node operators, this file is titled `fullnode.yaml`. If you installed your Full node using the `cargo` command, the file location defaults to the `.sui/sui_config` directory. If you installed from source, the `fullnode.yaml` file is in your `sui` root folder.
1. Add an entry to the config file for `db-checkpoint-config`. Using Amazon's S3 service as an example:
```yaml
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's `S3` service in the example.
* `bucket`: The S3 bucket name to store the snapshots.
* `aws-access-key-id` and `aws-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.
1. Save the sui-node.yaml file and restart the node.

## Restoring from snapshots

To restore from a snapshot, follow these steps:

1. Download the snapshot for the epoch you want to restore to your local disk. There is one snapshot per epoch in storage.
1. Place the snapshot into the directory that the `db-config` value points to in your node config file. For example, if the `db-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*”```
1. Mark downloaded snapshot as live:
```mv /opt/sio/db/authorities_db/epoch_10 /opt/sio/db/authorities_db/live```
1. Start the Sui node.
10 changes: 7 additions & 3 deletions doc/src/navconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
"title": "Connect to Sui",
"items": [
{
"label": "Programmable Transactions with TypeScript SDK",
"label": "Programmable Transaction Blocks with TypeScript SDK",
"fileName": "build/prog-trans-ts-sdk"
},
{
Expand All @@ -239,13 +239,17 @@
"external": true
},
{
"label": "Sui Full node",
"label": "Sui Full Node",
"fileName": "build/fullnode"
},
{
"label": "Sui Validator node",
"label": "Sui Validator Node",
"fileName": "build/validator-node"
},
{
"label": "Database Snapshots",
"fileName": "build/snapshot"
},
{
"label": "Event Query and Subscription",
"fileName": "build/event_api"
Expand Down

0 comments on commit 341a116

Please sign in to comment.