TagSchemaRegion
is an implementation of SchemaRegion
Firstly, you should package schema-engine-tag by the following command:
mvn clean package -pl schema-engine-tag -am -DskipTests
After that, you can get a conf directory and a lib directory in schema-engine-tag/target/schema-engine-tag. Copy the file in the conf directory to the conf directory of server, and copy the files in the lib directory to the lib directory of server.
Then, open the iotdb-datanode.properties in the conf directory of server, and set the schema_engine_mode
to Tag, set the enable_id_table
to true. Restart the IoTDB, the system will use TagSchemaRegion
to manage the metadata.
IoTDB offers different ways to interact with server, here we introduce the basic steps of using Cli tool to insert and query data. The command line cli is interactive, so you should see the welcome logo and statements if everything is ready:
--------------------- Starting IoTDB Cli --------------------- _____ _________ ______ ______ |_ _| | _ _ ||_ _ `.|_ _ \ | | .--.|_/ | | \_| | | `. \ | |_) | | | / .'`\ \ | | | | | | | __'. _| |_| \__. | _| |_ _| |_.' /_| |__) | |_____|'.__.' |_____| |______.'|_______/ version 1.0.0 IoTDB> login successfully
IoTDB> create timeseries root.ln.tag1.a.tag2.b.status with datatype=BOOLEAN,encoding=PLAIN Msg: The statement is executed successfully.
IoTDB> CREATE ALIGNED TIMESERIES root.ln.tag1.a.tag2.c(latitude FLOAT encoding=PLAIN compressor=SNAPPY, longitude FLOAT encoding=PLAIN compressor=SNAPPY) Msg: The statement is executed successfully.
enter a full path
IoTDB> show timeseries root.ln.tag2.c.tag1.a +-------------------------------+-----+-------------+--------+--------+-----------+----+----------+ | timeseries|alias|database|dataType|encoding|compression|tags|attributes| +-------------------------------+-----+-------------+--------+--------+-----------+----+----------+ | root.ln.tag1.a.tag2.c.latitude| null| root.ln| FLOAT| PLAIN| SNAPPY|null| null| |root.ln.tag1.a.tag2.c.longitude| null| root.ln| FLOAT| PLAIN| SNAPPY|null| null| +-------------------------------+-----+-------------+--------+--------+-----------+----+----------+
paths ending in “.**” indicate batch query
IoTDB> show timeseries root.ln.tag1.a.** +-------------------------------+-----+-------------+--------+--------+-----------+----+----------+ | timeseries|alias|database|dataType|encoding|compression|tags|attributes| +-------------------------------+-----+-------------+--------+--------+-----------+----+----------+ | root.ln.tag1.a.tag2.b.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| | root.ln.tag1.a.tag2.c.latitude| null| root.ln| FLOAT| PLAIN| SNAPPY|null| null| |root.ln.tag1.a.tag2.c.longitude| null| root.ln| FLOAT| PLAIN| SNAPPY|null| null| +-------------------------------+-----+-------------+--------+--------+-----------+----+----------+ IoTDB> show timeseries root.ln.tag2.c.** +-------------------------------+-----+-------------+--------+--------+-----------+----+----------+ | timeseries|alias|database|dataType|encoding|compression|tags|attributes| +-------------------------------+-----+-------------+--------+--------+-----------+----+----------+ | root.ln.tag1.a.tag2.c.latitude| null| root.ln| FLOAT| PLAIN| SNAPPY|null| null| |root.ln.tag1.a.tag2.c.longitude| null| root.ln| FLOAT| PLAIN| SNAPPY|null| null| +-------------------------------+-----+-------------+--------+--------+-----------+----+----------+ IoTDB> show timeseries root.ln.tag2.b.** +----------------------------+-----+-------------+--------+--------+-----------+----+----------+ | timeseries|alias|database|dataType|encoding|compression|tags|attributes| +----------------------------+-----+-------------+--------+--------+-----------+----+----------+ |root.ln.tag1.a.tag2.b.status| null| root.ln| BOOLEAN| PLAIN| SNAPPY|null| null| +----------------------------+-----+-------------+--------+--------+-----------+----+----------+
IoTDB> insert into root.ln.tag2.d(timestamp,status) values(1,true) Msg: The statement is executed successfully. IoTDB> insert into root.ln.tag2.d(timestamp,status) values(2,false) Msg: The statement is executed successfully. IoTDB> insert into root.ln.tag2.d(timestamp,status) values(3,true) Msg: The statement is executed successfully. IoTDB> insert into root.ln.tag1.a.tag2.d(timestamp,status) values(1,true) Msg: The statement is executed successfully.
IoTDB> insert into root.sg1.tag1.a(time, s1, s2) aligned values(2, 2, 2), (3, 3, 3) Msg: The statement is executed successfully.
IoTDB> select * from root.sg1.tag1.a +-----------------------------+------------------+------------------+ | Time|root.sg1.tag1.a.s1|root.sg1.tag1.a.s2| +-----------------------------+------------------+------------------+ |1970-01-01T08:00:00.002+08:00| 2.0| 2.0| |1970-01-01T08:00:00.003+08:00| 3.0| 3.0| +-----------------------------+------------------+------------------+
IoTDB> select * from root.sg1.tag1.a align by device +-----------------------------+---------------+---+---+ | Time| Device| s1| s2| +-----------------------------+---------------+---+---+ |1970-01-01T08:00:00.002+08:00|root.sg1.tag1.a|2.0|2.0| |1970-01-01T08:00:00.003+08:00|root.sg1.tag1.a|3.0|3.0| +-----------------------------+---------------+---+---+
IoTDB> select status from root.ln.tag2.d.** where time < 2017-11-01T00:08:00.000 +-----------------------------+----------------------------+---------------------+ | Time|root.ln.tag1.a.tag2.d.status|root.ln.tag2.d.status| +-----------------------------+----------------------------+---------------------+ |1970-01-01T08:00:00.001+08:00| true| true| |1970-01-01T08:00:00.002+08:00| null| false| |1970-01-01T08:00:00.003+08:00| null| true| +-----------------------------+----------------------------+---------------------+