Skip to content

Commit

Permalink
Add instructions to migrate a database. (Consensys#287)
Browse files Browse the repository at this point in the history
* Add  CLI option to disable built-in slashing protection for external signers.

Signed-off-by: Byron Gravenorst <[email protected]>

* Add instructions to connect to mainnet.

Signed-off-by: Byron Gravenorst <[email protected]>

* updating submodule to latest

* Add instructions to connect to mainnet.

Signed-off-by: Byron Gravenorst <[email protected]>

* Fix markdown issue.

Signed-off-by: Byron Gravenorst <[email protected]>

* Add instructions to migrate a database.

Signed-off-by: bgravenorst <[email protected]>

* Add instructions to migrate a database.

Signed-off-by: bgravenorst <[email protected]>

* Fix markdown issues.

Signed-off-by: bgravenorst <[email protected]>

* update submodule

* Address reviewer feedback.

Signed-off-by: bgravenorst <[email protected]>

Co-authored-by: Nicolas MASSART <[email protected]>
  • Loading branch information
bgravenorst and NicolasMassart authored May 19, 2021
1 parent bdaac18 commit 96cf286
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
51 changes: 51 additions & 0 deletions docs/HowTo/Migrate-Database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
description: How to migrate a RocksDB database to a LevelDB2 database.
---

# Migrate the database

As of v21.5.0, new Teku installations use a LevelDB2 database. Previous Teku versions use
RocksDB which continue to be supported.

LevelDB2 databases use less memory and are proven to be more stable with Teku. Users can migrate
Teku nodes running a RocksDB database to a LevelDB2 database if the Teku node runs in [pruning mode].

!!! warning

Teku nodes running in [archive mode] have to resync from genesis to migrate. Tools to migrate
existing databases will be provided in future releases.

To migrate a RocksDB database in [pruning mode] to a LevelDB2 database:

1. [Download the latest finalized state] from a beacon chain node:

```bash
curl -o state.ssz -H 'Accept: application/octet-stream' http://other-node:5051/eth/v1/debug/beacon/states/finalized
```

!!! note

This step is optional, you can also [supply the finalized checkpoint state] via URL from a beacon
chain node or Infura when restarting Teku in the step below.

1. Stop the Teku node you intend to migrate.

1. Delete the `beacon` directory in your
[data path](../Reference/CLI/CLI-Syntax.md#data-base-path-data-path).

!!! warning

Ensure not to delete the `validator` directory if one is present as this contains your
slashing protection data.

1. Restart Teku and specify the downloaded finalized state using the
[`--initial-state`](../Reference/CLI/CLI-Syntax.md#initial-state) command.

Teku creates a LevelDB2 database, and starts from the specified recent state. Teku should be in
sync and validating within minutes.

<!-- links -->
[Download the latest finalized state]: https://consensys.github.io/teku/#operation/getEthV1DebugBeaconStatesWithState_id
[pruning mode]: ../Reference/CLI/CLI-Syntax.md#data-storage-mode
[archive mode]: ../Reference/CLI/CLI-Syntax.md#data-storage-mode
[supply the finalized checkpoint state]: Get-Started/Checkpoint-Start.md
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ nav:
- Improve P2P connectivity: HowTo/Find-and-Connect/Improve-Connectivity.md
- Specify NAT methods: HowTo/Find-and-Connect/Specifying-NAT.md
- Voluntary exit: HowTo/Voluntary-Exit.md
- Migrate database: HowTo/Migrate-Database.md
- Troubleshoot:
- Solve common problems: HowTo/Troubleshoot/Troubleshooting.md
- Concepts:
Expand Down

0 comments on commit 96cf286

Please sign in to comment.