lotus 导出区块高度 最小快照

最小快照

screen -S chia
lotus chain export --recent-stateroots=901 --skip-old-msgs snapshot.car
  • 日志
  • lotus 区块高度导出 3个小时
# lotus --version
lotus version 1.14.1+mainnet+git.d2dca7b21
# cat daemon.log | grep export
2022-03-26T03:03:10.491Z	INFO	chainstore	store/snapshot.go:155	export started
2022-03-26T05:16:22.689Z	INFO	chainstore	store/snapshot.go:98	export	{"height": "1664640"}
2022-03-26T05:52:14.048Z	INFO	chainstore	store/snapshot.go:98	export	{"height": "0"}
2022-03-26T05:52:14.353Z	INFO	chainstore	store/snapshot.go:166	export finished	{"duration": 10143.861824855}

2022-05-01

  • 导出时间 5h
  • 61G May 1 15:21 snapshot.car
# cat daemon.log | grep export
2022-05-01T10:24:36.533+0800	INFO	chainstore	store/snapshot.go:155	export started
2022-05-01T14:33:11.063+0800	INFO	chainstore	store/snapshot.go:98	export	{"height": "1768320"}
2022-05-01T14:39:38.379+0800	INFO	chainstore	store/snapshot.go:98	export	{"height": "1765440"}

2022-05-01T15:21:56.781+0800	INFO	chainstore	store/snapshot.go:98	export	{"height": "0"}
2022-05-01T15:21:57.163+0800	INFO	chainstore	store/snapshot.go:166	export finished	{"duration": 17840.628867532}

2022-07-22

  • lotus v1.16.0
# lotus --version
lotus version 1.16.0+mainnet+git.01254ab32
  • 进入nvme盘目录
cd /seal/
screen -S chain
lotus chain export --recent-stateroots=901 --skip-old-msgs my-snapshot.car
-rw-r--r--  1 root root  67G Jul 21 18:23 my-snapshot.car
  • 导出时间 2h
# cat daemon.log | grep export
2022-07-21T16:32:52.944Z	INFO	chainstore	store/snapshot.go:171	export started
2022-07-21T18:09:27.684Z	INFO	chainstore	store/snapshot.go:103	export	{"height": "2001600"}
2022-07-21T18:09:29.491Z	INFO	chainstore	store/snapshot.go:103	export	{"height": "1998720"}
......
2022-07-21T18:23:57.698Z	INFO	chainstore	store/snapshot.go:103	export	{"height": "2880"}
2022-07-21T18:23:58.324Z	INFO	chainstore	store/snapshot.go:103	export	{"height": "0"}
2022-07-21T18:23:58.434Z	INFO	chainstore	store/snapshot.go:182	export finished	{"duration": 6665.490158174}

导入快照

lotus daemon stop
# mv datastore/ datastore_old
# mkdir datastore

# cd kvlog/metadata/
# mv 1633360978.log.cbor 1633360978.log.cbor_backup
lotus daemon --import-snapshot snapshot.car --halt-after-import

同步链

nohup lotus daemon >> /var/log/chain/daemon.log 2>&1 &

参考

  1. Creating a snapshot
  2. 导入导出同步数据裁剪快照
  3. lotus 链数据导入导出使用教程
  4. 压缩区块数据