A simple two machine instance failover method is described here, which allows you to:
- upgrade your validator software with virtually no down time, and
- failover to the secondary instance when your monitoring detects a problem with the primary instance without any safety issues that would otherwise be associated with running two instances of your validator.
You will need two validator-class machines for your primary and secondary validator. A third machine for running an etcd cluster, which is used to store the tower voting record for your validator.
There is ample documentation regarding etcd setup and configuration at https://etcd.io/, please generally familiarize yourself with etcd before continuing.
It's recommended that etcd be installed on a separate machine from your primary and secondary validator machines. This machine must be highly available, and depending on your needs you may wish to configure etcd with more than just one node.
etcd as desired for your machine. Then TLS certificates must be
created for authentication between the etcd cluster and your validator. Here is
one way to do this:
With Golang installed, run
cfssl program should now be
~/go/bin is in your PATH by running
Now create a certificate directory and configuration file:
then create certificates for the etcd server and the validator:
Copy these files to your primary and secondary validator machines:
and these files to the machine running the etcd server:
With this configuration, both the validator and etdc will share the same TLS certificate authority and will each authenticate the other with it.
etcd with the following arguments:
curl to confirm the etcd TLS certificates are properly configured:
On success, curl will return a 404 response.
For more information on etcd TLS setup, please refer to https://etcd.io/docs/v3.5/op-guide/security/#example-2-client-to-server-authentication-with-https-client-certificates
The following additional
solana-validator parameters are required to enable
tower storage into etcd:
Note that once running your validator will terminate if it's not able to write its tower into etcd before submitting a vote transactioin, so it's essential that your etcd endpoint remain accessible at all times.
Configure the secondary validator like the primary with the exception of the
solana-validator command-line argument changes:
- Generate and use a secondary validator identity:
validator-keypair.jsonis the identity keypair for your primary validator)
When both validators are running normally and caught up to the cluster, a failover from primary to secondary can be triggered by running the following command on the secondary validator:
The secondary validator will acquire a lock on the tower in etcd to ensure voting and block production safely switches over from the primary validator.
The primary validator will then terminate as soon as it detects the secondary validator using its identity.
Note: When the primary validator restarts (which may be immediate if you have configured your primary validator to do so) it will reclaim its identity from the secondary validator. This will in turn cause the secondary validator to exit. However if/when the secondary validator restarts, it will do so using the secondary validator identity and thus the restart cycle is broken.
Monitoring of your choosing can invoke the
validator-keypair.json command mentioned in the previous section.
It is not necessary to guarantee the primary validator has halted before failing over to the secondary, as the failover process will prevent the primary validator from voting and producing blocks even if it is in an unknown state.
To perform a software upgrade using this failover method:
- Install the new software version on your primary validator system but do not restart it yet.
- Trigger a manual failover to your secondary validator. This should cause your primary validator to terminate.
- When your primary validator restarts it will now be using the new software version.
- Once the primary validator catches up upgrade the secondary validator at your convenience.