Zeppelin-IoTDB

About Zeppelin

Zeppelin is a web-based notebook that enables interactive data analytics. You can connect to data sources and perform interactive operations with SQL, Scala, etc. The operations can be saved as documents, just like Jupyter. Zeppelin has already supported many data sources, including Spark, ElasticSearch, Cassandra, and InfluxDB. Now, we have enabled Zeppelin to operate IoTDB via SQL.

iotdb-note-snapshot

Zeppelin-IoTDB Interpreter

System Requirements

IoTDB VersionJava VersionZeppelin Version
>=0.12.0-SNAPSHOT>=1.8.0_271>=0.9.0

Install IoTDB: Reference to IoTDB Quick Start. Suppose IoTDB is placed at $IoTDB_HOME.

Install Zeppelin:

Method A. Download directly: You can download ZeppelinZeppelin-IoTDB - 图2 (opens new window) and unpack the binary package. netinstZeppelin-IoTDB - 图3 (opens new window) binary package is recommended since it’s relatively small by excluding irrelevant interpreters.

Method B. Compile from source code: Reference to build Zeppelin from sourceZeppelin-IoTDB - 图4 (opens new window). The command is mvn clean package -pl zeppelin-web,zeppelin-server -am -DskipTests.

Suppose Zeppelin is placed at $Zeppelin_HOME.

Build Interpreter

  1. cd $IoTDB_HOME
  2. mvn clean package -pl zeppelin-interpreter -am -DskipTests -P get-jar-with-dependencies

The interpreter will be in the folder:

  1. $IoTDB_HOME/zeppelin-interpreter/target/zeppelin-{version}-SNAPSHOT-jar-with-dependencies.jar

Install Interpreter

Once you have built your interpreter, create a new folder under the Zeppelin interpreter directory and put the built interpreter into it.

  1. cd $IoTDB_HOME
  2. mkdir -p $Zeppelin_HOME/interpreter/iotdb
  3. cp $IoTDB_HOME/zeppelin-interpreter/target/zeppelin-{version}-SNAPSHOT-jar-with-dependencies.jar $Zeppelin_HOME/interpreter/iotdb

Running Zeppelin and IoTDB

Go to $Zeppelin_HOME and start Zeppelin by running:

  1. ./bin/zeppelin-daemon.sh start

or in Windows:

  1. .\bin\zeppelin.cmd

Go to $IoTDB_HOME and start IoTDB server:

  1. # Unix/OS X
  2. > nohup sbin/start-server.sh >/dev/null 2>&1 &
  3. or
  4. > nohup sbin/start-server.sh -c <conf_path> -rpc_port <rpc_port> >/dev/null 2>&1 &
  5. # Windows
  6. > sbin\start-server.bat -c <conf_path> -rpc_port <rpc_port>

Use Zeppelin-IoTDB

Wait for Zeppelin server to start, then visit http://127.0.0.1:8080/

In the interpreter page:

  1. Click the Create new node button
  2. Set the note name
  3. Configure your interpreter

Now you are ready to use your interpreter.

iotdb-create-note

We provide some simple SQL to show the use of Zeppelin-IoTDB interpreter:

  1. SET STORAGE GROUP TO root.ln.wf01.wt01;
  2. CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN;
  3. CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=PLAIN;
  4. CREATE TIMESERIES root.ln.wf01.wt01.hardware WITH DATATYPE=INT32, ENCODING=PLAIN;
  5. INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
  6. VALUES (1, 1.1, false, 11);
  7. INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
  8. VALUES (2, 2.2, true, 22);
  9. INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
  10. VALUES (3, 3.3, false, 33);
  11. INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
  12. VALUES (4, 4.4, false, 44);
  13. INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
  14. VALUES (5, 5.5, false, 55);
  15. SELECT *
  16. FROM root.ln.wf01.wt01
  17. WHERE time >= 1
  18. AND time <= 6;

The screenshot is as follows:

iotdb-note-snapshot2

You can also design more fantasy documents referring to [1]Zeppelin-IoTDB - 图7 (opens new window) and others.

The above demo notebook can be found at $IoTDB_HOME/zeppelin-interpreter/Zeppelin-IoTDB-Demo.zpln.

Configuration

You can configure the connection parameters in http://127.0.0.1:8080/#/interpreter :

iotdb-configuration

The parameters you can configure are as follows:

PropertyDefaultDescription
iotdb.host127.0.0.1IoTDB server host to connect to
iotdb.port6667IoTDB server port to connect to
iotdb.usernamerootUsername for authentication
iotdb.passwordrootPassword for authentication
iotdb.fetchSize10000Query fetch size
iotdb.zoneIdZone Id
iotdb.enable.rpc.compressionFALSEWhether enable rpc compression
iotdb.time.display.typedefaultThe time format to display