Jump to content
FIBOS社区
Sign in to follow this  
huntformm

如何在fibos上创建快照和使用快照启动节点

Recommended Posts

本文介绍下如何通过快照启动FIBOS节点。
 
快照创建无需停止节点打包数据比备份数据更方便快捷。如果还不清楚如何启动一个fibos节点请参考 启动fibo节点
 
fibos版本 v1.4.1+
 
如何创建快照
 
1. 配置快照目录
 
       快照生成位置 config.data_dir 为根目录,可以配置
例1
config.data_dir = "./blockData/data"

fibos.load("producer", {
"snapshots-dir": "snapshots"
});

 

     那么快照生成位置为
     "./blockData/data/snapshots"
 
    例2 
config.data_dir = "./blockData/data"
fibos.load("producer", {
"snapshots-dir": "../snapshots"
});

 

    那么快照生成位置为
        "./blockData/snapshots"
 
2. 载入producer_api
fibos.load("producer_api");

 

3. 生成快照
 
curl http://127.0.0.1:8870/v1/producer/create_snapshot
 
例1 调用结果
{
"head_block_id":"00003070049e51276829f6d1020fa638e5428fc9f8b0532fc60f680d72359dbe",
"snapshot_name":"./blockData/data/snapshots/snapshot-00003070049e51276829f6d1020fa638e5428fc9f8b0532fc60f680d72359dbe.bin"
}

 

例2 调用结果
{
"head_block_id":"000006a4529a21b72b58c70c262fd3a754930d68b30b0b166f72fc1dbbc376e8",
"snapshot_name":"./blockData/data/./snapshots/snapshot-000006a4529a21b72b58c70c262fd3a754930d68b30b0b166f72fc1dbbc376e8.bin"
}

 

如何通过快照启动
 
1.配置快照文件路径
 
例1
fibos.load("chain", {
"snapshot": "./blockData/data/snapshots/snapshot-00003070049e51276829f6d1020fa638e5428fc9f8b0532fc60f680d72359dbe.bin"
});

 

例2
fibos.load("chain", {
"snapshot": "./blockData/snapshots/snapshot-00003070049e51276829f6d1020fa638e5428fc9f8b0532fc60f680d72359dbe.bin"
});

 

2.启动服务
 
fibos.start();
 
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×