You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versioned_docs/version-2.0.0/operators/maintenance/moving-node.md
+83-47Lines changed: 83 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,91 +6,127 @@ title: Move a Node
6
6
7
7
This guide is for active validators who want to move their node to another machine.
8
8
9
-
:::note
9
+
## Setup two nodes running in parallel
10
10
11
-
Starting with node version 1.5, operators need to move the unit files at the database level. This step allows moving the node with nearly zero rewards loss.
11
+
This method limits downtime and enables a smooth transition from the old to the new node. It keeps the node in sync with the tip of the chain.
12
12
13
-
:::
13
+
Existing node should be running and in sync with network. We will call this `old node`. It is using your active `validator key`.
14
+
Create a second node (`new node`) on another machine. This should sync with the network as `ttl`. This server needs a new key when started, we will call this `backup key`.
14
15
15
-
## Swapping Keys with a Hot Backup
16
+
Important: You NEVER want to run two nodes using the same validator key. Our swap procedure will always stop a node running validator key first.
16
17
17
-
This method limits downtime and enables a smooth transition from the old to the new node. It keeps the node in sync with the tip of the chain.
18
+
### Preparation of keys on both nodes
18
19
19
-
1. Once a node is running (`current_node`), create a second node (`backup_node`) on another machine. These two nodes will run in parallel.
20
-
2. When the `backup_node` is up to date, stop the `current_node`.
21
-
3. Move the unit files at the DB level using `rsync`. This step allows moving the node with nearly zero rewards loss.
22
-
4. Stop the `backup_node`.
23
-
5. Swap keys on the `backup_node`, now the new validator.
24
-
6. Restart the `backup_node`.
25
-
7. Swap keys on the `current_node`, now the new backup.
26
-
8. Restart the `current_node`.
27
-
28
-
### Preparation for swapping
29
-
30
-
1. Let both nodes synchronize to the tip of the blockchain. Keep the current validating node running with the original validator keyset.
31
-
32
-
2. Prepare to swap keys by following these steps:
20
+
Prepare to swap keys by following these steps:
33
21
34
22
- Create the following folder structure on both nodes under the `/etc/casper/validator_keys/` directory.
35
-
- Create subdirectories for the `current_node` and `backup_node`.
23
+
- Create subdirectories for the `validator` and `backup`.
36
24
- Copy each node's keyset under the corresponding directories.
37
25
38
26
```bash
39
27
/etc/casper/validator_keys/
40
28
├── public_key.pem
41
29
├── public_key_hex
42
30
├── secret_key.pem
43
-
├── current_node
31
+
├── validator
44
32
│ ├── public_key.pem
45
33
│ ├── public_key_hex
46
34
│ └── secret_key.pem
47
-
└── backup_node
35
+
└── backup
48
36
| ├── public_key.pem
49
37
| ├── public_key_hex
50
38
| └── secret_key.pem
51
39
```
52
40
41
+
By having both keys available, we can swap back if we have any issues.
42
+
53
43
This setup allows key swapping by running the `sudo -u casper cp * ../` command, as shown below.
54
44
55
-
### Swapping the nodes
45
+
After creating the keys, check and fix file permissions by running `casper-node-util check_premissions` and use `sudo casper-node-util fix_permissions` if needed.
46
+
47
+
### Swapping the keys
56
48
57
-
1. When the `backup_node` is up to date, stop the `current_node`.
49
+
To swap keys, we want the node to be stopped first.
58
50
59
-
2. On the `backup_node` (the future validator), use `rsync` to move the unit files from the `current_node`, located in `/var/lib/casper/casper-node/[NETWORK_NAME]/unit_files`.
51
+
```bash
52
+
sudo /etc/casper/node_util.py stop
53
+
```
60
54
61
-
3. On the `backup_node`, run these commands to stop the node, swap keys, and restart the node:
55
+
To enable a node to run as validator, we want to copy keys from `validator` directory.
62
56
63
-
```bash
64
-
sudo systemctl stop casper-node-launcher
65
-
cd /etc/casper/validator_keys/current_node
57
+
```bash
58
+
cd /etc/casper/validator_keys/validator
66
59
sudo -u casper cp * ../
67
-
sudo systemctl start casper-node-launcher
68
-
```
60
+
```
69
61
70
-
4. On the `current_node`, run these commands to stop the node and swap keys:
62
+
To enable a node to run as backup, we want to copy keys from `backup` directory.
71
63
72
-
```bash
73
-
sudo systemctl stop casper-node-launcher
74
-
cd /etc/casper/validator_keys/backup_node
64
+
```bash
65
+
cd /etc/casper/validator_keys/backup
75
66
sudo -u casper cp * ../
76
-
```
67
+
```
68
+
69
+
### Timing of swap for consensus
70
+
71
+
With Zug consensus, all needed state is persisted to the DB. This allows full network resume if all validators were stopped and started again. This does not
72
+
allow moving consensus state as easy as moving unit_files. We are working on a utility to export this and allow importing on new node.
77
73
78
-
5. Restart the original validator node (`current_node`), which is now the new backup:
74
+
If a node is moved without this data and started too soon, we get a situation where the new node signs blocks previously signed. This causes issues.
79
75
80
-
```bash
81
-
sudo systemctl start casper-node-launcher
82
-
```
76
+
The best method to swap currently uses the Era boundaries to isolate finality signature sending.
83
77
84
-
### Understanding rewards impact
78
+
This will describe how to manually find the last switch block time.
85
79
86
-
After swapping, the new validator node shows no round length until an era transition occurs and will lose all rewards from the point of the switch until the end of that era. The validator is not ejected but will receive rewards starting with the next era.
80
+
We will use the `get-era-summary` command in the `casper-client` to find the last switch block. Then get the block to find the time.
81
+
The commands will be shown separated, in case the give errors. If everything works, the single command at the end will give you the time.
0 commit comments