Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加状态数据库snapshot支持 #13

Closed
secp256 opened this issue Jan 8, 2019 · 0 comments
Closed

增加状态数据库snapshot支持 #13

secp256 opened this issue Jan 8, 2019 · 0 comments

Comments

@secp256
Copy link
Contributor

secp256 commented Jan 8, 2019

支持在不停止witness_node的情况下,dump内存中的状态数据库, 也即object_databases
由于之前已经存在 plugin snapshot, 用于指定区块高度或者时间dump内存状态为文本格式。
现在将新的snapshot称为state snapshot

witness_node启动参数增加

--state-snapshot  从指定路径读取Snapshot State
--state-snapshots-dir 将状态数据库 dump 到指定路径,若启动时不带此参数,表示不支持state snapshot

可以通过http rpc的方法,生成对应的state snapshot,调用方法如下:
request:

curl --data '{"jsonrpc": "2.0", "method": "call", "params": [0, "create_snapshot", []], "id": 1}' http://127.0.0.1:28090

reponse:

{
	"id": 1,
	"jsonrpc": "2.0",
	"result": {
		"head_block_num": 10351013,
		"head_block_id": "009df1a5da85dd7d27cad64e174dab96db84ea27",
		"snapshot_dir": "~/snapshot-dir/object_database-009df1a5da85dd7d27cad64e174dab96db84ea27"
	}
}

该功能仅限本地使用,不建议API服务器开启。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant