Skip to content

Update 0G Storage KV Node

This guide details the procedure for updating an existing 0G Storage KV node. The process involves stopping the current service, backing up critical configuration files, fetching the latest source code from the official repository, and recompiling the binary.

Before updating, you must stop the active service and secure your existing config.toml to prevent data loss or configuration overwrites.

Run the following command to stop the node, create a backup of your configuration in the $HOME directory, and remove the old source directory:

Terminal window
sudo systemctl stop zgs-kv && \
cp $HOME/0g-storage-kv/run/config.toml $HOME/config.toml.backup && \
rm -rf $HOME/0g-storage-kv

Follow these steps to clone the specific version and compile the new release binary.

Clone the repository at the v1.2.0 tag and checkout the specific commit hash required for this release:

Terminal window
git clone -b v1.2.0 https://github.com/0glabs/0g-storage-kv.git
cd $HOME/0g-storage-kv
git stash
git fetch --all --tags
git checkout 97ba360
git submodule update --init

Build the optimized release version using Cargo. This step requires an active Rust environment:

Terminal window
cargo build --release

Once the build is complete, restore your previous settings and restart the service infrastructure.

Move your backed-up configuration file into the new project structure:

Terminal window
mv $HOME/config.toml.backup $HOME/0g-storage-kv/run/config.toml

Reload the systemd manager and restart the KV service:

Terminal window
sudo systemctl daemon-reload
sudo systemctl restart zgs-kv

Verify that the node has started correctly and is successfully communicating with the storage node and blockchain RPC:

Terminal window
sudo journalctl -u zgs-kv.service -f -o cat
  • Service Status: Ensure the service shows as active (running) via systemctl status zgs-kv.
  • Version Check: Confirm the logs reflect the updated logic or versioning.
  • Connectivity: Ensure no “Connection Refused” errors appear regarding the zgs_node_urls.