### start-model examples Source: https://docs.tdengine.com/ai-and-advanced-analytics/tdgpt/dev/tsfm Examples of starting model services with the start-model script: start all services, start a specific service (TimesFM), and specify a custom configuration file with the -c option. ```bash /usr/bin/start-model all ``` ```bash /usr/bin/start-model timesfm ``` ```bash /usr/bin/start-model -c /path/to/custom_taosanode.config.py ``` -------------------------------- ### START XNODE TASK Example Source: https://docs.tdengine.com/tdengine-sql/cluster-management/xnode Example of starting an XNODE task by ID. ```sql taos> START XNODE TASK 1; ``` -------------------------------- ### taosinstall usage examples Source: https://docs.tdengine.com/operations-and-tooling/tools/inspect-tools/taosinstall Examples of taosinstall commands for installation and upgrade. Install on the current host with -m local, install all configured hosts with -m ssh and -f, install selected hosts with -L, and perform a stopped-service or rolling upgrade with -m ssh and optionally -r. ```bash # Install on the current host ./taosinstall install -m local # Install all configured hosts ./taosinstall install -m ssh -f /path/to/install.cfg # Install selected hosts ./taosinstall install -m ssh -L server1,server2 # Stopped-service or rolling upgrade ./taosinstall upgrade -m ssh ./taosinstall upgrade -m ssh -r ``` -------------------------------- ### Install and start StatsD Source: https://docs.tdengine.com/ecosystem-integrations/collection/statsd Commands to install dependencies and start StatsD with the modified configuration file (config.js). Run these after editing the configuration. ```bash npm install node stats.js config.js & ``` -------------------------------- ### taosinstall configuration file example Source: https://docs.tdengine.com/operations-and-tooling/tools/inspect-tools/taosinstall Example configuration file defining SSH access, local package and checksum, database credentials, per-component configuration templates, and services to install. The [test_env] section lists hosts with FQDN, username, password, and port; [local_pack] specifies the package path and MD5 checksum; [database] sets credentials and ports; and [taos_cfg], [taosadapter_cfg], and [taoskeeper_cfg] point to configuration files. ```ini [test_env] firstep=192.168.0.1||fqdn=tdengine1||username=root||password=123456||port=22 secondep=192.168.0.2||fqdn=tdengine2||username=root||password=123456||port=22 [local_pack] package=/path/to/tdengine-tsdb-enterprise-3.3.x.x-Linux-x64.tar.gz md5=317f88bf13aa21706ae8c2d4f919d30f [database] username=root password=taosdata port=6030 rest_port=6041 [taos_cfg] cfg_file=taos.cfg [taosadapter_cfg] cfg_file=taosadapter.toml [taoskeeper_cfg] cfg_file=taoskeeper.toml ``` -------------------------------- ### Compile and Install kafka-connect-tdengine Plugin Source: https://docs.tdengine.com/ecosystem-integrations/collection/kafka Clones the kafka-connect-tdengine source code, compiles and packages it with Maven, then unzips the generated plugin zip into the Kafka Connect plugin directory. The zip is created in target/components/packages/ and the example installs it to $KAFKA_HOME/components/. ```bash git clone --branch 3.0 https://github.com/taosdata/kafka-connect-tdengine.git cd kafka-connect-tdengine mvn clean package -Dmaven.test.skip=true unzip -d $KAFKA_HOME/components/ target/components/packages/taosdata-kafka-connect-tdengine-*.zip ``` -------------------------------- ### Run the Go connection example Source: https://docs.tdengine.com/cloud/programming/connect/go Run this command to execute the main.go file and test the connection. ```bash go run main.go ``` -------------------------------- ### Start the sample program Source: https://docs.tdengine.com/developer-guide/high-throughput Execute the JAR file using the Java command. Append -K to the command if using Kafka subscription mode. ```bash java -jar highVolume.jar -r 5 -w 5 -b 10000 -c 100000 -s 1000000 -R 1000 ``` -------------------------------- ### Initialize Go module Source: https://docs.tdengine.com/cloud/programming/connect/go Run this command to create a new Go module for the example project. ```bash go mod init tdengine.com/example ``` -------------------------------- ### CREATE XNODE examples Source: https://docs.tdengine.com/tdengine-sql/cluster-management/xnode Examples of creating Xnodes with different authentication methods: no credentials, user/password, and token. Each command returns 'Create OK'. ```sql taos> CREATE XNODE "h1:6055"; Create OK, 0 row(s) affected (0.050798s) taos> CREATE XNODE 'x1:6055' USER root PASS 'taosdata'; Create OK, 0 row(s) affected (0.050798s) taos> CREATE XNODE 'x2:6055' TOKEN 'C8V3o0ZVvYQ6sMEnjfixjtw0OvN9nIPFAL1HWvSKmHbQsds8vBpVbrEZn2hrzar'; Create OK, 0 row(s) affected (0.050798s) ``` -------------------------------- ### Install moment library Source: https://docs.tdengine.com/developer-guide/udf Install the third-party moment library required by the nextsunday UDF example. ```bash pip3 install moment ``` -------------------------------- ### Start all TDengine services on Linux Source: https://docs.tdengine.com/quick-start/download-and-install/package Starts all TDengine services on Linux after installation. Requires sudo privileges. ```bash sudo start-all.sh ``` -------------------------------- ### taosdump startup summary output Source: https://docs.tdengine.com/operations-and-tooling/tools/taosdump Example of the startup summary printed at the beginning of a backup or restore, showing runtime parameters such as connect mode, server, user, output path, content, databases, threads, format, schema only, time range, and checkpoint. ```text =========================================================================== taosdump - BACKUP =========================================================================== Connect Mode : Native Server : my-server:6030 User : root Output Path : /root/backup/ Content : basic Databases : test Data Threads : 8 Tag Threads : 2 Format : binary Schema Only : no Time Range : ALL Check Point : no =========================================================================== ``` -------------------------------- ### Start all TDengine services on Windows Source: https://docs.tdengine.com/quick-start/download-and-install/package Starts all TDengine services on Windows. Run from the installation directory in an administrator Command Prompt. With no arguments, it starts services by default. ```batch start-all.bat ``` -------------------------------- ### Start Active-Active Mode Source: https://docs.tdengine.com/operations-and-tooling/operations/ha/dual Starts the data replication task in an active-active setup. Both taosd and taosX must be running on the two hosts. ```bash taosx replica start ``` -------------------------------- ### SHOW XNODES example and output Source: https://docs.tdengine.com/tdengine-sql/cluster-management/xnode Example of showing all Xnodes and the resulting table with columns id, url, status, create_time, and update_time. ```sql taos> SHOW XNODES; ``` ```text id | url | status | create_time | update_time | =============================================================================== 1 | h1:6055 | online | 2025-12-14 01:01:34.655 | 2025-12-14 01:01:34.655 | Query OK, 1 row(s) in set (0.005518s) ``` -------------------------------- ### Docker Compose provisioning for TDengine + Grafana Source: https://docs.tdengine.com/ecosystem-integrations/visual/grafana Docker Compose setup for zero-configuration TDengine + Grafana. The first file (tdengine.yml) provisions the TDengine data source using environment variables; the second (docker-compose.yml) defines the tdengine and grafana services, mounts the provisioning file, and installs the plugin at startup. Start with `docker-compose up -d`. ```yaml apiVersion: 1 datasources: - name: TDengine type: tdengine-datasource orgId: 1 url: "$TDENGINE_API" isDefault: true secureJsonData: url: "$TDENGINE_API" basicAuth: "$TDENGINE_BASIC_AUTH" version: 1 editable: true ``` ```yaml version: "3.7" services: tdengine: image: tdengine/tdengine:latest container_name: tdengine hostname: tdengine environment: TAOS_FQDN: tdengine MONITOR_FQDN: tdengine EXPLORER_CLUSTER: http://tdengine:6041 TAOS_KEEPER_TDENGINE_HOST: tdengine volumes: - tdengine-data:/var/lib/taos/ ports: - 6060:6060 grafana: image: grafana/grafana:latest volumes: - ./tdengine.yml:/etc/grafana/provisioning/datasources/tdengine.yml - grafana-data:/var/lib/grafana environment: # install tdengine plugin at start GF_INSTALL_PLUGINS: "https://downloads.tdengine.com/tdengine-tsdb-datasource/tdengine-datasource.zip;tdengine-datasource" TDENGINE_API: "http://tdengine:6041" #printf "$TDENGINE_USER:$TDENGINE_PASSWORD" | base64 TDENGINE_BASIC_AUTH: "cm9vdDp0YW9zZGF0YQ==" ports: - 3000:3000 volumes: grafana-data: tdengine-data: ``` -------------------------------- ### Start all Windows services with start-all.bat Source: https://docs.tdengine.com/operations-and-tooling/operations/install Commands to start, inspect, or stop all services on Windows. Run from the installation directory in a new Command Prompt as administrator. Use start-all.bat -S to start services only and skip connectivity checks and Snode/Xnode initialization. ```batch start-all.bat start-all.bat status start-all.bat stop ``` -------------------------------- ### SHOW TOKENS example Source: https://docs.tdengine.com/tdengine-sql/user-and-privilege/user Example output of SHOW TOKENS, displaying token details such as name, user, provider, enable status, create_time, expire_time, and extra_info. ```sql taos> show tokens; name | user | provider | enable | create_time | expire_time | extra_info | ========================================================================================================= root_token | root | | 1 | 2025-12-25 10:02:28.000 | 1970-01-01 08:00:00.000 | | test_token | test | | 1 | 2025-12-25 10:01:47.000 | 1970-01-01 08:00:00.000 | | Query OK, 2 row(s) in set (0.003313s) ``` -------------------------------- ### Run Grafana container with TDengine plugin Source: https://docs.tdengine.com/ecosystem-integrations/visual/grafana Starts a Grafana container and automatically installs the TDengine data source plugin via the GF_INSTALL_PLUGINS environment variable. Requires Grafana containerized installation. ```bash docker run -d \ -p 3000:3000 \ --name=grafana \ -e "GF_INSTALL_PLUGINS=https://downloads.tdengine.com/tdengine-tsdb-datasource/tdengine-datasource.zip;tdengine-datasource" \ grafana/grafana ``` -------------------------------- ### CREATE MOUNT example Source: https://docs.tdengine.com/tdengine-sql/cluster-management/mount Example of mounting source directory /var/lib/taos_1 as mount1 on host dnode 1. After mounting, access source databases as mount1_. ```sql CREATE MOUNT mount1 ON DNODE 1 FROM '/var/lib/taos_1'; ``` -------------------------------- ### Stream Permission Grant and Revoke Example Source: https://docs.tdengine.com/tdengine-sql/user-and-privilege/grant Example SQL statements for granting and revoking stream permissions on specific streams or all streams in a database. Demonstrates SHOW, START, STOP, SHOW CREATE, ALL, and REVOKE operations. ```sql -- User processor can view all streams in power database GRANT SHOW ON STREAM power.* TO processor; -- User can start and stop specific stream GRANT START, STOP ON STREAM power.realtime_agg TO operator; -- User can view stream definition and operate stream GRANT SHOW CREATE, START, STOP ON STREAM power.* TO manager; -- User has full management permissions on stream GRANT ALL ON STREAM power.realtime_agg TO admin_user; -- Revoke user's start permission REVOKE START ON STREAM power.realtime_agg FROM operator; -- Revoke all permissions on stream from user REVOKE ALL ON STREAM power.realtime_agg FROM operator; ``` -------------------------------- ### SHOW XNODE TASKS Example Source: https://docs.tdengine.com/tdengine-sql/cluster-management/xnode Example of showing all XNODE tasks. ```sql taos> SHOW XNODE TASKS; ``` -------------------------------- ### Count Window SQL Example Source: https://docs.tdengine.com/tdengine-sql/data-query/distinguished Example of a count window query using count_window(4) to divide data into windows of 4 rows. The query selects window start and end times and counts rows. ```sql select _wstart, _wend, count(*) from t count_window(4); ``` -------------------------------- ### WebSocket Connection String Example Source: https://docs.tdengine.com/developer-guide/connectors-reference/csharp Example ConnectionStringBuilder connection string for a WebSocket connection to TDengine. The key-value pairs are separated by semicolons. Starting with TDengine.Connector 3.2.0, the host parameter can be a comma-separated address list for failover. ```text "protocol=WebSocket;host=127.0.0.1;port=6041;useSSL=false" ``` -------------------------------- ### Bootstrap Servers Example Source: https://docs.tdengine.com/data-ingest-and-delivery/no-code-delivery/Kafka Example of Kafka broker address list. Separate multiple addresses with commas. At least two reachable addresses are recommended for availability. ```text 127.0.0.1:9092,127.0.0.1:9093 ``` -------------------------------- ### Helm install output for simple TDengine deployment Source: https://docs.tdengine.com/operations-and-tooling/operations/deployment/kubernetes Output shown after installing the TDengine Helm chart with release name 'simple'. It provides instructions to get the pod name and run TDengine CLI commands. ```text NAME: simple LAST DEPLOYED: Sun Feb 9 13:40:00 2025 default STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: 1. Get first POD name: export POD_NAME=$(kubectl get pods --namespace default \ -l "app.kubernetes.io/name=tdengine,app.kubernetes.io/instance=simple" -o jsonpath="{.items[0].metadata.name}") 2. Show dnodes/mnodes: kubectl --namespace default exec $POD_NAME -- taos -s "show dnodes; show mnodes" 3. Run into TDengine CLI: kubectl --namespace default exec -it $POD_NAME -- taos ``` -------------------------------- ### Create database, supertable, and subtables Source: https://docs.tdengine.com/quick-start/data-subscription Run this SQL in the first shell to create the 'power' database, the 'meters' supertable, and subtables 'd1001' and 'd1002' if they do not already exist. This is a prerequisite for the data subscription example. ```sql CREATE DATABASE IF NOT EXISTS power PRECISION 'ms' KEEP 3650 DURATION 10 BUFFER 16; USE power; CREATE STABLE IF NOT EXISTS meters ( ts timestamp, current float, voltage int, phase float ) TAGS ( location varchar(64), group_id int ); CREATE TABLE IF NOT EXISTS d1001 USING meters TAGS ("California.SanFrancisco", 2); CREATE TABLE IF NOT EXISTS d1002 USING meters TAGS ("California.SanFrancisco", 3); ``` -------------------------------- ### Start TDengine services with systemctl on Linux Source: https://docs.tdengine.com/operations-and-tooling/operations/install Use these commands to start the four TDengine services after installation. Requires systemd; if unavailable, run /usr/local/taos/bin/taosd directly. Manage individual services with systemctl stop, restart, or status. ```bash sudo systemctl start taosd sudo systemctl start taosadapter sudo systemctl start taoskeeper sudo systemctl start taos-explorer ``` -------------------------------- ### taosinstall install command usage Source: https://docs.tdengine.com/operations-and-tooling/tools/inspect-tools/taosinstall Shows the usage of the taosinstall install command with its options. Key options include --model for local or SSH installation, --config for a specific configuration, --check-md5 for checksum verification, --list for a host list, --workers for concurrency (default 50), --set-hostname and --set-ips for FQDN and /etc/hosts entries, and --replicas for two or three replicas (default three). ```bash usage: taosinstall install [-h] [--model {local,ssh}] [--config CONFIG] [--backend] [--check-md5] [--list LIST] [--log-level {debug,info}] [--workers WORKERS] [--set-hostname] [--set-ips] [--replicas {2,3}] ``` -------------------------------- ### SHOW MOUNTS sample output Source: https://docs.tdengine.com/tdengine-sql/cluster-management/mount Sample output from SHOW MOUNTS, displaying mount name, dnode, creation time, and path. ```text name | dnode | create_time | path | ============================================================== mount1 | 1 | 2025-07-17 18:06:16.298 | /var/lib/taos_1 | ``` -------------------------------- ### Query result for INTERVAL(3h) example Source: https://docs.tdengine.com/tdengine-sql/data-query/distinguished The result of the INTERVAL(3h) query, showing window start times and aggregates. Windows are aligned to Unix time 0, so the first window starts at 23:00 on the previous day. ```text _wstart| n| total ---|---|--- 2025-12-08 23:00:00.000| 2| 30 2025-12-09 02:00:00.000| 2| 70 2025-12-09 08:00:00.000| 1| 50 ``` -------------------------------- ### Start Replication for All Databases Source: https://docs.tdengine.com/operations-and-tooling/operations/ha/dual Example that automatically creates synchronization tasks for all databases except information_schema, performance_schema, log, and audit. It also continuously monitors for new databases and starts replication when the same database name is created on both hosts. ```bash taosx replica start -f td1:6030 -t td2:6030 ``` -------------------------------- ### Clone the perspective-examples repository and navigate to the Python demo directory Source: https://docs.tdengine.com/ecosystem-integrations/visual/perspective Clones the perspective-examples repository from GitHub and changes into the examples/tdengine/python directory. This is the first step in setting up the demo environment. ```bash git clone https://github.com/ProspectiveCo/perspective-examples cd perspective-examples/examples/tdengine/python ``` -------------------------------- ### Run the installation script to install the TDengine client Source: https://docs.tdengine.com/ecosystem-integrations/visual/perspective Executes the install.sh script to install the TDengine client to the local machine. This is required before proceeding with the demo. ```bash ./install.sh ```