EOS状态历史节点可以使用快照方式来启动。
nodeos \
--plugin eosio::producer_api_plugin \
--plugin eosio::chain_api_plugin \
--plugin eosio::http_plugin \
--http-server-address 0.0.0.0:8889 \
--p2p-peer-address 127.0.0.1:9876 \
--p2p-listen-endpoint 0.0.0.0:9877 \
--plugin eosio::state_history_plugin --disable-replay-opts --trace-history --chain-state-history \
--resource-monitor-space-threshold 99 \
--data-dir /eos/data \
--snapshot /eos/data/snapshots/snapshot-00003153b2377b4eea65880311b6aaec4731b64990db594f063e67d78cf95615.bin \
--delete-all-blocks
state-history目录中的文件会记录snapshot的时间之后的状态历史
chain_state_history.log
trace_histor y.log
--delete-all-blocks用来清空blocks和state目录下的文件,但不会清理state-history的文件。
用快照启动状态历史节点,会自动追加更新state-history下的日志文件,不必手工删除。如果删除则只会包含snapshot之后的数据。
Troubleshoot
- --snapshot is incompatible with --genesis-json and --genesis-timestamp as the snapshot contains genesis information
注意不能同时配置“genesis-json”和“genesis-timestamp”两项,因为快照中已经存在这两项的值,会发生冲突,因为snapshot中已经包含了genesis信息。