User avatar
Gr33nDrag0n
Lisker
Posts: 123
Joined: Sat Mar 26, 2016 8:22 pm
Location: Quebec, Canada

HowTo: Make a Private Manual Snapshot (Updated 2016-11-20)

Sat Oct 15, 2016 4:50 am

I removed all the stuff with nginx to share the snapshots.
I removed all the stuff with cronjob for auto-snapshots.

The rest is the same guide but shorter/easier.

# Warning(s)

[list]
[*]Lisk v0.4.0+ is mandatory. Latest lisk.sh and lisk_snapshot.sh included in this version are required.
[*]This guide is assuming that you already are able to build a basic functional Lisk server.
[*]The snapshot server need a lisk client instance running and in sync. on the server.
[*]The snapshots are made from a second instance running in parallel.
[*]Both node instances will share the postgres service.
[*]Using the Lisk client as a forging server for delegate on same server not recommended.
[*]Do NOT use the Lisk client './public/' directory to host your backups.

# Users

I'm using the following users, adjust accordingly to your setup.

The "lisk" user is the user running lisk client.
It will need write permission in the target directory where the snapshots will be save.


# Directories

I'm using the following directories, adjust accordingly to your setup.
Do NOT use a sub-directory of Lisk client for 'shared backup directory'.
This will allow to keep it untouched and keep service online when updating Lisk client.

Lisk wallet directory ==> /opt/lisk/client/
Shared backup directory ==> /opt/lisk/backup/


Lisk Client - Create snapshot.json

Install jq using 'apt-get install jq' or 'yum install jq'

Adjust the path in 'mainconfig' & 'snapshotconfig' and run:

Code: Select all

mainconfig='/opt/lisk/client/config.json'
snapshotconfig='/opt/lisk/client/snapshot.json'

cp $mainconfig $snapshotconfig
jq '.port=9000' $snapshotconfig > tmp.$$.json && mv -f tmp.$$.json $snapshotconfig
jq '.version="9.9.9"' $snapshotconfig > tmp.$$.json && mv -f tmp.$$.json $snapshotconfig
jq '.minVersion="9.9.9"' $snapshotconfig > tmp.$$.json && mv -f tmp.$$.json $snapshotconfig
jq '.logFileName="logs/snapshot.log"' $snapshotconfig > tmp.$$.json && mv -f tmp.$$.json $snapshotconfig
jq '.loading.loadPerIteration=101' $snapshotconfig > tmp.$$.json && mv -f tmp.$$.json $snapshotconfig
jq '.db.database="lisk_snapshot"' $snapshotconfig > tmp.$$.json && mv -f tmp.$$.json $snapshotconfig
jq '.peers.list=[]' $snapshotconfig > tmp.$$.json && mv -f tmp.$$.json $snapshotconfig
jq '.ssl.enabled=false' $snapshotconfig > tmp.$$.json && mv -f tmp.$$.json $snapshotconfig


Test manual snapshot

For reference, this is lisk_snapshot.sh usage manual.

Code: Select all

Usage: lisk_snapshot.sh [-t <snapshot.json>] [-s <config.json>] [-b <backup directory>] [-d <days to keep>] [-r <round>] [-g]
 -t <snapshot.json>        -- config.json to use for validation
 -s <config.json>          -- config.json to create target database
 -b <backup directory>     -- Backup direcory
 -d <days to keep>         -- Days to keep backups
 -r <round>                -- Round height to snapshot at
 -g                        -- Make a copy of backup file named blockchain.db.gz


For manual execution, I like to work with two different SSH connections.

# Tab 1 - Adjust the paths and run:

Code: Select all

bash /opt/lisk/client/lisk_snapshot.sh -t /opt/lisk/client/snapshot.json -s /opt/lisk/client/config.json -b /opt/lisk/backup -d 3 -r highest -g


# Tab 2 - Adjust the path and run:

Code: Select all

tail -f /opt/lisk/client/logs/snapshot.log
Gr33nDrag0n | 194109334904015388L | Delegate | lisknode.io

Return to “Guides”

Who is online

Users browsing this forum: No registered users and 1 guest