-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1301 - Updated steps for moving a node #1303
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,68 +6,82 @@ title: Move a Node | |
|
||
This guide is for active validators who want to move their node to another machine. | ||
|
||
:::note | ||
|
||
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. | ||
|
||
::: | ||
|
||
## Swapping Keys with a Hot Backup | ||
|
||
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. | ||
|
||
1. Once a node is running (`current_node`), create a second node (`backup_node`) on another machine. These two nodes will run in parallel. | ||
2. When the `backup_node` is up to date, stop both nodes. | ||
3. Swap their associated keys. | ||
4. Restart the `backup_node`. | ||
2. When the `backup_node` is up to date, stop the `current_node`. | ||
3. Move the unit files at the DB level using `rsync`. This step allows moving the node with nearly zero rewards loss. | ||
4. Stop the `backup_node`. | ||
5. Swap keys on the `backup_node`, now the new validator. | ||
6. Restart the `backup_node`. | ||
7. Swap keys on the `current_node`, now the new backup. | ||
8. Restart the `current_node`. | ||
|
||
### Preparation for swapping | ||
|
||
Let both nodes synchronize to the tip of the blockchain. Keep the current validating node running with the original validator keyset. | ||
1. Let both nodes synchronize to the tip of the blockchain. Keep the current validating node running with the original validator keyset. | ||
|
||
Bond the `backup_node` and wait until rewards are issued. | ||
2. Bond the `backup_node` and wait until rewards are issued. | ||
|
||
To swap keys: | ||
3. Prepare to swap keys by following these steps: | ||
|
||
1. Create the following folder structure on both nodes under the `/etc/casper/validator_keys/` directory. | ||
2. Create subdirectories for the `current_node` and `backup_node`. | ||
3. Copy each node's keyset under the corresponding directories. | ||
- Create the following folder structure on both nodes under the `/etc/casper/validator_keys/` directory. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding steps and reformatting seems nicer to me. |
||
- Create subdirectories for the `current_node` and `backup_node`. | ||
- Copy each node's keyset under the corresponding directories. | ||
|
||
```bash | ||
/etc/casper/validator_keys/ | ||
├── public_key.pem | ||
├── public_key_hex | ||
├── secret_key.pem | ||
├── current_node | ||
│ ├── public_key.pem | ||
│ ├── public_key_hex | ||
│ └── secret_key.pem | ||
└── backup_node | ||
| ├── public_key.pem | ||
| ├── public_key_hex | ||
| └── secret_key.pem | ||
/etc/casper/validator_keys/ | ||
├── public_key.pem | ||
├── public_key_hex | ||
├── secret_key.pem | ||
├── current_node | ||
│ ├── public_key.pem | ||
│ ├── public_key_hex | ||
│ └── secret_key.pem | ||
└── backup_node | ||
| ├── public_key.pem | ||
| ├── public_key_hex | ||
| └── secret_key.pem | ||
``` | ||
|
||
This setup allows key swapping by running the `sudo -u casper cp * ../` command, as shown below. | ||
|
||
### Swapping the nodes | ||
|
||
On the `current_node`, run these commands: | ||
1. When the `backup_node` is up to date, stop the `current_node`. | ||
|
||
```bash | ||
sudo systemctl stop casper-node-launcher | ||
cd /etc/casper/validator_keys/backup_node | ||
sudo -u casper cp * ../ | ||
``` | ||
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`. | ||
|
||
On the `backup_node` (the future validator), run these commands: | ||
3. On the `backup_node`, run these commands to stop the node, swap keys, and restart the node: | ||
|
||
```bash | ||
sudo systemctl stop casper-node-launcher | ||
cd /etc/casper/validator_keys/current_node | ||
sudo -u casper cp * ../ | ||
sudo systemctl start casper-node-launcher | ||
``` | ||
```bash | ||
sudo systemctl stop casper-node-launcher | ||
cd /etc/casper/validator_keys/current_node | ||
sudo -u casper cp * ../ | ||
sudo systemctl start casper-node-launcher | ||
``` | ||
|
||
Restart the original validator node (`current_node`), which is now the new backup: | ||
4. On the `current_node`, run these commands to stop the node and swap keys: | ||
|
||
```bash | ||
sudo systemctl start casper-node-launcher | ||
``` | ||
```bash | ||
sudo systemctl stop casper-node-launcher | ||
cd /etc/casper/validator_keys/backup_node | ||
sudo -u casper cp * ../ | ||
``` | ||
|
||
5. Restart the original validator node (`current_node`), which is now the new backup: | ||
|
||
```bash | ||
sudo systemctl start casper-node-launcher | ||
``` | ||
|
||
### Understanding rewards impact | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a more detailed list here.