This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch document
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/document by this push:
     new 1ec2d9b  add restore metadata selectively
1ec2d9b is described below

commit 1ec2d9b675c8fcf5d470834be11e168cd52a2082
Author: shaofengshi <shaofeng...@apache.org>
AuthorDate: Mon Oct 29 22:06:11 2018 +0800

    add restore metadata selectively
---
 website/_docs/howto/howto_backup_metadata.cn.md | 31 +++++++++++++++++++++++--
 website/_docs/howto/howto_backup_metadata.md    | 31 +++++++++++++++++++++++--
 2 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/website/_docs/howto/howto_backup_metadata.cn.md 
b/website/_docs/howto/howto_backup_metadata.cn.md
index 4717597..66ab3ed 100644
--- a/website/_docs/howto/howto_backup_metadata.cn.md
+++ b/website/_docs/howto/howto_backup_metadata.cn.md
@@ -14,7 +14,7 @@ kylin.metadata.url=kylin_metadata@hbase
 
 这表明元数据会被保存在一个叫作 “kylin_metadata”的htable 里。你可以在 hbase shell 里 scan 该 htbale 
来获取它。
 
-## 使用二进制包来备份 metadata store
+## 使用二进制包来备份 metadata
 
 有时你需要将 Kylin 的 metadata store 从 hbase 备份到磁盘文件系统。在这种情况下,假设你在部署 Kylin 的 hadoop 
命令行(或沙盒)里,你可以到KYLIN_HOME并运行:
 
@@ -24,7 +24,7 @@ kylin.metadata.url=kylin_metadata@hbase
 
 
来将你的元数据导出到本地目录,这个目录在KYLIN_HOME/metadata_backps下,它的命名规则使用了当前时间作为参数:KYLIN_HOME/meta_backups/meta_year_month_day_hour_minute_second
 。
 
-## 使用二进制包来恢复 metatdara store
+## 使用二进制包来恢复 metadata
 
 万一你发现你的元数据被搞得一团糟,想要恢复先前的备份:
 
@@ -39,6 +39,33 @@ kylin.metadata.url=kylin_metadata@hbase
 ./bin/metastore.sh restore $KYLIN_HOME/meta_backups/meta_xxxx_xx_xx_xx_xx_xx
 {% endhighlight %}
 
+## 有选择地恢复 metadata (推荐)
+如果只更改了几个元数据文件,管理员只需选择要还原的这些文件,而不必覆盖所有元数据。 与完全恢复相比,这种方法更有效,更安全,因此建议使用。
+
+创建一个新的空目录,然后根据要还原的元数据文件的位置在其中创建子目录; 例如,要恢复多维数据集实例,您应该创建一个“cube”子目录:
+
+{% highlight Groff markup %}
+mkdir /path/to/restore_new
+mkdir /path/to/restore_new/cube
+{% endhighlight %}
+
+将要还原的元数据文件复制到此新目录:
+
+{% highlight Groff markup %}
+cp meta_backups/meta_2016_06_10_20_24_50/cube/kylin_sales_cube.json 
/path/to/restore_new/cube/
+{% endhighlight %}
+
+此时,您可以手动修改/修复元数据。
+
+从此目录还原:
+
+{% highlight Groff markup %}
+cd $KYLIN_HOME
+./bin/metastore.sh restore /path/to/restore_new
+{% endhighlight %}
+
+只有在此文件夹中的文件才会上传到Kylin Metastore。 同样,在恢复完成后,单击 Web UI 上的“Reload 
Metadata”按钮以刷新缓存。
+
 ## 在开发环境备份/恢复元数据
 
 在开发调试 Kylin 时,典型的环境是一台装有 IDE 
的开发机上和一个后台的沙盒,通常你会写代码并在开发机上运行测试案例,但每次都需要将二进制包放到沙盒里以检查元数据是很麻烦的。这时有一个名为 
SandboxMetastoreCLI 工具类可以帮助你在开发机本地下载/上传元数据。
diff --git a/website/_docs/howto/howto_backup_metadata.md 
b/website/_docs/howto/howto_backup_metadata.md
index a559d9a..d9af7dd 100644
--- a/website/_docs/howto/howto_backup_metadata.md
+++ b/website/_docs/howto/howto_backup_metadata.md
@@ -14,7 +14,7 @@ kylin.metadata.url=kylin_metadata@hbase
 
 This indicates that the metadata will be saved as a htable called 
`kylin_metadata`. You can scan the htable in hbase shell to check it out.
 
-## Backup metadata store with binary package
+## Backup metadata with binary package
 
 Sometimes you need to backup the Kylin's metadata store from hbase to your 
disk file system.
 In such cases, assuming you're on the hadoop CLI(or sandbox) where you 
deployed Kylin, you can go to KYLIN_HOME and run :
@@ -25,7 +25,7 @@ In such cases, assuming you're on the hadoop CLI(or sandbox) 
where you deployed
 
 to dump your metadata to your local folder a folder under 
KYLIN_HOME/metadata_backps, the folder is named after current time with the 
syntax: KYLIN_HOME/meta_backups/meta_year_month_day_hour_minute_second
 
-## Restore metadata store with binary package
+## Restore metadata with binary package
 
 In case you find your metadata store messed up, and you want to restore to a 
previous backup:
 
@@ -40,6 +40,33 @@ Then upload the backup metadata to Kylin's metadata store:
 ./bin/metastore.sh restore $KYLIN_HOME/meta_backups/meta_xxxx_xx_xx_xx_xx_xx
 {% endhighlight %}
 
+## Restore metadata selectively (Recommended)
+If only changes a couple of metadata files, the administrator can just pick 
these files to restore, without having to cover all the metadata. Compared to 
the full recovery, this approach is more efficient, more safe, so it is 
recommended.
+
+Create a new empty directory, and then create subdirectories in it according 
to the location of the metadata files to restore; for example, to restore a 
Cube instance, you should create a "cube" subdirectory:
+
+{% highlight Groff markup %}
+mkdir /path/to/restore_new
+mkdir /path/to/restore_new/cube
+{% endhighlight %}
+
+Copy the metadata file to be restored to this new directory:
+
+{% highlight Groff markup %}
+cp meta_backups/meta_2016_06_10_20_24_50/cube/kylin_sales_cube.json 
/path/to/restore_new/cube/
+{% endhighlight %}
+
+At this point you can use modify/fix the metadata manually.
+
+Restore from this directory:
+
+{% highlight Groff markup %}
+cd $KYLIN_HOME
+./bin/metastore.sh restore /path/to/restore_new
+{% endhighlight %}
+
+Only the files in the folder will be uploaded to Kylin metastore. Similarly, 
after the recovery is finished, click Reload Metadata button on the Web UI to 
flush cache.
+
 ## Backup/restore metadata in development env 
 
 When developing/debugging Kylin, typically you have a dev machine with an IDE, 
and a backend sandbox. Usually you'll write code and run test cases at dev 
machine. It would be troublesome if you always have to put a binary package in 
the sandbox to check the metadata. There is a helper class called 
SandboxMetastoreCLI to help you download/upload metadata locally at your dev 
machine. Follow the Usage information and run it in your IDE.

Reply via email to