天天看點

調用kylin的restAPI接口建構cube

調用kylin的restAPI接口建構cube

參考:http://kylin.apache.org/docs/howto/howto_build_cube_with_restapi.html

1. 調用cube的建構操作

curl -X PUT -H "Authorization: Basic QURNSU46IUB3c3VPOTAtQw==" -H 'Content-Type: application/json' -d '{"startTime":'1501632000000', "endTime":'1501718400000', "buildType":"BUILD"}' http://10.214.234.111:7070/kylin//api/cubes/test_cube_gov_hall_movie_box/build
           

kylin的cube的buid操作需要輸入的參數:

{
 "startTime":'1501632000000',
 "endTime":'1501718400000',
 "buildType":"BUILD"
}
           

其中kylinUI上預設的時間是8點整。2017/8/3 08時0分0秒轉換成毫秒數,就是開始startTime的值。

startTime 和endTime都需要是每天的8點整的毫秒數。

調用kylin restapi的權限認證:使用Base64編碼的使用者名和密碼,作為權限碼。

可以使用如下方法生成Base64編碼。

public class Base64Demo {
    public static void main(String[] args){
        String encode_str = "ADMIN:!@wsuO90-C";
        String decode_str = "QURNSU46S1lMSU4=";
        try{
            // 編碼
            byte[] encodeBase64 = Base64.encodeBase64(encode_str.getBytes("UTF-8"));
            System.out.println("ENCODE RESULT: " +new String(encodeBase64));

            // 解碼
            byte[] decodeBase64 = Base64.decodeBase64(decode_str.getBytes("UTF-8"));
            System.out.println("DECODE RESULT: " +new String(decodeBase64));

        } catch(UnsupportedEncodingException e){
            e.printStackTrace();
        }

    }
}
           
  • 參考官方說明文檔

    http://kylin.apache.org/docs/howto/howto_build_cube_with_restapi.html

2. 删除kylin中無用的segment

REST API for deleting segment

https://issues.apache.org/jira/browse/KYLIN-1540

curl -X DELETE -H "Authorization: Basic QURNSU46IUB3c3VPOTAtQw==" http://10.214.234.111:7070/kylin/api/cubes/test_cube_gov_hall_movie_box/segs/19700118090516_19700118090643
           

作者:

丹江湖畔養蜂子的趙大爹

出處:http://www.cnblogs.com/honeybee/

關于作者:丹江湖畔養蜂子的趙大爹

本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連結