Copying a Matrix Node Database

technical-docs-docker

DisarmmSource: https://medium.com/@disarmm/copying-a-matrix-node-database-aba2ec7f3c2e

This is fairly straight forward and the tldr is you just copy the whole thing and delete the nodekey and update the wallet files.

First of all, this works on windows and linux machines, but I’ve mostly done it on linux and that’s where the screenshots will be from. You can copy to/from linux to windows, but the gman program is operating specific so if you copy between linux and windows you have to download the correct gman file from the matrix github.

Locate the parent directory where you have all of your matrix files. You should see these files on linux.


contents of /mnt/data/originalNode

You must stop your node before copying.

Copy your old node files into your a new node directory, assuming /mnt/data/originalNode is your first node. I like using rsync because if it gets interrupted you can restart it where it left off and these nodes have a lot of data in them. It has saved me many times.
rsync -av /mnt/data/originalNode /mnt/data/newNode
make sure you type it exactly like that. if you type an extra / at the end of the destination path it will produce different copy behavior.

Once it has finished copying, you need to update the wallet address and password in the signAccount.json file and then you need to add the correct wallet file in the keystore directory. The last thing would be to
cd /mnt/data/newNode/gman
and then
rm nodekey
It is important to delete the nodekey file. the nodekey is basically like an ID or a street address. Imagine if you built a new house right next to yours and you copied everything down to the address number on the house/mailbox. How would everyone else know which house was which?

Then you start your new node from the new directory. It will create a new nodekey for you when you start and you should be using your new wallet. This is mostly for copying from one server to another, or if you are using my docker setup and need to copy from one node to another rather than spend days syncing.

Be the first to comment on "Copying a Matrix Node Database"

Leave a comment

Your email address will not be published.


*


Scroll Up