How do I restore a node from a snapshot?
Restoring a node from a snapshot allows the node avoid resyncing from genesis by resyncing from the last known validated block saved in the snapshot.
Assuming you have access to a previously saved snapshot, the steps are as follows:
Install lz4
sudo apt install lz4Download the snapshot
Assuming the snapshot is available at some online location, use wget to retrieve the snapshot file.
wget https://<location of snapshot>Alternatively, copy the file to the local node server using whatever other preferred means.
Stop the node
systemctl stop mantrachaindReset the node
This will erase your node database. If you are already running validator, be sure you backed up your priv_validator_key.json prior to running the the command. The command does not wipe the file. However, you should keep a backup of this file in a safe location.
WARNING: If you use this snapshot on a validator node during a chain halt, make sure you back up
priv_validator_state.jsonand then replace it after the snapshot is extracted but before you start the node process. This is very important in order to avoid double-signing.
backup
cp $HOME/.mantrachain/data/priv_validator_state.json /some/safe/locationreset
mantrachaind tendermint unsafe-reset-all --home $HOME/.mantrachain --keep-addr-bookExtract the snapshot
lz4 -c -d mantrachain_XXXXXXX.lz4 | tar -x -C $HOME/.mantrachainIMPORTANT: If you run a validator node and the chain is in halt, it is time to replace the
priv_validator_state.jsonfile that you have backed up.
cp /some/safe/location/priv_validator_state.json $HOME/.mantrachain/config/priv_validator_key.jsonStart the node
systemctl start mantrachaindVerify the node is running
journalctl -xefu mantrachaindIf everything is good you can delete the snapshot file to free up space.
Last updated