Apache Druid常用API

简介: Apache Druid常用API

1.查询某个Meta Datasource下所有的segments

GET http://coordinator_hostname:8081/druid/coordinator/v1/metadata/datasources/datasource_name/segments/

GET http://coordinator_hostname:8062/druid/coordinator/v1/metadata/datasources/T24R16_RATE1/segments/

["T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z","T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T0
9:53:03.923Z_1","T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z_10","T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00
.000Z_2018-11-30T09:53:03.923Z_11","T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z_12"]

2.查询某个Meta Datasource下某个segment

GET http://coordinator_hostname:8081/druid/coordinator/v1/metadata/datasources/datasource_name/segments/segment_id

GET http://coordinator_hostname:8062/druid/coordinator/v1/metadata/datasources/T24R16_RATE1/segments/T24R16_RATE1_2018-12-12T00:00:00.000Z_2018-12-13T00:00:00.000Z_2018-12-11T16:02:01.049Z_11

{"dataSource":"T24R16_RATE1","interval":"2018-12-12T00:00:00.000Z/2018-12-13T00:00:00.000Z","version":"2018-12-11T16:02:01.049Z","loadSpec":{"type":"hdfs","path":"hdfs://namenodea.bos.opmbd.com:8020/druid/segments/T24R16_RATE1/20181212T000000.000Z_20181213T000000.000Z/2018-12-11T16_02_01.049Z/11_4a80ec61-cb8e-4fc0-ab0b-802f57fd4b4a_index.zip"},"dimensions":"appName,nodeName,isFundTrans,transType,requestTime,channelSubSystem,errorCode,errorMessage,hour,day,year,month","metrics":"TotalTransCount,SuccessTransCount,FaildTransCount,MaxProcessTime,MinProcessTime,TotalProcessTime","shardSpec":{"type":"numbered","partitionNum":11,"partitions":0},"binaryVersion":9,"size":3569916,"identifier":"T24R16_RATE1_2018-12-12T00:00:00.000Z_2018-12-13T00:00:00.000Z_2018-12-11T16:02:01.049Z_11"}

3.删除某个Datasource下的某个segment

DELETE http://coordinator_hostname:8081/druid/coordinator/v1/metadata/datasources/datasource_name/segments/segment_id

4.停止流任务

POST http://overlord_hostname:8090/druid/indexer/v1/supervisor/datasource_name/shutdown

5.查看流任务状态

GET http://overlord_hostname:8090/druid/indexer/v1/supervisor/datasource_name/status

GET  http://overlord_hostname:8065/druid/indexer/v1/supervisor/T24R16_RATE1/status

{"id":"T24R16_RATE1","generationTime":"2018-12-12T10:27:17.774Z","payload":{"dataSource":"T24R16_RATE1","topic":"T24R16APP4","partitions":1,"replicas":1,"durationSeconds":3600,"activeTasks":[{"id":"index_kafka_T24R16_RATE1_aad49f137ceda5f_habbdajf","startingOffsets":{"0":256596818},"startTime":"2018-12-12T09:27:57.321Z","remainingSeconds":39,"type":"ACTIVE","currentOffsets":{"0":257093461},"lag":{"0":0}}],"publishingTasks":[],"latestOffsets":{"0":257093461},"minimumLag":{"0":0},"aggregateLag":0,"offsetsLastUpdated":"2018-12-12T10:26:58.085Z"}}

6.查看Meta Datasource信息

GET http://coordinator_hostname:8081/druid/coordinator/v1/metadata/datasources/datasource_name/

GET http://coordinator_hostname:8062/druid/coordinator/v1/metadata/datasources/T24R16_RATE1

{"name":"T24R16_RATE1","properties":{"created":"2018-12-12T10:27:44.208Z"},"segments":[{"dataSource":"T24R16_RATE1","interval":"2018-11-27T00:00:00.000Z/2018-11-28T00:00:00.000Z","version":"2018-11-30T09:53:03.923Z","loadSpec":{"type":"hdfs","path":"hdfs://namenodea.bos.opmbd.com:8020/druid/segments/T24R16_RATE1/20181127T000000.000Z_20181128T000000.000Z/2018-11-30T09_53_03.923Z/0_aedd22eb-1c30-428c-9ab4-e346d84150e0_index.zip"},"dimensions":"appName,nodeName,isFundTrans,transType,requestTime,channelSubSystem,errorCode,errorMessage","metrics":"TotalTransCount,SuccessTransCount,FaildTransCount,MaxProcessTime,MinProcessTime,TotalProcessTime","shardSpec":{"type":"numbered","partitionNum":0,"partitions":0},"binaryVersion":9,"size":3603204,"identifier":"T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z"},{"dataSource":"T24R16_RATE1","interval":"2018-11-27T00:00:00.000Z/2018-11-28T00:00:00.000Z","version":"2018-11-30T09:53:03.923Z","loadSpec":{"type":"hdfs","path":"hdfs://namenodea.bos.opmbd.com:8020/druid/segments/T24R16_RATE1/20181127T000000.000Z_20181128T000000.000Z/2018-11-30T09_53_03.923Z/1_34ff3724-af5d-43ea-903d-e2ec7c0d3ccd_index.zip"},"dimensions":"appName,nodeName,isFundTrans,transType,requestTime,channelSubSystem,errorCode,errorMessage","metrics":"TotalTransCount,SuccessTransCount,FaildTransCount,MaxProcessTime,MinProcessTime,TotalProcessTime","shardSpec":{"type":"numbered","partitionNum":1,"partitions":0},"binaryVersion":9,"size":3609845,"identifier":"T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z_1"}]}

7.查看DataSource Rule

GET http://coordinator_hostname:8081/druid/coordinator/v1/rules/datasource_name>

GET http://coordinator_hostname:8062/druid/coordinator/v1/rules

{"_default":[{"tieredReplicants":{"_default_tier":1},"type":"loadForever"},{"type":"dropForever"}],"APP_T24_HOUR":[],"T24R16_TransMonitor":[],"APP_T24_MINUTE":[]}

GET http://coordinator_hostname:8062/druid/coordinator/v1/rules/T24R16_RATE1
[]

8.查看Datasource信息

GET http://coordinator_hostname:8081/druid/coordinator/v1/datasources/datasource_name

GET http://coordinator_hostname:8062/druid/coordinator/v1/datasources/T24R16_RATE1

{"tiers":{"_default_tier":{"size":3658919489,"segmentCount":1163}},"segments":{"maxTime":"2018-12-13T00:00:00.000Z","size":3658919489,"minTime":"2018-11-27T00:00:00.000Z","count":1163}}

9.查看某个Datasource下所有的segments

GET http://coordinator_hostname:8081/druid/coordinator/v1/datasources/datasource_name/segments

GET http://coordinator_hostname:8062/druid/coordinator/v1/datasources/T24R16_RATE1/segments

["T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z","T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z_1","T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z_10"]

10.查看某个Datasource下某个segment

GET http://coordinator_hostname:8081/druid/coordinator/v1/datasources/datasource_name/segments/

GET http://coordinator_hostname:8062/druid/coordinator/v1/datasources/T24R16_RATE1/segments/T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z

{"metadata":{"dataSource":"T24R16_RATE1","interval":"2018-11-27T00:00:00.000Z/2018-11-28T00:00:00.000Z","version":"2018-11-30T09:53:03.923Z","loadSpec":{"type":"hdfs","path":"hdfs://namenodea.bos.opmbd.com:8020/druid/segments/T24R16_RATE1/20181127T000000.000Z_20181128T000000.000Z/2018-11-30T09_53_03.923Z/0_aedd22eb-1c30-428c-9ab4-e346d84150e0_index.zip"},"dimensions":"appName,nodeName,isFundTrans,transType,requestTime,channelSubSystem,errorCode,errorMessage","metrics":"TotalTransCount,SuccessTransCount,FaildTransCount,MaxProcessTime,MinProcessTime,TotalProcessTime","shardSpec":{"type":"numbered","partitionNum":0,"partitions":0},"binaryVersion":9,"size":3603204,"identifier":"T24R16_RATE1_2018-11-27T00:00:00.000Z_2018-11-28T00:00:00.000Z_2018-11-30T09:53:03.923Z"},"servers":["datanode3.bos.opmbd.com:8063"]}

11.删除Task任务状态

POST http://overlord_hostname:8090/druid/indexer/v1/task/taskId/shutdown

12.查看Task任务状态

GET http://overlord_hostname:8090/druid/indexer/v1/task/taskId/status

GET  http://overlord_hostname:8065/druid/indexer/v1/task/index_kafka_APP_T24_HOUR_d95f44c20fab354_pinifbki/status

{"task":"index_kafka_APP_T24_HOUR_d95f44c20fab354_pinifbki","status":{"id":"index_kafka_APP_T24_HOUR_d95f44c20fab354_pinifbki","status":"RUNNING","duration":-1}}

13.查看Task任务的所有segments

GET http://overlord_hostname:8090/druid/indexer/v1/task/taskId/segments

GET  http://overlord_hostname:8065/druid/indexer/v1/task/index_kafka_APP_T24_MINUTE_54cae6981ec8880_cfigommg/segments

[{"dataSource":"APP_T24_MINUTE","interval":"2018-12-12T00:00:00.000Z/2018-12-13T00:00:00.000Z","version":"2018-12-11T16:02:01.042Z","loadSpec":{"type":"hdfs","path":"hdfs://namenodea.bos.opmbd.com:8020/druid/segments/APP_T24_MINUTE/20181212T000000.000Z_20181213T000000.000Z/2018-12-11T16_02_01.042Z/18_76923693-dc73-4a05-931d-fe0488be7cbd_index.zip"},"dimensions":"appName,nodeName,isFundTrans,transType","metrics":"TotalTransCount,SuccessTransCount,FaildTransCount,MaxProcessTime,MinProcessTime,TotalProcessTime","shardSpec":{"type":"numbered","partitionNum":18,"partitions":0},"binaryVersion":9,"size":109031,"identifier":"APP_T24_MINUTE_2018-12-12T00:00:00.000Z_2018-12-13T00:00:00.000Z_2018-12-11T16:02:01.042Z_18"}]

14.查看正在进行的任务

GET http://overlord_hostname:8090/druid/indexer/v1/runningTasks

GET  http://overlord_hostname:8065/druid/indexer/v1/runningTasks

[{"id":"index_kafka_APP_T24_HOUR_d95f44c20fab354_pinifbki","createdTime":"2018-12-12T06:04:32.957Z","queueInsertionTime":"2018-12-12T06:04:32.960Z","statusCode":null,"duration":null,"location":{"host":"datanode3.bos.opmbd.com","port":8103,"tlsPort":-1}},{"id":"index_kafka_APP_T24_MINUTE_d3b476e5aca2159_mohihhoi","createdTime":"2018-12-12T10:37:47.789Z","queueInsertionTime":"2018-12-12T10:37:47.791Z","statusCode":null,"duration":null,"location":{"host":"datanode3.bos.opmbd.com","port":8102,"tlsPort":-1}},{"id":"index_kafka_T24R16_RATE1_1a2bfc23f45339e_mijfgcje","createdTime":"2018-12-12T10:27:58.430Z","queueInsertionTime":"2018-12-12T10:27:58.432Z","statusCode":null,"duration":null,"location":{"host":"datanode3.bos.opmbd.com","port":8101,"tlsPort":-1}},{"id":"index_kafka_T24R16_TransMonitor_df0b26842cf98c8_llfmpjpg","createdTime":"2018-12-12T10:38:28.626Z","queueInsertionTime":"2018-12-12T10:38:28.628Z","statusCode":null,"duration":null,"location":{"host":"datanode3.bos.opmbd.com","port":8104,"tlsPort":-1}}]

15.查看正在等待的任务

GET http://overlord_hostname:8090/druid/indexer/v1/waitingTasks

GET  http://localhost:8065/druid/indexer/v1/waitingTasks

16.查看正在挂起的任务

GET http://overlord_hostname:8090/druid/indexer/v1/pendingTasks

GET  http://localhost:8065/druid/indexer/v1/pendingTasks

17.查看所有Datasources

GET http://coordinator_hostname:8081/druid/coordinator/v1/datasources/

GET http://coordinator_hostname:8062/druid/coordinator/v1/datasources/

["APP_T24_HOUR","APP_T24_MINUTE","T24R16_RATE1","T24R16_TransMonitor","wikiticker"]

18.查看完成的任务

GET http://overlord_hostname:8090/druid/indexer/v1/completeTasks

GET  http://overlord_hostname:8065/druid/indexer/v1/completeTasks

[{"id":"index_kafka_T24R16_TransMonitor_ec92905e89f1403_eaaplohe","createdTime":"2018-12-12T09:38:18.598Z","queueInsertionTime":"1970-01-01T00:00:00.000Z","statusCode":"SUCCESS","duration":3670040,"location":{"host":null,"port":-1,"tlsPort":-1}},{"id":"index_kafka_APP_T24_MINUTE_54cae6981ec8880_cfigommg","createdTime":"2018-12-12T09:37:38.075Z","queueInsertionTime":"1970-01-01T00:00:00.000Z","statusCode":"SUCCESS","duration":3729859,"location":{"host":null,"port":-1,"tlsPort":-1}},{"id":"index_kafka_T24R16_RATE1_aad49f137ceda5f_habbdajf","createdTime":"2018-12-12T09:27:48.518Z","queueInsertionTime":"1970-01-01T00:00:00.000Z","statusCode":"SUCCESS","duration":3729979,"location":{"host":null,"port":-1,"tlsPort":-1}},{"id":"index_kafka_T24R16_TransMonitor_58f6e0029909c7e_ldnbhmff","createdTime":"2018-12-12T08:38:08.720Z","queueInsertionTime":"1970-01-01T00:00:00.000Z","statusCode":"SUCCESS","duration":3669990,"location":{"host":null,"port":-1,"tlsPort":-1}},{"id":"index_kafka_APP_T24_MINUTE_48ae762357d6961_fkgeeied","createdTime":"2018-12-12T08:37:28.253Z","queueInsertionTime":"1970-01-01T00:00:00.000Z","statusCode":"SUCCESS","duration":3669934,"location":{"host":null,"port":-1,"tlsPort":-1}}]

19.查看集群所有节点信息

GET http://coordinator_hostname:8081/druid/coordinator/v1/servers?simple

GET http://coordinator_hostname:8062/druid/coordinator/v1/servers?simple

[{"host":"datanode3.bos.opmbd.com:8102","tier":"_default_tier","type":"indexer-executor","priority":0,"currSize":0,"maxSize":0},{"host":"datanode3.bos.opmbd.com:8101","tier":"_default_tier","type":"indexer-executor","priority":0,"currSize":0,"maxSize":0},{"host":"datanode3.bos.opmbd.com:8104","tier":"_default_tier","type":"indexer-executor","priority":0,"currSize":0,"maxSize":0},{"host":"datanode3.bos.opmbd.com:8103","tier":"_default_tier","type":"indexer-executor","priority":0,"currSize":0,"maxSize":0},{"host":"datanode3.bos.opmbd.com:8063","tier":"_default_tier","type":"historical","priority":0,"currSize":3794792640,"maxSize":130000000000}]

20.重启任务

curl -X 'POST' -H 'Content-Type:application/json' -d @supervisor/T24R16-rate-index.json overlord_hostname:8065/druid/indexer/v1/supervisor

目录
相关文章
|
13天前
|
JSON 前端开发 API
Apache HttpClient调用Spring3 MVC Restful Web API演示
Apache HttpClient调用Spring3 MVC Restful Web API演示
15 1
|
1月前
|
Java API Apache
ZooKeeper【基础 03】Java 客户端 Apache Curator 基础 API 使用举例(含源代码)
【4月更文挑战第11天】ZooKeeper【基础 03】Java 客户端 Apache Curator 基础 API 使用举例(含源代码)
41 11
|
1月前
|
存储 druid NoSQL
Apache Druid 底层的数据存储
Apache Druid 底层的数据存储
63 1
|
1月前
|
存储 druid NoSQL
Apache Druid 底层存储设计(列存储与全文检索)
Apache Druid 底层存储设计(列存储与全文检索)
69 1
|
1月前
|
存储 SQL druid
​十分钟了解 Apache Druid
​十分钟了解 Apache Druid
131 1
|
1月前
|
安全 前端开发 程序员
Springboot-EolinkApikit一键生成注释与一键上传API接口(idea社区版2023.1.4+apache-maven-3.9.3-bin)
Springboot-EolinkApikit一键生成注释与一键上传API接口(idea社区版2023.1.4+apache-maven-3.9.3-bin)
27 0
|
1月前
|
Java API Maven
Springboot快速搭建跨域API接口(idea社区版2023.1.4+apache-maven-3.9.3-bin)
Springboot快速搭建跨域API接口(idea社区版2023.1.4+apache-maven-3.9.3-bin)
54 0
|
1月前
|
存储 消息中间件 druid
Apache Druid 的集群设计与工作流程
Apache Druid 的集群设计与工作流程
58 0
|
1月前
|
存储 SQL druid
十分钟了解 Apache Druid
十分钟了解 Apache Druid
116 0
|
1月前
|
Java API Apache
ZooKeeper【基础 03】Java 客户端 Apache Curator 基础 API 使用举例(含源代码)
ZooKeeper【基础 03】Java 客户端 Apache Curator 基础 API 使用举例(含源代码)
36 0

推荐镜像

更多