Taosdump备份报错

【TDengine 使用环境】
测试

【TDengine 版本】

社区版 3.3.6

【操作系统以及版本】

Red Hat Enterprise Linux release 8.7 (Ootpa)

【部署方式】非容器部署

【集群节点数】3节点,3个dnode,3个mnode

【集群副本数】3副本

【描述业务影响】备份报错,只备份了1张表,第二张表没有备份。

【问题复现路径/shan】每次备份都报错,而且,报错的那个表不是我们创建的,是不是数据库自动创建的?

【遇到的问题:问题现象及影响】无法备份

【资源配置】3台4核8G内存100G磁盘

【报错完整截图】(不要大段的粘贴报错代码,论坛直接看报错代码不直观)

INFO: connection 0x10feed0 is dumping out schema: 111234 from oneesg_value.oneesg_value_ef210941704c589d9ae8e367e3708f05
INFO: connection 0x10feed0 is dumping out schema: 111235 from oneesg_value.oneesg_value_25f9b74a22f71622640428ea17b68bd6
INFO: connection 0x10feed0 is dumping out schema: 111236 from oneesg_valueOK: total 111236 table(s) of stable: oneesg_value schema dumped.
ERROR: convertTbDesToJsonImplMore() LN2755, wrong type: 0
ERROR: prepareAvroWface() LN2142, Unable to parse:
{“type”:“record”,“name”:“global_one_esg._record”,“fields”:[{“name”:“tbname”,“type”:[“null”,“string”]},{“name”:“ts”,“type”:[“null”,“long”]},{“name”:“col0”,“type”:[“null”,“int”]},{“name”:“col1”,“type”:[“null”,“int”]},},{“name”:“col3”,“type”:[“null”,“bytes”]},{“name”:“col4”,“type”:[“null”,“long”]},{“name”:“col5”,“type”:[“null”,“long”]},{“name”:“col6”,“type”:[“null”,“boolean”]},{“name”:“col7”,“type”:[“null”,“bytes”]},{“name”:“col8”,“type”:[“null”,“bytes”]},{“name”:“col9”,“type”:[“null”,“bytes”]},{“name”:“col10”,“type”:[“null”,“bytes”]},{“name”:“col11”,“type”:[“null”,“bytes”]},{“name”:“col12”,“type”:[“null”,“int”]}]}
to schema
error message: Error parsing JSON: unexpected token near ‘}’
ERROR: convertTbDesToJsonImplMore() LN2755, wrong type: 0
ERROR: prepareAvroWface() LN2142, Unable to parse:
{“type”:“record”,“name”:“global_one_esg._record”,“fields”:[{“name”:“tbname”,“type”:[“null”,“string”]},{“name”:“ts”,“type”:[“null”,“long”]},{“name”:“col0”,“type”:[“null”,“int”]},{“name”:“col1”,“type”:[“null”,“int”]},},{“name”:“col3”,“type”:[“null”,“bytes”]},{“name”:“col4”,“type”:[“null”,“long”]},{“name”:“col5”,“type”:[“null”,“long”]},{“name”:“col6”,“type”:[“null”,“boolean”]},{“name”:“col7”,“type”:[“null”,“bytes”]},{“name”:“col8”,“type”:[“null”,“bytes”]},{“name”:“col9”,“type”:[“null”,“bytes”]},{“name”:“col10”,“type”:[“null”,“bytes”]},{“name”:“col11”,“type”:[“null”,“bytes”]},{“name”:“col12”,“type”:[“null”,“int”]}]}
to schema
error message: Error parsing JSON: unexpected token near ‘}’
.oneesg_value_357d05ea0afd16972c5158972445479b
INFO: create 8 thread(s) to export data …

用命令行备份报的错。报错中的global_one_esg._record表不是我们创建的。

这个表也不是 TDengine 的系统表。查询一下,这个表属于哪个库的?

看报错事global_one_esg库,但是在explorer中看不到这个表。

select * from information_schema.ins_tables where table_name = ‘_record’;

请使用这个命令查询一下,看看输出结果是什么。

或这个命令也行:
show global_one_esg.tables like ‘%record%’;

taos> select * from information_schema.ins_tables where table_name = ‘_record’;

DB error: Invalid column name: ‘_record’ [0x80002602] (0.002204s)
taos>
taos> show global_one_esg.tables like ‘%record%’;

DB error: syntax error near “‘%record%’;” [0x80002600] (0.000062s)

开始备份的时候会有以下报错,跟这个有关系么?
OK: Database: global_one_esg exists
ERROR: typeStrToType() LN348 Unknown type: DECIMAL(38, 15)
ERROR: typeStrToType() LN348 Unknown type: DECIMAL(38, 15)
start time: 2025-12-10 10:25:45
INFO: Getting table(s) count of db (global_one_esg) …
INFO: Start to dump out database: global_one_esg
INFO: start dump out super table data (oneesg_value) …
INFO: start dump super table meta (oneesg_value) col:14 tags:3 …
INFO: Get super table (oneesg_value) child tables (111236) ok
INFO: The number of tables of oneesg_value is 111236!
INFO: connection: 0x10feed0 is dumping out schema of sub-table(s) of oneesg_value

你好,这个有解决方案么?

用的是哪个版本?4位数的版本号。

你们使用了decimal的数据类型是吗?看错误应该是备份的时候有问题,我们分析下。稍后回复。

确认了,taosdump还没有支持DECIMAL数据类型,在研发的排期计划中。

数据库版本是 社区版 3.3.6.13,如果taosdump不支持,有其他备份方式么?

如果数据量不大,存储可以支持的话,可以导出成 csv 文件进行备份。

select * from dbName.stableName >> “/data/dump/xxx.csv”;
因为这种方式导出的文件没有压缩,所以会占用磁盘空间。

我有2个超级表,下边有几万个子表,导出数据时,使用上边的sql导出超级表的数据,还原时,子表会自动创建么?

我们的数据库集群中有2个超级表,下边有几万个子表,这种情况适合用哪种备份方式?可以不考虑磁盘大小,现在taosdump不能用,有其他的推荐么?

可以使用查询方式导出到 csv 文件中,携带子表名(select tbname, * from 超级表;)。这样就备份成文件了。
恢复的时候:使用插入到超级表的方式,可以导入到数据库中。
请参考官网文档中的操作说明:

好的,我测试一下。另外,直接备份集群中某一台服务器的datadir是否可以?

这种方式是不可以的。