[ 
https://issues.apache.org/jira/browse/KYLIN-1605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15261432#comment-15261432
 ] 

Richard Calaba edited comment on KYLIN-1605 at 4/28/16 2:40 AM:
----------------------------------------------------------------

Hello,

1) tested the metadata backup/restore - on Kylin 1.5.1 - seems working fine. 
But the problem is that this cannot be used as selective approach if I need to 
transport (import) just selected objects (cubes / cube_desc / models / ...) ... 
except if I would manually delete the not needed (irrelevant) json files from 
the meta backup directory ... that requires deep knowledge of the Kylin 
metadata model

2) Tried to test the approach to use 
org.apache.kylin.storage.hbase.util.CubeMigrationCLI ... in my case couldn't 
test it fully as I am getting error:

Exception in thread "main" java.lang.IllegalStateException: Cannot migrate cube 
that is not in READY state.
        at 
org.apache.kylin.storage.hbase.util.CubeMigrationCLI.moveCube(CubeMigrationCLI.java:110)
        at 
org.apache.kylin.storage.hbase.util.CubeMigrationCLI.moveCube(CubeMigrationCLI.java:150)
        at 
org.apache.kylin.storage.hbase.util.CubeMigrationCLI.main(CubeMigrationCLI.java:89)

So it means that Cube migration requires only READY cubes - with data ... and I 
need concept of migrating a Cube metadata (complete definition from source 
tables through model to Cube descriptor and Cube metadata) ... maybe this can 
be added as JIRA ticket to enable migration of empty Cubes (not READY) if they 
are consistent ... ???

In addition this approach has additional problem from automation perspective - 
it requires existing Kylin Project in the target system. But there is no 
official API (at least documented API) which would allow creation of Kylin 
Project so we can automate this ... maybe another JIRA ticket to be created for 
this project creation API ?

Last but not least ... the original ask in this JIRA ticket is to have ability 
to selectively (through REST API - could be even script API I do not care) to 
export all JSON metadata RELATED to ONE particular cube (Cube Meta / Desc / 
Model / DB Tables). The the reason is that we would like to use this cube to 
"clone" it from one Hive DB schema (lets say TEMPLATE.*) to another DB schema 
(i.e. CLIENT_XYZ.) - for now even assuming that both DB schemata TEMPLATE and 
CLIENT_XYZ have exactly same DB tables - just contain different data). Of 
course we need to clone it asKylin Cube with different Name and possibly also 
associated with different Kylin Project (and ideally we want to do this 
cross-system - but if we have working cross system Cube migration - even with 
not READY cubes - then fine). The scenario is - DEV contains TEMPLATE schema 
which is then instantiated in PRODUCTION for various clients where data is 
isolated by DB schema (multi-tenancy).

The current Cube Cloning is not sufficient - I can only clone to another Kylin 
Project exact copy of the cube - I cannot exchange the DB schema the Cube is 
accessing. Maybe the whole thing I am asking for could be achieved by having:

    1) Cube Cloning - where I can specify new Cube Name the Target Project and 
can also optionally specify the rules to overwrite the source DB schema of the 
tables used in the Cube while cloning it into another new DB schema. Because 
there is REST API to load hive tables - that can be used to make sure the 
tables of the target DB schema are consistent with the source schema and cube 
can be thus cloned cross-schema. 

    2) REST API to be able to create Kylin Projects

    3) Ability to migrate from one Kylin system to another Kylin system also 
not READY (but consistent) cubes.

Because of all the arguments above I am making this feature request as 
critical. We need approach to be able to copy well defined cubes (tested 
templates - without data) in one system (DEV) to multiple Kylin Projects in 
multiple Kylin systems (who all share same DB table structures of the DB tables 
used in Kylin Cubes/Models).

To achieve this now -> it requires backup of metastore, manual selection of 
relevant json files, manual modification of json files and then restore to the 
target system from this modified metadata backup. Lot of manual steps - high 
probability of human mistake. 



was (Author: [email protected]):
Hello,

1) tested the metadata backup/restore - on Kylin 1.5.1 - seems working fine. 
But the problem is that this cannot be used as selective approach if I need to 
transport (import) just selected objects (cubes / cube_desc / models / ...) ... 
except if I would manually delete the not needed (irrelevant) json files from 
the meta backup directory ... that requires deep knowledge of the Kylin 
metadata model

2) Tried to test the approach to use 
org.apache.kylin.storage.hbase.util.CubeMigrationCLI ... in my case couldn't 
test it fully as I am getting error:

Exception in thread "main" java.lang.IllegalStateException: Cannot migrate cube 
that is not in READY state.
        at 
org.apache.kylin.storage.hbase.util.CubeMigrationCLI.moveCube(CubeMigrationCLI.java:110)
        at 
