Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

이 가이드는 스냅샷과 상태 동기화를 사용하여 Stable 노드를 빠르게 동기화하는 다양한 방법을 다룹니다.

동기화 방법 개요

방법동기화 시간필요 저장 공간사용 사례
Pruned 스냅샷~10분< 5 GiB일반 풀 노드
아카이브 스냅샷~1시간~500 GB아카이브 노드, 블록 익스플로러

공식 스냅샷

Stable은 매일(00:00 UTC) 업데이트되는 공식 스냅샷을 제공합니다.

스냅샷 정보

메인넷

유형압축크기URL업데이트 주기
PrunedLZ4< 5 GiB다운로드매일
아카이브ZSTD~300 GB다운로드매주

테스트넷

유형압축크기URL업데이트 주기
PrunedLZ4< 5 GiB다운로드매일
아카이브ZSTD~800 GB다운로드매주

Pruned 스냅샷 사용

Pruned 스냅샷은 최근 블록체인 상태(마지막 100~1000개 블록)를 포함합니다.

1단계: 환경 변수 설정

# Set service name (default: stable)
export SERVICE_NAME=stable

2단계: 노드 서비스 중지

# Stop the running node
sudo systemctl stop ${SERVICE_NAME}
 
# Verify it's stopped
sudo systemctl status ${SERVICE_NAME}

3단계: 현재 데이터 백업(선택 사항)

# Create backup directory
mkdir -p ~/stable-backup
 
# Backup current state (optional, requires significant space)
cp -r ~/.stabled/data ~/stable-backup/

4단계: Pruned 스냅샷 다운로드 및 추출

Mainnet
# Install dependencies
sudo apt install -y wget zstd pv
 
# Create snapshot directory
mkdir -p ~/snapshot
cd ~/snapshot
 
# Download pruned snapshot with progress
wget -c https://stable-data-dist.s3.us-east-1.amazonaws.com/mainnet/snapshots/snapshot.tar.lz4
 
