Skip to content

Commit a928ef2

Browse files
docs: Add guide for reenabling pruning [DEV-5291] (#60)
* added guide for reenabling pruning * Additional details & minor format changes * Fix typo Co-authored-by: Kaustubh K <54210167+kaustubhkapatral@users.noreply.github.com> --------- Co-authored-by: kaustubhkapatral <kaustubh.kapatral@gmail.com> Co-authored-by: Kaustubh K <54210167+kaustubhkapatral@users.noreply.github.com>
1 parent fbe5a83 commit a928ef2

2 files changed

Lines changed: 105 additions & 0 deletions

File tree

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* [Unjailing a jailed validator](docs/validator-guide/unjail.md)
2727
* [Move validator to a different machine](docs/validator-guide/move-validator.md)
2828
* [Backup and restore node keys with Hashicorp Vault](docs/validator-guide/backup-and-restore.md)
29+
* [Re-enable pruning and recovering node db](docs/validator-guide/reenable-pruning.md)
2930
* [Network-wide Software Upgrades](docs/upgrades/README.md)
3031
* [Upgrade Guides](docs/upgrades/upgrade-guides/README.md)
3132
* [Upgrade to v0.6.x](docs/upgrades/upgrade-guides/v0.6-upgrade.md)
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Guide for re-enabling pruning and recovering node db
2+
3+
This guide is specifically made for the the validators/node operators affected by the pruning issue encountered following our v4.x upgrade. This issue required some validators/node operators having to disable pruning entirely.
4+
5+
Re-enabling pruning (to `default`/`custom` from `nothing`) on the affected nodes will cause the nodes to halt again as the database pruning resumes its operation. To avoid this it is recommended to reset your node db and recover it using state sync or a db snapshot. The nodes that weren't affected by the pruning issue or that had recovered by the time the pruning fix was rolled out do not have to undergo this procedure.
6+
7+
Following this procedure will significantly reduce the disk space required for your node’s regular operations, thereby lowering operational costs (on the nodes we manage, we observed storage usage drop from 700+ GB to under 10 GB). Additionally, running a node with less disk usage will likely improve performance.
8+
9+
You have two options here:
10+
11+
1) Reset via State Sync
12+
2) Reset by using DB snapshot
13+
14+
## State Sync
15+
16+
Stop the systemd service of the node.
17+
`sudo systemctl stop cheqd-cosmovisor.service`
18+
19+
Take a backup of the priv_validator_state.json. **This step is very Important for validator nodes:**
20+
21+
```bash
22+
cp ~/.cheqdnode/data/priv_validator_state.json ~/priv_validator_state.json
23+
```
24+
25+
Turn the pruning strategy to default or custom based on your preference in the `~/.cheqdnode/config/app.toml` file.
26+
27+
Reset the database:
28+
29+
```bash
30+
cheqd-noded tendermint unsafe-reset-all --home ~/.cheqdnode/ --keep-addr-book
31+
```
32+
33+
Restore the priv_validator_state.json. **This step is very Important for validator nodes:**
34+
35+
```bash
36+
cp ~/priv_validator_state.json ~/.cheqdnode/data/priv_validator_state.json
37+
```
38+
39+
Enable statesync on the node and provide the required variables:
40+
41+
```bash
42+
STATESYNC_RPC="https://rpc.cheqd.net:443"
43+
LATEST_HEIGHT=$(curl -s $STATESYNC_RPC/block | jq -r .result.block.header.height)
44+
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000))
45+
TRUST_HASH=$(curl -s "$STATESYNC_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
46+
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
47+
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$STATESYNC_RPC,$STATESYNC_RPC\"| ; \
48+
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
49+
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" ~/.cheqdnode/config/config.toml
50+
```
51+
52+
Start the node:
53+
54+
```bash
55+
sudo systemctl restart cheqd-cosmovisor.service
56+
```
57+
58+
The node should start looking for statesync chunks from it's peers and begin the restoration process in a few minutes. After some time, it should catch up with the network and continue signing blocks.
59+
60+
## Snapshot
61+
62+
Stop the systemd service of the node:
63+
64+
```bash
65+
sudo systemctl stop cheqd-cosmovisor.service`
66+
```
67+
68+
Take a backup of the priv_validator_state.json. **This step is very Important for validator nodes:**
69+
70+
```bash
71+
cp ~/.cheqdnode/data/priv_validator_state.json ~/priv_validator_state.json
72+
```
73+
74+
Turn the pruning strategy to default or custom based on your preference in the `~/.cheqdnode/config/app.toml` file.
75+
76+
Reset the database:
77+
78+
```bash
79+
cheqd-noded tendermint unsafe-reset-all --home ~/.cheqdnode/ --keep-addr-book`
80+
```
81+
82+
Restore the priv_validator_state.json. **This step is very Important for validator nodes:**
83+
84+
```bash
85+
cp ~/priv_validator_state.json ~/.cheqdnode/data/priv_validator_state.json
86+
```
87+
88+
Download the latest lz4 tar archive for mainnet from [our snapshots page](https://snapshots.cheqd.net/#mainnet/)
89+
90+
```bash
91+
wget https://cheqd-node-backups.ams3.digitaloceanspaces.com/mainnet/<timestamp>/cheqd-mainnet-1_<timestamp>.tar.lz4
92+
```
93+
94+
Unpack the tar archive and restore the db:
95+
96+
```bash
97+
lz4 -c -d cheqd-mainnet-1_<timestamp>.tar.lz4 | tar -x -C ~/.cheqdnode`
98+
```
99+
100+
Start the node
101+
102+
```bash
103+
sudo systemctl restart cheqd-cosmovisor.service
104+
```

0 commit comments

Comments
 (0)