Kylin RESTful API使用实践

官网:http://kylin.apache.org/cn/docs/howto/howto_use_restapi.html#build-cube

Base64加密:https://www.sojson.com/base64.html

 

查询

curl -X POST -H "Authorization: Basic base64加密(账号:密码)" -H "Content-Type: application/json" -d '{ "sql":"select l.PROVINCE_NAME,sum(p.PAYMENT_AMOUNT) from DWD_FACT_PAYMENT_INFO p left join DWD_DIM_BASE_PROVINCE l on p.PROVINCE_ID=l.ID group by l.PROVINCE_NAME", "project":"gmall" }' http://hadoop102:7070/kylin/api/query

 

测试环境下执行:

curl -X POST -H "Authorization: Basic QURNSU46S1lMSU4=" -H "Content-Type: application/json" -d '{ "sql":"select l.PROVINCE_NAME,sum(p.PAYMENT_AMOUNT) from DWD_FACT_PAYMENT_INFO p left join DWD_DIM_BASE_PROVINCE l on p.PROVINCE_ID=l.ID group by l.PROVINCE_NAME;", "project":"gmall" }' http://hadoop102:7070/kylin/api/query

Build cube 

拼了08:00:00是为了解决时差的问题,和我们差了8个区   所以这里08:00:00相当于我们的0点

curl -X PUT -H "Authorization: Basic XXXXXXXXX" -H 'Content-Type: application/json' -d '{"startTime":'1423526400000', "endTime":'1423612800000', "buildType":"BUILD"}' http://<host>:<port>/kylin/api/cubes/{cubeName}/build

在生产中 然后用azkaban调度该sh脚本就行了

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章