Migrate the database
Teku version 26.2.0 and later use RocksDB as the default database for new installations. Earlier Teku versions use LevelDB. LevelDB support has been deprecated and may be removed in a future release.
RocksDB databases use less memory and proves to be more stable with Teku.
We recommend Teku nodes running in prune mode or minimal mode (default) use the manual migration,
and Teku nodes running in archive mode use the automatic migration method.
Automatic migration
Teku nodes running in [archive mode] must resynchronize from genesis to migrate from LevelDB to RocksDB.
Use the migrate-database subcommand to migrate the database.
Once migration completes there will be two databases in Teku's data folder.
Manually verify that Teku starts and has the expected data before you remove old LevelDB database.
You need double the disk space of the existing Teku storage folder for the migration process. Once you are satisfied with the migration then you can delete the LevelDB to free up space.
Ensure that Teku isn't running when using the migrate-database subcommand.
The duration of the migration depends on various factors, but principally on the disk speed.
Status updates display during the migration process.
To migrate the database:
-
Shut down the local Teku instance.
-
Run
migrate-databaseto create a RocksDB database. Pass your configuration file or CLI options so that Teku has the correct paths and context.Exampleteku migrate-database --data-path /etc/teku/data/At a minimum, provide the
--networkand--data-pathoptions.noteIf not supplied
--networkdefaults tomainnet. -
The migration process informs you if it succeeded, or provides context to errors. If successful, then confirm Teku functions correctly.
Exampleteku --data-path /etc/teku/data/ -
If Teku is running correctly, remove the
beacon.olddirectory from the--data-pathdirectory.
If migration fails, resolve any issues and retry. Contact support on the Teku Discord channel if you need help resolving issues.
Manual migration
Users can manually migrate Teku nodes running a LevelDB database to a RocksDB database if the Teku node runs in prune mode or minimal mode (default).
Teku nodes running in [archive mode] must resynchronize from genesis to migrate. Use the automatic migration to migrate Teku nodes running in [archive mode].
To migrate a LevelDB database in minimal mode or prune mode to a RocksDB database:
-
Stop the Teku node you intend to migrate.
-
Clear the beacon database, either:
- Restart Teku with
--force-clear-db - Manually delete the
beacon/dbdirectory in your data path andbeacon/db.versionfile.
warningIf you manually delete, ensure not to delete the
validatordirectory if one is present as this contains your slashing protection data. - Restart Teku with
-
Add the
--checkpoint-sync-urloption with link to any community state provider to Teku command line and start Teku. Check Start Teku from a recent state for more information.
Teku creates a RocksDB database, and starts from the specified recent state. Teku should be in sync and validating within minutes.