调用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();
        }

    }
}

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
posted @ 2017-08-15 16:03  丹江湖畔养蜂子赵大爹  阅读(809)  评论(0编辑  收藏  举报