You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2017/08/18 06:18:02 UTC
[2/5] kylin git commit: Add docs for 2.1 and udpate download page
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/acl.cn.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/acl.cn.md b/website/_docs21/tutorial/acl.cn.md
new file mode 100644
index 0000000..61de162
--- /dev/null
+++ b/website/_docs21/tutorial/acl.cn.md
@@ -0,0 +1,35 @@
+---
+layout: docs21-cn
+title: Kylin Cube 权限授予教程
+categories: 教程
+permalink: /cn/docs21/tutorial/acl.html
+version: v1.2
+since: v0.7.1
+---
+
+
+
+在`Cubes`页面,双击cube行查看详细信息。在这里我们关注`Access`标签。
+点击`+Grant`按钮进行授权。
+
+
+
+一个cube有四种不同的权限。将你的鼠标移动到`?`图标查看详细信息。
+
+
+
+授权对象也有两种:`User`和`Role`。`Role`是指一组拥有同样权限的用户。
+
+### 1. 授予用户权限
+* 选择`User`类型,输入你想要授权的用户的用户名并选择相应的权限。
+
+ 
+
+* 然后点击`Grant`按钮提交请求。在这一操作成功后,你会在表中看到一个新的表项。你可以选择不同的访问权限来修改用户权限。点击`Revoke`按钮可以删除一个拥有权限的用户。
+
+ 
+
+### 2. 授予角色权限
+* 选择`Role`类型,通过点击下拉按钮选择你想要授权的一组用户并选择一个权限。
+
+* 然后点击`Grant`按钮提交请求。在这一操作成功后,你会在表中看到一个新的表项。你可以选择不同的访问权限来修改组权限。点击`Revoke`按钮可以删除一个拥有权限的组。
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/acl.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/acl.md b/website/_docs21/tutorial/acl.md
new file mode 100644
index 0000000..b3b7fdf
--- /dev/null
+++ b/website/_docs21/tutorial/acl.md
@@ -0,0 +1,32 @@
+---
+layout: docs21
+title: Kylin Cube Permission
+categories: tutorial
+permalink: /docs21/tutorial/acl.html
+since: v0.7.1
+---
+
+In `Cubes` page, double click the cube row to see the detail information. Here we focus on the `Access` tab.
+Click the `+Grant` button to grant permission.
+
+
+
+There are four different kinds of permissions for a cube. Move your mouse over the `?` icon to see detail information.
+
+
+
+There are also two types of user that a permission can be granted: `User` and `Role`. `Role` means a group of users who have the same role.
+
+### 1. Grant User Permission
+* Select `User` type, enter the username of the user you want to grant and select the related permission.
+
+ 
+
+* Then click the `Grant` button to send a request. After the success of this operation, you will see a new table entry show in the table. You can select various permission of access to change the permission of a user. To delete a user with permission, just click the `Revoke` button.
+
+ 
+
+### 2. Grant Role Permission
+* Select `Role` type, choose a group of users that you want to grant by click the drop down button and select a permission.
+
+* Then click the `Grant` button to send a request. After the success of this operation, you will see a new table entry show in the table. You can select various permission of access to change the permission of a group. To delete a group with permission, just click the `Revoke` button.
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/create_cube.cn.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/create_cube.cn.md b/website/_docs21/tutorial/create_cube.cn.md
new file mode 100644
index 0000000..e1f076d
--- /dev/null
+++ b/website/_docs21/tutorial/create_cube.cn.md
@@ -0,0 +1,129 @@
+---
+layout: docs21-cn
+title: Kylin Cube 创建教程
+categories: 教程
+permalink: /cn/docs21/tutorial/create_cube.html
+version: v1.2
+since: v0.7.1
+---
+
+
+### I. 新建一个项目
+1. 由顶部菜单栏进入`Query`页面,然后点击`Manage Projects`。
+
+ 
+
+2. 点击`+ Project`按钮添加一个新的项目。
+
+ 
+
+3. 填写下列表单并点击`submit`按钮提交请求。
+
+ 
+
+4. 成功后,底部会显示通知。
+
+ 
+
+### II. 同步一张表
+1. 在顶部菜单栏点击`Tables`,然后点击`+ Sync`按钮加载hive表元数据。
+
+ 
+
+2. 输入表名并点击`Sync`按钮提交请求。
+
+ 
+
+### III. 新建一个cube
+首先,在顶部菜单栏点击`Cubes`。然后点击`+Cube`按钮进入cube designer页面。
+
+
+
+**步骤1. Cube信息**
+
+填写cube基本信息。点击`Next`进入下一步。
+
+你可以使用字母、数字和“_”来为你的cube命名(注意名字中不能使用空格)。
+
+
+
+**步骤2. 维度**
+
+1. 建立事实表。
+
+ 
+
+2. 点击`+Dimension`按钮添加一个新的维度。
+
+ 
+
+3. 可以选择不同类型的维度加入一个cube。我们在这里列出其中一部分供你参考。
+
+ * 从事实表获取维度。
+ 
+
+ * 从查找表获取维度。
+ 
+
+ 
+
+ * 从有分级结构的查找表获取维度。
+ 
+
+ * 从有衍生维度(derived dimensions)的查找表获取维度。
+ 
+
+4. 用户可以在保存维度后进行编辑。
+ 
+
+**步骤3. 度量**
+
+1. 点击`+Measure`按钮添加一个新的度量。
+ 
+
+2. 根据它的表达式共有5种不同类型的度量:`SUM`、`MAX`、`MIN`、`COUNT`和`COUNT_DISTINCT`。请谨慎选择返回类型,它与`COUNT(DISTINCT)`的误差率相关。
+ * SUM
+
+ 
+
+ * MIN
+
+ 
+
+ * MAX
+
+ 
+
+ * COUNT
+
+ 
+
+ * DISTINCT_COUNT
+
+ 
+
+**步骤4. 过滤器**
+
+这一步骤是可选的。你可以使用`SQL`格式添加一些条件过滤器。
+
+
+
+**步骤5. 更新设置**
+
+这一步骤是为增量构建cube而设计的。
+
+
+
+选择分区类型、分区列和开始日期。
+
+
+
+**步骤6. 高级设置**
+
+
+
+**步骤7. 概览 & 保存**
+
+你可以概览你的cube并返回之前的步骤进行修改。点击`Save`按钮完成cube创建。
+
+
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/create_cube.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/create_cube.md b/website/_docs21/tutorial/create_cube.md
new file mode 100644
index 0000000..c86984f
--- /dev/null
+++ b/website/_docs21/tutorial/create_cube.md
@@ -0,0 +1,198 @@
+---
+layout: docs21
+title: Kylin Cube Creation
+categories: tutorial
+permalink: /docs21/tutorial/create_cube.html
+---
+
+This tutorial will guide you to create a cube. It need you have at least 1 sample table in Hive. If you don't have, you can follow this to create some data.
+
+### I. Create a Project
+1. Go to `Query` page in top menu bar, then click `Manage Projects`.
+
+ 
+
+2. Click the `+ Project` button to add a new project.
+
+ 
+
+3. Enter a project name, e.g, "Tutorial", with a description (optional), then click `submit` button to send the request.
+
+ 
+
+4. After success, the project will show in the table.
+
+ 
+
+### II. Sync up Hive Table
+1. Click `Model` in top bar and then click `Data Source` tab in the left part, it lists all the tables loaded into Kylin; click `Load Hive Table` button.
+
+ 
+
+2. Enter the hive table names, separated with commad, and then click `Sync` to send the request.
+
+ 
+
+3. [Optional] If you want to browser the hive database to pick tables, click the `Load Hive Table From Tree` button.
+
+ 
+
+4. [Optional] Expand the database node, click to select the table to load, and then click `Sync`.
+
+ 
+
+5. A success message will pop up. In the left `Tables` section, the newly loaded table is added. Click the table name will expand the columns.
+
+ 
+
+6. In the background, Kylin will run a MapReduce job to calculate the approximate cardinality for the newly synced table. After the job be finished, refresh web page and then click the table name, the cardinality will be shown in the table info.
+
+ 
+
+
+### III. Create Data Model
+Before create a cube, need define a data model. The data model defines the star schema. One data model can be reused in multiple cubes.
+
+1. Click `Model` in top bar, and then click `Models` tab. Click `+New` button, in the drop-down list select `New Model`.
+
+ 
+
+2. Enter a name for the model, with an optional description.
+
+ 
+
+3. In the `Fact Table` box, select the fact table of this data model.
+
+ 
+
+4. [Optional] Click `Add Lookup Table` button to add a lookup table. Select the table name and join type (inner or left).
+
+ 
+
+5. [Optional] Click `New Join Condition` button, select the FK column of fact table in the left, and select the PK column of lookup table in the right side. Repeat this if have more than one join columns.
+
+ 
+
+6. Click "OK", repeat step 4 and 5 to add more lookup tables if any. After finished, click "Next".
+
+7. The "Dimensions" page allows to select the columns that will be used as dimension in the child cubes. Click the `Columns` cell of a table, in the drop-down list select the column to the list.
+
+ 
+
+8. Click "Next" go to the "Measures" page, select the columns that will be used in measure/metrics. The measure column can only from fact table.
+
+ 
+
+9. Click "Next" to the "Settings" page. If the data in fact table increases by day, select the corresponding date column in the `Partition Date Column`, and select the date format, otherwise leave it as blank.
+
+10. [Optional] Select `Cube Size`, which is an indicator on the scale of the cube, by default it is `MEDIUM`.
+
+11. [Optional] If some records want to excluded from the cube, like dirty data, you can input the condition in `Filter`.
+
+
+ 
+
+12. Click `Save` and then select `Yes` to save the data model. After created, the data model will be shown in the left `Models` list.
+
+ 
+
+### IV. Create Cube
+After the data model be created, you can start to create cube.
+
+Click `Model` in top bar, and then click `Models` tab. Click `+New` button, in the drop-down list select `New Cube`.
+ 
+
+
+**Step 1. Cube Info**
+
+Select the data model, enter the cube name; Click `Next` to enter the next step.
+
+You can use letters, numbers and '_' to name your cube (blank space in name is not allowed). `Notification List` is a list of email addresses which be notified on cube job success/failure.
+ 
+
+
+**Step 2. Dimensions**
+
+1. Click `Add Dimension`, it popups two option: "Normal" and "Derived": "Normal" is to add a normal independent dimension column, "Derived" is to add a derived dimension column. Read more in [How to optimize cubes](/docs15/howto/howto_optimize_cubes.html).
+
+2. Click "Normal" and then select a dimension column, give it a meaningful name.
+
+ 
+
+3. [Optional] Click "Derived" and then pickup 1 more multiple columns on lookup table, give them a meaningful name.
+
+ 
+
+4. Repeate 2 and 3 to add all dimension columns; you can do this in batch for "Normal" dimension with the button `Auto Generator`.
+
+ 
+
+5. Click "Next" after select all dimensions.
+
+**Step 3. Measures**
+
+1. Click the `+Measure` to add a new measure.
+ 
+
+2. There are 6 types of measure according to its expression: `SUM`, `MAX`, `MIN`, `COUNT`, `COUNT_DISTINCT` and `TOP_N`. Properly select the return type for `COUNT_DISTINCT` and `TOP_N`, as it will impact on the cube size.
+ * SUM
+
+ 
+
+ * MIN
+
+ 
+
+ * MAX
+
+ 
+
+ * COUNT
+
+ 
+
+ * DISTINCT_COUNT
+ This measure has two implementations:
+ a) approximate implementation with HyperLogLog, select an acceptable error rate, lower error rate will take more storage.
+ b) precise implementation with bitmap (see limitation in https://issues.apache.org/jira/browse/KYLIN-1186).
+
+ 
+
+ Pleaste note: distinct count is a very heavy data type, it is slower to build and query comparing to other measures.
+
+ * TOP_N
+ Approximate TopN measure pre-calculates the top records in each dimension combination, it will provide higher performance in query time than no pre-calculation; Need specify two parameters here: the first is the column will be used as metrics for Top records (aggregated with SUM and then sorted in descending order); the second is the literal ID, represents the record like seller_id;
+
+ Properly select the return type, depends on how many top records to inspect: top 10, top 100 or top 1000.
+
+ 
+
+
+**Step 4. Refresh Setting**
+
+This step is designed for incremental cube build.
+
+`Auto Merge Time Ranges (days)`: merge the small segments into medium and large segment automatically. If you don't want to auto merge, remove the default two ranges.
+
+`Retention Range (days)`: only keep the segment whose data is in past given days in cube, the old segment will be automatically dropped from head; 0 means not enable this feature.
+
+`Partition Start Date`: the start date of this cube.
+
+
+
+**Step 5. Advanced Setting**
+
+`Aggregation Groups`: by default Kylin put all dimensions into one aggregation group; you can create multiple aggregation groups by knowing well about your query patterns. For the concepts of "Mandatory Dimensions", "Hierarchy Dimensions" and "Joint Dimensions", read this blog: [New Aggregation Group](/blog/2016/02/18/new-aggregation-group/)
+
+`Rowkeys`: the rowkeys are composed by the dimension encoded values. "Dictionary" is the default encoding method; If a dimension is not fit with dictionary (e.g., cardinality > 10 million), select "false" and then enter the fixed length for that dimension, usually that is the max. length of that column; if a value is longer than that size it will be truncated. Please note, without dictionary encoding, the cube size might be much bigger.
+
+You can drag & drop a dimension column to adjust its position in rowkey; Put the mandantory dimension at the begining, then followed the dimensions that heavily involved in filters (where condition). Put high cardinality dimensions ahead of low cardinality dimensions.
+
+
+**Step 6. Overview & Save**
+
+You can overview your cube and go back to previous step to modify it. Click the `Save` button to complete the cube creation.
+
+
+
+Cheers! now the cube is created, you can go ahead to build and play it.
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/cube_build_job.cn.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/cube_build_job.cn.md b/website/_docs21/tutorial/cube_build_job.cn.md
new file mode 100644
index 0000000..09390fb
--- /dev/null
+++ b/website/_docs21/tutorial/cube_build_job.cn.md
@@ -0,0 +1,66 @@
+---
+layout: docs21-cn
+title: Kylin Cube 建立和Job监控教程
+categories: 教程
+permalink: /cn/docs21/tutorial/cube_build_job.html
+version: v1.2
+since: v0.7.1
+---
+
+### Cube建立
+首先,确认你拥有你想要建立的cube的权限。
+
+1. 在`Cubes`页面中,点击cube栏右侧的`Action`下拉按钮并选择`Build`操作。
+
+ 
+
+2. 选择后会出现一个弹出窗口。
+
+ 
+
+3. 点击`END DATE`输入框选择增量构建这个cube的结束日期。
+
+ 
+
+4. 点击`Submit`提交请求。
+
+ 
+
+ 
+
+ 提交请求成功后,你将会看到`Jobs`页面新建了job。
+
+ 
+
+5. 如要放弃这个job,点击`Discard`按钮。
+
+ 
+
+### Job监控
+在`Jobs`页面,点击job详情按钮查看显示于右侧的详细信息。
+
+
+
+job详细信息为跟踪一个job提供了它的每一步记录。你可以将光标停放在一个步骤状态图标上查看基本状态和信息。
+
+
+
+点击每个步骤显示的图标按钮查看详情:`Parameters`、`Log`、`MRJob`、`EagleMonitoring`。
+
+* Parameters
+
+ 
+
+ 
+
+* Log
+
+ 
+
+ 
+
+* MRJob(MapReduce Job)
+
+ 
+
+ 
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/cube_build_job.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/cube_build_job.md b/website/_docs21/tutorial/cube_build_job.md
new file mode 100644
index 0000000..c042f73
--- /dev/null
+++ b/website/_docs21/tutorial/cube_build_job.md
@@ -0,0 +1,67 @@
+---
+layout: docs21
+title: Kylin Cube Build and Job Monitoring
+categories: tutorial
+permalink: /docs21/tutorial/cube_build_job.html
+---
+
+### Cube Build
+First of all, make sure that you have authority of the cube you want to build.
+
+1. In `Models` page, click the `Action` drop down button in the right of a cube column and select operation `Build`.
+
+ 
+
+2. There is a pop-up window after the selection, click `END DATE` input box to select end date of this incremental cube build.
+
+ 
+
+4. Click `Submit` to send the build request. After success, you will see the new job in the `Monitor` page.
+
+ 
+
+5. The new job is in "pending" status; after a while, it will be started to run and you will see the progress by refresh the web page or click the refresh button.
+
+ 
+
+
+6. Wait the job to finish. In the between if you want to discard it, click `Actions` -> `Discard` button.
+
+ 
+
+7. After the job is 100% finished, the cube's status becomes to "Ready", means it is ready to serve SQL queries. In the `Model` tab, find the cube, click cube name to expand the section, in the "HBase" tab, it will list the cube segments. Each segment has a start/end time; Its underlying HBase table information is also listed.
+
+ 
+
+If you have more source data, repeate the steps above to build them into the cube.
+
+### Job Monitoring
+In the `Monitor` page, click the job detail button to see detail information show in the right side.
+
+
+
+The detail information of a job provides a step-by-step record to trace a job. You can hover a step status icon to see the basic status and information.
+
+
+
+Click the icon buttons showing in each step to see the details: `Parameters`, `Log`, `MRJob`.
+
+* Parameters
+
+ 
+
+ 
+
+* Log
+
+ 
+
+ 
+
+* MRJob(MapReduce Job)
+
+ 
+
+ 
+
+
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/cube_build_performance.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/cube_build_performance.md b/website/_docs21/tutorial/cube_build_performance.md
new file mode 100755
index 0000000..7169488
--- /dev/null
+++ b/website/_docs21/tutorial/cube_build_performance.md
@@ -0,0 +1,266 @@
+---
+layout: docs21
+title: Cube Build Tuning Step by Step
+categories: tutorial
+permalink: /docs21/tutorial/cube_build_performance.html
+---
+ *This tutorial is an example step by step about how to optimize build of cube.*
+
+In this scenario we're trying to optimize a very simple Cube, with 1 fact and 1 lookup table (Date Dimension). Before do a real tunning, please get an overall understanding about Cube build process from [Optimize Cube Build](/docs20/howto/howto_optimize_build.html)
+
+
+
+The baseline is:
+
+* One Measure: Balance, calculate always Max, Min and Count
+* All Dim_date (10 items) will be used as dimensions
+* Input is a Hive CSV external table
+* Output is a Cube in HBase without compression
+
+With this configuration, the results are: 13 min to build a cube of 20 Mb (Cube_01)
+
+### Cube_02: Reduce combinations
+To make the first improvement, use Joint and Hierarchy on Dimensions to reduce the combinations (number of cuboids).
+
+Put together all ID and Text of: Month, Week, Weekday and Quarter using Joint Dimension
+
+
+
+
+Define Id_date and Year as a Hierarchy Dimension
+
+This reduces the size down to 0.72MB and time to 5 min
+
+[Kylin 2149](https://issues.apache.org/jira/browse/KYLIN-2149), ideally, these Hierarchies can be defined also:
+* Id_weekday > Id_date
+* Id_Month > Id_date
+* Id_Quarter > Id_date
+* Id_week > Id_date
+
+But for now, it impossible to use Joint and Hierarchy together for one dimension.
+
+
+### Cube_03: Compress output
+To make the next improvement, compress HBase Cube with Snappy:
+
+
+
+Another option is Gzip:
+
+
+
+
+The results of compression output are:
+
+
+
+The difference between Snappy and Ggzip in time is less than 1% but in size it is 18%
+
+
+### Cube_04: Compress Hive table
+The time distribution is like this:
+
+
+
+
+Group detailed times by concepts :
+
+
+
+67 % is used to build / process flat table and respect 30% to build the cube
+
+A lot of time is used in the first steps.
+
+This time distribution is typical in a cube with few measures and few dim (or very optimized)
+
+
+Try to use ORC Format and compression on Hive input table (Snappy):
+
+
+
+
+The time in the first three stree steps (Flat Table) has been improved by half.
+
+Other columnar formats can be tested:
+
+
+
+
+* ORC
+* ORC compressed with Snappy
+
+But the results are worse than when using Sequence file.
+
+See comments about this here: [Shaofengshi in MailList](http://apache-kylin.74782.x6.nabble.com/Kylin-Performance-td6713.html#a6767)
+
+The second strep is to redistribute Flat Hive table:
+
+
+
+Is a simple row count, two approximations can be made
+* If it doesn’t need to be accurate, the rows of the fact table can be counted→ this can be performed in parallel with Step 1 (and 99% of the time it will be accurate)
+
+
+
+
+* In the future versions (KYLIN-2165 v2.0), this steps will be implemented using Hive table statistics.
+
+
+
+### Cube_05: Partition Hive table (fail)
+The distribution of rows is:
+
+Table | Rows
+--- | ---
+Fact Table | 3.900.00
+Dim Date | 2.100
+
+And the query (the simplified version) to build the flat table is:
+{% highlight Groff markup %}
+```sql
+SELECT
+,DIM_DATE.X
+,DIM_DATE.y
+,FACT_POSICIONES.BALANCE
+FROM FACT_POSICIONES INNER JOIN DIM_DATE
+ ON ID_FECHA = .ID_FECHA
+WHERE (ID_DATE >= '2016-12-08' AND ID_DATE < '2016-12-23')
+```
+{% endhighlight %}
+
+The problem here, is that, Hive in only using 1 Map to create Flat Table. It is important to lets go to change this behavior. The solution is to partition DIM and FACT in the same columns
+
+* Option 1: Use id_date as a partition column on Hive table. This has a big problem: the Hive metastore is meant for few a hundred of partitions and not thousands (In [Hive 9452](https://issues.apache.org/jira/browse/HIVE-9452) there is an idea to solve this but it isn’t finished yet)
+* Option 2: Generate a new column for this purpose like Monthslot.
+
+
+
+
+Add the same column to dim and fact tables
+
+Now, upgrade the the data model with this new condition to join tables
+
+
+
+
+The new query to generate flat table will be similar to:
+{% highlight Groff markup %}
+```sql
+SELECT *
+ FROM FACT_POSICIONES **INNER JOIN** DIM_DATE
+ ON ID_FECHA = .ID_FECHA AND MONTHSLOT=MONTHSLOT
+```
+{% endhighlight %}
+
+Rebuild the new cube with this data model
+
+As a result, the performance has worsened :( . After tried several attempts, there hasn’t been a solution
+
+
+
+
+The problem is that partitions were not used to generate several Mappers
+
+
+
+
+(I checked this issue with ShaoFeng Shi. He thinks the problem is that there are few many rows and we are not working with a real Hadoop cluster. See this [tech note](http://kylin.apache.org/docs16/howto/howto_optimize_build.html)).
+
+
+### Resume of results
+
+
+
+
+The tunning process has been:
+* Hive Input tables compressed
+* HBase Output compressed
+* Apply techniques of reduction of cardinality (Joint, Derived, Hierarchy and Mandatory)
+* Personalize Dim encoder for each Dim and choose the best order of Dim in Row Key
+
+
+
+Now, there are three types of cubes:
+* Cubes with low cardinality in their dimensions (Like cube 4, most of time is usend in flat table steps)
+* Cubes with high cardinality in their dimensions (Like cube 6,most of time is usend on Build cube, the flat table steps are lower than 10%)
+* The third type, ultra high cardinality (UHC) which is outside the scope of this article
+
+
+### Cube 6: Cube with high cardinality Dimensions
+
+
+
+In this case the **72%** of the time is used to build Cube
+
+This step is a MapReduce task, you can see the YARN log of these steps on  > 
+
+How can the performance of Map – Reduce be improved? The easy way is to increase the numbers of Mappers and Reduces (= Increase parallelism).
+
+
+
+
+
+**NOTE:** YARN / MapReduce have a lot parameters to configure and adapt to theyour system. The focus here is only on small parts.
+
+(In my system I can assign 12 – 14 GB and 8 cores to YARN Resources):
+
+* yarn.nodemanager.resource.memory-mb = 15 GB
+* yarn.scheduler.maximum-allocation-mb = 8 GB
+* yarn.nodemanager.resource.cpu-vcores = 8 cores
+With this config our max theoreticaleorical grade of parallelismelist is 8. However, but this has a problem: “Timed out after 3600 secs”
+
+
+
+
+The parameter mapreduce.task.timeout (1 hour by default) define max time that Application Master (AM) can happen with out ACK of Yarn Container. Once this time passes, AM kill the container and retry the same 4 times (with the same result)
+
+Where is the problem? The problem is that 4 mappers started, but each mapper needed more than 4 GB to finish
+
+* The solution 1: add more RAM to YARN
+* The solution 2: increase vCores number used in Mapper step to reduce the RAM used
+* The solution 3: you can play with max RAM to YARN by node (yarn.nodemanager.resource.memory-mb) and experiment with mimin RAM perto container (yarn.scheduler.minimum-allocation-mb). If you increase minimum RAM per container, YARN will reduce the numbers of Mappers
+
+
+
+
+In the last two cases the results are the same: reduce the level of parallelism ==>
+* Now we only start 3 mappers start at the same time, the fourth must be wait for a free slot
+* The three first mappers distribute spread the ram among themselves, and as a result they will have enough ram to finish the task
+
+During a normal “Build Cube” step you will see similars messages on YARN log:
+
+
+
+
+If you don’t see this periodically, perhaps you have a bottleneck in the memory.
+
+
+
+### Cube 7: Improve cube response time
+We can try to use different aggregations groups to improve the query performance of some very important Dim or a Dim with high cardinality.
+
+In our case we define 3 Aggregations Groups:
+1. “Normal cube”
+2. Cube with Date Dim and Currency (as mandatory)
+3. Cube with Date Dim and Carteras_Desc (as mandatory)
+
+
+
+
+
+
+
+
+
+
+
+Compare without / with AGGs:
+
+
+
+
+Now it uses 3% more of time to build the cube and 0.6% of space, but queries by currency or Carteras_Desc will be much faster.
+
+
+
+
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/cube_spark.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/cube_spark.md b/website/_docs21/tutorial/cube_spark.md
new file mode 100644
index 0000000..d07fcfc
--- /dev/null
+++ b/website/_docs21/tutorial/cube_spark.md
@@ -0,0 +1,167 @@
+---
+layout: docs21
+title: Build Cube with Spark (beta)
+categories: tutorial
+permalink: /docs21/tutorial/cube_spark.html
+---
+Kylin v2.0 introduces the Spark cube engine, it uses Apache Spark to replace MapReduce in the build cube step; You can check [this blog](/blog/2017/02/23/by-layer-spark-cubing/) for an overall picture. The current document uses the sample cube to demo how to try the new engine.
+
+## Preparation
+To finish this tutorial, you need a Hadoop environment which has Kylin v2.0.0 or above installed. Here we will use Hortonworks HDP 2.4 Sandbox VM, the Hadoop components as well as Hive/HBase has already been started.
+
+## Install Kylin v2.0.0
+
+Download the Kylin v2.0.0 for HBase 1.x from Kylin's download page, and then uncompress the tar ball into */usr/local/* folder:
+
+{% highlight Groff markup %}
+
+wget http://www-us.apache.org/dist/kylin/apache-kylin-2.0.0/apache-kylin-2.0.0-bin-hbase1x.tar.gz -P /tmp
+
+tar -zxvf /tmp/apache-kylin-2.0.0-bin-hbase1x.tar.gz -C /usr/local/
+
+export KYLIN_HOME=/usr/local/apache-kylin-2.0.0-bin
+{% endhighlight %}
+
+## Prepare "kylin.env.hadoop-conf-dir"
+
+To run Spark on Yarn, need specify **HADOOP_CONF_DIR** environment variable, which is the directory that contains the (client side) configuration files for Hadoop. In many Hadoop distributions the directory is "/etc/hadoop/conf"; But Kylin not only need access HDFS, Yarn and Hive, but also HBase, so the default directory might not have all necessary files. In this case, you need create a new directory and then copying or linking those client files (core-site.xml, hdfs-site.xml, yarn-site.xml, hive-site.xml and hbase-site.xml) there. In HDP 2.4, there is a conflict between hive-tez and Spark, so need change the default engine from "tez" to "mr" when copy for Kylin.
+
+{% highlight Groff markup %}
+
+mkdir $KYLIN_HOME/hadoop-conf
+ln -s /etc/hadoop/conf/core-site.xml $KYLIN_HOME/hadoop-conf/core-site.xml
+ln -s /etc/hadoop/conf/hdfs-site.xml $KYLIN_HOME/hadoop-conf/hdfs-site.xml
+ln -s /etc/hadoop/conf/yarn-site.xml $KYLIN_HOME/hadoop-conf/yarn-site.xml
+ln -s /etc/hbase/2.4.0.0-169/0/hbase-site.xml $KYLIN_HOME/hadoop-conf/hbase-site.xml
+cp /etc/hive/2.4.0.0-169/0/hive-site.xml $KYLIN_HOME/hadoop-conf/hive-site.xml
+vi $KYLIN_HOME/hadoop-conf/hive-site.xml (change "hive.execution.engine" value from "tez" to "mr")
+
+{% endhighlight %}
+
+Now, let Kylin know this directory with property "kylin.env.hadoop-conf-dir" in kylin.properties:
+
+{% highlight Groff markup %}
+kylin.env.hadoop-conf-dir=/usr/local/apache-kylin-2.0.0-bin/hadoop-conf
+{% endhighlight %}
+
+If this property isn't set, Kylin will use the directory that "hive-site.xml" locates in; while that folder may have no "hbase-site.xml", will get HBase/ZK connection error in Spark.
+
+## Check Spark configuration
+
+Kylin embedes a Spark binary (v1.6.3) in $KYLIN_HOME/spark, all the Spark configurations can be managed in $KYLIN_HOME/conf/kylin.properties with prefix *"kylin.engine.spark-conf."*. These properties will be extracted and applied when runs submit Spark job; E.g, if you configure "kylin.engine.spark-conf.spark.executor.memory=4G", Kylin will use "--conf spark.executor.memory=4G" as parameter when execute "spark-submit".
+
+Before you run Spark cubing, suggest take a look on these configurations and do customization according to your cluster. Below is the default configurations, which is also the minimal config for a sandbox (1 executor with 1GB memory); usually in a normal cluster, need much more executors and each has at least 4GB memory and 2 cores:
+
+{% highlight Groff markup %}
+kylin.engine.spark-conf.spark.master=yarn
+kylin.engine.spark-conf.spark.submit.deployMode=cluster
+kylin.engine.spark-conf.spark.yarn.queue=default
+kylin.engine.spark-conf.spark.executor.memory=1G
+kylin.engine.spark-conf.spark.executor.cores=2
+kylin.engine.spark-conf.spark.executor.instances=1
+kylin.engine.spark-conf.spark.eventLog.enabled=true
+kylin.engine.spark-conf.spark.eventLog.dir=hdfs\:///kylin/spark-history
+kylin.engine.spark-conf.spark.history.fs.logDirectory=hdfs\:///kylin/spark-history
+#kylin.engine.spark-conf.spark.yarn.jar=hdfs://namenode:8020/kylin/spark/spark-assembly-1.6.3-hadoop2.6.0.jar
+#kylin.engine.spark-conf.spark.io.compression.codec=org.apache.spark.io.SnappyCompressionCodec
+
+## uncomment for HDP
+#kylin.engine.spark-conf.spark.driver.extraJavaOptions=-Dhdp.version=current
+#kylin.engine.spark-conf.spark.yarn.am.extraJavaOptions=-Dhdp.version=current
+#kylin.engine.spark-conf.spark.executor.extraJavaOptions=-Dhdp.version=current
+
+{% endhighlight %}
+
+For running on Hortonworks platform, need specify "hdp.version" as Java options for Yarn containers, so please uncommment the last three lines in kylin.properties.
+
+Besides, in order to avoid repeatedly uploading Spark assembly jar to Yarn, you can manually do that once, and then configure the jar's HDFS location; Please note, the HDFS location need be full qualified name.
+
+{% highlight Groff markup %}
+hadoop fs -mkdir -p /kylin/spark/
+hadoop fs -put $KYLIN_HOME/spark/lib/spark-assembly-1.6.3-hadoop2.6.0.jar /kylin/spark/
+{% endhighlight %}
+
+After do that, the config in kylin.properties will be:
+{% highlight Groff markup %}
+kylin.engine.spark-conf.spark.yarn.jar=hdfs://sandbox.hortonworks.com:8020/kylin/spark/spark-assembly-1.6.3-hadoop2.6.0.jar
+kylin.engine.spark-conf.spark.driver.extraJavaOptions=-Dhdp.version=current
+kylin.engine.spark-conf.spark.yarn.am.extraJavaOptions=-Dhdp.version=current
+kylin.engine.spark-conf.spark.executor.extraJavaOptions=-Dhdp.version=current
+{% endhighlight %}
+
+All the "kylin.engine.spark-conf.*" parameters can be overwritten at Cube or Project level, this gives more flexibility to the user.
+
+## Create and modify sample cube
+
+Run the sample.sh to create the sample cube, and then start Kylin server:
+
+{% highlight Groff markup %}
+
+$KYLIN_HOME/bin/sample.sh
+$KYLIN_HOME/bin/kylin.sh start
+
+{% endhighlight %}
+
+After Kylin is started, access Kylin web, edit the "kylin_sales" cube, in the "Advanced Setting" page, change the "Cube Engine" from "MapReduce" to "Spark (Beta)":
+
+
+ 
+
+Click "Next" to the "Configuration Overwrites" page, click "+Property" to add property "kylin.engine.spark.rdd-partition-cut-mb" with value "500" (reasons below):
+
+ 
+
+The sample cube has two memory hungry measures: a "COUNT DISTINCT" and a "TOPN(100)"; Their size estimation can be inaccurate when the source data is small: the estimized size is much larger than the real size, that causes much more RDD partitions be splitted, which slows down the build. Here 100 is a more reasonable number for it. Click "Next" and "Save" to save the cube.
+
+
+## Build Cube with Spark
+
+Click "Build", select current date as the build end date. Kylin generates a build job in the "Monitor" page, in which the 7th step is the Spark cubing. The job engine starts to execute the steps in sequence.
+
+
+ 
+
+
+ 
+
+When Kylin executes this step, you can monitor the status in Yarn resource manager. Click the "Application Master" link will open Spark web UI, it shows the progress of each stage and the detailed information.
+
+
+ 
+
+
+ 
+
+
+After all steps be successfully executed, the Cube becomes "Ready" and you can query it as normal.
+
+## Troubleshooting
+
+When getting error, you should check "logs/kylin.log" firstly. There has the full Spark command that Kylin executes, e.g:
+
+{% highlight Groff markup %}
+2017-03-06 14:44:38,574 INFO [Job 2d5c1178-c6f6-4b50-8937-8e5e3b39227e-306] spark.SparkExecutable:121 : cmd:export HADOOP_CONF_DIR=/usr/local/apache-kylin-2.0.0-bin/hadoop-conf && /usr/local/apache-kylin-2.0.0-bin/spark/bin/spark-submit --class org.apache.kylin.common.util.SparkEntry --conf spark.executor.instances=1 --conf spark.yarn.jar=hdfs://sandbox.hortonworks.com:8020/kylin/spark/spark-assembly-1.6.3-hadoop2.6.0.jar --conf spark.yarn.queue=default --conf spark.yarn.am.extraJavaOptions=-Dhdp.version=current --conf spark.history.fs.logDirectory=hdfs:///kylin/spark-history --conf spark.driver.extraJavaOptions=-Dhdp.version=current --conf spark.master=yarn --conf spark.executor.extraJavaOptions=-Dhdp.version=current --conf spark.executor.memory=1G --conf spark.eventLog.enabled=true --conf spark.eventLog.dir=hdfs:///kylin/spark-history --conf spark.executor.cores=2 --conf spark.submit.deployMode=cluster --files /etc/hbase/2.4.0.0-169/0/hbase-site.xml --jars /usr/local
/apache-kylin-2.0.0-bin/spark/lib/spark-assembly-1.6.3-hadoop2.6.0.jar,/usr/hdp/2.4.0.0-169/hbase/lib/htrace-core-3.1.0-incubating.jar,/usr/hdp/2.4.0.0-169/hbase/lib/hbase-client-1.1.2.2.4.0.0-169.jar,/usr/hdp/2.4.0.0-169/hbase/lib/hbase-common-1.1.2.2.4.0.0-169.jar,/usr/hdp/2.4.0.0-169/hbase/lib/hbase-protocol-1.1.2.2.4.0.0-169.jar,/usr/hdp/2.4.0.0-169/hbase/lib/metrics-core-2.2.0.jar,/usr/hdp/2.4.0.0-169/hbase/lib/guava-12.0.1.jar, /usr/local/apache-kylin-2.0.0-bin/lib/kylin-job-2.0.0.jar -className org.apache.kylin.engine.spark.SparkCubingByLayer -hiveTable kylin_intermediate_kylin_sales_cube_555c4d32_40bb_457d_909a_1bb017bf2d9e -segmentId 555c4d32-40bb-457d-909a-1bb017bf2d9e -confPath /usr/local/apache-kylin-2.0.0-bin/conf -output hdfs:///kylin/kylin_metadata/kylin-2d5c1178-c6f6-4b50-8937-8e5e3b39227e/kylin_sales_cube/cuboid/ -cubename kylin_sales_cube
+
+{% endhighlight %}
+
+You can copy the cmd to execute manually in shell and then tunning the parameters quickly; During the execution, you can access Yarn resource manager to check more. If the job has already finished, you can check the history info in Spark history server.
+
+By default Kylin outputs the history to "hdfs:///kylin/spark-history", you need start Spark history server on that directory, or change to use your existing Spark history server's event directory in conf/kylin.properties with parameter "kylin.engine.spark-conf.spark.eventLog.dir" and "kylin.engine.spark-conf.spark.history.fs.logDirectory".
+
+The following command will start a Spark history server instance on Kylin's output directory, before run it making sure you have stopped the existing Spark history server in sandbox:
+
+{% highlight Groff markup %}
+$KYLIN_HOME/spark/sbin/start-history-server.sh hdfs://sandbox.hortonworks.com:8020/kylin/spark-history
+{% endhighlight %}
+
+In web browser, access "http://sandbox:18080" it shows the job history:
+
+ 
+
+Click a specific job, there you will see the detail runtime information, that is very helpful for trouble shooting and performance tuning.
+
+## Go further
+
+If you're a Kylin administrator but new to Spark, suggest you go through [Spark documents](https://spark.apache.org/docs/1.6.3/), and don't forget to update the configurations accordingly. You can enable Spark [Dynamic Resource Allocation](https://spark.apache.org/docs/1.6.1/configuration.html#dynamic-allocation) so that it can auto scale/shrink for different work load. Spark's performance relies on Cluster's memory and CPU resource, while Kylin's Cube build is a heavy task when having a complex data model and a huge dataset to build at one time. If your cluster resource couldn't fulfill, errors like "OutOfMemorry" will be thrown in Spark executors, so please use it properly. For Cube which has UHC dimension, many combinations (e.g, a full cube with more than 12 dimensions), or memory hungry measures (Count Distinct, Top-N), suggest to use the MapReduce engine. If your Cube model is simple, all measures are SUM/MIN/MAX/COUNT, source data is small to medium scale, Spark engine would
be a good choice. Besides, Streaming build isn't supported in this engine so far (KYLIN-2484).
+
+Now the Spark engine is in public beta; If you have any question, comment, or bug fix, welcome to discuss in dev@kylin.apache.org.
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/cube_streaming.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/cube_streaming.md b/website/_docs21/tutorial/cube_streaming.md
new file mode 100644
index 0000000..c4124eb
--- /dev/null
+++ b/website/_docs21/tutorial/cube_streaming.md
@@ -0,0 +1,219 @@
+---
+layout: docs21
+title: Scalable Cubing from Kafka
+categories: tutorial
+permalink: /docs21/tutorial/cube_streaming.html
+---
+Kylin v1.6 releases the scalable streaming cubing function, it leverages Hadoop to consume the data from Kafka to build the cube, you can check [this blog](/blog/2016/10/18/new-nrt-streaming/) for the high level design. This doc is a step by step tutorial, illustrating how to create and build a sample cube;
+
+## Preparation
+To finish this tutorial, you need a Hadoop environment which has kylin v1.6.0 or above installed, and also have a Kafka (v0.10.0 or above) running; Previous Kylin version has a couple issues so please upgrade your Kylin instance at first.
+
+In this tutorial, we will use Hortonworks HDP 2.2.4 Sandbox VM + Kafka v0.10.0(Scala 2.10) as the environment.
+
+## Install Kafka 0.10.0.0 and Kylin
+Don't use HDP 2.2.4's build-in Kafka as it is too old, stop it first if it is running.
+{% highlight Groff markup %}
+curl -s http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/0.10.0.0/kafka_2.10-0.10.0.0.tgz | tar -xz -C /usr/local/
+
+cd /usr/local/kafka_2.10-0.10.0.0/
+
+bin/kafka-server-start.sh config/server.properties &
+
+{% endhighlight %}
+
+Download the Kylin v1.6 from download page, expand the tar ball in /usr/local/ folder.
+
+## Create sample Kafka topic and populate data
+
+Create a sample topic "kylindemo", with 3 partitions:
+
+{% highlight Groff markup %}
+
+bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 3 --topic kylindemo
+Created topic "kylindemo".
+{% endhighlight %}
+
+Put sample data to this topic; Kylin has an utility class which can do this;
+
+{% highlight Groff markup %}
+export KAFKA_HOME=/usr/local/kafka_2.10-0.10.0.0
+export KYLIN_HOME=/usr/local/apache-kylin-1.6.0-bin
+
+cd $KYLIN_HOME
+./bin/kylin.sh org.apache.kylin.source.kafka.util.KafkaSampleProducer --topic kylindemo --broker localhost:9092
+{% endhighlight %}
+
+This tool will send 100 records to Kafka every second. Please keep it running during this tutorial. You can check the sample message with kafka-console-consumer.sh now:
+
+{% highlight Groff markup %}
+cd $KAFKA_HOME
+bin/kafka-console-consumer.sh --zookeeper localhost:2181 --bootstrap-server localhost:9092 --topic kylindemo --from-beginning
+{"amount":63.50375137330458,"category":"TOY","order_time":1477415932581,"device":"Other","qty":4,"user":{"id":"bf249f36-f593-4307-b156-240b3094a1c3","age":21,"gender":"Male"},"currency":"USD","country":"CHINA"}
+{"amount":22.806058795736583,"category":"ELECTRONIC","order_time":1477415932591,"device":"Andriod","qty":1,"user":{"id":"00283efe-027e-4ec1-bbed-c2bbda873f1d","age":27,"gender":"Female"},"currency":"USD","country":"INDIA"}
+
+ {% endhighlight %}
+
+## Define a table from streaming
+Start Kylin server with "$KYLIN_HOME/bin/kylin.sh start", login Kylin Web GUI at http://sandbox:7070/kylin/, select an existing project or create a new project; Click "Model" -> "Data Source", then click the icon "Add Streaming Table";
+
+ 
+
+In the pop-up dialogue, enter a sample record which you got from the kafka-console-consumer, click the ">>" button, Kylin parses the JSON message and listS all the properties;
+
+You need give a logic table name for this streaming data source; The name will be used for SQL query later; here enter "STREAMING_SALES_TABLE" as an example in the "Table Name" field.
+
+You need select a timestamp field which will be used to identify the time of a message; Kylin can derive other time values like "year_start", "quarter_start" from this time column, which can give your more flexibility on building and querying the cube. Here check "order_time". You can deselect those properties which are not needed for cube. Here let's keep all fields.
+
+Notice that Kylin supports structured (or say "embedded") message from v1.6, it will convert them into a flat table structure. By default use "_" as the separator of the structed properties.
+
+ 
+
+
+Click "Next". On this page, provide the Kafka cluster information; Enter "kylindemo" as "Topic" name; The cluster has 1 broker, whose host name is "sandbox", port is "9092", click "Save".
+
+ 
+
+In "Advanced setting" section, the "timeout" and "buffer size" are the configurations for connecting with Kafka, keep them.
+
+In "Parser Setting", by default Kylin assumes your message is JSON format, and each record's timestamp column (specified by "tsColName") is a bigint (epoch time) value; in this case, you just need set the "tsColumn" to "order_time";
+
+
+
+In real case if the timestamp value is a string valued timestamp like "Jul 20, 2016 9:59:17 AM", you need specify the parser class with "tsParser" and the time pattern with "tsPattern" like this:
+
+
+
+
+Click "Submit" to save the configurations. Now a "Streaming" table is created.
+
+
+
+## Define data model
+With the table defined in previous step, now we can create the data model. The step is almost the same as you create a normal data model, but it has two requirement:
+
+* Streaming Cube doesn't support join with lookup tables; When define the data model, only select fact table, no lookup table;
+* Streaming Cube must be partitioned; If you're going to build the Cube incrementally at minutes level, select "MINUTE_START" as the cube's partition date column. If at hours level, select "HOUR_START".
+
+Here we pick 13 dimension and 2 measure columns:
+
+
+
+
+Save the data model.
+
+## Create Cube
+
+The streaming Cube is almost the same as a normal cube. a couple of points need get your attention:
+
+* The partition time column should be a dimension of the Cube. In Streaming OLAP the time is always a query condition, and Kylin will leverage this to narrow down the scanned partitions.
+* Don't use "order\_time" as dimension as that is pretty fine-grained; suggest to use "mintue\_start", "hour\_start" or other, depends on how you will inspect the data.
+* Define "year\_start", "quarter\_start", "month\_start", "day\_start", "hour\_start", "minute\_start" as a hierarchy to reduce the combinations to calculate.
+* In the "refersh setting" step, create more merge ranges, like 0.5 hour, 4 hours, 1 day, and then 7 days; This will help to control the cube segment number.
+* In the "rowkeys" section, drag&drop the "minute\_start" to the head position, as for streaming queries, the time condition is always appeared; putting it to head will help to narrow down the scan range.
+
+ 
+
+ 
+
+ 
+
+ 
+
+Save the cube.
+
+## Run a build
+
+You can trigger the build from web GUI, by clicking "Actions" -> "Build", or sending a request to Kylin RESTful API with 'curl' command:
+
+{% highlight Groff markup %}
+curl -X PUT --user ADMIN:KYLIN -H "Content-Type: application/json;charset=utf-8" -d '{ "sourceOffsetStart": 0, "sourceOffsetEnd": 9223372036854775807, "buildType": "BUILD"}' http://localhost:7070/kylin/api/cubes/{your_cube_name}/build2
+{% endhighlight %}
+
+Please note the API endpoint is different from a normal cube (this URL end with "build2").
+
+Here 0 means from the last position, and 9223372036854775807 (Long.MAX_VALUE) means to the end position on Kafka topic. If it is the first time to build (no previous segment), Kylin will seek to beginning of the topics as the start position.
+
+In the "Monitor" page, a new job is generated; Wait it 100% finished.
+
+## Click the "Insight" tab, compose a SQL to run, e.g:
+
+ {% highlight Groff markup %}
+select minute_start, count(*), sum(amount), sum(qty) from streaming_sales_table group by minute_start order by minute_start
+ {% endhighlight %}
+
+The result looks like below.
+
+
+
+## Automate the build
+
+Once the first build and query got successfully, you can schedule incremental builds at a certain frequency. Kylin will record the offsets of each build; when receive a build request, it will start from the last end position, and then seek the latest offsets from Kafka. With the REST API you can trigger it with any scheduler tools like Linux cron:
+
+ {% highlight Groff markup %}
+crontab -e
+*/5 * * * * curl -X PUT --user ADMIN:KYLIN -H "Content-Type: application/json;charset=utf-8" -d '{ "sourceOffsetStart": 0, "sourceOffsetEnd": 9223372036854775807, "buildType": "BUILD"}' http://localhost:7070/kylin/api/cubes/{your_cube_name}/build2
+ {% endhighlight %}
+
+Now you can site down and watch the cube be automatically built from streaming. And when the cube segments accumulate to bigger time range, Kylin will automatically merge them into a bigger segment.
+
+## Trouble shootings
+
+ * You may encounter the following error when run "kylin.sh":
+{% highlight Groff markup %}
+Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/kafka/clients/producer/Producer
+ at java.lang.Class.getDeclaredMethods0(Native Method)
+ at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
+ at java.lang.Class.getMethod0(Class.java:2856)
+ at java.lang.Class.getMethod(Class.java:1668)
+ at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
+ at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
+Caused by: java.lang.ClassNotFoundException: org.apache.kafka.clients.producer.Producer
+ at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
+ at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
+ at java.security.AccessController.doPrivileged(Native Method)
+ at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
+ at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
+ ... 6 more
+{% endhighlight %}
+
+The reason is Kylin wasn't able to find the proper Kafka client jars; Make sure you have properly set "KAFKA_HOME" environment variable.
+
+ * Get "killed by admin" error in the "Build Cube" step
+
+ Within a Sandbox VM, YARN may not allocate the requested memory resource to MR job as the "inmem" cubing algorithm requests more memory. You can bypass this by requesting less memory: edit "conf/kylin_job_conf_inmem.xml", change the following two parameters like this:
+
+ {% highlight Groff markup %}
+ <property>
+ <name>mapreduce.map.memory.mb</name>
+ <value>1072</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>mapreduce.map.java.opts</name>
+ <value>-Xmx800m</value>
+ <description></description>
+ </property>
+ {% endhighlight %}
+
+ * If there already be bunch of history messages in Kafka and you don't want to build from the very beginning, you can trigger a call to set the current end position as the start for the cube:
+
+{% highlight Groff markup %}
+curl -X PUT --user ADMIN:KYLIN -H "Content-Type: application/json;charset=utf-8" -d '{ "sourceOffsetStart": 0, "sourceOffsetEnd": 9223372036854775807, "buildType": "BUILD"}' http://localhost:7070/kylin/api/cubes/{your_cube_name}/init_start_offsets
+{% endhighlight %}
+
+ * If some build job got error and you discard it, there will be a hole (or say gap) left in the Cube. Since each time Kylin will build from last position, you couldn't expect the hole be filled by normal builds. Kylin provides API to check and fill the holes
+
+Check holes:
+ {% highlight Groff markup %}
+curl -X GET --user ADMINN:KYLIN -H "Content-Type: application/json;charset=utf-8" http://localhost:7070/kylin/api/cubes/{your_cube_name}/holes
+{% endhighlight %}
+
+If the result is an empty arrary, means there is no hole; Otherwise, trigger Kylin to fill them:
+ {% highlight Groff markup %}
+curl -X PUT --user ADMINN:KYLIN -H "Content-Type: application/json;charset=utf-8" http://localhost:7070/kylin/api/cubes/{your_cube_name}/holes
+{% endhighlight %}
+
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/flink.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/flink.md b/website/_docs21/tutorial/flink.md
new file mode 100644
index 0000000..3390fd7
--- /dev/null
+++ b/website/_docs21/tutorial/flink.md
@@ -0,0 +1,249 @@
+---
+layout: docs21
+title: Connect from Apache Flink
+categories: tutorial
+permalink: /docs21/tutorial/flink.html
+---
+
+
+### Introduction
+
+This document describes how to use Kylin as a data source in Apache Flink;
+
+There were several attempts to do this in Scala and JDBC, but none of them works:
+
+* [attempt1](http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/JDBCInputFormat-preparation-with-Flink-1-1-SNAPSHOT-and-Scala-2-11-td5371.html)
+* [attempt2](http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Type-of-TypeVariable-OT-in-class-org-apache-flink-api-common-io-RichInputFormat-could-not-be-determi-td7287.html)
+* [attempt3](http://stackoverflow.com/questions/36067881/create-dataset-from-jdbc-source-in-flink-using-scala)
+* [attempt4](https://codegists.com/snippet/scala/jdbcissuescala_zeitgeist_scala);
+
+We will try use CreateInput and [JDBCInputFormat](https://ci.apache.org/projects/flink/flink-docs-release-1.2/dev/batch/index.html) in batch mode and access via JDBC to Kylin. But it isn’t implemented in Scala, is only in Java [MailList](http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/jdbc-JDBCInputFormat-td9393.html). This doc will go step by step solving these problems.
+
+### Pre-requisites
+
+* Need an instance of Kylin, with a Cube; [Sample Cube](kylin_sample.html) will be good enough.
+* [Scala](http://www.scala-lang.org/) and [Apache Flink](http://flink.apache.org/) Installed
+* [IntelliJ](https://www.jetbrains.com/idea/) Installed and configured for Scala/Flink (see [Flink IDE setup guide](https://ci.apache.org/projects/flink/flink-docs-release-1.1/internals/ide_setup.html) )
+
+### Used software:
+
+* [Apache Flink](http://flink.apache.org/downloads.html) v1.2-SNAPSHOT
+* [Apache Kylin](http://kylin.apache.org/download/) v1.5.2 (v1.6.0 also works)
+* [IntelliJ](https://www.jetbrains.com/idea/download/#section=linux) v2016.2
+* [Scala](downloads.lightbend.com/scala/2.11.8/scala-2.11.8.tgz) v2.11
+
+### Starting point:
+
+This can be out initial skeleton:
+
+{% highlight Groff markup %}
+import org.apache.flink.api.scala._
+val env = ExecutionEnvironment.getExecutionEnvironment
+val inputFormat = JDBCInputFormat.buildJDBCInputFormat()
+ .setDrivername("org.apache.kylin.jdbc.Driver")
+ .setDBUrl("jdbc:kylin://172.17.0.2:7070/learn_kylin")
+ .setUsername("ADMIN")
+ .setPassword("KYLIN")
+ .setQuery("select count(distinct seller_id) as sellers from kylin_sales group by part_dt order by part_dt")
+ .finish()
+ val dataset =env.createInput(inputFormat)
+{% endhighlight %}
+
+The first error is: 
+
+Add to Scala:
+{% highlight Groff markup %}
+import org.apache.flink.api.java.io.jdbc.JDBCInputFormat
+{% endhighlight %}
+
+Next error is 
+
+We can solve dependencies [(mvn repository: jdbc)](https://mvnrepository.com/artifact/org.apache.flink/flink-jdbc/1.1.2); Add this to your pom.xml:
+{% highlight Groff markup %}
+<dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-jdbc</artifactId>
+ <version>${flink.version}</version>
+</dependency>
+{% endhighlight %}
+
+## Solve dependencies of row
+
+Similar to previous point we need solve dependencies of Row Class [(mvn repository: Table) ](https://mvnrepository.com/artifact/org.apache.flink/flink-table_2.10/1.1.2):
+
+ 
+
+
+* In pom.xml add:
+{% highlight Groff markup %}
+<dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-table_2.10</artifactId>
+ <version>${flink.version}</version>
+</dependency>
+{% endhighlight %}
+
+* In Scala:
+{% highlight Groff markup %}
+import org.apache.flink.api.table.Row
+{% endhighlight %}
+
+## Solve RowTypeInfo property (and their new dependencies)
+
+This is the new error to solve:
+
+ 
+
+
+* If check the code of [JDBCInputFormat.java](https://github.com/apache/flink/blob/master/flink-batch-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCInputFormat.java#L69), we can see [this new property](https://github.com/apache/flink/commit/09b428bd65819b946cf82ab1fdee305eb5a941f5#diff-9b49a5041d50d9f9fad3f8060b3d1310R69) (and mandatory) added on Apr 2016 by [FLINK-3750](https://issues.apache.org/jira/browse/FLINK-3750) Manual [JDBCInputFormat](https://ci.apache.org/projects/flink/flink-docs-master/api/java/org/apache/flink/api/java/io/jdbc/JDBCInputFormat.html) v1.2 in Java
+
+ Add the new Property: **setRowTypeInfo**
+
+{% highlight Groff markup %}
+val inputFormat = JDBCInputFormat.buildJDBCInputFormat()
+ .setDrivername("org.apache.kylin.jdbc.Driver")
+ .setDBUrl("jdbc:kylin://172.17.0.2:7070/learn_kylin")
+ .setUsername("ADMIN")
+ .setPassword("KYLIN")
+ .setQuery("select count(distinct seller_id) as sellers from kylin_sales group by part_dt order by part_dt")
+ .setRowTypeInfo(DB_ROWTYPE)
+ .finish()
+{% endhighlight %}
+
+* How can configure this property in Scala? In [Attempt4](https://codegists.com/snippet/scala/jdbcissuescala_zeitgeist_scala), there is an incorrect solution
+
+ We can check the types using the intellisense: 
+
+ Then we will need add more dependences; Add to scala:
+
+{% highlight Groff markup %}
+import org.apache.flink.api.table.typeutils.RowTypeInfo
+import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, TypeInformation}
+{% endhighlight %}
+
+ Create a Array or Seq of TypeInformation[ ]
+
+ 
+
+
+ Solution:
+
+{% highlight Groff markup %}
+ var stringColum: TypeInformation[String] = createTypeInformation[String]
+ val DB_ROWTYPE = new RowTypeInfo(Seq(stringColum))
+{% endhighlight %}
+
+## Solve ClassNotFoundException
+
+ 
+
+Need find the kylin-jdbc-x.x.x.jar and then expose to Flink
+
+1. Find the Kylin JDBC jar
+
+ From Kylin [Download](http://kylin.apache.org/download/) choose **Binary** and the **correct version of Kylin and HBase**
+
+ Download & Unpack: in ./lib:
+
+ 
+
+
+2. Make this JAR accessible to Flink
+
+ If you execute like service you need put this JAR in you Java class path using your .bashrc
+
+ 
+
+
+ Check the actual value: 
+
+ Check the permission for this file (Must be accessible for you):
+
+ 
+
+
+ If you are executing from IDE, need add your class path manually:
+
+ On IntelliJ:  >  >  > 
+
+ The result, will be similar to: 
+
+## Solve "Couldn’t access resultSet" error
+
+ 
+
+
+It is related with [Flink 4108](https://issues.apache.org/jira/browse/FLINK-4108) [(MailList)](http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/jdbc-JDBCInputFormat-td9393.html#a9415) and Timo Walther [make a PR](https://github.com/apache/flink/pull/2619)
+
+If you are running Flink <= 1.2 you will need apply this path and make clean install
+
+## Solve the casting error
+
+ 
+
+In the error message you have the problem and solution …. nice ;) ¡¡
+
+## The result
+
+The output must be similar to this, print the result of query by standard output:
+
+ 
+
+
+## Now, more complex
+
+Try with a multi-colum and multi-type query:
+
+{% highlight Groff markup %}
+select part_dt, sum(price) as total_selled, count(distinct seller_id) as sellers
+from kylin_sales
+group by part_dt
+order by part_dt
+{% endhighlight %}
+
+Need changes in DB_ROWTYPE:
+
+ 
+
+
+And import lib of Java, to work with Data type of Java 
+
+The new result will be:
+
+ 
+
+
+## Error: Reused Connection
+
+
+ 
+
+Check if your HBase and Kylin is working. Also you can use Kylin UI for it.
+
+
+## Error: java.lang.AbstractMethodError: ….Avatica Connection
+
+See [Kylin 1898](https://issues.apache.org/jira/browse/KYLIN-1898)
+
+It is a problem with kylin-jdbc-1.x.x. JAR, you need use Calcite 1.8 or above; The solution is to use Kylin 1.5.4 or above.
+
+ 
+
+
+
+## Error: can't expand macros compiled by previous versions of scala
+
+Is a problem with versions of scala, check in with "scala -version" your actual version and choose your correct POM.
+
+Perhaps you will need a IntelliJ > File > Invalidates Cache > Invalidate and Restart.
+
+I added POM for Scala 2.11
+
+
+## Final Words
+
+Now you can read Kylin’s data from Apache Flink, great!
+
+[Full Code Example](https://github.com/albertoRamon/Flink/tree/master/ReadKylinFromFlink/flink-scala-project)
+
+Solved all integration problems, and tested with different types of data (Long, BigDecimal and Dates). The patch has been comited at 15 Oct, then, will be part of Flink 1.2.
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/hue.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/hue.md b/website/_docs21/tutorial/hue.md
new file mode 100755
index 0000000..fa00d82
--- /dev/null
+++ b/website/_docs21/tutorial/hue.md
@@ -0,0 +1,264 @@
+---
+layout: docs21
+title: Connect from Apache Hue
+categories: tutorial
+permalink: /docs21/tutorial/hue.html
+---
+### Introduction
+ In [Hue-2745](https://issues.cloudera.org/browse/HUE-2745) v3.10, add jdbc support like Phoenix, Kylin, Redshift, Solr Parallel SQL, …
+
+However, there isn’t any manual to use with Kylin :(
+
+### Pre-requisites
+Build a cube sample of Kylin with: [Quick Start with Sample Cube](http://kylin.apache.org/docs15/tutorial/kylin_sample.html), will be enough
+
+You can check:
+
+ 
+
+
+### Used Software:
+* [Apache Hue](http://gethue.com/) v3.10.0
+* [Apache Kylin](http://kylin.apache.org/) v1.5.2
+
+
+### Install Apache Hue
+If you have Hue installed, you can skip this step
+
+To install Hue on Ubuntu 16.04 LTS. The [official Instructions](http://gethue.com/how-to-build-hue-on-ubuntu-14-04-trusty/) didn’t work but [this](https://github.com/cloudera/hue/blob/master/tools/docker/hue-base/Dockerfile) works fine:
+
+There isn’t any binary package thus [pre-requisites](https://github.com/cloudera/hue#development-prerequisites) must be installed and compile with the command *make*
+
+{% highlight Groff markup %}
+ Sudo apt-get install --fix-missing -q -y \
+ git \
+ ant \
+ gcc \
+ g++ \
+ libkrb5-dev \
+ libmysqlclient-dev \
+ libssl-dev \
+ libsasl2-dev \
+ libsasl2-modules-gssapi-mit \
+ libsqlite3-dev \
+ libtidy-0.99-0 \
+ libxml2-dev \
+ libxslt-dev \
+ libffi-dev \
+ make \
+ maven \
+ libldap2-dev \
+ python-dev \
+ python-setuptools \
+ libgmp3-dev \
+ libz-dev
+{% endhighlight %}
+
+Download and Compile:
+
+{% highlight Groff markup %}
+ git clone https://github.com/cloudera/hue.git
+ cd hue
+ make apps
+{% endhighlight %}
+
+Start and connect to Hue:
+
+{% highlight Groff markup %}
+ build/env/bin/hue runserver_plus localhost:8888
+{% endhighlight %}
+* runserver_plus: is like runserver with [debugger](http://django-extensions.readthedocs.io/en/latest/runserver_plus.html#usage)
+* localIP: Port, usually Hue uses 8888
+
+The output must be similar to:
+
+ 
+
+
+Connect using your browser: http://localhost:8888
+
+ 
+
+
+Important: The first time that you connect to hue, you set Login / Pass for admin
+
+We will use Hue / Hue as login / pass
+
+
+**Issue 1:** Could not create home directory
+
+ 
+
+
+ It is a permission problem of your current user, you can use: sudo to start Hue
+
+**Issue 2:** Could not connect to …
+
+ 
+
+ If Hue’s code had been downloaded from Git, Hive connection is active but not configured → skip this message
+
+**Issue 3:** Address already in use
+
+ 
+
+ The port is in use or you have a Hive process running already
+
+ You can use *ps -ef | grep hue*, to find the PID and kill
+
+
+### Configure Apache Hue for Kylin
+The purpose is to add a snipped in a notebook with Kylin queries
+
+References:
+* [Custom SQL Databases](http://gethue.com/custom-sql-query-editors/)
+* [Manual: Kylin JDBC Driver](http://kylin.apache.org/docs/howto/howto_jdbc.html)
+* [GitHub: Kylin JDBC Driver](https://github.com/apache/kylin/tree/3b2ebd243cfe233ea7b1a80285f4c2110500bbe5/jdbc)
+
+Register JDBC Driver
+
+1. To find the JAR Class for the JDBC Connector
+
+ From Kylin [Download](http://kylin.apache.org/download/)
+Choose **Binary** and the **correct version of Kylin and HBase**
+
+ Download & Unpack: in ./lib:
+
+ 
+
+
+2. Place this JAR in Java ClassPATH using .bashrc
+
+ 
+
+
+ check the actual value: 
+
+ check the permission for this file (must be accessible to you):
+
+ 
+
+
+3. Add this new interface to Hue.ini
+
+ Where is the hue.ini ?
+
+ * If the code is downloaded from Git: *UnzipPath/desktop/conf/pseudo-distributed.ini*
+
+ (I shared my *INI* file in GitHub).
+
+ * If you are using Cloudera: you must use Advanced Configuration Snippet
+
+ * Other: find your actual *hue.ini*
+
+ Add these lines in *[[interpreters]]*
+{% highlight Groff markup %}
+ [[[kylin]]]
+ name=kylin JDBC
+ interface=jdbc
+ options='{"url": "jdbc:kylin://172.17.0.2:7070/learn_kylin","driver": "org.apache.kylin.jdbc.Driver", "user": "ADMIN", "password": "KYLIN"}'
+{% endhighlight %}
+
+4. Try to Start Hue and connect just like in ‘Start and connect’
+
+TIP: One JDBC Source for each project is need
+
+
+Register without a password, it can do use this other format:
+{% highlight Groff markup %}
+ options='{"url": "jdbc:kylin://172.17.0.2:7070/learn_kylin","driver": "org.apache.kylin.jdbc.Driver"}'
+{% endhighlight %}
+
+And when you open the Notebook, Hue prompts this:
+
+ 
+
+
+
+**Issue 1:** Hue can’t Start
+
+If you see this when you connect to Hue ( http://localhost:8888 ):
+
+ 
+
+
+Go to the last line 
+
+And launch Python Interpreter (see console icon on the right):
+
+ 
+
+In this case: I've forgotten to close “ after learn_kylin
+
+**Issue 2:** Password Prompting
+
+In Hue 3.11 there is a bug [Hue 4716](https://issues.cloudera.org/browse/HUE-4716)
+
+In Hue 3.10 with Kylin, I don’t have any problem :)
+
+
+## Test query Example
+Add Kylin JDBC as source in the Kylin’s notebook:
+
+  >  >  > 
+
+
+Write a query, like this:
+{% highlight Groff markup %}
+ select part_dt, sum(price) as total_selled, count(distinct seller_id) as sellers from kylin_sales group by part_dt order by part_dt
+{% endhighlight %}
+
+And Execute with: 
+
+ 
+
+
+ **Congratulations !!!** you are connected to Hue with Kylin
+
+
+**Issue 1:** No suitable driver found for jdbc:kylin
+
+ 
+
+There is a bug,not solved since 27 Aug 2016, nor in 3.10 and 3.11,
+but the solution is very easy (Thanks to Shahab Tajik)
+
+[Link](https://github.com/cloudera/hue/pull/369):
+You only need to change 3 lines in *<HuePath>/desktop/libs/librdbms/src/librdbms/jdbc.py*
+
+
+## Limits
+In Hue 3.10 and 3.11
+* Auto-complete doesn’t work on JDBC interfaces
+* Max 1.000 records. There is a limitation on JDBC interfaces, because Hue does not support result pagination [Hue 3419](https://issues.cloudera.org/browse/HUE-3419)
+* Obviously: It’s read-only
+
+
+### Future Work
+
+**Dashboards**
+There is an amazing feature of Hue: [Search Dasboards](http://gethue.com/search-dashboards/) / [Dynamic Dashboards](http://gethue.com/hadoop-search-dynamic-search-dashboards-with-solr/). You can ‘play’ with this [Demo On-line](http://demo.gethue.com/search/admin/collections) … **But this only works with SolR**
+
+There is a Jira to solve this: [Hue 3228](https://issues.cloudera.org/browse/HUE-3228), is in RoadMap for 4.1. Check Hue MailList[MailList](https://groups.google.com/a/cloudera.org/forum/#!topic/hue-user/B6FWBeoqK7I) and add Dashboards to JDBC connections
+
+**Chart & Dynamic Filter**
+Nowadays, It isn’t compatible, you only can work with Grid
+
+I think the problem is that Hue doesn’t know how to read Kylin Metadata [Hue 4011](https://issues.cloudera.org/browse/HUE-4011)
+
+ 
+
+
+**DB Query**
+  >  , is not yet supported with JDBC
+
+Now it only supports [Django Databases](https://docs.djangoproject.com/en/1.9/topics/install/#database-installation)
+
+
+
+
+
+**For any suggestions, feel free to contact me**
+
+**Thanks, Alberto**
+
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/kylin_client_tool.cn.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/kylin_client_tool.cn.md b/website/_docs21/tutorial/kylin_client_tool.cn.md
new file mode 100644
index 0000000..ebc99be
--- /dev/null
+++ b/website/_docs21/tutorial/kylin_client_tool.cn.md
@@ -0,0 +1,97 @@
+---
+layout: docs21-cn
+title: Kylin Client Tool 使用教程
+categories: 教程
+permalink: /cn/docs21/tutorial/kylin_client_tool.html
+---
+
+> Kylin-client-tool是一个用python编写的,完全基于kylin的rest api的工具。可以实现kylin的cube创建,按时build cube,job的提交、调度、查看、取消与恢复。
+
+## 安装
+1.确认运行环境安装了python2.6/2.7
+
+2.本工具需安装第三方python包apscheduler和requests,运行setup.sh进行安装,mac用户运行setup-mac.sh进行安装。也可用setuptools进行安装
+
+## 配置
+修改工具目录下的settings/settings.py文件,进行配置
+
+`KYLIN_USER` Kylin用户名
+
+`KYLIN_PASSWORD` Kylin的密码
+
+`KYLIN_REST_HOST` Kylin的地址
+
+`KYLIN_REST_PORT` Kylin的端口
+
+`KYLIN_JOB_MAX_COCURRENT` 允许同时build的job数量
+
+`KYLIN_JOB_MAX_RETRY` cube build出现error后,允许的重启job次数
+
+## 命令行的使用
+本工具使用optparse通过命令行来执行操作,具体用法可通过`python kylin_client_tool.py -h`来查看
+
+## cube的创建
+本工具定义了一种读手写的文本,来快速cube创建的方法,格式如下
+
+`cube名|fact table名|维度1,维度1类型;维度2,维度2类型...|指标1,指标1表达式,指标1类型...|设置项|filter|`
+
+设置项内有以下选项,
+
+`no_dictionary` 设置Rowkeys中不生成dictionary的维度及其长度
+
+`mandatory_dimension` 设置Rowkeys中mandatory的维度
+
+`aggregation_group` 设置aggregation group
+
+`partition_date_column` 设置partition date column
+
+`partition_date_start` 设置partition start date
+
+具体例子可以查看cube_def.csv文件,目前不支持含lookup table的cube创建
+
+使用`-c`命令进行创建,用`-F`指定cube定义文件,例如
+
+`python kylin_client_tool.py -c -F cube_def.csv`
+
+## build cube
+###使用cube定义文件build
+使用`-b`命令,需要用`-F`指定cube定义文件,如果指定了partition date column,通过`-T`指定end date(year-month-day格式),若不指定,以当前时间为end date,例如
+
+`python kylin_client_tool.py -b -F cube_def.csv -T 2016-03-01`
+
+###使用cube名文件build
+用`-f`指定cube名文件,文件每行一个cube名
+
+`python kylin_client_tool.py -b -f cube_names.csv -T 2016-03-01`
+
+###直接命令行写cube名build
+用`-C`指定cube名,通过逗号进行分隔
+
+`python kylin_client_tool.py -b -C client_tool_test1,client_tool_test2 -T 2016-03-01`
+
+## job管理
+###查看job状态
+使用`-s`命令查看,用`-f`指定cube名文件,用`-C`指定cube名,若不指定,将查看所有cube状态。用`-S`指定job状态,R表示`Running`,E表示`Error`,F表示`Finished`,D表示`Discarded`,例如:
+
+`python kylin_client_tool.py -s -C kylin_sales_cube -f cube_names.csv -S F`
+
+###恢复job
+用`-r`命令恢复job,用`-f`指定cube名文件,用`-C`指定cube名,若不指定,将恢复所有Error状态的job,例如:
+
+`python kylin_client_tool.py -r -C kylin_sales_cube -f cube_names.csv`
+
+###取消job
+用`-k`命令取消job,用`-f`指定cube名文件,用`-C`指定cube名,若不指定,将取消所有Running或Error状态的job,例如:
+
+`python kylin_client_tool.py -k -C kylin_sales_cube -f cube_names.csv`
+
+## 定时build cube
+### 每隔一段时间build cube
+在cube build命令的基础上,使用`-B i`指定每隔一段时间build的方式,使用`-O`指定间隔的小时数,例如:
+
+`python kylin_client_tool.py -b -F cube_def.csv -B i -O 1`
+
+### 设定时间build cube
+使用`-B t`指定按时build cube的方式,使用`-O`指定build时间,用逗号进行分隔
+
+`python kylin_client_tool.py -b -F cube_def.csv -T 2016-03-04 -B t -O 2016,3,1,0,0,0`
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/kylin_sample.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/kylin_sample.md b/website/_docs21/tutorial/kylin_sample.md
new file mode 100644
index 0000000..c04eec2
--- /dev/null
+++ b/website/_docs21/tutorial/kylin_sample.md
@@ -0,0 +1,21 @@
+---
+layout: docs21
+title: Quick Start with Sample Cube
+categories: tutorial
+permalink: /docs21/tutorial/kylin_sample.html
+---
+
+Kylin provides a script for you to create a sample Cube; the script will also create three sample hive tables:
+
+1. Run ${KYLIN_HOME}/bin/sample.sh ; Restart kylin server to flush the caches;
+2. Logon Kylin web with default user ADMIN/KYLIN, select project "learn_kylin" in the project dropdown list (left upper corner);
+3. Select the sample cube "kylin_sales_cube", click "Actions" -> "Build", pick up a date later than 2014-01-01 (to cover all 10000 sample records);
+4. Check the build progress in "Monitor" tab, until 100%;
+5. Execute SQLs in the "Insight" tab, for example:
+ select part_dt, sum(price) as total_selled, count(distinct seller_id) as sellers from kylin_sales group by part_dt order by part_dt
+6. You can verify the query result and compare the response time with hive;
+
+
+## What's next
+
+You can create another cube with the sample tables, by following the tutorials.
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/odbc.cn.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/odbc.cn.md b/website/_docs21/tutorial/odbc.cn.md
new file mode 100644
index 0000000..e76b4d2
--- /dev/null
+++ b/website/_docs21/tutorial/odbc.cn.md
@@ -0,0 +1,34 @@
+---
+layout: docs21-cn
+title: Kylin ODBC 驱动程序教程
+categories: 教程
+permalink: /cn/docs21/tutorial/odbc.html
+version: v1.2
+since: v0.7.1
+---
+
+> 我们提供Kylin ODBC驱动程序以支持ODBC兼容客户端应用的数据访问。
+>
+> 32位版本或64位版本的驱动程序都是可用的。
+>
+> 测试操作系统:Windows 7,Windows Server 2008 R2
+>
+> 测试应用:Tableau 8.0.4 和 Tableau 8.1.3
+
+## 前提条件
+1. Microsoft Visual C++ 2012 再分配(Redistributable)
+ * 32位Windows或32位Tableau Desktop:下载:[32bit version](http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe)
+ * 64位Windows或64位Tableau Desktop:下载:[64bit version](http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe)
+
+2. ODBC驱动程序内部从一个REST服务器获取结果,确保你能够访问一个
+
+## 安装
+1. 如果你已经安装,首先卸载已存在的Kylin ODBC
+2. 从[下载](../../download/)下载附件驱动安装程序,并运行。
+ * 32位Tableau Desktop:请安装KylinODBCDriver (x86).exe
+ * 64位Tableau Desktop:请安装KylinODBCDriver (x64).exe
+
+3. Both drivers already be installed on Tableau Server, you properly should be able to publish to there without issues
+
+## 错误报告
+如有问题,请报告错误至Apache Kylin JIRA,或者发送邮件到dev邮件列表。
http://git-wip-us.apache.org/repos/asf/kylin/blob/2eb11fa4/website/_docs21/tutorial/odbc.md
----------------------------------------------------------------------
diff --git a/website/_docs21/tutorial/odbc.md b/website/_docs21/tutorial/odbc.md
new file mode 100644
index 0000000..c4ed8a9
--- /dev/null
+++ b/website/_docs21/tutorial/odbc.md
@@ -0,0 +1,49 @@
+---
+layout: docs21
+title: Kylin ODBC Driver
+categories: tutorial
+permalink: /docs21/tutorial/odbc.html
+since: v0.7.1
+---
+
+> We provide Kylin ODBC driver to enable data access from ODBC-compatible client applications.
+>
+> Both 32-bit version or 64-bit version driver are available.
+>
+> Tested Operation System: Windows 7, Windows Server 2008 R2
+>
+> Tested Application: Tableau 8.0.4, Tableau 8.1.3 and Tableau 9.1
+
+## Prerequisites
+1. Microsoft Visual C++ 2012 Redistributable
+ * For 32 bit Windows or 32 bit Tableau Desktop: Download: [32bit version](http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe)
+ * For 64 bit Windows or 64 bit Tableau Desktop: Download: [64bit version](http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe)
+
+
+2. ODBC driver internally gets results from a REST server, make sure you have access to one
+
+## Installation
+1. Uninstall existing Kylin ODBC first, if you already installled it before
+2. Download ODBC Driver from [download](../../download/).
+ * For 32 bit Tableau Desktop: Please install KylinODBCDriver (x86).exe
+ * For 64 bit Tableau Desktop: Please install KylinODBCDriver (x64).exe
+
+3. Both drivers already be installed on Tableau Server, you properly should be able to publish to there without issues
+
+## DSN configuration
+1. Open ODBCAD to configure DSN.
+ * For 32 bit driver, please use the 32bit version in C:\Windows\SysWOW64\odbcad32.exe
+ * For 64 bit driver, please use the default "Data Sources (ODBC)" in Control Panel/Administrator Tools
+
+
+2. Open "System DSN" tab, and click "Add", you will see KylinODBCDriver listed as an option, Click "Finish" to continue.
+
+
+3. In the pop up dialog, fill in all the blanks, The server host is where your Kylin Rest Server is started.
+
+
+4. Click "Done", and you will see your new DSN listed in the "System Data Sources", you can use this DSN afterwards.
+
+
+## Bug Report
+Please open Apache Kylin JIRA to report bug, or send to dev mailing list.