Database Upgrade
This section covers upgrade procedures for KWDB database across different deployment scenarios, including upgrades using deployment scripts and container images.
Before upgrading, carefully review all precautions and select the appropriate upgrade method based on your deployment approach.
Upgrade Using Deployment Scripts
Due to major architectural refactoring in v3.0.0, v1.x and v2.x cannot be directly upgraded to v3.0.0.
Recommended upgrade approach:
- Deploy a new v3.0.0 version.
- Migrate data using the export and import functionality.
For instructions, see Data Export and Data Import.
Upgrade for Source Code Compilation
For KWDB instances installed by compiling from source code, you can upgrade by compiling the new version. This upgrade method is suitable for users with specific customization requirements who have compilation and deployment experience.
Prerequisites
- Completed data and configuration backup
- Downloaded new version source code
- Compilation environment and dependencies meet KWDB requirements
Steps
- Compile the new version following the KWDB compilation documentation.
- Start the service using the same startup command as the previous version.
- Verify that the service is running as expected.
Upgrade for Container Image Deployment
For KWDB deployed using Docker container images, upgrades are performed by updating the container image.
This section covers two upgrade methods:
- Upgrade using Docker Compose
- Upgrade using Docker commands
Upgrade Using Docker Compose
Prerequisites
- Data and configuration files have been backed up.
- The new version container image has been obtained.
Steps
Load the new container image:
docker load < KaiwuDB.tarStop and remove existing containers:
docker-compose downRemove the old version image:
docker rmi ${image_name}Update the image version in
docker-compose.yml.Start KWDB with the new version:
docker-compose up -d
Upgrade Using Docker Commands
Prerequisites
- Data and configuration files have been backed up.
Steps
Stop the KWDB container. The container name is the one specified by the
--nameparameter when running the container.docker stop <kwdb-container>Remove the container:
docker rm <kwdb-container>Obtain the new version image:
Pull from image repository:
docker pull kwdb/kwdb:<new_version_number>Import from local file:
docker load < KaiwuDB.tar
Start the new version container. All parameters should remain consistent with the original container except for the image name.
Insecure mode:
docker run -d --privileged --name kwdb \ --ulimit memlock=-1 \ --ulimit nofile=$max_files \ -p $db_port:26257 \ -p $http_port:8080 \ -v /var/lib/kaiwudb:/kaiwudb/deploy/kwdb-container \ --ipc shareable \ -w /kaiwudb/bin \ <kwdb_image> \ ./kwbase start-single-node \ --insecure \ --listen-addr=0.0.0.0:26257 \ --http-addr=0.0.0.0:8080 \ --store=/kaiwudb/deploy/kwdb-containerSecure mode:
docker run -d --privileged --name kwdb \ --ulimit memlock=-1 \ --ulimit nofile=$max_files \ -p $db_port:26257 \ -p $http_port:8080 \ -v /etc/kaiwudb/certs:<certs_dir> \ -v /var/lib/kaiwudb:/kaiwudb/deploy/kwdb-container \ --ipc shareable \ -w /kaiwudb/bin \ <kwdb_image> \ ./kwbase start-single-node \ --certs-dir=<certs_dir> \ --listen-addr=0.0.0.0:26257 \ --http-addr=0.0.0.0:8080 \ --store=/kaiwudb/deploy/kwdb-container