TDengine docker安装方法

docker run -d --privileged=true \
--restart=always --name=tdengine \
-v /opt/taos/data:/var/lib/taos \
-v /opt/taos/log:/var/log/taos \
-v /usr/local/taos/driver/libtaos.so.3.2.0.0:/usr/lib/libtaos.so \
-v /usr/share/zoneinfo:/usr/share/zoneinfo \
-e TZ=Asia/Shanghai \
-p 6030:6030 -p 6041:6041 -p 6043-6049:6043-6049 -p 6043-6049:6043-6049/udp tdengine/tdengine:3.2.0.0


--安装tdengine服务端
docker pull tdengine/tdengine:3.2.0.0

mkdir -p /data/taos/dnode/data /data/taos/dnode/log

docker run -d --privileged=true \
--restart=always --name=tdengine \
-v /data/taos/dnode/data:/var/lib/taos \
-v /data/taos/dnode/log:/var/log/taos \
-p 6030:6030 -p 6041:6041 -p 6043-6049:6043-6049 -p 6043-6049:6043-6049/udp tdengine/tdengine:3.2.0.0


进入容器内,修改密码
docker exec -it tdengine /bin/bash

运行 TDengine CLI
taos

show databases;

create database test


修改密码
alter user root pass 'test@1';

再次进入容器需指定用户名密码
taos -uroot -p   test@1

 

 

docker容器复制文件到物理机,带星号会复制失败:
docker cp tdengine:/usr/local/taos/driver/libtaos.so.3.2.0.0* /usr/local/taos/driver/libtaos.so.3.2.0.0*

docker cp tdengine:/etc/taos/taos.cfg /etc/taos/taos.cfg

 

yaml配置:
使用原生的连接需要安装客户端,docker应用的话需要安装tdengine客户端到相应应用容器里面
tdengine-server:
url: jdbc:TAOS://IP:6030/dbname?user=root&password=124564897
username: root
password: 123456789
driver-class-name: com.taosdata.jdbc.TSDBDriver
minimum-idle: 5
idle-timeout: 180000
maximum-pool-size: 10
auto-commit: true
max-lifetime: 1800000
connection-timeout: 30000
connection-test-query: show tables


使用rest/websocker 连接不需要安装客户端
tdengine-server:
url: jdbc:TAOS-RS://${TDENGINE_HOST:IP}:${TDENGINE_PORT:6041}/${TDENGINE_DBNAME:DB}?timezone=UTC-8&charset=utf-8&serverTimezone=Asia/Shanghai
username: ${TDENGINE_USERNAME:root}
password: ${TDENGINE_PWD:pwd123}
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
minimum-idle: 5
idle-timeout: 180000
maximum-pool-size: 10
auto-commit: true
max-lifetime: 1800000
connection-timeout: 30000
connection-test-query: show tables

 

posted @ 2024-05-31 18:35  Kevin_Zhou_9  阅读(294)  评论(0编辑  收藏  举报