1.sql带有时间的模式:
select count(*) from "behavior-h5sdk" where "__time" BETWEEN TIMESTAMP '2019-01-30 00:00:00' AND TIMESTAMP '2019-01-30 23:59:59'
##所有的时间相关的查询的列都是用"__time"这个字段
时间格式的函数:
select DATE_TRUNC('day',"__time"),count(*) from "updates-tutorial" group by DATE_TRUNC('day',"__time") ##把时间戳 2019-02-04T00:00:00.000Z 转换成 day的级别 2019-02-04
2.上传数据:
curl -X 'POST' -H 'Content-Type:application/json' -d @/data/upload/example-index.json http://prestoslave01:8090/druid/indexer/v1/task
## /data/upload/example-index.json 为druid中data角色的节点的目录,example-index.json 为上传数据的json格式文件。
## prestoslave01:8090 为druid 的active的主节点的地址
3.查询数据:
curl -X POST 'prestoslave02:8082/druid/v2/?pretty' -H 'Content-Type:application/json' -H 'Accept:application/json' -d @quickstart/wikipedia-top-pages.json
## prestoslave02:8082 为druid中的查询节点,也就是query节点的地址和端口
## quickstart/wikipedia-top-pages.json 这个是采用的相对路径的文件来进行查询
4.获取所有的实时数据流的supervise: curl http://prestoslave01:8081/druid/indexer/v1/supervisor?full
5.查询某台服务器是否为druid的leader:
curl -H 'Content-Type:application/json' http://prestoslave01:8081/druid/coordinator/v1/leader
6.supervise的信息获取的命令
获取指定supervise id的Spec :
curl http://prestoslave01:8081/druid/indexer/v1/supervisor/behavior-h5sdk
# 这里的supervise id为 behavior-h5sdk
获取druid消费kafka数据的offset以及延迟的基本情况报告 curl http://prestoslave01:8081/druid/indexer/v1/supervisor/behavior-h5sdk/status # 这里的supervise id为 behavior-h5sdk
获取指定supervisor id的历史spec : curl http://prestoslave01:8081/druid/indexer/v1/supervisor/behavior-h5sdk/history