|
| 1 | +--- |
| 2 | +id: failover-node-instruction |
| 3 | +title: Failover/backup node instruction |
| 4 | +sidebar_label: Failover/backup node instruction |
| 5 | +sidebar_position: 10 |
| 6 | +--- |
| 7 | + |
| 8 | +# How to set up Failover/Backup node |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +There are two main ways to set up a failover node, each with its own pros and cons. Read through both options and choose the one that works best for your situation. |
| 13 | + |
| 14 | +**Option 1** is best if you need a failover node that can also serve as an RPC node, or if you need one failover node for multiple validators. However, it requires a restart when the failover node becomes a validator. |
| 15 | + |
| 16 | +**Option 2** is best for minimizing downtime, as the failover happens almost instantly. However, the failover node must be dedicated to a single validator and cannot serve as an RPC node. |
| 17 | + |
| 18 | +### Important Note |
| 19 | + |
| 20 | +* Once a node becomes a validator node and begins tracking a specific shard, it cannot be reverted to track all shards. |
| 21 | +* During the failover process, a node operator may lose one RPC node when the node transitions to a validator node (option 1). This is a known issue, and it is on the team's roadmap for resolution. |
| 22 | + |
| 23 | +### [Option 1] RPC node as a failover node |
| 24 | + |
| 25 | +This is the traditional [recovery plan](https://near-nodes.io/troubleshooting/common-errors) which has been available on the mainnet, where you have a primary validator node and a secondary failover node. |
| 26 | + |
| 27 | +#### Pros |
| 28 | + |
| 29 | +* It is possible to use an RPC node as a failover node. |
| 30 | +* Failover node can be used for multiple validator nodes, each tracking different shards. |
| 31 | + |
| 32 | +#### Cons |
| 33 | + |
| 34 | +* A restart of neard is required before a failover node can be promoted to a new validator node. |
| 35 | + |
| 36 | +#### Setup for the failover node while it is on standby |
| 37 | + |
| 38 | +In `config.json` |
| 39 | +* Set `tracked_shards` to `[0]` |
| 40 | +* Set `store.load_mem_tries_for_tracked_shards` to `false` |
| 41 | + |
| 42 | +#### Procedure |
| 43 | + |
| 44 | +* Copy `validator_key.json` to the failover node. |
| 45 | +* In `config.json` file of the failover node: |
| 46 | + * Set `tracked_shards` to `[]` |
| 47 | + * Set `store.load_mem_tries_for_tracked_shards` to `true` |
| 48 | +* **Note**: You don’t need to swap the `node_key.json` file on the failover node. The network identifies nodes by their key and IP address, so changing the IP address might prevent successful syncing. |
| 49 | +* Stop the primary validator node. |
| 50 | +* Restart the failover node. |
| 51 | + |
| 52 | +### [Option 2] Validator key hot swap |
| 53 | + |
| 54 | +This method allows you to quickly transfer the validator key to the failover node with very little downtime. |
| 55 | + |
| 56 | +#### Pros |
| 57 | + |
| 58 | +* No need to restart the failover node during transition. |
| 59 | +* Failover can happen in seconds, minimizing downtime. |
| 60 | + |
| 61 | +#### Cons |
| 62 | + |
| 63 | +* The failover node cannot be used as an RPC node while it is on standby. |
| 64 | +* The failover node is dedicated to just one validator node. |
| 65 | + |
| 66 | +#### Setup for the failover node while it is on standby |
| 67 | + |
| 68 | +* In `config.json` |
| 69 | + * Add `“tracked_shadow_validator”: “<validator_id>”` (where `<validator_id>` is the pool ID of the validator). |
| 70 | + * Set `tracked_shards` to `[]`. |
| 71 | + * Set `store.load_mem_tries_for_tracked_shards` to `true`. |
| 72 | +* **Note**: The failover node must be dedicated to a single validator and cannot be used as an RPC node during failover. Since mem_trie doesn’t work well with RPC nodes, the failover node won’t be able to perform RPC functions. |
| 73 | + |
| 74 | +#### Procedure |
| 75 | + |
| 76 | +With the changes made to the `config.json` file and the validator key hot swap procedure, the failover node can quickly take over validator responsibilities. |
| 77 | +* Copy `validator_key.json` to the failover node. |
| 78 | +* [Optional] Remove `“tracked_shadow_validator”: “<validator_id>”` from `config.json` file of the failover node. |
| 79 | +* **Note**: You don’t need to swap the `node_key.json` file on the failover node. The network identifies nodes by their key and IP address, so changing the key might prevent successful syncing. |
| 80 | +* Stop the primary node. |
| 81 | +* Send a `SIGHUP` signal to the failover node (without restarting it). |
| 82 | +* The failover node will pick up the validator key and start validating. |
| 83 | + |
0 commit comments