Преглед на файлове

deploy: taos-explorer 和 iot-platform 改用 host.containers.internal 访问 TDengine

- tdengine-operator 同时启动 taosd + taosadapter(host 网络)
- 删除单独的 taosadapter bridge 容器
- explorer REST API 地址改为 host.containers.internal:6041
- explorer 去掉 cluster_native(bridge 网络 native 连接不可用)
- iot-platform JDBC URL 改为 host.containers.internal:6031
- start-tdengine-operator.sh 不传 taosd 参数,禁用 keeper/explorer
mqy20260511
humanleft преди 2 седмици
родител
ревизия
806cdb0a64

+ 6
- 6
deploy/config/explorer.toml Целия файл

@@ -35,16 +35,16 @@ log_level = "info"
35 35
 #
36 36
 # Default is "http://localhost:6041" - the default endpoint for REST API.
37 37
 # Note: taos-explorer requires REST API for registration/login.
38
-# cluster_native is optional performance boost for data migration only.
38
+# Use host.containers.internal for bridge network containers to reach host network services.
39 39
 #
40
-cluster = "http://172.21.185.173:6041"
40
+cluster = "http://host.containers.internal:6041"
41 41
 
42 42
 # native endpoint to connect to the cluster.
43
-# Default is disabled. To enable it, set it to the native API URL like "taos://localhost:6030" and uncomment it.
44
-# If you enable it, you will get more performance for data migration tasks.
45
-# If modify this config item, you must relogin to clear the cache in browser local storage.
43
+# Default is disabled. Native connection from bridge network to host network
44
+# does not work due to TDengine FQDN reconnection mechanism (epset contains 127.0.0.1).
45
+# Keep disabled; REST API is sufficient.
46 46
 #
47
-cluster_native = "taos://172.21.185.173:6031"
47
+# cluster_native = "taos://host.containers.internal:6031"
48 48
 
49 49
 # API endpoint for data replication/backup/data sources. No default option.
50 50
 #   Set it to API URL like "http://localhost:6050".

+ 3
- 3
deploy/scripts/start-taos-explorer.sh Целия файл

@@ -1,7 +1,7 @@
1 1
 #!/bin/bash
2 2
 # Start taos-explorer container
3
-# Uses native connection (cluster_native) to connect directly to taosd
4
-# REST API (taosAdapter) is no longer required
3
+# Uses REST API (taosAdapter) via host.containers.internal
4
+# TDengine native connection from bridge network does not work due to FQDN mechanism
5 5
 #
6 6
 # Data mount note: TDengine image defines VOLUME /var/lib/taos which creates
7 7
 # an anonymous volume that overrides child bind mounts. We mount the parent
@@ -34,4 +34,4 @@ podman run -d \
34 34
 
35 35
 echo "${CONTAINER_NAME} started."
36 36
 echo "Port: 127.0.0.1:6060 (nginx proxy)"
37
-echo "Connection: native (taos://172.21.185.173:6031), no taosAdapter required"
37
+echo "Connection: REST API via host.containers.internal:6041"

+ 0
- 30
deploy/scripts/start-taosadapter.sh Целия файл

@@ -1,30 +0,0 @@
1
-#!/bin/bash
2
-# Start taosAdapter as independent container
3
-# Provides REST API (port 6041) for Node.js service and third-party tools
4
-# Connects to tdengine-operator (host network, port 6031)
5
-
6
-set -e
7
-
8
-CONTAINER_NAME="taosadapter"
9
-IMAGE="docker.io/tdengine/tdengine:3.3.6.13"
10
-CFG_FILE="/mnt/iot-platform/config/taosadapter.toml"
11
-TAOS_CFG="/mnt/tdengine-operator/taos.cfg"
12
-
13
-echo "Starting ${CONTAINER_NAME}..."
14
-
15
-# Stop and remove existing container if present
16
-podman rm -f "${CONTAINER_NAME}" 2>/dev/null || true
17
-
18
-podman run -d \
19
-    --name "${CONTAINER_NAME}" \
20
-    --network bridge \
21
-    --restart unless-stopped \
22
-    -p 6041:6041 \
23
-    -v "${CFG_FILE}:/etc/taos/taosadapter.toml:ro" \
24
-    -v "${TAOS_CFG}:/etc/taos/taos.cfg:ro" \
25
-    "${IMAGE}" \
26
-    taosadapter -c /etc/taos/taosadapter.toml
27
-
28
-echo "${CONTAINER_NAME} started."
29
-echo "Port: 6041 (REST API)"
30
-echo "Connects to taosd at 172.21.185.173:6031 via taos.cfg"

+ 7
- 4
deploy/scripts/start-tdengine-operator.sh Целия файл

@@ -1,7 +1,9 @@
1 1
 #!/bin/bash
2
-# Start tdengine-operator container (taosd only)
2
+# Start tdengine-operator container (taosd + taosadapter)
3 3
 # Data directory: /mnt/tdengine-operator/data
4 4
 # Network: host (required for TDengine FQDN mechanism)
5
+# taosadapter runs inside this container, listening on host port 6041
6
+# taoskeeper and taos-explorer are disabled (deployed separately)
5 7
 
6 8
 set -e
7 9
 
@@ -20,11 +22,12 @@ podman run -d \
20 22
     --name "${CONTAINER_NAME}" \
21 23
     --network host \
22 24
     --restart unless-stopped \
25
+    -e TAOS_DISABLE_KEEPER=1 \
26
+    -e TAOS_DISABLE_EXPLORER=1 \
23 27
     -v "${DATA_DIR}:/var/lib/taos" \
24 28
     -v "${LOG_DIR}:/var/log/taos" \
25 29
     -v "${CFG_FILE}:/etc/taos/taos.cfg:ro" \
26
-    "${IMAGE}" \
27
-    taosd
30
+    "${IMAGE}"
28 31
 
29 32
 echo "${CONTAINER_NAME} started."
30
-echo "Port: 6031 (native), taosd on host network"
33
+echo "Ports: 6031 (taosd native), 6041 (taosadapter REST API)"

+ 1
- 1
iot-platform/src/main/java/com/iot/platform/config/IotProperties.java Целия файл

@@ -115,7 +115,7 @@ public class IotProperties {
115 115
      * TDengine配置
116 116
      */
117 117
     public static class TDengine {
118
-        private String url = "jdbc:TAOS://172.21.185.173:6031/";
118
+        private String url = "jdbc:TAOS://host.containers.internal:6031/";
119 119
         private String username = "";
120 120
         private String password = "";
121 121
 

+ 1
- 1
iot-platform/src/main/resources/application.yml Целия файл

@@ -70,6 +70,6 @@ iot:
70 70
     password: ${MQTT_PASSWORD:}
71 71
     charge-station-topic: ${MQTT_CHARGE_STATION_TOPIC:station/ChargeStation/device/+/post/json}
72 72
   tdengine:
73
-    url: jdbc:TAOS://172.21.185.173:6031/
73
+    url: jdbc:TAOS://host.containers.internal:6031/
74 74
     username: ${TDENGINE_USERNAME:}
75 75
     password: ${TDENGINE_PASSWORD:}

Loading…
Отказ
Запис