Greetings, I would like to show another way to transfer a validator node to another server without using an intermediate full node server. This transfer was carried out about 2 months ago and is still working without any errors. To do this, we just need to copy all the contents of the current validator server to the new one. Turn off the current server and turn on the new one. Everything is very simple. Read on for more details on how to do this.
All actions are described for the source code for those who use docker, everything is similar except for a number of points, namely the files that you transfer, you need to install and transfer the docker to a new server with all its contents by default /var/lib/docker/. Sorry, I didn’t have a chance to test the docker port, so you need to do a test port for the full node, if everything works out according to this manual, do the port for the validator node as well.
For source code
Preparing a new server, installing the latest version of Ubuntu 22.04 at the time of writing
article.
Next, log in as root and perform the basic installation of applications
- Clone the Aptos repo.
git clone https://github.com/aptos-labs/aptos-core.git
- cd into aptos-core directory.
cd aptos-core
- Run the scripts/dev_setup.sh Bash script as shown below. This will prepare your developer environment.
chmod +x ./scripts/dev_setup.sh
./scripts/dev_setup.sh
-
Install HA proxy recommend use manual by Sirouk or just send message to me and I will send this manual to you.
-
Installing aptos-cli manual is better to use from the official site
Download CLI Binaries | Aptos Docs
After the installation is completed, let’s start copying the contents of the folder with the configuration files of the validator node, for me it looks like this
config
validator.yaml
genesis.blob
keys
private-keys.yaml
public-keys.yaml
validator-identity.yaml
p1xel32
operator.yaml
owner.yaml
waypoint.txt
Copy the default client initialization file, it is located in your user or root folder
# ls -la
14 user user 4096 Feb 2 18:27 .
19 user user 4096 Nov 16 10:06 ..
2 user user 4096 Dec 6 12:20 pm .aptos
We copy this content to a similar location on a new server. For this, I use SCP.
scp -r /local/directory remote_username@10.10.0.2:/remote/directory
Transfer the default node launch binary is /username/aptos-core/target/release/aptos-node
scp /local/directory remote_username@10.10.0.2:/remote/directory
Create a service file You need to change the path depending on where your node startup binary is
sudo tee /etc/systemd/system/aptos-validator.service > /dev/null <<EOF
[unit]
Description=aptos-validator daemon
After=network-online.target
[Service]
User=$USER
ExecStart=/username/aptos-core/target/release/aptos-node -f /home/mainnet/validator.yaml
Restart=on-failure
RestartSec=5
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable aptos-validator
sudo systemctl daemon-reload
In total, we copied the entire config folder, copied the initialization folder and prepared the service to run the node.
Everything is ready, then we need to switch about 30 minutes before the end of the epoch. You can easily check how much time you need by comparing database size and your upload speed to new validator node.
Big thanks to Alden Hu for pointing about correct db copying process
Stop your main validator node (old one) and copy entire database folder
We copy the contents of the database in a similar way, the default location for the database is /opt/aptos, we need to copy the entire aptos folder to a similar location. You can also see where you have the database in the validator.yaml file, you need to find the data_dir parameter: “/opt/aptos/data”
scp -r /local/directory remote_username@10.10.0.2:/remote/directory
After copying complete start the old node. Execute the command on main validator node, old one:
Big thanks to sherry for pointing correct command
aptos node update-validator-network-addresses \
--pool-address \
--validator-host ip:6180 \
--validator-network-public-key\
--operator-config-file /username/aptos/p1xel32/operator.yaml \
--profile mainnet-operator
Now stop old node.
On the new second server, start the service aptos
systemctl start aptos-validator
Check your node stat.
That’s all. All the best