소스 검색

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
 #
35
 #
36
 # Default is "http://localhost:6041" - the default endpoint for REST API.
36
 # Default is "http://localhost:6041" - the default endpoint for REST API.
37
 # Note: taos-explorer requires REST API for registration/login.
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
 # native endpoint to connect to the cluster.
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
 # API endpoint for data replication/backup/data sources. No default option.
49
 # API endpoint for data replication/backup/data sources. No default option.
50
 #   Set it to API URL like "http://localhost:6050".
50
 #   Set it to API URL like "http://localhost:6050".

+ 3
- 3
deploy/scripts/start-taos-explorer.sh 파일 보기

1
 #!/bin/bash
1
 #!/bin/bash
2
 # Start taos-explorer container
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
 # Data mount note: TDengine image defines VOLUME /var/lib/taos which creates
6
 # Data mount note: TDengine image defines VOLUME /var/lib/taos which creates
7
 # an anonymous volume that overrides child bind mounts. We mount the parent
7
 # an anonymous volume that overrides child bind mounts. We mount the parent
34
 
34
 
35
 echo "${CONTAINER_NAME} started."
35
 echo "${CONTAINER_NAME} started."
36
 echo "Port: 127.0.0.1:6060 (nginx proxy)"
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
-#!/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
 #!/bin/bash
1
 #!/bin/bash
2
-# Start tdengine-operator container (taosd only)
2
+# Start tdengine-operator container (taosd + taosadapter)
3
 # Data directory: /mnt/tdengine-operator/data
3
 # Data directory: /mnt/tdengine-operator/data
4
 # Network: host (required for TDengine FQDN mechanism)
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
 set -e
8
 set -e
7
 
9
 
20
     --name "${CONTAINER_NAME}" \
22
     --name "${CONTAINER_NAME}" \
21
     --network host \
23
     --network host \
22
     --restart unless-stopped \
24
     --restart unless-stopped \
25
+    -e TAOS_DISABLE_KEEPER=1 \
26
+    -e TAOS_DISABLE_EXPLORER=1 \
23
     -v "${DATA_DIR}:/var/lib/taos" \
27
     -v "${DATA_DIR}:/var/lib/taos" \
24
     -v "${LOG_DIR}:/var/log/taos" \
28
     -v "${LOG_DIR}:/var/log/taos" \
25
     -v "${CFG_FILE}:/etc/taos/taos.cfg:ro" \
29
     -v "${CFG_FILE}:/etc/taos/taos.cfg:ro" \
26
-    "${IMAGE}" \
27
-    taosd
30
+    "${IMAGE}"
28
 
31
 
29
 echo "${CONTAINER_NAME} started."
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
      * TDengine配置
115
      * TDengine配置
116
      */
116
      */
117
     public static class TDengine {
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
         private String username = "";
119
         private String username = "";
120
         private String password = "";
120
         private String password = "";
121
 
121
 

+ 1
- 1
iot-platform/src/main/resources/application.yml 파일 보기

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

Loading…
취소
저장