Update 0G Storage KV Node
Overview
Section titled “Overview”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.
Preparation and Backup
Section titled “Preparation and Backup”Before updating, you must stop the active service and secure your existing config.toml to prevent data loss or configuration overwrites.
Stop Service and Backup Config
Section titled “Stop Service and Backup Config”Run the following command to stop the node, create a backup of your configuration in the $HOME directory, and remove the old source directory:
sudo systemctl stop zgs-kv && \cp $HOME/0g-storage-kv/run/config.toml $HOME/config.toml.backup && \rm -rf $HOME/0g-storage-kvUpdate and Build Source
Section titled “Update and Build Source”Follow these steps to clone the specific version and compile the new release binary.
Fetch Latest Code
Section titled “Fetch Latest Code”Clone the repository at the v1.2.0 tag and checkout the specific commit hash required for this release:
git clone -b v1.2.0 https://github.com/0glabs/0g-storage-kv.gitcd $HOME/0g-storage-kvgit stashgit fetch --all --tagsgit checkout 97ba360git submodule update --initCompile Binary
Section titled “Compile Binary”Build the optimized release version using Cargo. This step requires an active Rust environment:
cargo build --releaseConfiguration Restore and Restart
Section titled “Configuration Restore and Restart”Once the build is complete, restore your previous settings and restart the service infrastructure.
Restore Configuration
Section titled “Restore Configuration”Move your backed-up configuration file into the new project structure:
mv $HOME/config.toml.backup $HOME/0g-storage-kv/run/config.tomlRestart Service
Section titled “Restart Service”Reload the systemd manager and restart the KV service:
sudo systemctl daemon-reloadsudo systemctl restart zgs-kvPost-Update Verification
Section titled “Post-Update Verification”Monitor Node Logs
Section titled “Monitor Node Logs”Verify that the node has started correctly and is successfully communicating with the storage node and blockchain RPC:
sudo journalctl -u zgs-kv.service -f -o catVerification Checklist
Section titled “Verification Checklist”- Service Status: Ensure the service shows as
active (running)viasystemctl 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.