Transfer validator node to other server (no fn required)

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

  1. Clone the Aptos repo.

git clone https://github.com/aptos-labs/aptos-core.git

  1. cd into aptos-core directory.

cd aptos-core

  1. 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

  1. Install HA proxy recommend use manual by Sirouk or just send message to me and I will send this manual to you.

  2. 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

15 Likes

worked hard!

3 Likes

nice thanks you

4 Likes

Great Post! Helpful info for those that understand it. Thank you.

5 Likes

great detailed guide (if one of the validators suddenly has a problem with the server and he comes to this forum to find a way to solve it)

2 Likes

Thanks for great guide!

3 Likes

Thank you for sharing your detailed guide on transferring a validator node to another server. It’s great to see community members helping each other out. When performing such technical tasks, it’s crucial to ensure a smooth transition, and your instructions are quite comprehensive.
While you’re setting up your new server, you might want to consider reliable proxy services like LightningProxies to enhance the security and stability of your connection. Utilizing a trusted proxy can help maintain a consistent connection and safeguard your network during the transfer process.

It would be great to include a link here)

Asked about post it here permission from haproxy manual owner