IoTDB (Internet of Things Database) is a data management system for time series data, which can provide users specific services, such as, data collection, storage and analysis. Due to its light weight structure, high performance and usable features together with its seamless integration with the Hadoop and Spark ecology, IoTDB meets the requirements of massive dataset storage, high throughput data input, and complex data analysis in the industrial IoT field.
Add iotdb
to your Cargo.toml
toml
[dependencies]
iotdb = "0.0.5"
```rust use thrift::Error;
use iotdb::common::{Compressor, DataType, Encoding}; use iotdb::{Config, Session};
fn main() -> Result<(), Error> { let config = Config::new() .endpoint("127.0.0.1", "6667") .user("root") .password("root") .zone_id("UTC+8") // .debug(true) .build();
// open session
let mut session = Session::new(config).open()?;
println!("time_zone: {}", session.time_zone()?);
session.delete_storage_group("root.ln")?;
session.set_storage_group("root.ln")?;
session.create_time_series(
"root.ln.wf01.wt01.temperature",
DataType::INT64,
Encoding::default(),
Compressor::default(),
)?;
session.create_time_series(
"root.ln.wf01.wt01.humidity",
DataType::INT64,
Encoding::default(),
Compressor::default(),
)?;
session.sql("INSERT INTO root.ln.wf01.wt01(timestamp,status) values(100,true)")?;
session.sql("INSERT INTO root.ln.wf01.wt01(timestamp,status) values(200,false)")?;
session.sql(
"INSERT INTO root.ln.wf01.wt01(timestamp,status,temperature) values(300,false,18.36)",
)?;
session.sql(
"INSERT INTO root.ln.wf01.wt01(timestamp,status,temperature) values(400,true,32.23)",
)?;
session.sql("select * from root.ln")?.show();
session.close()?;
Ok(())
}
```
shell
curl -O https://archive.apache.org/dist/iotdb/0.11.2/apache-iotdb-0.11.2-bin.zip
shell
cd $IOTDB_HOME && sbin/start-server -c conf -rpc_port 6667
shell
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
4.Run example
```shell git clone https://github.com/francis-du/iotdb-rs.git
cargo run --example main ```