Skip to content

Backup your keys v0.16.3(Docker version)

manikanta472 edited this page Oct 14, 2021 · 6 revisions

This tutorial applies to the below scenario you may find yourself in:

You are using docker to run the node

You want to backup your keys to a secure place, to avoid potential loss

  1. Go to your node folder in your local host
cd $OLDATA
ls

You will see result similar to below:

config.toml  consensus  consensus.log  keystore  nodedata
  1. Shutdown docker container
sudo docker ps

You will see result similar to below:

CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                                              NAMES
fba51ae2e889        e29e7560b874            "/usr/local/bin/full…"   20 minutes ago      Up 20 minutes       0.0.0.0:8000->80/tcp                                               happy_cray

Now shutdown the container, use the CONTAINER_ID from last step

sudo docker stop CONTAINER_ID

Check if docker container is shutdown

sudo docker ps

result in last step should gone

  1. backup all credential files
mkdir ~/olbackup
cd $OLDATA
sudo cp -r consensus/config ~/olbackup/config
sudo cp -r nodedata/accounts.db ~/olbackup/accounts.db

if there is keystore folder under $OLDATA:

sudo cp -r keystore ~/olbackup
cd ~

change the permission of the backup folder

sudo chmod -R 777 olbackup

compress the backup to a file

tar -cvf backup.tar olbackup
ls

you will see a file names backup.tar in current folder

after this, remove the folder:

rm -rf olbackup

and check if the backup.tar file can be successfully decompressed:

tar -xvf backup.tar

after this step, see if the files are there:

ls

you will see a folder names olbackup in current folder

cd olbackup
ls

you will see similar to below

accounts.db  config  keystore

and check if the structure is similar to below:

├── accounts.db
├── config
│   ├── addrbook.json
│   ├── genesis.json
│   ├── node_key.json
│   ├── priv_validator_key.json
│   └── priv_validator_key_ecdsa.json
└── keystore
    ├── OL_2020-09-11T17:39:36.888996000EDT_0lt2dfd011ba5e3c8186c76bec7dc09ca04d3d2bd59
    └── ...
  1. keep your credential files in an offline secure place

Clone this wiki locally