[Cosmos] 파티션정리 및 Backup

91Savage·2023년 1월 16일
0

Cosmos

목록 보기
1/2

- Cosmos 노드 파티션 정리

참고 : https://medibloc.gitbook.io/panacea-core/for-validators/join-mainnet-testnet#state-sync
참고 : https://docs.tendermint.com/v0.34/tendermint-core/state-sync.html

Cosmos 노드는 쌓인 데이터를 Reset 해주는 기능이 있다.

"panacead tendermint unsafe-reset-all"

이를 통해 가득찬 파티션을 비우는데 활용 할 수 있다.

1. 중요 정보 백업

- ~/.panacea/data/priv_validator_state.json
- ~/.panacea/config/priv_validator_key.json
- ~/.panacea/config/node_key.json

보통 ~/.panacead/config/backup 에 백업 해줌

2. 신뢰 할 수있는 블록을 RPC를 통해 받는다.

- curl -s 13.124.96.254:26657/block | jq -r '.result.block.header.height + "\n" + .result.block_id.hash'

7700000 (height)
0D3E53F02ABCDDA8AAC1520342D37A290DDABE4C28190EE6E2C6B0C819F74D4A (hash)

** jq 설치가 안되어 있을 땐 해줘야함

- apt install jq

3. Config.toml

[statesync]

enable = true

rpc_servers = "3.35.82.40:26657,13.124.96.254:26657,52.79.108.35:26657" # rpc addresses
trust_height = <trusted-block-height> // 위에서 받은 값
trust_hash = "<trusted-block-hash>" // 위에서 받은 값
trust_period = "336h0m0s" # 2/3 of 21 days (unbonding period)

4. 데이터베이스 초기화

  • systemctl stop panacead (먼저 노드 정지)

  • panacead tendermint unsafe-reset-all (초기화)

  • systemctl start panacead (노드 시작)

  • journactl -u panacead.service -f --output cat (블록 싱크 확인)

0개의 댓글