# Remove old data
rm -rf ~/.stabled/data/*
 
# Extract snapshot with progress indicator
pv stable_pruned.tar.zst | zstd -d -c | tar -xf - -C ~/.stabled/
 
# Alternative extraction without pv
zstd -d stable_pruned.tar.zst -c | tar -xvf - -C ~/.stabled/
 
# Clean up
rm stable_pruned.tar.zst

5단계: 노드 재시작

# Start the node
sudo systemctl start ${SERVICE_NAME}
 
# Check status
sudo systemctl status ${SERVICE_NAME}
 
# Monitor logs
sudo journalctl -u stabled -f

아카이브 스냅샷 사용

아카이브 스냅샷은 전체 블록체인 기록을 포함합니다.

1단계: 시스템 준비

# Stop node
sudo systemctl stop ${SERVICE_NAME}
 
# Install dependencies
sudo apt install -y wget zstd pv
 
# Check available disk space (need 2x snapshot size)
df -h ~/.stabled

2단계: 아카이브 스냅샷 다운로드 및 추출

Mainnet
# Create working directory
mkdir -p ~/snapshot
cd ~/snapshot
 
# Download archive snapshot
wget -c https://stable-data-dist.s3.us-east-1.amazonaws.com/mainnet/snapshots/stable_archive.tar.zst
 
# Clear old data
rm -rf ~/.stabled/data/*
 
# Extract with high memory for better performance
pv stable_archive.tar.zst | zstd -d --long=31 --memory=2048MB -c - | tar -xf - -C ~/.stabled/
 
# Alternative: Standard extraction
zstd -d --long=31 stable_archive.tar.zst -c | tar -xvf - -C ~/.stabled/
 
# Clean up
rm stable_archive.tar.zst

3단계: 노드 시작

# Start service
sudo systemctl start ${SERVICE_NAME}
 
# Verify sync status
curl -s localhost:26657/status | jq '.result.sync_info'

직접 스냅샷 만들기

수동 스냅샷 생성

# Stop node
sudo systemctl stop ${SERVICE_NAME}
 
# Create snapshot archive
cd ~/.stabled
tar -cf - data/ | lz4 -9 > ~/stable-snapshot-$(date +%Y%m%d).tar.lz4
 
# Create checksum
sha256sum ~/stable-snapshot-*.tar.lz4 > checksums.txt
 
# Restart node
sudo systemctl start ${SERVICE_NAME}

자동 스냅샷 스크립트

#!/bin/bash
# snapshot.sh - Automated snapshot creation
 
# Configuration
SNAPSHOT_DIR="/var/snapshots"
STABLED_HOME="$HOME/.stabled"
KEEP_DAYS=7
 
# Create snapshot directory
mkdir -p $SNAPSHOT_DIR
 
# Stop node
sudo systemctl stop ${SERVICE_NAME}
 
# Create snapshot
SNAPSHOT_NAME="stable-snapshot-$(date +%Y%m%d-%H%M%S).tar.lz4"
tar -cf - -C $STABLED_HOME data/ | lz4 -9 > $SNAPSHOT_DIR/$SNAPSHOT_NAME
 
# Generate metadata
cat > $SNAPSHOT_DIR/latest.json <<EOF
{
  "filename": "$SNAPSHOT_NAME",
  "height": "$(cat $STABLED_HOME/data/cs.wal/wal | grep height | tail -1 | awk '{print $2}' | tr -d ',')",
  "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
  "size": "$(du -h $SNAPSHOT_DIR/$SNAPSHOT_NAME | awk '{print $1}')",
  "checksum": "$(sha256sum $SNAPSHOT_DIR/$SNAPSHOT_NAME | awk '{print $1}')"
}
EOF
 
# Clean old snapshots
find $SNAPSHOT_DIR -name "stable-snapshot-*.tar.lz4" -mtime +$KEEP_DAYS -delete
 
# Restart node
sudo systemctl start ${SERVICE_NAME}
 
echo "Snapshot created: $SNAPSHOT_DIR/$SNAPSHOT_NAME"

자동 스냅샷 예약

# Add to crontab (weekly on Sunday at 2 AM)
(crontab -l ; echo "0 2 * * 0 /usr/local/bin/snapshot.sh") | crontab -

검증 및 문제 해결

스냅샷 무결성 검증

# Check snapshot checksum
sha256sum -c checksums.txt
 
# Verify extraction
tar -I lz4 -tvf snapshot.tar.lz4 | head -20
 
# Test snapshot size
tar -I lz4 -tvf snapshot.tar.lz4 | wc -l

일반적인 문제

문제: 스냅샷 추출 실패

# Check disk space
df -h
 
# Verify file integrity
lz4 -t snapshot.tar.lz4
 
# Try alternative extraction
lz4 -d snapshot.tar.lz4 snapshot.tar
tar -xvf snapshot.tar -C ~/.stabled/

문제: 스냅샷 후 노드가 시작되지 않음

# Check permissions
ls -la ~/.stabled/data/
 
# Fix permissions
sudo chown -R $USER:$USER ~/.stabled/
 
# Verify genesis file
sha256sum ~/.stabled/config/genesis.json
 
# Reset and try again
stabled comet unsafe-reset-all
# Then restore snapshot

문제: 상태 동기화 실패

# Try different RPC servers
# Update config.toml with alternative RPCs
 
# Increase chunk fetchers
sed -i 's/chunk_fetchers = .*/chunk_fetchers = 8/' ~/.stabled/config/config.toml
 
# Clear and retry
stabled comet unsafe-reset-all --keep-addr-book

성능 최적화

다운로드 최적화

# Use aria2 for parallel downloads
aria2c -x 16 -s 16 https://stable-data-dist.s3.us-east-1.amazonaws.com/testnet/snapshots/snapshot.tar.lz4
 
# Use wget with compression
wget --header="Accept-Encoding: gzip" -c URL
 
# Resume interrupted downloads
curl -C - -o snapshot.tar.lz4 URL

추출 최적화

# Use parallel extraction
pigz -d -c snapshot.tar.gz | tar -xf - -C ~/.stabled/
 
# Monitor extraction progress
pv snapshot.tar.lz4 | tar -I lz4 -xf - -C ~/.stabled/
 
# Use more memory for zstd
zstd -d --long=31 --memory=4096MB archive.tar.zst

모범 사례

  1. 데이터를 교체하기 전에 항상 검증자 키를 백업하세요
  2. 스냅샷을 추출하기 전에 체크섬을 검증하세요
  3. 추출 중에 디스크 공간을 모니터링하세요(스냅샷 크기의 2배 필요)
  4. 가능한 경우 공식 스냅샷을 사용하세요
  5. 비프로덕션 환경에서 먼저 스냅샷을 테스트하세요
  6. 아카이브 노드를 위해 정기적인 스냅샷을 예약하세요
  7. 감사 추적을 위해 스냅샷 출처를 문서화하세요

다음 단계