org.apache.kylin.storage.hbase.util.CubeMigrationCLI.moveCube(CubeMigrationCLI.java:150)
        at 
org.apache.kylin.storage.hbase.util.CubeMigrationCLI.main(CubeMigrationCLI.java:89)

So it means that Cube migration requires only READY cubes - with data ... and I 
need concept of migrating a Cube metadata (complete definition from source 
tables through model to Cube descriptor and Cube metadata) ... maybe this can 
be added as JIRA ticket to enable migration of empty Cubes (not READY) if they 
are consistent ... ???

In addition this approach has additional problem from automation perspective - 
it requires existing Kylin Project in the target system. But there is no 
official API (at least documented API) which would allow creation of Kylin 
Project so we can automate this ... maybe another JIRA ticket to be created for 
this project creation API ?

Last but not least ... the original ask in this JIRA ticket is to have ability 
to selectively (through REST API - could be even script API I do not care) to 
export all JSON metadata RELATED to ONE particular cube (Cube Meta / Desc / 
Model / DB Tables). The the reason is that we would like to use this cube to 
"clone" it from one Hive DB schema (lets say TEMPLATE.*) to another DB schema 
(i.e. CLIENT_XYZ.) - for now even assuming that both DB schemata TEMPLATE and 
CLIENT_XYZ have exactly same DB tables - just contain different data). Of 
course we need to clone it asKylin Cube with different Name and possibly also 
associated with different Kylin Project (and ideally we want to do this 
cross-system - but if we have working cross system Cube migration - even with 
not READY cubes - then fine). The scenario is - DEV contains TEMPLATE schema 
which is then instantiated in PRODUCTION for various clients where data is 
isolated by DB schema (multi-tenancy).

The current Cube Cloning is not sufficient - I can only clone to another Kylin 
Project exact copy of the cube - I cannot exchange the DB schema the Cube is 
accessing. Maybe the whole thing I am asking for could be achieved by having:

    1) Cube Cloning - where I can specify new Cube Name the Target Project and 
can also optionally specify the rules to overwrite the source DB schema of the 
tables used in the Cube while cloning it into another new DB schema. Because 
there is REST API to load hive tables - that can be used to make sure the 
tables of the target DB schema are consistent with the source schema and cube 
can be thus cloned cross-schema. 

    2) Ability to migrate from one Kylin system to another Kylin system also 
not READY (but consistent) cubes.

Because of all the arguments above I am making this feature request as 
critical. We need approach to be able to copy well defined cubes (tested 
templates - without data) in one system (DEV) to multiple Kylin Projects in 
multiple Kylin systems (who all share same DB table structures of the DB tables 
used in Kylin Cubes/Models).

To achieve this now -> it requires backup of metastore, manual selection of 
relevant json files, manual modification of json files and then restore to the 
target system from this modified metadata backup. Lot of manual steps - high 
probability of human mistake. 


> Functionality to Export/Import Hive/Model/Cube Metadata - API
> -------------------------------------------------------------
>
>                 Key: KYLIN-1605
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1605
>             Project: Kylin
>          Issue Type: New Feature
>          Components: General
>    Affects Versions: Future
>            Reporter: Richard Calaba
>            Priority: Critical
>
> Hello,
> I wonder what is the official way to copy a Kylin Cube definition from one 
> system to another ??? I didn't find any official docu for that in Kylin. I 
> also checked REST API and didn't find all building blocks which would be 
> needed to achieve this.
> The scenario is to transfer Cube definition from one system to another system 
> (like DEV to QAS / QAS to PRD, ...). So it can be rebuild there from that 
> actual system's data.
> I imagine the functionality to be split into:
> 1) Export Hive Table Metadata (REST API) to JSON
> 2) Import Hive Table Metadata (REST API) from JSON - checks whether the Hive 
> DB table meta in JSON is consistent with actual Hive DB table
> 3) Export Cube Model Metadata (REST API) to JSON
> 4) Import Cube Model Metadata (REST API) from JSON - checks whether the 
> underlying Hive DB tables exists and are consistent with Model; returns new 
> unique ID of the imported model
> 5) Export Cube Descriptor (metadata) (REST API) to JSON
> 6) Import Cube Descriptor (metadata) (REST API) from JSON. Check that  Cube 
> metadata is consistent (i.e. that the referred Model is existing in the 
> system). Returns new unique ID of the imported Cube so it can be used for 
> example to call Build Cube REST API after successful import.
> Optionally the Export/Import functions can be then connected to UI.
> Because of the Dependencies (Hive DB table Meta -> Cube Model -> Cube 
> Descriptor) and because of the reusability of the building blocks (several 
> Models referring same Hive DB Tables/Views; several Cubes referring same 
> Model) we should have independent Export/Import REST APIs for each level 
> separately (Hive DB meta / Model / Cube Descriptor).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to