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
sudoprivileges:- Users with passwordless
sudowon't need to enter passwords during installation. - Users without passwordless
sudowill be prompted for passwords when needed.
- Users with passwordless
- For container deployment: regular users must be in the docker group (add with
sudo usermod -aG docker $USER).
Steps
Log in to the deployment node, navigate to the
kwdb_installdirectory and edit thedeploy.cfgfile.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=adminParameters:
Configuration Level Parameter Description global secure_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 kaiwudbby 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 theCPUQuotavalue in thekaiwudb.servicefile after the deployment is complete. Specifically, change any decimal values to integers (e.g., change180.0%to180%) to ensure the setting takes effect. For instructions, see CPU usage configuration.local local_node_ipThe IP address for client and application connection. The default listening address is 0.0.0.0, meaning the node will listen onkaiwudb_portacross all IP addresses on the host.cluster cluster_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. Grant execution permission to the
deploy.shscript.chmod +x ./deploy.shInstall the KWDB cluster.
For multi-replica clusters:
./deploy.sh install --multi-replicaFor single-replica clusters:
./deploy.sh install --single-replica
Reload the
systemddaemon configuration.systemctl daemon-reloadInitialize 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 -ior
./deploy.sh cluster --initVerify the cluster status.
./deploy.sh cluster -sor
./deploy.sh cluster --statusOutput fields:
Field Description 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_availableis_liveNode health indicators:
- If both aretrue, the node is considered healthy.
- If both arefalse, the node is considered non-functional.(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