Nodes Backup & Restore
If you’ve found your node failing due to some unexplained error, a clean docker image might remove the issue. But just downloading a new docker image would cause your node to lose the data it’s currently holding, making it susceptible to litigation and loss of tokens. So here we guide you through the process of how to reinstall your ot-node while keeping all the data necessary for your node to keep its jobs.
Make sure your node is running the latest version of ot-node. This tutorial downloads the latest version of the code and using different ot-node versions for backing up and restoring your node can cause issues
The first thing to do is to back up your files and store them outside your docker so that you can delete the container and install a new one. Run the following commands to create a backup
docker exec otnode node /ot-node/current/scripts/backup.js --configDir=/ot-node/data
docker cp otnode:/ot-node/backup ./
ls ./backup
These commands should show something similar to the following image

Please check the contents of the latest backup directory, indicated by the directory name (in the above case, the folder named
2020-03-20T09:10:28.059Z
. They should contain all of the files shown below.

⚠️Warning⚠️
DO NOT proceed unless the backup folder contains all of the files shown above. Contact support at [email protected] for guidance on backing up your node safely.
Now we can stop the container and download a new one. Run the following commands:
docker stop otnode
docker rm otnode
imageId=$(docker images | grep otnode | awk '{print $3}')
docker rmi $imageId
Now you’ve successfully removed your image, and can download a new one.Run the following command to download a new docker image
sudo docker create -i --log-driver json-file --log-opt max-size=1g --name=otnode -p 8900:8900 -p 5278:5278 -p 3000:3000 -v ~/.origintrail_noderc:/ot-node/.origintrail_noderc origintrail/ot-node:release_mainnet
Note
If you’re running a testnet node, just replace mainnet with testnet in the command. Also, thanks for helping us test new features, you rock! 🤘
The last thing to do is to put your backup into your new container.
Warning
Because of their opposite behaviour, ot-node restore process does not work well when the dataset pruning feature is enabled. Because of this, we strongly recommend disabling the dataset pruning feature before you run a node restore process, then re-enable the feature after the restore process has been completed.
The dataset pruning feature is disabled by default, but if you have it enabled you can see how to disable it in the configuration parameters section
Extract the restore script from the container with the following command
docker cp otnode:/ot-node/current/scripts/restore.sh ./
And now run it:
./restore.sh
That’s it! Your node should be running now, you can go ahead and see the logs by running:
docker logs otnode -f
If you’ve backed up your files in a different place or are using a custom directory for your data on the node, you can edit those in the restore script. Run the following command to see all the options for the restore command:
./restore.sh --help
Last modified 2yr ago