Download PDFSubmit Feedback

  • Prerequisites
  • Steps

Deploy Using Scripts

During deployment, the system verifies configuration files, runtime environment, hardware setup, and software dependencies. The installation will proceed with a warning if hardware requirements are not met, but will abort with error messages if required software dependencies are missing.

All deployment activities are logged in the log directory within kwdb_install. If an error occurs during deployment, you can find error prompts in the terminal output and detailed information in the log files.

Prerequisites

System Requirements:

  • All target nodes meet the requirements for hardware, operating system, and software dependencies.
  • Network requirements:
    • Network connectivity: All nodes are network-connected.
    • Location: All nodes are located in the same data center.
    • Ports: All required ports are open and accessible.
    • Network latency between machines: Less than 50 ms.
    • Clock synchronization between nodes: less than 500 ms.
  • The bare-metal or container installation package is obtained.

User Access Requirements:

  • SSH passwordless authentication configured between the deployment node and all cluster nodes.
  • One of the following user permissions:
    • Root user access
    • Regular user with sudo privileges:
      • Users with passwordless sudo won't need to enter passwords during installation.
      • Users without passwordless sudo will be prompted for passwords when needed.
    • For container deployment: regular users must be in the docker group (add with sudo usermod -aG docker $USER).

Steps

  1. Log in to the deployment node, navigate to the kwdb_install directory and edit the deploy.cfg file.

    Example:

    [global]
    secure_mode=tls
    management_user=kaiwudb
    rest_port=8080
    kaiwudb_port=26257
    brpc_port=27257    
    data_root=/var/lib/kaiwudb
    cpu=1
    
    [local]
    node_addr= local_node_ip
    
    [cluster]
    node_addr= cluster_node_ips
    ssh_port=22
    ssh_user=admin
    

    Parameters:

    Configuration LevelParameterDescription
    globalsecure_modeDefines the security mode. Options include:
    - insecure: Enables insecure mode.
    - tls: (Default) Enable secure mode. This generates TLS certificates for clients or application connections, stored in /etc/kaiwudb/certs.
    management_userThe user account for managing KWDB, set to kaiwudb by default. After installation, KWDB creates this user and a user group with the same name.
    rest_portPort for web services (default: 8080).
    kaiwudb_portPort for client, application and node connections (default: 26257).
    brpc_portThe brpc communication port between KWDB time-series engines, used for inter-node communication (default: 27257).
    data_rootData directory (default: /var/lib/kaiwudb).
    cpu(Optional) Specifies CPU usage for KWDB on the node. The default is unlimited. The value range is [0,1], with a precision of up to two decimal places. After deployment, you can also adjust the CPU resource limit for KWDB. For more information, see Configure Bare-Metal Cluster or Configure Container Deployment.
    Note: For bare-metal deployment, if the environment is Ubuntu 18.04, you need to modify the CPUQuota value in the kaiwudb.service file after the deployment is complete. Specifically, change any decimal values to integers (e.g., change 180.0% to 180%) to ensure the setting takes effect. For instructions, see CPU usage configuration.
    locallocal_node_ipThe IP address for client and application connection. The default listening address is 0.0.0.0, meaning the node will listen on kaiwudb_port across all IP addresses on the host.
    clustercluster_node_ipsThe IP addresses of remote nodes. The IP addresses of each node should be separated by commas (,), and there must be at least two remote nodes.
    ssh_portThe SSH port used for remote node access; it must be identical across all nodes.
    ssh_userThe SSH username for remote node login; it must be identical across all nodes.
  2. Grant execution permission to the deploy.sh script.

    chmod +x ./deploy.sh
    
  3. Install the KWDB cluster.

    • For multi-replica clusters:

      ./deploy.sh install --multi-replica
      
    • For single-replica clusters:

      ./deploy.sh install --single-replica
      
  4. Reload the systemd daemon configuration.

    systemctl daemon-reload
    
  5. Initialize and start the cluster.

    WARNING

    Multi-replica cluster initialization takes approximately 10 seconds. High availability features may not activate if nodes fail during this period.

    ./deploy.sh cluster -i
    

    or

    ./deploy.sh cluster --init
    
  6. Verify the cluster status.

    ./deploy.sh cluster -s
    

    or

    ./deploy.sh cluster --status
    

    Output fields:

    FieldDescription
    idNode ID.
    addressNode address.
    sql_addressSQL address.
    buildThe KWDB version running on the node.
    started_atThe date and time when the node was started.
    updated_atThe date and time when the node's status was last updated. When the node is healthy, a new status is recorded approximately every 10 seconds. If the node is unhealthy, the recorded status may be older.
    localityNode ID.
    start_modeThe startup mode of the node.
    is_available
    is_live
    Node health indicators:
    - If both are true, the node is considered healthy.
    - If both are false, the node is considered non-functional.
  7. (Optional) Enable KWDB to start automatically after a system reboot.

    Note

    KWDB startup may fail after system reboot if node time differs by >500 ms from other nodes. Ensure clock synchronization before manually starting KWDB if automatic startup fails.

    systemctl enable kaiwudb