Skip to content
This repository has been archived by the owner on Mar 2, 2020. It is now read-only.

Update stuck node or Jumpstart chain sync

Nick Yeates edited this page Sep 18, 2019 · 30 revisions

The following commands are step by step instructions for Tomo masternode operators that can be used for two major use-cases:

  1. Fixing nodes that are stuck; evidenced by a node that stays on a block and doesn't progress
  2. Jumpstarting a newly setup masternode; avoid waiting a week for synchronization

Basically, you download a compressed version of the last-known "good" chaindata. This comes from Tomochain Ptd on a weekly basis. You remove the nodes old data and update it with the newly downloaded data. Finally you restart the sync-process from this known-good checkpoint.

Note: Assure that you have enough disk space for both the tar file AND its uncompressed contents. Double the space or more.

# Login as user that has access to tmn or docker-compose
# Download Tomo's chaindata archive (make sure you have enough disk space available)
wget https://chaindata.tomochain.com/20190813.tar -P /tmp

# Stop your node (for tmn users)
tmn stop
# OR in the node folder (for docker-compose users)
docker-compose stop

# Remove your nodes old data (for tmn users)
sudo rm -rf /var/lib/docker/volumes/$(docker volume ls -q)/_data/data/tomo/chaindata
# OR (for docker-compose users)
sudo rm -rf /var/lib/docker/volumes/$(docker volume ls -q)/_data/tomo/chaindata

# Extract the data (for tmn users)
# See below "Tip", if you can not wait for the extraction to finish
# See below "Troubleshoot", if you have issues running the command
sudo pv /tmp/20190813.tar | sudo tar x -C /var/lib/docker/volumes/$(docker volume ls -q)/_data/data/tomo/
# OR (for docker-compose users)
sudo pv /tmp/20190813.tar | sudo tar x -C /var/lib/docker/volumes/$(docker volume ls -q)/_data/tomo/

# Start your node back (for tmn users)
tmn start
# OR in the node folder (for docker-compose users)
docker-compose start

# If you're really running out of space, remove the tar file
# keeping it might be a good idea if you get stuck further before a new snapshot is released
rm /tmp/20190813.tar

Tip: Extract the data in background

    # In case you can not wait for the extraction to finish, you can run it in the background
    nohup tar xC /var/lib/docker/volumes/$(docker volume ls -q)/_data/data/tomo/ -f 20190813.tar &

    # Alternatively, use 'screen'
    # Run it in the background AND see its status AND avoid interruption from terminal closing
    screen
    sudo pv /tmp/20190813.tar | sudo tar x -C /var/lib/docker/volumes/$(docker volume ls -q)/_data/tomo/
    exit #if done
    screen -r #if disconnected from shell (gets back to background shell still operating)

Troubleshoot 'pv' command not found

    # Install pv utility on Ubuntu
    sudo apt install pv