0chain / 0chain/zcnwebappscripts

Snapshots create and apply draft

未关闭 适合新手
#116 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
documentation
主要语言
Shell
星标
1
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

# Create snapshorts

## Create sharder snapshots
Use sharder1 on mainnet as an example, we need to stop both the sharder and postgres docker containers first. Then find all the data folders, compress them and upload to the snapshots server.

get data in `/var/0chain/sharder/ssd` folder and compress:
```sh
tar -czvf sharder-ssd.tar.gz /var/0chain/sharder/ssd/docker.local/data

# upload the ssharder-ssd.tar.gz to snapshots server
```

get data in `/var/0chain/sharder/hdd` folder and compress:
```sh
tar -czvf sharder-hdd.tar.gz /var/0chain/sharder/hdd/docker.local/sharder1/data

# upload the sharder-hdd.tar.gz to snapshots server
```

# Create miner snapshot

Stop the miner docker container, then compress the data folder:

```sh
tar -czvf miner-ssd.tar.gz /var/0chain/miner/ssd/docker.local/miner1/data

# upload the miner-ssd.tar.gz to snapshots server
```

# Apply snapshots
## Sharder

The first step is ensure both sharder and postgres are not running, stop them otherwise.

Download the snapshots from the snapshots server, get both `sharder-ssd.tar.gz` and `sharder-hdd.tar.gz` . Suppose the sharder has the same folder structure, before applying the snapshots, please backup the existing data if any.

Extract the ssd sharder data

```sh
tar -xzvf sharder-ssd.tar.gz -C /var/0chain/sharder/ssd/docker.local/sharder1/data/
```

Extract the hdd sharder data

```sh
tar -xzvf sharder-hdd.tar.gz -C /var/0chain/sharder/hdd/docker.local/sharder1/data/
```

Once extracted, we can start the sharder and postgres docker containers.

### Miner
Stop the miner and redis if they are running. There are 2 redis instances, `miner*_redis_1` and `miner*_redis_txns_1`. So make sure they are both stopped.

Download the snapshot from server.
Backup the data if any.

Extract the snapshot to the miner's data folder, for our miner server, we can do:
```sh
tar -xzvf miner-ssd.tar.gz -C /var/0chain/miner/ssd/docker.local/miner1/data/
```

Start the miner and redis containers

贡献指南

这个仓库没有索引到贡献指南

调研方向

该问题描述了为分片节点和矿工节点创建和应用快照。首先检查仓库结构,找到 zcnwebappscripts 项目中的现有脚本。在代码库中查找任何处理 docker 命令或数据备份的相关脚本。根据项目文档或配置文件验证提到的文件夹路径(/var/0chain/sharder/ssd 等)。任务是记录这些步骤,因此请确保最终文档放置在适当的位置,例如 README 或 docs 文件夹中。

由索引模型根据 Issue 内容生成。

评估

技术栈
docker, shell
领域
devops, tooling
Issue 类型
文档
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
65/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。