Skip to content

1. BSC节点维护

官当

1.1 离线维护

这个的前提下必须有备机,保证服务不中断

根据官方测试,当存储量达到高容量时(之前是 1.5TB,这是一个实验值,最新数字需要更新),全节点的性能会下降。我们建议全节点通过修剪存储来始终保持 light storage。

  • 停止BSC节点
bash
systemctl stop bsc
systemctl stop bsc
  • 清理数据
bash
screen -S clean_bsc /data/apps/geth_bsc_v1.4.16 geth snapshot prune-state --datadir /data/bsc
screen -S clean_bsc /data/apps/geth_bsc_v1.4.16 geth snapshot prune-state --datadir /data/bsc

完成需要 3-5 小时,根据本地数据量

💡 说明

1:使用screen窗口期间可以退出或者关闭命令行对话框。

2:退出当前窗口时用ctrl+ad(顺序按a和d字母即可),绝对不要用exit或ctrl+d退出会话。

3:退出会话后,可以用screen -x clean_bsc重新连接到会话。这样可以保持在shell下运行,网络中断不会影响

如果想退出,进入3步骤,然后按 ctrl+c 即可

  • 启动服务
bash
systemctl start bsc
systemctl start bsc

1.2 实时维护

Ancient data is block data that is already considered immutable. This is determined by a threshold which is currently set at 90000. This means that blocks older than 90000 are considered ancient data. We recommend the --prunceancient flag to users who don’t care about the ancient data. This is also advised for users who want to save disk space since this will only keep data for the latest 90000 blocks. Note that once this flag is turned on, the ancient data will not be recovered again and you cannot go back running your node without this flag in the start-up command.

bash
./geth --tries-verify-mode none --config /server/config.toml --datadir /server/node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0 --pruneancient=true --syncmode=full
./geth --tries-verify-mode none --config /server/config.toml --datadir /server/node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0 --pruneancient=true --syncmode=full

1.3 prune-block

v1.1.8 中引入了一个新的离线功能,用于删除不需要的 ancient block 数据。它将丢弃 ancient 数据库中的 block、receipt 和 header 以节省空间。

  • 停止bsc服务
bash
systemctl stop bsc
systemctl stop bsc
  • 启动
bash
./geth snapshot prune-block --datadir /server/node --datadir.ancient ./chaindata/ancient --block-amount-reserved 1024
./geth snapshot prune-block --datadir /server/node --datadir.ancient ./chaindata/ancient --block-amount-reserved 1024

block-amount-reserved 1024 : 保留1024个最新的数据,default: 90000