【TDengine 使用环境】
预生产环境
【TDengine 版本】
v3.3.8
【操作系统以及版本】
ubuntu
【部署方式】非容器部署
【描述业务影响】
【问题复现路径/shan】做过哪些操作出现的问题
按照文档增加 smlAutoChildTableNameDelimiter=-
【遇到的问题:问题现象及影响】
按照文档增加 smlAutoChildTableNameDelimiter=- 配置不生效,依然生成默认的MD5值的子表名称
【报错完整截图】(不要大段的粘贴报错代码,论坛直接看报错代码不直观)
修改后已重启服务
taosadapter 重启了吗?
systemctl restart taosadapter
Java 相关代码:
private static final String lineDemo = “meters,location=california current=10.3000002f64,current1=10.3000002f64,voltage=219i32,phase=0.31f64 1626006833639”;
public static void main(String args) throws SQLException {
final String url = “jdbc:TAOS-WS://” + host + “:6041?user=root&password=myPassword”;
try (Connection connection = DriverManager.getConnection(url)) {
init(connection);
AbstractConnection conn = connection.unwrap(AbstractConnection.class);
conn.write(lineDemo, SchemalessProtocolType.LINE, SchemalessTimestampType.MILLI_SECONDS);
System.out.println(“Inserted data with schemaless successfully.”);
} catch (Exception ex) {
// please refer to the JDBC specifications for detailed exceptions info
System.out.printf(“Failed to insert data with schemaless, %sErrMessage: %s%n”,
ex instanceof SQLException ? "ErrCode: " + ((SQLException) ex).getErrorCode() + ", " : “”,
ex.getMessage());
// Print stack trace for context in examples. Use logging in production.
ex.printStackTrace();
throw ex;
}
}
private static void init(Connection connection) throws SQLException {
try (Statement stmt = connection.createStatement()) {
stmt.execute(“CREATE DATABASE IF NOT EXISTS power”);
stmt.execute(“USE power”);
}
}
我的安装包:tdengine-tsdb-oss-3.3.8.8-linux-x64.deb
修改配置过程:
1、编辑涛思配置文件:sudo vim /etc/taos/taos.cfg
2、末尾增加配置:smlAutoChildTableNameDelimiter=_
3、重启涛思服务:sudo systemctl restart taosd
4、检查服务状态:sudo systemctl status taosd
step 1:
/etc/taos/taos.cfg 配置:
smlAutoChildTableNameDelimiter _
step 2:
systemctl restart taosadapter
meters,location=california current=10.3000002f64,current1=10.3000002f64,voltage=219i32,phase=0.31f64 1626006833639
这个语句应该会生成超级表 meters ,子表 california
注意:实际生产中,应保证子表名的唯一性。
配置修改为: ”smlAutoChildTableNameDelimiter _” ,已生效,感谢支持。