Ensuring that the Cardano node remains up-to-date is a critical responsibility for all stake pool operators. To facilitate a smooth and secure updating process, it is advisable to compile the cardano-node and cardano-cli binaries on a separate machine before uploading them to the block-producing server. This approach minimizes the downtime of the actual stake pool server and reduces the risk of encountering build issues during the update.
In certain scenarios, updating the cardano-node version may necessitate a chain replay. In such cases, it becomes essential to prepare not only the binaries but also a synchronized blockchain database on the separate machine. This pre-synced database can then be transferred to the block-producing server, enabling the node to resume operations without the need for a lengthy resynchronization from the genesis block.
1) Building and uploading the binaries
Start by building and uploading the new Cardano node and Cardano CLI binaries:
Download or build the new versions. Download the static binaries from https://github.com/input-output-hk/cardano-node/releases or clone the latest version of the Cardano node repository and compile the new versions of cardano-node and cardano-cli.
git checkout tags/<tag>
nix build .#hydraJobs.musl.cardano-node-linux
cd result
tar -xf cardano-node-x.x.x-linux.tar.gz
cp ./cardano-node ./cardan0-cli ~/.local/bin/
2) Database operations
If a chain replay is required, follow these steps to sync the node and prepare the database:
Sync the new node. Start and fully sync the new node with the blockchain on a separate machine. Ensure a clean shutdown of the node to preserve the integrity of the database.
Compress blockchain data. Once the new node has fully synced, compress the blockchain data into a tarball:
tar -czvf db.tar.gz ./db
Calculate SHA-256 hash. Generate the SHA-256 hash for the tarball:
sha256sum db.tar.gz > db.tar.gz.sha256
Transfer the database. Transfer the compressed blockchain data tarball, and the hash file to the ~/src directory on your block-producing server: