|
| 1 | +<!-- |
| 2 | +
|
| 3 | + Licensed to the Apache Software Foundation (ASF) under one |
| 4 | + or more contributor license agreements. See the NOTICE file |
| 5 | + distributed with this work for additional information |
| 6 | + regarding copyright ownership. The ASF licenses this file |
| 7 | + to you under the Apache License, Version 2.0 (the |
| 8 | + "License"); you may not use this file except in compliance |
| 9 | + with the License. You may obtain a copy of the License at |
| 10 | + |
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + |
| 13 | + Unless required by applicable law or agreed to in writing, |
| 14 | + software distributed under the License is distributed on an |
| 15 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | + KIND, either express or implied. See the License for the |
| 17 | + specific language governing permissions and limitations |
| 18 | + under the License. |
| 19 | +
|
| 20 | +--> |
| 21 | + |
| 22 | +# 1. Outline |
| 23 | + |
| 24 | +- What's Zeppelin |
| 25 | + |
| 26 | +- IoTDB Zeppelin-Interpreter |
| 27 | + - System Requirements |
| 28 | + - Build Interpreter |
| 29 | + - Install Interpreter |
| 30 | + - Running Zeppelin and IoTDB |
| 31 | +- Use Zeppelin-IoTDB |
| 32 | +- Configuration |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +# 2. What's Zeppelin |
| 37 | + |
| 38 | +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. |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +# 3. Zeppelin-IoTDB Interpreter |
| 45 | + |
| 46 | +## System Requirements |
| 47 | + |
| 48 | +| IoTDB Version | Java Version | Zeppelin Version | |
| 49 | +| :-----------: | :-----------: | :--------------: | |
| 50 | +| >=`0.12.0-SNAPSHOT` | >=`1.8.0_271` | `>=0.9.0` | |
| 51 | + |
| 52 | +You can install IoTDB according to [IoTDB Quick Start](https://iotdb.apache.org/UserGuide/Master/Get%20Started/QuickStart.html). Suppose IoTDB is placed at `$IoTDB_HOME`. |
| 53 | + |
| 54 | +You can download [Zeppelin](https://zeppelin.apache.org/download.html#) and unpack the binary package directly or [build Zeppelin from source](https://zeppelin.apache.org/docs/latest/setup/basics/how_to_build.html). Suppose Zeppelin is placed at `$Zeppelin_HOME`. |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +## 3.2 Build Interpreter |
| 59 | + |
| 60 | +``` |
| 61 | + cd $IoTDB_HOME |
| 62 | + mvn clean package -pl zeppelin-interpreter -am -DskipTests |
| 63 | +``` |
| 64 | + |
| 65 | +The interpreter will be in the folder: |
| 66 | + |
| 67 | +``` |
| 68 | + $IoTDB_HOME/zeppelin-interpreter/target/zeppelin-{version}-SNAPSHOT-jar-with-dependencies.jar |
| 69 | +``` |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | +## 3.3 Install Interpreter |
| 74 | + |
| 75 | +Once you have built your interpreter, create a new folder under the Zeppelin interpreter directory and put the built interpreter into it. |
| 76 | + |
| 77 | +``` |
| 78 | + cd $IoTDB_HOME |
| 79 | + mkdir -p $Zeppelin_HOME/interpreter/iotdb |
| 80 | + cp $IoTDB_HOME/zeppelin-interpreter/target/zeppelin-{version}-SNAPSHOT-jar-with-dependencies.jar $Zeppelin_HOME/interpreter/iotdb |
| 81 | +``` |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +## 3.4 Running Zeppelin and IoTDB |
| 86 | + |
| 87 | +Go to `$Zeppelin_HOME` and start Zeppelin by running: |
| 88 | + |
| 89 | +``` |
| 90 | + ./bin/zeppelin-daemon.sh start |
| 91 | +``` |
| 92 | + |
| 93 | +or in Windows: |
| 94 | + |
| 95 | +``` |
| 96 | + .\bin\zeppelin.cmd |
| 97 | +``` |
| 98 | + |
| 99 | +Go to `$IoTDB_HOME` and [start IoTDB server](https://github.com/apache/iotdb#start-iotdb): |
| 100 | + |
| 101 | +``` |
| 102 | + # Unix/OS X |
| 103 | + > nohup sbin/start-server.sh >/dev/null 2>&1 & |
| 104 | + or |
| 105 | + > nohup sbin/start-server.sh -c <conf_path> -rpc_port <rpc_port> >/dev/null 2>&1 & |
| 106 | + |
| 107 | + # Windows |
| 108 | + > sbin\start-server.bat -c <conf_path> -rpc_port <rpc_port> |
| 109 | +``` |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | +# 4. Use Zeppelin-IoTDB |
| 114 | + |
| 115 | +Wait for Zeppelin server to start, then visit http://127.0.0.1:8080/ |
| 116 | + |
| 117 | +In the interpreter page: |
| 118 | + |
| 119 | +1. Click the `Create new node` button |
| 120 | +2. Set the note name |
| 121 | +3. Configure your interpreter |
| 122 | + |
| 123 | +Now you are ready to use your interpreter. |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +We provide some simple SQL to show the use of Zeppelin-IoTDB interpreter: |
| 128 | + |
| 129 | +```sql |
| 130 | + SET STORAGE GROUP TO root.ln.wf01.wt01; |
| 131 | + CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN; |
| 132 | + CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=PLAIN; |
| 133 | + CREATE TIMESERIES root.ln.wf01.wt01.hardware WITH DATATYPE=INT32, ENCODING=PLAIN; |
| 134 | + |
| 135 | + INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware) |
| 136 | + VALUES (1, 1.1, false, 11); |
| 137 | + |
| 138 | + INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware) |
| 139 | + VALUES (2, 2.2, true, 22); |
| 140 | + |
| 141 | + INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware) |
| 142 | + VALUES (3, 3.3, false, 33); |
| 143 | + |
| 144 | + INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware) |
| 145 | + VALUES (4, 4.4, false, 44); |
| 146 | + |
| 147 | + INSERT INTO root.ln.wf01.wt01 (timestamp, temperature, status, hardware) |
| 148 | + VALUES (5, 5.5, false, 55); |
| 149 | + |
| 150 | + |
| 151 | + SELECT * |
| 152 | + FROM root.ln.wf01.wt01 |
| 153 | + WHERE time >= 1 |
| 154 | + AND time <= 6; |
| 155 | +``` |
| 156 | + |
| 157 | +The screenshot is as follows: |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | +You can also design more fantasy documents referring to [[1]](https://zeppelin.apache.org/docs/0.9.0-SNAPSHOT/usage/display_system/basic.html) and others. |
| 162 | + |
| 163 | +The above demo notebook can be found at `$IoTDB_HOME/zeppelin-interpreter/Zeppelin-IoTDB-Demo.zpln`. |
| 164 | + |
| 165 | + |
| 166 | + |
| 167 | +# 5. Configuration |
| 168 | + |
| 169 | +You can configure the connection parameters in http://127.0.0.1:8080/#/interpreter : |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | +The parameters you can configure are as follows: |
| 174 | + |
| 175 | +| Property | Default | Description | |
| 176 | +| ---------------------------- | --------- | ------------------------------- | |
| 177 | +| iotdb.host | 127.0.0.1 | IoTDB server host to connect to | |
| 178 | +| iotdb.port | 6667 | IoTDB server port to connect to | |
| 179 | +| iotdb.username | root | Username for authentication | |
| 180 | +| iotdb.password | root | Password for authentication | |
| 181 | +| iotdb.fetchSize | 10000 | Query fetch size | |
| 182 | +| iotdb.zoneId | | Zone Id | |
| 183 | +| iotdb.enable.rpc.compression | FALSE | Whether enable rpc compression | |
| 184 | +| iotdb.time.display.type | default | The time format to display | |
0 commit comments