参考
https://github.com/EOSIO/eos/issues/5107
正文
最近弄了一台服务器来同步eos 主网的数据, 但是在同步过程中老是会莫名其妙的停掉, 通过查日志发现了一些端倪.
我启动节点是用的nohup 启动的, 所以我查看了最近200调日志
tail -n 200 nohup.out
发现了这样一句话:
Database has reached an unsafe level of usage,
shutting down to avoid corrupting the database.
Please increase the value set for "chain-state-db-size-mb" and restart the process!
Details: 3060101 database_guard_exception: Database usage is at unsafe levels
database free: 134215280, guard size: 134217728
{"f":134215280,"g":134217728}
thread-0 controller.cpp:1627 validate_db_available_size
shutdown..
很明确, 原来是EOS 程序 因为数据库尺寸达到了危险指标, 所以自己退出了.
然而我的机器有6TB 磁盘空间, mongodb随便它用….
从日志中可以看出需要将 chain-state-db-size-mb 设置大一点才行, 不过这个值要设置多大才合适呢?
我不知道, 我直接多加了个0就是了…
以下是我修改部分的配置
# Maximum size (in MiB) of the chain state database (eosio::chain_plugin)
chain-state-db-size-mb = 10240
# Safely shut down node when free space remaining in the chain state database drops below this size (in MiB). (eosio::chain_plugin)
chain-state-db-guard-size-mb = 100
# Maximum size (in MiB) of the reversible blocks database (eosio::chain_plugin)
reversible-blocks-db-size-mb = 10240
# Safely shut down node when free space remaining in the reverseible blocks database drops below this size (in MiB). (eosio::chain_plugin)
reversible-blocks-db-guard-size-mb = 20
中文版:
# 用于存储链状态的数据库尺寸,以兆为单位
chain-state-db-size-mb = 10240
# 用于存储链状态的数据库尺寸低于多少兆时安全的退出节点
chain-state-db-guard-size-mb = 100
# 用于存储不可逆的区块数据 的 数据库尺寸,以兆为单位
reversible-blocks-db-size-mb = 10240
# 用于存储不可逆区块的数据库尺寸低于多少兆时安全的退出节点
reversible-blocks-db-guard-size-mb = 100