3. Syncing DB

Validator Nodes

This document introduces another centralized fast state syncing method using rclone. Please use it with caution. This guide is mainly used for a newly started node to catch up with the blockchain faster. Otherwise, the blockchain syncing may take weeks from genesis block.

Rclone db snapshot is sync'ed with blockchain frequently. However, there maybe a potential race condition when the rclone may fail due to our nodes were updating the db files at the same time. In this case, just re-run the rclone command to re-sync again.

1. Installing Rclone

For installing Rclone, please follow the instructions at https://rclone.org.

on a Linux system, you may run the following command.

curl https://rclone.org/install.sh | sudo bash

Make sure your rclone version is above v1.53.2 . you can check version by rclone version

2. Configuring Rclone

To check the location of the rclone.conffile run:

rclone config file

The rclone.conf file is usually located at ~/.config/rclone/rclone.conf .

Now run the following command to create the rclone.conf file.

cat<<-EOF > ~/.config/rclone/rclone.conf
[mainnet]
type = google cloud storage
object_acl = publicRead
bucket_acl = publicRead
location = eu
storage_class = MULTI_REGIONAL
anonymous = true

[testnet]
type = google cloud storage
object_acl = publicRead
bucket_acl = publicRead
location = asia
storage_class = MULTI_REGIONAL
anonymous = true
EOF

3. Running Rclone

Below is the command to sync shard 0:

rclone -P -L --checksum sync mainnet:posichain-mainnet-data/posichain-node-vo001/posichain_db_0 posichain_db_0 --multi-thread-streams 4 --transfers=32

If you encounter the following error:

NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults

Add the option --config=/path/to/your/rclone.conf to the command line.

After the sync, you may use du -h posichain_db_* command to check the size of the downloaded snapshots.

-P will display a download progress & ETA.

Non-Validating/Explorer Nodes

To sync your node in archival mode, run the following command. Depending on the size, the syncing of the blockchain will take quite some time.

rclone -P -L --checksum sync mainnet:posichain-mainnet-data/posichain-node-a001/posichain_db_0 posichain_db_0 --multi-thread-streams 4 --transfers=32

Last updated