####################
### MQTT Broker Configuration
####################
# whether to enable the mqtt service.
enable_mqtt_service=false # 修改成 true , 代表开启 mqtt服务
# the mqtt service binding host.
mqtt_host=0.0.0.0 # ip
# the mqtt service binding port.
mqtt_port=1883 # 端口
# the handler pool size for handing the mqtt messages.
mqtt_handler_pool_size=1
# the mqtt message payload formatter.
mqtt_payload_formatter=json # 数据格式
# max length of mqtt message in byte
mqtt_max_message_size=1048576
设置一个存储组到IOTDB,名为root : IoTDB> SET STORAGE GROUP TO root
查看当前IOTDB的存储组 : IoTDB> SHOW STORAGE GROUP
IoTDB> SHOW STORAGE GROUP
+-------------+
|storage group|
+-------------+
| root.test|
+-------------+
Total line number = 1
It costs 0.127s
查看系统中存在的所有时间序列 :IoTDB> SHOW TIMESERIES
IoTDB> show timeseries
+-------------------------------+-----+-------------+--------+--------+-----------+----+----------+
| timeseries|alias|storage group|dataType|encoding|compression|tags|attributes|
+-------------------------------+-----+-------------+--------+--------+-----------+----+----------+
|root.test.wf01.wt01.temperature| null| root.test| FLOAT| GORILLA| SNAPPY|null| null|
| root.test.wf01.wt01.status| null| root.test| BOOLEAN| RLE| SNAPPY|null| null|
| root.test.wf01.wt01.hardware| null| root.test| TEXT| PLAIN| SNAPPY|null| null|
+-------------------------------+-----+-------------+--------+--------+-----------+----+----------+
Total line number = 3
It costs 0.009s
查看系统中存在的特定时间序列: SHOW TIMESERIES root.test.wf01.wt01.status
IoTDB> SHOW TIMESERIES root.test.wf01.wt01.status
+--------------------------+-----+-------------+--------+--------+-----------+----+----------+
| timeseries|alias|storage group|dataType|encoding|compression|tags|attributes|
+--------------------------+-----+-------------+--------+--------+-----------+----+----------+
|root.test.wf01.wt01.status| null| root.test| BOOLEAN| RLE| SNAPPY|null| null|
+--------------------------+-----+-------------+--------+--------+-----------+----+----------+
Total line number = 1
It costs 0.003s
插入数据 INSERT INTO root.test.wf01.wt01(timestamp,status,temperature) values(200,false,20.71)
IoTDB> INSERT INTO root.test.wf01.wt01(timestamp,status,temperature) values(200,false,20.71)
Msg: The statement is executed successfully.
查看数据: select * from root.test;
IoTDB> select * from root.test;
+------------------------+-------------------------------+--------------------------+----------------------------+
| Time|root.test.wf01.wt01.temperature|root.test.wf01.wt01.status|root.test.wf01.wt01.hardware|
+------------------------+-------------------------------+--------------------------+----------------------------+
|2021-01-20T02:00:00.000Z| 21.2| true| hello|
+------------------------+-------------------------------+--------------------------+----------------------------+
Total line number = 1
It costs 0.077s
查看设备:show devices
IoTDB> show devices
+-------------------+
| devices|
+-------------------+
|root.test.wf01.wt01|
+-------------------+
Total line number = 1
It costs 0.002s
mqtt to iotdb
代码
构建一个实体对象,用于存储
package wang.datahub.iotdb;
import com.google.gson.Gson;
import java.util.List;
public class IotdbVO {
private String device;
private long timestamp = System.currentTimeMillis();
private List measurements;
private List
网上关于SQL优化的教程很多,但是比较杂乱。近日有空整理了一下,写出来跟大家分享一下,其中有错误和不足的地方,还请大家纠正补充。
这篇文章我花费了大量的时间查找资料、修改、排版,希望大家阅读之后,感觉好的话推荐给更多的人,让更多的人看到、纠正以及补充。
1.对查询进行优化,要尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。
2.应尽量避免在 where
Zookeeper类是Zookeeper提供给用户访问Zookeeper service的主要API,它包含了如下几个内部类
首先分析它的内部类,从WatchRegistration开始,为指定的znode path注册一个Watcher,
/**
* Register a watcher for a particular p
何为部分应用函数?
Partially applied function: A function that’s used in an expression and that misses some of its arguments.For instance, if function f has type Int => Int => Int, then f and f(1) are p