Download PDFSubmit Feedback

  • Upgrade Using Deployment Scripts
  • Upgrade for Source Code Compilation
  • Upgrade for Container Image Deployment

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:

  1. Deploy a new v3.0.0 version.
  2. 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

Steps

  1. Compile the new version following the KWDB compilation documentationopen in new window.
  2. Start the service using the same startup command as the previous version.
  3. 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

  1. Load the new container image:

    docker load < KaiwuDB.tar
    
  2. Stop and remove existing containers:

    docker-compose down
    
  3. Remove the old version image:

    docker rmi ${image_name}
    
  4. Update the image version in docker-compose.yml.

  5. Start KWDB with the new version:

    docker-compose up -d
    

Upgrade Using Docker Commands

Prerequisites

  • Data and configuration files have been backed up.

Steps

  1. Stop the KWDB container. The container name is the one specified by the --name parameter when running the container.

       docker stop <kwdb-container>
    
  2. Remove the container:

       docker rm <kwdb-container>
    
  3. Obtain the new version image:

    • Pull from image repository:

         docker pull kwdb/kwdb:<new_version_number>
      
    • Import from local file:

         docker load < KaiwuDB.tar
      
  4. 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-container
      
    • Secure 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