#iotdb #cli-client #apache #cli #iot-db #iotdb-client

app iotdb-cli

用Rust编写的Apache IotDB CLI客户端

4个版本

0.1.0 2022年8月3日
0.0.3 2022年1月27日
0.0.2 2021年11月27日
0.0.1 2021年11月8日

#4 in #iotdb

Apache-2.0

31KB
623 代码行(不包括注释)

Logo

iotdb-cli

用Rust编写的Apache IotDB CLI客户端

Contribute downloads GitHub Release Top Lang Rust Build Docs Build License Crates Publish


Alt

Docker

docker run --name iotdb-cli -d ghcr.io/iotdb-lab/iotdb-cli
docker exec -it iotdb-cli iotdb

安装

Linux supported macOS supported Windows supported

  1. 使用 Cargo
cargo install -f iotdb-cli

cargo install -f --git  https://github.com/iotdb-lab/iotdb-cli.git
  1. 二进制文件 安装
curl -s https://raw.githubusercontent.com/iotdb-lab/iotdb-cli/main/install.sh | bash

curl -s https://raw.githubusercontent.com/iotdb-lab/iotdb-cli/main/install.sh | bash -s -- x.x.x
wget -qO- https://raw.githubusercontent.com/iotdb-lab/iotdb-cli/main/install.sh | bash

wget -qO- https://raw.githubusercontent.com/iotdb-lab/iotdb-cli/main/install.sh | bash -s -- x.x.x

用法

iotdb -h

▀██▀  ▄▄█▀▀██   █▀▀██▀▀█ ▀██▀▀█▄   ▀██▀▀█▄
 ██  ▄█▀    ██     ██     ██   ██   ██   ██
 ██  ██      ██    ██     ██    ██  ██▀▀▀█▄
 ██  ▀█▄     ██    ██     ██    ██  ██    ██
▄██▄  ▀▀█▄▄▄█▀    ▄██▄   ▄██▄▄▄█▀  ▄██▄▄▄█▀     

Author: github.com/francis-du <[email protected]>
Version: iotdb-cli 0.1.0

USAGE:
    iotdb [FLAGS] [OPTIONS] [sql] [SUBCOMMAND]

FLAGS:
    -d, --debug      Enable debug mode
        --dev        Dev server
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -e, --endpoint <endpoint>    Set server endpoint, eg: `localhost:6667`
    -f, --file <file>            Execute batch form sql file, eg: `iotdb -f ddl.sql`
    -H, --host <host>            Set server hostname or ip address, eg: `127.0.0.1`
    -p, --password <password>    Set user password
    -P, --port <port>            Set server port
    -t, --timezone <timezone>    Set timezone, eg: `UTC+8`
    -u, --user <user>            Set user name

ARGS:
    <sql>    Execute single sql, eg: `iotdb "show storage group"`

SUBCOMMANDS:
    csv        Csv util(TODO)
    file       Execute batch form sql file, eg: `iotdb file ddl.sql`
    help       Prints this message or the help of the given subcommand(s)
    load       Load TsFile util (TODO)
    update     Update binary (TODO)
    usage      Print usage info
    version    Prints server version information
  1. 连接到IoTDB服务器
  • 使用默认用户名和密码
$ iotdb "SHOW STORAGE GROUP"
+---------------+
| storage group |
+---------------+
| root.ln       |
| root.sg1      |
+---------------+
  • 指定参数
iotdb -u root -p root -e 127.0.0.1:6667 -t UTC+8

or 

iotdb -u root -p root -H 127.0.0.1 -P 6667 -t UTC+8
  1. 交互式执行单个SQL命令
$ iotdb -u root -p root --e 127.0.0.1:6667 -t UTC+8

▀██▀  ▄▄█▀▀██   █▀▀██▀▀█ ▀██▀▀█▄   ▀██▀▀█▄
 ██  ▄█▀    ██     ██     ██   ██   ██   ██
 ██  ██      ██    ██     ██    ██  ██▀▀▀█▄
 ██  ▀█▄     ██    ██     ██    ██  ██    ██
▄██▄  ▀▀█▄▄▄█▀    ▄██▄   ▄██▄▄▄█▀  ▄██▄▄▄█▀     

Author: github.com/francis-du <[email protected]>
Version: iotdb-cli v0.1.0
Usage:
    1. Print usage info: `?` or `help` 
    2. Exec system command on OS: `!ps`
    3. Exit: `exit` or `quit` or `Ctrl-C` or `Ctrl-D`
IOTDB#(127.0.0.1:6667)>  SHOW STORAGE GROUP
+---------------+
| storage group |
+---------------+
| root.ln       |
| root.sg1      |
+---------------+
  1. 从指定的SQL文件中执行SQL命令
$ iotdb file tests/create_and_insert.sql
$ iotdb -file tests/create_and_insert.sql
$ iotdb -f tests/create_and_insert.sql
Statements: [
    "DELETE STORAGE GROUP root.test;",
    "CREATE TIMESERIES root.test.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN;",
    "CREATE TIMESERIES root.test.temperature WITH DATATYPE=FLOAT, ENCODING=RLE;",
    "INSERT INTO root.test(timestamp, status)\n values (1637960249484, true);",
    "INSERT INTO root.test(timestamp, status, temperature)\n values (1637960256493, false, 20.71);",
    "INSERT INTO root.test(timestamp, status, temperature)\n values (1637960261494, true, 32.43);",
    "INSERT INTO root.test(timestamp, status, temperature)\n values (1637960272492, false, 28.66);",
    "INSERT INTO root.test(timestamp, status, temperature)\n values (1637960272492, true, 22.61);",
    "INSERT INTO root.test(timestamp, status, temperature)\n values (1637960296493, false, 28.66);",
]
23:00:23 [INFO] Execute batch statements successfully
  1. 打印用法信息
$ iotdb usage

许可证

Apache License 2.0

依赖

~20–31MB
~503K SLoC