修剪执行客户端

注意

这适用于 gethnethermind 用户。 Besu 不需要修剪。

如果您使用 gethnethermind 作为主执行客户端,您可能会注意到节点的可用磁盘空间随时间慢慢减少。 执行客户端是造成这种情况的最大因素;根据您在 rocketpool service config 期间为其缓存分配的 RAM 大小,它每天可能会增长数 GB!

为了处理这个问题,执行客户端提供了一个称为修剪的特殊功能,让它们能够安全地扫描和清理数据库以回收一些可用空间。 每个使用 Geth 或 Nethermind 的节点运营商最终都需要修剪它。

如果您有 2 TB SSD,通常可以在修剪轮次之间持续数月。 对于 1 TB SSD 用户,您将需要更频繁地修剪。

如果您启用了 Grafana 仪表板,一个好的经验法则是当节点的已用磁盘空间超过 80% 时开始考虑修剪执行客户端。

当您决定是时候修剪时,Smartnode 可以根据您的请求为您修剪。 请阅读下文以了解它的工作原理以及预期结果。

注意

修剪执行客户端仅在 Docker 模式下可用。

如果您使用自己的执行客户端,例如混合模式或原生模式中的外部客户端,则无法使用 Smartnode 修剪执行客户端。 您需要手动进行。 请参考您的执行客户端的文档以了解如何修剪它。

先决条件

从下面的标签中选择您正在使用的客户端。

Geth
Nethermind

修剪 Geth 意味着使主执行客户端离线以便它可以清理自己。 当这种情况发生时,Smartnode(和您的共识客户端)将需要其他方式来访问 ETH1 链以正常运行。

提供这一点的最简单方法是使用后备节点。 如果您已经使用 rocketpool service config 配置了后备节点,那么当您的 Geth 容器停机维护时,Smartnode 将自动切换到它。 它还会通知您的共识客户端使用后备节点。

警告

如果您没有配置后备节点,您的节点将在修剪过程中停止验证。 在完成并与网络重新同步之前,它将错过所有证明和区块提案。 在此期间,您将因错过验证而泄漏 ETH!

考虑到这一点,成功修剪 Geth 需要以下两个条件:

  • 配置了可用的后备节点
  • SSD 上至少剩余 50 GB 的可用空间

开始修剪

从下面的标签中选择您正在使用的客户端。

Geth
Nethermind

当您想要修剪 Geth 时,只需运行此命令:

rocketpool service prune-eth1

如果您没有启用后备客户端对,您将收到以下警告:

This will shut down your main execution client and prune its database, freeing up disk space.
Once pruning is complete, your execution client will restart automatically.

You do not have a fallback execution client configured.
Your node will no longer be able to perform any validation duties (attesting or proposing blocks) until Geth is done pruning and has synced again.
Please configure a fallback client with `rocketpool service config` before running this.
Are you sure you want to prune your main execution client? [y/n]

如果您确实启用了一个,您将看到以下提示:

This will shut down your main execution client and prune its database, freeing up disk space.
Once pruning is complete, your execution client will restart automatically.

You have fallback clients enabled. Rocket Pool (and your consensus client) will use that while the main client is pruning.
Are you sure you want to prune your main execution client? [y/n]

如果您接受,您将看到 Smartnode 准备过程的一些详细信息;它应该以成功消息结束:

Are you sure you want to prune your main ETH1 client? [y/n]
y

Your disk has 303 GiB free, which is enough to prune.
Stopping rocketpool_eth1...
Provisioning pruning on volume rocketpool_eth1clientdata...
Restarting rocketpool_eth1...

Done! Your main ETH1 client is now pruning. You can follow its progress with `rocketpool service logs eth1`.
Once it's done, it will restart automatically and resume normal operation.
NOTE: While pruning, you **cannot** interrupt the client (e.g. by restarting) or you risk corrupting the database!
You must let it run to completion!

这样,Geth 现在正在修剪,您已经完成了! 您可以使用以下命令跟踪其进度:

rocketpool service logs eth1

修剪完成后,它将自动重启,Smartnode 将恢复使用它而不是您的后备节点。