IoTDB(Internet of Things Database) is an integrated data management engine designed for time series data, which can provide users specific services for data collection, storage and analysis. Due to its light weight structure, high performance and usable features together with its intense integration with Hadoop and Spark ecology, IoTDB meets the requirements of massive dataset storage, high-speed data input and complex data analysis in the IoT industrial field.
IoTDB's features are as following:
For the latest information about IoTDB, please visit our IoTDB official website (will transfer to iotdb.apache.org in the future).
To use IoTDB, you need to have:
If you want to use Hadoop or Spark to analyze IoTDB data file (called as TsFile), you need to compile the hadoop and spark modules.
This short guide will walk you through the basic process of using IoTDB. For a more-complete guide, please visit our website's Document Part.
If you are not the first time that building IoTDB, remember deleting the following files:
rm -rf iotdb/iotdb/data/
rm -rf iotdb/iotdb/lib/
Then you can build IoTDB using Maven in current folder:
mvn clean package -Dmaven.test.skip=true
(NOTICE: Remember that you have to use -Dmaven.test.skip=true before you run tests, it is because some IT (integration test) requires jars in iotdb-cli/cli/lib/, and the folder is empty before you run mvn package
. After that, you can run mvn test
as long as you do not run mvn clean
. For more details, see: How to test IoTDB
)
If successful, you will see the the following text in the terminal:
[INFO] BUILD SUCCESS
Otherwise, you may need to check the error statements and fix the problems.
After build, the IoTDB project will be at the folder "iotdb/iotdb". The folder will include the following contents:
iotdb/iotdb/ <-- root path
|
+- bin/ <-- script files
|
+- conf/ <-- configuration files
|
+- lib/ <-- project dependencies
|
+- LICENSE <-- LICENSE
NOTE: We also provide already built JARs and project at http://tsfile.org/download instead of build the jar package yourself.
Before starting to use IoTDB, you need to config the configuration files first. For your convenience, we have already set the default config in the files.
In total, we provide users three kinds of configurations module: environment config module (iotdb-env.bat, iotdb-env.sh), system config module (tsfile-format.properties, iotdb-engine.properties) and log config module (logback.xml). All of these kinds of configuration files are put in iotdb/config folder.
For more, you are advised to check our website document page. The forth chapter in User Guide Document will give you the details.
After that we start the server. Running the startup script:
# Unix/OS X
> ./bin/start-server.sh
# Windows
> bin\start-server.bat
The server can be stopped with ctrl-C or the following script:
# Unix/ OS X
> ./bin/stop-server.sh
# Windows
> bin\stop-server.bat
Now let's trying to read and write some data from IoTDB using our Client. To start the client, you need to explicit the server's IP and PORT as well as the USER_NAME and PASSWORD.
cd cli/cli
# Unix/OS X
> ./bin/start-client.sh -h <ip> -p <port> -u <username> -pw <password>
# Windows
> bin\start-client.bat -h <ip> -p <port> -u <username> -pw <password>
NOTE: In the system, we set a default user in IoTDB named 'root'. The default password for 'root' is 'root'. You can use this default user if you are making the first try or you didn't create users by yourself.
The command line client is interactive so if everything is ready you should see the welcome logo and statements:
_____ _________ ______ ______
|_ _| | _ _ ||_ _ `.|_ _ \
| | .--.|_/ | | \_| | | `. \ | |_) |
| | / .'`\ \ | | | | | | | __'.
_| |_| \__. | _| |_ _| |_.' /_| |__) |
|_____|'.__.' |_____| |______.'|_______/ version 0.7.0
IoTDB> login successfully
IoTDB>
Now, you can use IoTDB SQL to operate IoTDB, and when you've had enough fun, you can input 'quit' or 'exit' command to leave the client.
But lets try something slightly more interesting:
IoTDB> SET STORAGE GROUP TO root.vehicle
execute successfully.
IoTDB> CREATE TIMESERIES root.vehicle.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE
execute successfully.
Till now, we have already create a table called root.vehicle and add a column called d0.s0 in the table. Let's take a look at what we have done by 'SHOW TIMESERIES' command.
IoTDB> SHOW TIMESERIES
=== Timeseries Tree ===
root:{
vehicle:{
d0:{
s0:{
DataType: INT32,
Encoding: RLE,
args: {},
StorageGroup: root.vehicle
}
}
}
}
Insert time series data is the basic operation of IoTDB, you can use 'INSERT' command to finish this:
IoTDB> insert into root.vehicle.d0(timestamp,s0) values(1,101);
execute successfully.
The data we've just inserted displays like this:
IoTDB> SELECT d0.s0 FROM root.vehicle
+-----------------------+------------------+
| Time|root.vehicle.d0.s0|
+-----------------------+------------------+
|1970-01-01T08:00:00.001| 101|
+-----------------------+------------------+
record number = 1
execute successfully.
If your session looks similar to what's above, congrats, your IoTDB is operational!
For more on what commands are supported by IoTDB SQL, see our website document page. The eighth chapter in User Guide Document will give you help.
SET STORAGE GROUP TO root.fit.d1;
SET STORAGE GROUP TO root.fit.d2;
SET STORAGE GROUP TO root.fit.p;
CREATE TIMESERIES root.fit.d1.s1 WITH DATATYPE=INT32,ENCODING=RLE;
CREATE TIMESERIES root.fit.d1.s2 WITH DATATYPE=TEXT,ENCODING=PLAIN;
CREATE TIMESERIES root.fit.d2.s1 WITH DATATYPE=INT32,ENCODING=RLE;
CREATE TIMESERIES root.fit.d2.s3 WITH DATATYPE=INT32,ENCODING=RLE;
CREATE TIMESERIES root.fit.p.s1 WITH DATATYPE=INT32,ENCODING=RLE;
# Unix/OS X
> ./bin/import-csv.sh -h <ip> -p <port> -u <username> -pw <password> -f <xxx.csv>
# Windows
> bin\import-csv.bat -h <ip> -p <port> -u <username> -pw <password> -f <xxx.csv>
csvInsertError.error
# Unix/OS X
> ./bin/export-csv.sh -h <ip> -p <port> -u <username> -pw <password> -td <xxx.csv> [-tf <time-format>]
# Windows
> bin\export-csv.bat -h <ip> -p <port> -u <username> -pw <password> -td <xxx.csv> [-tf <time-format>]