Apache Zeppelin
Apache Zeppelin
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.
Zeppelin-IoTDB Interpreter
System Requirements
IoTDB Version | Java Version | Zeppelin Version |
---|---|---|
>=0.12.0 | >=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 Zeppelin and unpack the binary package. netinst binary package is recommended since it's relatively small by excluding irrelevant interpreters.
Method B. Compile from source code: Reference to build Zeppelin from source. The command is
mvn clean package -pl zeppelin-web,zeppelin-server -am -DskipTests
.
Suppose Zeppelin is placed at $Zeppelin_HOME
.
Build Interpreter
cd $IoTDB_HOME
mvn clean package -pl iotdb-connector/zeppelin-interpreter -am -DskipTests -P get-jar-with-dependencies
The interpreter will be in the folder:
$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.
cd $IoTDB_HOME
mkdir -p $Zeppelin_HOME/interpreter/iotdb
cp $IoTDB_HOME/zeppelin-interpreter/target/zeppelin-{version}-SNAPSHOT-jar-with-dependencies.jar $Zeppelin_HOME/interpreter/iotdb
Modify Configuration
Enter $Zeppelin_HOME/conf
and use template to create Zeppelin configuration file:
cp zeppelin-site.xml.template zeppelin-site.xml
Open the zeppelin-site.xml file and change the zeppelin.server.addr
item to 0.0.0.0
Running Zeppelin and IoTDB
Go to $Zeppelin_HOME
and start Zeppelin by running:
./bin/zeppelin-daemon.sh start
or in Windows:
.\bin\zeppelin.cmd
Go to $IoTDB_HOME
and start IoTDB server:
# Unix/OS X
> nohup sbin/start-server.sh >/dev/null 2>&1 &
or
> nohup sbin/start-server.sh -c <conf_path> -rpc_port <rpc_port> >/dev/null 2>&1 &
# Windows
> 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:
- Click the
Create new node
button - Set the note name
- Configure your interpreter
Now you are ready to use your interpreter.
We provide some simple SQL to show the use of Zeppelin-IoTDB interpreter:
CREATE DATABASE root.ln.wf01.wt01;
CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN;
CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=PLAIN;
CREATE TIMESERIES root.ln.wf01.wt01.hardware WITH DATATYPE=INT32, ENCODING=PLAIN;
INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
VALUES (1, 1.1, false, 11);
INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
VALUES (2, 2.2, true, 22);
INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
VALUES (3, 3.3, false, 33);
INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
VALUES (4, 4.4, false, 44);
INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware)
VALUES (5, 5.5, false, 55);
SELECT *
FROM root.ln.wf01.wt01
WHERE time >= 1
AND time <= 6;
The screenshot is as follows:
You can also design more fantasy documents referring to [1] 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 :
The parameters you can configure are as follows:
Property | Default | Description |
---|---|---|
iotdb.host | 127.0.0.1 | IoTDB server host to connect to |
iotdb.port | 6667 | IoTDB server port to connect to |
iotdb.username | root | Username for authentication |
iotdb.password | root | Password for authentication |
iotdb.fetchSize | 10000 | Query fetch size |
iotdb.zoneId | Zone Id | |
iotdb.enable.rpc.compression | FALSE | Whether enable rpc compression |
iotdb.time.display.type | default | The time format to display |