The Sync Tool is an IoTDB suite tool that continuously uploads the timeseries data from the edge (sender) to the cloud(receiver).
On the sender side of the sync-tool, the sync module is embedded in the IoTDB engine. The receiver side of the sync-tool supports IoTDB (standalone/cluster).
You can use SQL commands to start or close a synchronization task at the sender, and you can check the status of the synchronization task at any time. At the receiving end, you can set the IP white list to specify the access IP address range of sender.

Two machines A and B, which are installed with iotdb, we want to continuously synchronize the data from A to B. To better describe this process, we introduce the following concepts.
root.sg.d.s, sender B also includes the path root.sg.d.s, sender A deletes database root.sg will also delete all data of B stored in the path root.sg.d.s at receiver.SHOW DATANODES that are in the Running state are connected, otherwise the execution will fail.Execute the following SQL statements at the sender and receiver to quickly start a data synchronization task between two IoTDB. For complete SQL statements and configuration matters, please see the parameter configurationand SQL sections. For more usage examples, please refer to the usage examples section.
Start sender IoTDB and receiver IoTDB.
Create a PipeSink with IoTDB type.
IoTDB> CREATE PIPESINK central_iotdb AS IoTDB (ip='There is your goal IP', port='There is your goal port')
IoTDB> CREATE PIPE my_pipe TO central_iotDB
IoTDB> START PIPE my_pipe
IoTDB> SHOW PIPES
IoTDB> STOP PIPE my_pipe
IoTDB> START PIPE my_pipe
IoTDB> DROP PIPE my_pipe
All parameters are in $IOTDB_ HOME$/conf/iotdb-common.properties, after all modifications are completed, execute load configuration and it will take effect immediately.
| Parameter Name | max_number_of_sync_file_retry |
|---|---|
| Description | The maximum number of retries when the sender fails to synchronize files to the receiver. |
| Data type | Int : [0,2147483647] |
| Default value | 5 |
| Parameter Name | ip_white_list |
|---|---|
| Description | Set the white list of IP addresses of the sender of the synchronization, which is expressed in the form of network segments, and multiple network segments are separated by commas. When the sender synchronizes data to the receiver, the receiver allows synchronization only when the IP address of the sender is within the network segment set in the white list. If the whitelist is empty, the receiver does not allow any sender to synchronize data. By default, the receiver rejects the synchronization request of all IP addresses except 127.0.0.1. When configuring this parameter, please ensure that all DataNode addresses on the sender are set. |
| Data type | String |
| Default value | 127.0.0.1/32 |
IoTDB> SHOW PIPESINKTYPE IoTDB> +-----+ | type| +-----+ |IoTDB| +-----+
IoTDB> CREATE PIPESINK <PipeSinkName> AS IoTDB [(ip='127.0.0.1',port=6667);]
IoTDB> DROP PIPESINK <PipeSinkName>
IoTDB> SHOW PIPESINKS IoTDB> SHOW PIPESINK [PipeSinkName] IoTDB> +-----------+-----+------------------------+ | name| type| attributes| +-----------+-----+------------------------+ |my_pipesink|IoTDB|ip='127.0.0.1',port=6667| +-----------+-----+------------------------+
Create a pipe.
** (i.e. data in all timeseries), the FROM statement only supports root, and the WHERE statement only supports the start time of the specified time. The start time can be specified in the form of yyyy-mm-dd HH:MM:SS or a timestamp.IoTDB> CREATE PIPE my_pipe TO my_iotdb [FROM (select ** from root WHERE time>='yyyy-mm-dd HH:MM:SS' )]
IoTDB> STOP PIPE <PipeName>
IoTDB> START PIPE <PipeName>
IoTDB> DROP PIPE <PipeName>
This statement can be executed on both senders and receivers.
Show all Pipe's status.
create time: the creation time of this pipe.
name: the name of this pipe.
role: the current role of this IoTDB in pipe, there are two possible roles.
remote: information about the opposite end of the Pipe.
status: the Pipe's status.
attributes: the attributes of Pipe
message: the status message of this pipe. When pipe runs normally, this column is NORMAL. When an exception occurs, messages may appear in following two states.
IoTDB> SHOW PIPES IoTDB> +-----------------------+--------+--------+-------------+---------+------------------------------------+-------+ | create time| name | role| remote| status| attributes|message| +-----------------------+--------+--------+-------------+---------+------------------------------------+-------+ |2022-03-30T20:58:30.689|my_pipe1| sender| my_pipesink| STOP|SyncDelOp=false,DataStartTimestamp=0| NORMAL| +-----------------------+--------+--------+-------------+---------+------------------------------------+-------+ |2022-03-31T12:55:28.129|my_pipe2|receiver|192.168.11.11| RUNNING| Database='root.vehicle'| NORMAL| +-----------------------+--------+--------+-------------+---------+------------------------------------+-------+
Show PIPES.IoTDB> SHOW PIPE [PipeName]
vi conf/iotdb-common.properties to config the parameters,set the IP white list to 192.168.0.1/32 to receive and only receive data from sender.#################### ### PIPE Server Configuration #################### # White IP list of Sync client. # Please use the form of IPv4 network segment to present the range of IP, for example: 192.168.0.0/16 # If there are more than one IP segment, please separate them by commas # The default is to reject all IP to sync except 0.0.0.0 # Datatype: String ip_white_list=192.168.0.1/32
IoTDB> CREATE PIPESINK my_iotdb AS IoTDB (IP='192.168.0.2',PORT=6667)
IoTDB> CREATE PIPE p TO my_iotdb FROM (select ** from root where time>='2022-03-30 00:00:00') IoTDB> CREATE PIPE p TO my_iotdb FROM (select ** from root where time>= 1648569600000)
IoTDB> START PIPE p
IoTDB> SHOW PIPE p
Execute SQL on sender.
CREATE DATABASE root.vehicle; CREATE TIMESERIES root.vehicle.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE; CREATE TIMESERIES root.vehicle.d0.s1 WITH DATATYPE=TEXT, ENCODING=PLAIN; CREATE TIMESERIES root.vehicle.d1.s2 WITH DATATYPE=FLOAT, ENCODING=RLE; CREATE TIMESERIES root.vehicle.d1.s3 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN; insert into root.vehicle.d0(timestamp,s0) values(now(),10); insert into root.vehicle.d0(timestamp,s0,s1) values(now(),12,'12'); insert into root.vehicle.d0(timestamp,s1) values(now(),'14'); insert into root.vehicle.d1(timestamp,s2) values(now(),16.0); insert into root.vehicle.d1(timestamp,s2,s3) values(now(),18.0,true); insert into root.vehicle.d1(timestamp,s3) values(now(),false); flush;
Execute SELECT statements, the same results can be found on sender and receiver.
IoTDB> select ** from root.vehicle +-----------------------------+------------------+------------------+------------------+------------------+ | Time|root.vehicle.d0.s0|root.vehicle.d0.s1|root.vehicle.d1.s3|root.vehicle.d1.s2| +-----------------------------+------------------+------------------+------------------+------------------+ |2022-04-03T20:08:17.127+08:00| 10| null| null| null| |2022-04-03T20:08:17.358+08:00| 12| 12| null| null| |2022-04-03T20:08:17.393+08:00| null| 14| null| null| |2022-04-03T20:08:17.538+08:00| null| null| null| 16.0| |2022-04-03T20:08:17.753+08:00| null| null| true| 18.0| |2022-04-03T20:08:18.263+08:00| null| null| false| null| +-----------------------------+------------------+------------------+------------------+------------------+ Total line number = 6 It costs 0.134s
Execute CREATE PIPESINK demo as IoTDB get message PIPESINK [demo] already exists in IoTDB.
DROP PIPESINK demo to drop PipeSink and recreate it.Execute DROP PIPESINK pipesinkName get message Can not drop PIPESINK [demo], because PIPE [mypipe] is using it.
SHOW PIPE on the sender side to stop using the PipeSink's PIPE.Execute CREATE PIPE p to demo get message PIPE [p] is STOP, please retry after drop it.
DROP PIPE p to drop Pipe and recreate it.Execute CREATE PIPE p to demo get message Fail to create PIPE [p] because Connection refused on DataNode: {id=2, internalEndPoint=TEndPoint(ip:127.0.0.1, port:10732)}.
SHOW DATANODES, and check for unreachable DataNode networks, or wait for their status to change to Unknown and re-execute the statement.Execute START PIPE p get message Fail to start PIPE [p] because Connection refused on DataNode: {id=2, internalEndPoint=TEndPoint(ip:127.0.0.1, port:10732)}.
SHOW DATANODES, and check for unreachable DataNode networks, or wait for their status to change to Unknown and re-execute the statement.Execute STOP PIPE p get message Fail to stop PIPE [p] because Connection refused on DataNode: {id=2, internalEndPoint=TEndPoint(ip:127.0.0.1, port:10732)}.
SHOW DATANODES, and check for unreachable DataNode networks, or wait for their status to change to Unknown and re-execute the statement.Execute DROP PIPE p get message Fail to DROP_PIPE because Fail to drop PIPE [p] because Connection refused on DataNode: {id=2, internalEndPoint=TEndPoint(ip:127.0.0.1, port:10732)}. Please execute [DROP PIPE p] later to retry.
SHOW DATANODES, and check for unreachable DataNode networks, or wait for their status to change to Unknown and re-execute the statement.Sync.log prompts org.apache.iotdb.commons.exception.IoTDBException: root.** already been created as database