IoTDB 企业篇入门教程③:数据同步与增量备份实战指南
文章目录
一、前文
IoTDB入门教程——导读
数据库备份与迁移是数据库运维中的核心任务,其重要性不言而喻。 确保备份过程既简单快捷又稳定可靠,对于保障数据安全与业务连续性至关重要。
如果是使用开源版本IoTDB,那么有如下三种数据同步和备份的方法,可供选择。
IoTDB 入门教程 基础篇⑨——TsFile导入导出工具 IoTDB 入门教程 基础篇⑩——CSV导入导出工具 IoTDB 入门教程 基础篇⑪——Data导入导出工具
但是,这些操作略显繁琐,不如IoTDB企业版(TimechoDB)所使用的数据同步的功能,来的方便快捷和高效。
二、系统架构

所以,综上所述,数据同步和备份是一个安全的服务器的刚需。
而TimechoDB的数据同步功能恰恰满足了这个需求,而且用起来极其方便。
三、准备两台服务器
切记:两台服务器的IoTDB的版本必须一致。
[root@iZgw0bdpdtyqxyz77dha9nZ iotdb-enterprise-1.3.1.4-bin]# bash sbin/start-cli.sh
---------------------
Starting IoTDB Cli
---------------------
_____ _________ ______ ______
|_ _| | _ _ ||_ _ `.|_ _ \
| | .--.|_/ | | \_| | | `. \ | |_) |
| | / .'`\ \ | | | | | | | __'.
_| |_| \__. | _| |_ _| |_.' /_| |__) |
|_____|'.__.' |_____| |______.'|_______/ Enterprise version 1.3.1.4 (Build: 9658c9d)
Successfully login at 127.0.0.1:6667
IoTDB> select * from root.test.test order by time desc
+----+---------------------+
|Time|root.test.test.status|
+----+---------------------+
+----+---------------------+
Empty set.
It costs 0.024s
[root@VM-0-3-centos apache-iotdb-1.3.1-all-bin]# bash sbin/start-cli.sh
---------------------
Starting IoTDB Cli
---------------------
_____ _________ ______ ______
|_ _| | _ _ ||_ _ `.|_ _ \
| | .--.|_/ | | \_| | | `. \ | |_) |
| | / .'`\ \ | | | | | | | __'.
_| |_| \__. | _| |_ _| |_.' /_| |__) |
|_____|'.__.' |_____| |______.'|_______/ version 1.3.1 (Build: 214695d)
Successfully login at 127.0.0.1:6667
IoTDB> select status from root.test.test
+----+---------------------+
|Time|root.test.test.status|
+----+---------------------+
+----+---------------------+
Empty set.
It costs 0.018s
四、新建任务


五、数据同步测试
IoTDB> insert into root.test.test(status) values(0)
Msg: The statement is executed successfully.
IoTDB> select status from root.test.test
+-----------------------------+---------------------+
| Time|root.test.test.status|
+-----------------------------+---------------------+
|2024-08-05T22:32:50.872+08:00| 0.0|
+-----------------------------+---------------------+
Total line number = 1
It costs 0.013s
六、遇到的问题
iotdb-enterprise-1.3.1.4-bin
,内网端的数据库版本是apache-iotdb-1.3.2-all-bin
。2024-08-05T16:24:56.451, Failed to transfer tsfile insertion event PipeTsFileInsertionEvent{isTsFileFormatValid=true, resource=file is /home/iotdb-enterprise-1.3.1.4-bin/data/datanode/data/sequence/root.test/1/2848/1722562250962-2-0-0.tsfile, status: NORMAL, tsFile=/home/iotdb-enterprise-1.3.1.4-bin/data/datanode/data/pipe/tsfile/sequence-root.test-1-2848-1722562250962-2-0-0.tsfile, isLoaded=false, isGeneratedByPipe=false, isClosed=true, dataContainer=null} - EnrichedEvent{referenceCount=1, pipeName='测试', pipeTaskMeta=PipeTask{progressIndex='MinimumProgressIndex{}', leaderDataNodeId=1, exceptionMessages='{}'}, committerKey='测试_1', commitId=2, pattern='root', startTime=-28800000, endTime=1722825127000, isPatternParsed=true, isTimeParsed=true, shouldReportOnCommit=false}, because Seal file /home/iotdb-enterprise-1.3.1.4-bin/data/datanode/data/pipe/tsfile/sequence-root.test-1-2848-1722562250962-2-0-0.tsfile error, result status TSStatus(code:1810, message:Auto create or verify schema error when executing statement LoadTsFileStatement{file=/home/apache-iotdb-1.3.2-all-bin/data/datanode/system/pipe/receiver/3/sequence-root.test-1-2848-1722562250962-2-0-0.tsfile, deleteAfterLoad=true, databaseLevel=1, verifySchema=true, tsFiles Size=1}.)..
apache-iotdb-1.3.1-all-bin
,就正常了。切记:两台服务器的IoTDB的版本必须一致。
觉得好,就一键三连呗(点赞+收藏+关注)
作者:小康师兄