kylin-cube: 使用api来build, 定时执行job

api 返回值 描述
http://ip:7070/kylin/api/models json数组 查看所有model元数据
http://ip:7070/kylin/api/cubes json数组 查看所有cube元数据
http://ip:7070/kylin/api/jobs/xxx json数组 查看单个cube提交后的任务

获取用户名密码: 被base64加密后的格式:QURNSU46S1lMSU4=

UserName=ADMIN
Password=KYLIN
baseUsernamePasswd=`python -c "import base64; print base64.standard_b64encode('$UserName:$Password')"`

1,执行cube的相关任务

a, build/rebuild cube

curl -X PUT \
-H "Authorization: Basic $baseUsernamePasswd" \
-H "Content-Type: application/json" \
-d '{
    "startTime": 0,
    "endTime": 1388563200000,
    "buildType": "BUILD"
}' \
http://localhost:7070/kylin/api/cubes/ys_demo/build
#http://localhost:7070/kylin/api/cubes/ys_demo/rebuild

##数据返回
{"uuid":"2eb3c342-daa2-4fab-abb8-c622beb46d9b", ...}

b, 获取job的状态

curl -X GET \
-H "Authorization: Basic QURNSU46S1lMSU4=" \
-H "Content-Type: application/json" \
http://localhost:7070/kylin/api/jobs/cbfaf44f-c7bb-4b5a-9da4-671f6c84b1bb

##返回的数据
{...,"submitter":"ADMIN","job_status":"RUNNING","progress":53.84615384615385...}

2, 元数据备份、恢复

[hdfs@node1 kylin]$ metastore.sh
usage: metastore.sh backup
       metastore.sh fetch DATA
       metastore.sh reset
       metastore.sh refresh-cube-signature
       metastore.sh restore PATH_TO_LOCAL_META
       metastore.sh list RESOURCE_PATH
       metastore.sh cat RESOURCE_PATH
       metastore.sh remove RESOURCE_PATH
       metastore.sh clean [--delete true]

[hdfs@node1 kylin]$ metastore.sh  list /
Starting list /
Retrieving hadoop conf dir......
[/UUID, /acl, /cube, /cube_desc, /cube_statistics, /dict, /execute, /execute_output, /model_desc, /project, /query, /table, /table_exd, /user]

[hdfs@node1 kylin]$ metastore.sh backup
Starting backup to /opt/kylin/meta_backups/meta_2019_04_19_12_11_46.....

[hdfs@node1 kylin]$ ls meta_backups/
meta_2019_04_19_10_29_28  meta_2019_04_19_12_11_46
[hdfs@node1 kylin]$ ls meta_backups/meta_2019_04_19_10_29_28/
acl   cube_desc        dict     execute_output  project  table      user
cube  cube_statistics  execute  model_desc      query    table_exd  UUID

[hdfs@node1 kylin]$ ls meta_backups/meta_2019_04_19_10_29_28/project/
CDR_ADMISSION_INFO.json  kylin_demo.json  Ys_kylin_Demo.json
[hdfs@node1 kylin]$ ls meta_backups/meta_2019_04_19_10_29_28/cube
aa2423.json  aa2.json  kylin.json  kylinspark.json  ys_demo.json

你可能感兴趣的:(kylin)