nutz 版本:1.r.68-SNAPSHOT +
nutzboot 版本:2.4.2-SNAPSHOT +
TDengine 支持版本:2.0.18.0 +
nutz 官网:http://nutzam.com/
TDengine 官网:https://www.taosdata.com/cn/
服务端:CentOS 8.2 64 位
客户端:Windows 10 64 位
官网下载 rpm 安装包
执行安装 rpm -ivh TDengine-server-2.0.18.0-Linux-x64.rpm
修改配置文件 vi /etc/taos/taos.cfg
加上当前服务器 hostname 主机名
# first fully qualified domain name (FQDN) for TDengine system
firstEp wizzer-test:6030
# local fully qualified domain name (FQDN)
fqdn wizzer-test
taos
或 taos -h 127.0.0.1
执行数据库创建命令taos > create database test;
修改 C:\Windows\System32\drivers\etc\hosts
添加 ip wizzer-test
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.budwk</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<nutzboot.version>2.4.2-SNAPSHOT</nutzboot.version>
<jaxb-api.version>2.3.1</jaxb-api.version>
<slf4j.version>1.7.25</slf4j.version>
<logback.version>1.2.3</logback.version>
<taos-jdbcdriver.version>2.0.23</taos-jdbcdriver.version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-core</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-nutz-dao</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>${taos-jdbcdriver.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-parent</artifactId>
<version>${nutzboot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>nutz</id>
<url>http://jfrog.nutz.cn/artifactory/libs-release</url>
</repository>
<repository>
<id>nutz-snapshots</id>
<url>http://jfrog.nutz.cn/artifactory/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nutz-snapshots</id>
<url>http://jfrog.nutz.cn/artifactory/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
<plugin>
<groupId>org.nutz.boot</groupId>
<artifactId>nutzboot-maven-plugin</artifactId>
<version>${nutzboot.version}</version>
</plugin>
</plugins>
</build>
</project>
/**
* 注意 TDengine 表及字段名都为小写字母
*/
@Table("iot_dev")
public class Iot_dev implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Comment("ID")
@ColDefine(type = ColType.TIMESTAMP)
private Date ts;
@Column("devid") //字段名都为小写字母
@Comment("设备 ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String devId;
@Column("devtype") //字段名都为小写字母
@Comment("设备类型")
@ColDefine(type = ColType.BINARY, width = 32)
private String devType;
@Column
@Comment("状态")
@ColDefine(type = ColType.BOOLEAN)
private Boolean status;
@Column
@Comment("读数 1")
@ColDefine(type = ColType.DOUBLE)
private Double val1;
@Column
@Comment("读数 2")
@ColDefine(type = ColType.INT)
private Integer val2;
@Column
@Comment("读数 3")
@ColDefine(type = ColType.INT,width = 3)
private Integer val3;
@Column
@Comment("读数 4")
@ColDefine(type = ColType.INT,width = 2)
private Integer val4;
}
https://gitee.com/wizzer/demo/tree/master/nutzboot-tdengine-demo