From 3115a2d5ab51af85602249789dde1171894ed2fa Mon Sep 17 00:00:00 2001 From: amela Date: Thu, 19 Oct 2023 10:23:07 +0200 Subject: [PATCH] docs/node/run-your-node/maintenance: Update state wipe instructions --- .../maintenance/wiping-node-state.md | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/docs/node/run-your-node/maintenance/wiping-node-state.md b/docs/node/run-your-node/maintenance/wiping-node-state.md index c20d370a7a..d7c946af0a 100644 --- a/docs/node/run-your-node/maintenance/wiping-node-state.md +++ b/docs/node/run-your-node/maintenance/wiping-node-state.md @@ -1,45 +1,53 @@ # Wiping Node State -In some cases you might want (or need) to do a full redeploy with clean state before deploying a new version of the network. This should never actually be used during a Mainnet unless there is some serious corruption, but your node will have to spend time catching up to the rest of the network. +In certain situations, you may need to do a complete node redeployment with a +clean state. Two common scenarios for this are during a breaking network upgrade +or in cases of severe data corruption. If you need to wipe your node due to +severe corruption, it's important to note that your node will need some time to +catch up with the rest of the network. -The following instructions assume that your `datadir` is defined as `/serverdir/node` in your node's config. +The following instructions are based on the assumption that you have defined +your `datadir` as `/serverdir/node` in your node's configuration. ## State Wipe and Keep Node Identity -:::caution +:::info -Make sure to include the `--preserve.mkvs_database` flag if you are wiping blockchain state on a runtime node and need to preserve runtime state. +Note that by default, the `--preserve.mkvs_database` flag is set to true, +preserving the runtime/paratime state. ::: -1. Stop the `oasis-node` server process (this will depend on your own deployment setup). -2. Remove blockchain state using the `oasis-node unsafe-reset` command: +To wipe a consensus state while preserving the runtime/paratime state follow +these instructions: + +1. Stop the `oasis-node` server process (this will depend on your own deployment +setup). +2. Remove consensus state using the `oasis-node unsafe-reset` command: ```bash # Do a dry run first to see which files will get deleted. oasis-node unsafe-reset \ - --preserve.mkvs_database \ --datadir=/serverdir/node \ --dry_run \ - --log.level info # Delete. oasis-node unsafe-reset \ - --preserve.mkvs_database \ --datadir /serverdir/node \ - --log.level info ``` 3. Start the `oasis-node` server process. :::info -`oasis-node` is very strict regarding the ownership of the files. If you encounter the following error: +`oasis-node` is very strict regarding the ownership of the files. If you +encounter the following error: ``` common/Mkdir: path '/serverdir/node' has invalid owner: 1000. Expected owner: 0 ``` -you need to run the `oasis-node` command as the exact user that owns the files, e.g.: +you need to run the `oasis-node` command as the exact user that owns the files, +e.g.: ``` sudo --user=#1000 -- oasis-node unsafe-reset --datadir=/serverdir/node --dry_run --log.level info @@ -51,12 +59,17 @@ sudo --user=#1000 -- oasis-node unsafe-reset --datadir=/serverdir/node --dry_run :::danger -This is likely not what you want to do. This is destructive and might result in losing private state required to operate the given node. **USE AT YOUR OWN RISK.** +This is likely not what you want to do. This is destructive and will result in +losing private state required to operate the given node. **USE AT YOUR OWN +RISK.** A full state wipe will also mean that you'll need to generate a new node +identity (or copy the old one). ::: -A full state wipe will also mean that you'll need to generate a new node identity (or copy the old one). +To perform a full state wipe follow these steps: -1. Stop the `oasis-node` server process (this will depend on your own deployment setup) +1. Stop the `oasis-node` server process (this will depend on your own deployment +setup) 2. Remove the `/serverdir/node` directory. -3. Redeploy your node. You'll need to copy your Node artifacts or create brand new ones. +3. Redeploy your node. You'll need to copy your Node artifacts or create brand +new ones.