How to migrate a Flow node from one machine to another
There are a few different methods to migrate a running Flow node from one machine to the other.
Choose the method depending upon what part of the staking data of the node is changing.
If there is no change to the network address or the staking and networking keys and only the hardware the node is running needs to be changed then do the following:
- Stop the Flow node.
- Copy over the bootstrap data (typically under
/var/flow/bootstrap) which contains the node private key to the new machine.
- Copy over the data folder (typically under
/var/flow/data) which contains the state data.
- Start the new node on the same network address as the old one.
Please ensure that there is minimal downtime during this migration.
The network address is currently part of the staking data that was submitted for the node. It is how other nodes in the network discover this node. Hence, the network address of the node must stay the same between epochs otherwise the node will become unreachable for the other nodes and stop functioning.
A change to the node network address (IP or a hostname) can only be done during the spork process.
To change the networking address:
- A day before the upcoming mainnet spork, change the network address for the nodes in Flow Port (using the update network address feature). The change will not take effect till an epoch transition happens.
- Change the addresses in the
/var/flow/bootstrap/private-root-information/private-node-info_<nodeid>/node-info.priv.jsonjson file on the node.
- A spork also causes an epoch transition, and the new addresses will take effect after the spork immediately.
If the node after migration will be using new staking or networking keys then it needs to be unstaked and then re-staked with the new keys.
- Unstake the node via Flow Port.
- Register the new node via Flow Port with the new staking information.
- Run the new node with the new keys and network address. It should be able to join the network at the next epoch (see timing)
Unstaking a node will result in the node not earning rewards for the next epoch. Delegators to the old node will have their tokens unstaked automatically. They will also stop earning rewards unless they withdraw their unstaked tokens and delegate them to a different node.