Multi-node takeover and maintenance
Multi-node maintenance describes how tasks move to other execution nodes to continue running. It covers pre-takeover checks, planned draining, unplanned failures, and verification in isolation. Draining only reassigns tasks; it does not synchronize files. After takeover, check data differences and recovery windows for the interruption period individually.
Where to operate: run Xnode management SQL in the taosExplorer Data Browser or taos CLI; task management in taosExplorer; configuration on each execution host and agent.
Multiple nodes allow eligible tasks to continue running on other execution nodes. Task reassignment, agent reconnection, cache replay, and database disaster recovery are separate capabilities. Together they do not provide a blanket guarantee of zero interruption, zero loss, or exactly-once delivery.
1. Pre-takeover checks
| Object | Requirement |
|---|---|
| Xnode | At least two planned nodes are registered with the same management cluster, with matching versions and sufficient capacity |
| Direct tasks | All candidate nodes can access the source and target and have the required plugins, runtimes, certificates, files, and permissions; check task constraints such as fixed execution locations separately |
| Agent tasks | The same agent connects to two or more registered taosX instances, and every gRPC endpoint is reachable from the agent host |
| Execution state | Determine individually whether source positions, files, caches, backup directories, and keys are available on the takeover node; scheduling does not copy them automatically |
| Recovery window | Source retention and available caches cover the time required for maintenance, reconnection, and catch-up |
Example agent endpoints:
endpoint = "http://taosx-a:6055,http://taosx-b:6055"
token = "REPLACE_WITH_AGENT_TOKEN"
This connects one agent to multiple taosX instances; it is not automatic takeover between two agents. Using two independent agents for the same source task, each connected to one node, does not mean this high-availability arrangement is configured. An agent process failure or loss of all endpoints can still interrupt collection.
2. Planned draining
- Run
SHOW XNODES;,SHOW XNODE TASKS;,SHOW XNODE JOBS;, andSHOW XNODE AGENTS;in the taosExplorer Data Browser or taos CLI, and save the original node-to-task relationships. - Record the last source position, last verifiable target record, and current lag and counts. Confirm that candidate nodes pass the checks in the previous section.
- Have an authorized TDengine TSDB administrator run
DRAIN XNODE 2;during the approved window. Replace2with the ID of the node to maintain. - Recheck task and job ownership, and confirm that other nodes actually begin processing and generate new target data. A successful drain SQL response alone is not sufficient grounds to stop the original host.
- Preserve files and caches on the original node, then maintain the service using its original deployment method. After maintenance, recheck nodes and tasks. Do not start another set of tasks for the same source and target without authorization. Restored service connectivity does not mean draining has been cleared. If the node still shows
drain, do not expect it to receive new tasks automatically.
Draining reassigns existing tasks; it is not a file synchronization tool. If file sources, backup chains, or pending target-write caches depend on the original node's disk, prepare a dedicated preservation and recovery plan first.
2.1 Confirm that draining is complete
Run the following read-only checks in the taosExplorer Data Browser or taos CLI. Save the results both before and after draining. Output may contain connection details or identity materials; redact it before sending it externally.
SHOW XNODES;
SHOW XNODE TASKS;
SHOW XNODE JOBS;
SHOW XNODE AGENTS;
Compare the results with the node IDs, task IDs, and job IDs recorded earlier. Matching task names do not prove that the original task has recovered. Check in this order:
| Check | What it establishes | Next step |
|---|---|---|
Original node shows drain | The node is in drain state; this does not prove all migration has succeeded | Continue checking actual ownership of the original task and every job. |
| Jobs required by the original task run on candidate nodes | Execution locations have changed | Check the agent, source reads, target writes, and recovery window for this path. |
| Verifiable new samples appear in the original task's target | The new path can deliver those samples | Check the interruption window, backlog, and data differences before deciding whether to stop the original service. |
| A task was already manually stopped or completed | It is not a running task that should automatically recover | Compare with the pre-maintenance inventory; do not start tasks individually just to make every status show running. |
2.2 Failure or partial task migration
If SQL returns an error or times out, or some tasks have not migrated, do not stop the original service yet. Draining is not a transaction in which every task succeeds or rolls back together. Some tasks may already have started on candidate nodes, while the original node may remain in drain state.
| Symptom | Check and action |
|---|---|
| Original node is unreachable | Check its service and management connection; do not repeatedly drain an offline node instead of recovering from the failure. Check surviving nodes as described in the next section. |
| No available candidate node | Check candidate Xnode status, capacity, task constraints, and whether the required agent connects to the candidate node; a second registration record alone is insufficient. |
| Only some jobs have migrated | Compare each job's actual location, status, and error reason. Preserve tasks that have already taken over and the original state; do not recreate a complete set of tasks for the same scope. |
| Timeout returned and actual result is unknown | Save the original SQL error and logs from both sides, and rerun the read-only queries above; a timeout alone does not prove the action did not occur. |
Node remains in drain after maintenance | Restarting the service or reconnecting the network does not clear draining. Preserve the existing registration and files, and contact technical support to confirm how this version can return the node to management. Do not delete and recreate it without authorization. |
See Xnode management for drain SQL syntax. If SQL fails, do not bypass it with internal APIs or run unconfirmed commands to “restore scheduling.” For PI subscriptions, discovery state, and backfill, also follow PI task maintenance and recovery.
3. Handling unplanned failures
First check task ownership and reasons from surviving nodes, confirm from agent logs whether the agent has connected to other endpoints, and obtain actual new data. Offline detection and reconnection may take time. Establish takeover duration through actual drills. Do not assume a fixed number of seconds or promise a business recovery deadline on that basis.
If tasks fail on the new node, check networks, plugins, authentication, certificates, and directories individually. Before the old node recovers, confirm which tasks are responsible for writing, to avoid unchecked manual recreation or duplicate collection. See Restarts, checkpoints, and store-and-forward for source position and local state checks.
4. Verification in an isolated environment
Approve the failure scope, rollback conditions, and source samples first; do not disconnect production networks directly. Record pre-failure samples and counts on a test path, perform one approved node maintenance operation or failure simulation, observe task execution locations, agent connections, and recovery time, then check every known sample and new record before and after the interruption.
Verification must at least establish where execution resumed, which position it resumed from, whether the original node's state still needs handling, the window containing duplicates or gaps, and when catch-up completes. Do not declare high-availability verification successful while unexplained data differences remain. Multi-node execution takeover does not replace Backup and restore or Disaster recovery and dual-active operation.