IoTDB supports registering ConfigNode, DataNode, and AINode as Linux system services via the three scripts daemon-confignode.sh, daemon-datanode.sh, and daemon-ainode.sh. Combined with the system-built systemctl command, it manages the IoTDB cluster in daemon mode, enabling more convenient startup, shutdown, restart, and auto-start on boot operations, and improving service stability.
Note: This feature is available starting from version 2.0.9-beta.
| Item | Specification |
|---|---|
| OS | Linux (supports the systemctl command) |
| User Privilege | root user |
| Environment Variable | JAVA_HOME must be set before deploying ConfigNode and DataNode |
Enter the IoTDB installation directory and execute the corresponding daemon script:
# Register ConfigNode service ./tools/ops/daemon-confignode.sh # Register DataNode service ./tools/ops/daemon-datanode.sh # Register AINode service ./tools/ops/daemon-ainode.sh
During script execution, you will be prompted with two options:
After script execution, the corresponding service files will be generated in the /etc/systemd/system/ directory:
iotdb-confignode.serviceiotdb-datanode.serviceiotdb-ainode.serviceAfter service registration, you can use systemctl commands to start, stop, restart, check status, and configure auto-start on boot for each IoTDB node service. All commands below must be executed as the root user.
# Start ConfigNode service systemctl start iotdb-confignode # Start DataNode service systemctl start iotdb-datanode # Start AINode service systemctl start iotdb-ainode
# Stop ConfigNode service systemctl stop iotdb-confignode # Stop DataNode service systemctl stop iotdb-datanode # Stop AINode service systemctl stop iotdb-ainode
After stopping the service, check the service status. If it shows inactive (dead), the service has been shut down successfully. For other statuses, check IoTDB logs to analyze exceptions.
# Check ConfigNode service status systemctl status iotdb-confignode # Check DataNode service status systemctl status iotdb-datanode # Check AINode service status systemctl status iotdb-ainode
Status Description:
active (running): Service is running. If this status persists for 10 minutes, the service has started successfully.failed: Service startup failed. Check IoTDB logs for troubleshooting.Restarting a service is equivalent to stopping and then starting it. Commands are as follows:
# Restart ConfigNode service systemctl restart iotdb-confignode # Restart DataNode service systemctl restart iotdb-datanode # Restart AINode service systemctl restart iotdb-ainode
# Enable ConfigNode auto-start on boot systemctl enable iotdb-confignode # Enable DataNode auto-start on boot systemctl enable iotdb-datanode # Enable AINode auto-start on boot systemctl enable iotdb-ainode
# Disable ConfigNode auto-start on boot systemctl disable iotdb-confignode # Disable DataNode auto-start on boot systemctl disable iotdb-datanode # Disable AINode auto-start on boot systemctl disable iotdb-ainode
[Unit], [Service], and [Install] sections in the daemon-xxx.sh script. For details of configuration items, refer to the next section.daemon-xxx.sh script.xx.service file in /etc/systemd/system.systemctl daemon-reload.daemon-xxx.sh Configuration Items[Unit] Section (Service Metadata)| Item | Description |
|---|---|
| Description | Service description |
| Documentation | Link to the official IoTDB documentation |
| After | Ensures the service starts only after the network service has started |
[Service] Section (Service Runtime Configuration)| Item | Meaning |
|---|---|
| StandardOutput, StandardError | Specify storage paths for service standard output and error logs |
| LimitNOFILE=65536 | Set the maximum number of file descriptors, default value is 65536 |
| Type=simple | Service type is a simple foreground process; systemd tracks the main service process |
| User=root, Group=root | Run the service with root user and group permissions |
| ExecStart / ExecStop | Specify the paths of the service startup and shutdown scripts respectively |
| Restart=on-failure | Automatically restart the service only if it exits abnormally |
| SuccessExitStatus=143 | Treat exit code 143 (128+15, normal termination via SIGTERM) as a successful exit |
| RestartSec=5 | Interval between service restarts, default 5 seconds |
| StartLimitInterval=600s, StartLimitBurst=3 | Maximum 3 restarts within 10 minutes (600 seconds) to prevent excessive resource consumption from frequent restarts |
| RestartPreventExitStatus=SIGKILL | Do not auto-restart the service if killed by the SIGKILL signal, avoiding infinite restart of zombie processes |
[Install] Section (Installation Configuration)| Item | Meaning |
|---|---|
| WantedBy=multi-user.target | Start the service automatically when the system enters multi-user mode |
.service File Format[Unit] Description=iotdb-confignode Documentation=https://iotdb.apache.org/ After=network.target [Service] StandardOutput=null StandardError=null LimitNOFILE=65536 Type=simple User=root Group=root Environment=JAVA_HOME=$JAVA_HOME ExecStart=$IoTDB_SBIN_HOME/start-confignode.sh Restart=on-failure SuccessExitStatus=143 RestartSec=5 StartLimitInterval=600s StartLimitBurst=3 RestartPreventExitStatus=SIGKILL [Install] WantedBy=multi-user.target
Note: The above is the standard format of the iotdb-confignode.service file. The formats of iotdb-datanode.service and iotdb-ainode.service are similar.
Process Daemon Mechanism
kill, ./sbin/stop-xxx.sh, or systemctl stop) will not trigger auto-restart.Log Location
logs folder under the IoTDB installation directory. Refer to this directory for troubleshooting.Cluster Status Check
./sbin/start-cli.sh and run the show cluster command to view the cluster status.Fault Recovery Procedure
failed, after fixing the issue, you must first execute systemctl daemon-reload before running systemctl start, otherwise startup will fail.Configuration Activation
daemon-xxx.sh script, execute systemctl daemon-reload to re-register the service for new configurations to take effect.Startup Mode Compatibility
systemctl start can be stopped using ./sbin/stop (no restart triggered)../sbin/start cannot be monitored via systemctl.