OpenEthereum数据备份
数据导出
导出数据格式
openethereum [options] export blocks --format=[FORMAT] --from=[BLOCK] --to=[BLOCK] [FILE]
停止服务
# systemctl stop openethereum
导出数据
# ./openethereum --chain /usr/local/openethereum/node.json --config /usr/local/openethereum/node.toml --base-path /data/openethereum/node export blocks --from=0 --to=50000 node
Loading config file from /usr/local/openethereum/node.toml
2023-02-16 10:48:58 Not preparing block; cannot sign.
2023-02-16 10:48:58 Configured for Hashii using AuthorityRound engine
2023-02-16 10:49:00 #0
2023-02-16 10:49:01 #10000
2023-02-16 10:49:01 #20000
2023-02-16 10:49:01 #30000
2023-02-16 10:49:02 #40000
2023-02-16 10:49:02 #50000
2023-02-16 10:49:02 Export completed.
数据导入
导入数据格式
openethereum [options] import --format=[FORMAT] [FILE]
停止服务
# systemctl stop openethereum
导入数据
./openethereum --chain /usr/local/openethereum/node.json --config /usr/local/openethereum/node.toml --base-path /data/openethereum/node import node
2023-02-16 10:54:42 Not preparing block; cannot sign.
2023-02-16 10:54:42 Configured for Hashii using AuthorityRound engine
2023-02-16 10:54:42 Signal for switch to contract-based validator set.
2023-02-16 10:54:42 Initial contract validators: [0x884c9b21053196121cb3f6cc51da2665766d787c, 0x8513b289b60c978833e935ff59501266c5588855]
2023-02-16 10:54:45 Not preparing block; cannot sign.
2023-02-16 10:54:47 Syncing #26431 0x97f0…8c1f 5286.00 blk/s 0.0 tx/s 0.0 Mgas/s 0+21247 Qed 8 MiB chain 32 MiB queue
2023-02-16 10:54:51 Import completed in 9 seconds, 50000 blocks, 5322 blk/s, 0 transactions, 0 tx/s, 0 Mgas, 0 Mgas/s
查看节点数据同步
2023-02-16 11:12:17 Starting OpenEthereum/v3.3.4-stable-f2dd855-20220704/x86_64-linux-gnu/rustc1.62.0
2023-02-16 11:12:17 Keys path /data/openethereum/node/keys/hashii
2023-02-16 11:12:17 DB path /data/openethereum/node/chains/hashii/db/c30b5bb34be386bf
2023-02-16 11:12:17 State DB configuration: fast
2023-02-16 11:12:17 Operating mode: active
2023-02-16 11:12:17 Not preparing block; cannot sign.
2023-02-16 11:12:18 Configured for Hashii using AuthorityRound engine
2023-02-16 11:12:18 Listening for new connections on 0.0.0.0:8546.
2023-02-16 11:12:18 Removed existing file '/data/openethereum/node/jsonrpc.ipc'.
2023-02-16 11:12:18 Started prometeus metrics at http://0.0.0.0:3000/metrics
2023-02-16 11:12:20 Not preparing block; cannot sign.
2023-02-16 11:12:23 Public node URL: enode://d388dd4345f748d2b2fdfa6bdfb5a68f0de0a3c50d9eeeb29d39e8e3aec8c1fa2e7701bf519e69766b2ba2937ac7f365d31a26264499f91d3b3169bb7e952e37@172.16.1.11:30300
2023-02-16 11:12:33 Syncing #69300 0x1d58…05d1 1287.46 blk/s 0.0 tx/s 0.0 Mgas/s 0+26040 Qed LI:#95339 1/25 peers 7 MiB chain 39 MiB queue RPC: 0 conn, 5 req/s, 25 µs
2023-02-16 11:12:38 Syncing #89417 0x93b8…3338 4023.40 blk/s 0.0 tx/s 0.0 Mgas/s 0+24903 Qed LI:#114389 1/25 peers 13 MiB chain 38 MiB queue RPC: 0 conn, 5 req/s, 30 µs
2023-02-16 11:12:43 Syncing #109730 0x8133…d61c 4062.60 blk/s 0.0 tx/s 0.0 Mgas/s 0+25360 Qed LI:#135090 1/25 peers 13 MiB chain 38 MiB queue RPC: 0 conn, 4 req/s, 44 µs
2023-02-16 11:12:48 Syncing #129417 0x267d…2cb1 3937.40 blk/s 0.0 tx/s 0.0 Mgas/s 0+24748 Qed LI:#154267 1/25 peers 13 MiB chain 37 MiB queue RPC: 0 conn, 5 req/s, 31 µs
2023-02-16 11:12:53 Syncing #149820 0x775b…c21d 4080.60 blk/s 0.0 tx/s 0.0 Mgas/s 0+24514 Qed LI:#174333 1/25 peers 13 MiB chain 37 MiB queue RPC: 0 conn, 5 req/s, 30 µs
2023-02-16 11:12:58 Syncing #170156 0x85b9…9c4f 4067.20 blk/s 0.0 tx/s 0.0 Mgas/s 0+26149 Qed LI:#196304 1/25 peers 13 MiB chain 40 MiB queue RPC: 0 conn, 5 req/s, 34 µs
...
2023-02-16 11:23:29 Reorg to #500403 0xfd5f…4386 (0xe3d3…1d2d #500401 0x0731…d9ce 0xec6d…85e3)
2023-02-16 11:23:31 Imported #505594 0x2c66…437d (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:23:35 Imported #505595 0x9b4d…1706 (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:23:45 Imported #505596 0x1660…75e7 (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:23:55 Imported #505597 0x038c…3fa2 (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:23:59 2/25 peers 2 MiB chain 0 bytes queue RPC: 0 conn, 5 req/s, 39 µs
2023-02-16 11:24:05 Imported #505598 0x6c71…e79b (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
snapshot
快照格式
openethereum [options] snapshot --at=[BLOCK] <FILE>
openethereum [options] restore [FILE]
停止服务
# systemctl stop openethereum
生成快照
# ./openethereum --chain /usr/local/openethereum/node.json --config /usr/local/openethereum/node.toml --base-path /data/openethereum/node snapshot --at=50000 snapshot_data
Loading config file from /usr/local/openethereum/node.toml
2023-02-16 10:57:55 Not preparing block; cannot sign.
2023-02-16 10:57:55 Configured for Hashii using AuthorityRound engine
2023-02-16 10:57:55 Snapshots are currently experimental. File formats may be subject to change.
2023-02-16 10:57:55 Taking snapshot starting at block 50000
2023-02-16 10:57:55 Using 16 threads for Snapshot creation.
2023-02-16 10:57:55 produced 12 state chunks and 1 block chunks.
2023-02-16 10:57:55 Re-enabling pruning.
2023-02-16 10:57:55 snapshot creation complete
2023-02-16 10:58:00 Not preparing block; cannot sign.
还原快照
# ./openethereum --chain /usr/local/openethereum/node.json --config /usr/local/openethereum/node.toml --base-path /data/openethereum/node restore snapshot_data
Loading config file from /usr/local/openethereum/node.toml
2023-02-16 11:01:00 Not preparing block; cannot sign.
2023-02-16 11:01:00 Configured for Hashii using AuthorityRound engine
2023-02-16 11:01:00 Snapshot restoration is experimental and the format may be subject to change.
2023-02-16 11:01:00 On encountering an unexpected error, please ensure that you have a recent snapshot.
2023-02-16 11:01:00 Attempting to restore from snapshot at 'snapshot_data'
2023-02-16 11:01:00 Restoring to block #50000 (0x0xcc0c6609866eb64bd891b5d906e2b97e750e31fa08240fe28b3687900f5d071d)
2023-02-16 11:01:00 Restoring state
2023-02-16 11:01:00 Processed 0/12 state chunks and 0/1 block chunks.
2023-02-16 11:01:00 Restoring blocks
2023-02-16 11:01:00 First new block calculated: 0xcc0c6609866eb64bd891b5d906e2b97e750e31fa08240fe28b3687900f5d071d
2023-02-16 11:01:00 Migrated 0 ancient blocks
2023-02-16 11:01:00 Restoration complete.
查看节点数据同步
2023-02-16 11:02:20 Starting OpenEthereum/v3.3.4-stable-f2dd855-20220704/x86_64-linux-gnu/rustc1.62.0
2023-02-16 11:02:20 Keys path /data/openethereum/node/keys/hashii
2023-02-16 11:02:20 DB path /data/openethereum/node/chains/hashii/db/c30b5bb34be386bf
2023-02-16 11:02:20 State DB configuration: fast
2023-02-16 11:02:20 Operating mode: active
2023-02-16 11:02:20 Not preparing block; cannot sign.
2023-02-16 11:02:20 Configured for Hashii using AuthorityRound engine
2023-02-16 11:02:20 Downloading old blocks from 0x6448eef774303a2cf1f95c7ba02682f670ddca2dc30b5bb34be386bf9422990c (#0) till Some(0xcc0c6609866eb64bd891b5d906e2b97e750e31fa08240fe28b3687900f5d071d) (#Some(50000))
2023-02-16 11:02:20 Listening for new connections on 0.0.0.0:8546.
2023-02-16 11:02:20 Removed existing file '/data/openethereum/node/jsonrpc.ipc'.
2023-02-16 11:02:20 Started prometeus metrics at http://0.0.0.0:3000/metrics
2023-02-16 11:02:25 Not preparing block; cannot sign.
2023-02-16 11:02:25 Public node URL: enode://d388dd4345f748d2b2fdfa6bdfb5a68f0de0a3c50d9eeeb29d39e8e3aec8c1fa2e7701bf519e69766b2ba2937ac7f365d31a26264499f91d3b3169bb7e952e37@172.16.1.11:30300
2023-02-16 11:02:35 Syncing #50845 0xb0da…26f8 56.37 blk/s 0.0 tx/s 0.0 Mgas/s 0+26460 Qed Ancient:#0 LI:#77305 2/25 peers 244 KiB chain 40 MiB queue RPC: 0 conn, 3 req/s, 33 µs
2023-02-16 11:02:40 Syncing #71465 0xe582…53fc 4124.62 blk/s 0.0 tx/s 0.0 Mgas/s 0+24589 Qed Ancient:#0 LI:#96228 2/25 peers 7 MiB chain 37 MiB queue RPC: 0 conn, 2 req/s, 33 µs
2023-02-16 11:02:45 Syncing #91584 0xb9d8…038c 4023.80 blk/s 0.0 tx/s 0.0 Mgas/s 0+24710 Qed Ancient:#0 LI:#116294 2/25 peers 7 MiB chain 37 MiB queue RPC: 0 conn, 3 req/s, 36 µs
...
2023-02-16 11:17:51 Reorg to #500403 0xfd5f…4386 (0xe3d3…1d2d #500401 0x0731…d9ce 0xec6d…85e3)
2023-02-16 11:17:52 Imported #505560 0xe8fe…d112 (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:17:55 Imported #505561 0x30c0…df13 (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:18:05 Imported #505562 0x81b0…f52b (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:18:15 Imported #505563 0xa795…fe37 (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:18:21 Ancient:#254 AB:#254 2/25 peers 2 MiB chain 0 bytes queue RPC: 0 conn, 3 req/s, 54 µs
2023-02-16 11:18:25 Imported #505564 0xd43d…b997 (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:18:35 Imported #505565 0x8e9d…37c0 (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:18:45 Imported #505566 0xb05f…40e7 (0 txs, 0.00 Mgas, 0 ms, 0.57 KiB)
2023-02-16 11:18:51 Ancient:#254 AB:#254 2/25 peers 2 MiB chain 0 bytes queue RPC: 0 conn, 0 req/s, 37 µs