You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/05/06 07:23:02 UTC

[incubator-doris] branch master updated: [doc]Add binlog to load and import the doris table and the original table … (#9317)

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

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 86b7717fe2 [doc]Add binlog to load and import the doris table and the original table … (#9317)
86b7717fe2 is described below

commit 86b7717fe272e08caa197ba651b622fb9f790cc4
Author: caoliang-web <71...@users.noreply.github.com>
AuthorDate: Fri May 6 15:22:55 2022 +0800

    [doc]Add binlog to load and import the doris table and the original table … (#9317)
---
 .../import/import-way/binlog-load-manual.md        | 51 ++++++++++++++++++----
 .../import/import-way/binlog-load-manual.md        | 47 +++++++++++++++++---
 2 files changed, 84 insertions(+), 14 deletions(-)

diff --git a/docs/en/data-operate/import/import-way/binlog-load-manual.md b/docs/en/data-operate/import/import-way/binlog-load-manual.md
index a5b46077f9..e274c75d30 100644
--- a/docs/en/data-operate/import/import-way/binlog-load-manual.md
+++ b/docs/en/data-operate/import/import-way/binlog-load-manual.md
@@ -338,7 +338,7 @@ Like the slave node in mysql, Canal Server also needs to save the latest consump
 
 ### Configure Target Table Properties
 
-User needs to first create the target table which is corresponding to the MySQL side.
+User needs to first create the target table which is corresponding to the MySQL side
 
 Binlog Load can only support unique target tables from now, and the batch delete feature of the target table must be activated.
 
@@ -346,24 +346,59 @@ For the method of enabling Batch Delete, please refer to the batch delete functi
 
 Example:
 
-```
--- create target table
-CREATE TABLE `test1` (
-  `a` int(11) NOT NULL COMMENT "",
-  `b` int(11) NOT NULL COMMENT ""
+```text
+--create Mysql table
+CREATE TABLE `demo.source_test` (
+  `id` int(11) NOT NULL COMMENT "",
+  `name` int(11) NOT NULL COMMENT ""
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+
+
+-- create Doris table
+CREATE TABLE `target_test` (
+  `id` int(11) NOT NULL COMMENT "",
+  `name` int(11) NOT NULL COMMENT ""
 ) ENGINE=OLAP
-UNIQUE KEY(`a`)
+UNIQUE KEY(`id`)
 COMMENT "OLAP"
-DISTRIBUTED BY HASH(`a`) BUCKETS 8;
+DISTRIBUTED BY HASH(`id`) BUCKETS 8;
 
 -- enable batch delete
 ALTER TABLE canal_test.test1 ENABLE FEATURE "BATCH_DELETE";
 ```
+**! !  Doris table structure and Mysql table structure field order must be consistent ! !**
 
 ### Create SyncJob
 
+```text
+CREATE SYNC `demo`.`job`
+(
+FROM `demo`.`source_test1` INTO `target_test`
+(id,name)
+)
+FROM BINLOG
+(
+"type" = "canal",
+"canal.server.ip" = "127.0.0.1",
+"canal.server.port" = "11111",
+"canal.destination" = "xxx",
+"canal.username" = "canal",
+"canal.password" = "canal"
+);
+```
+
 The detailed syntax for creating a data synchronization job can be connected to Doris and [CREATE SYNC JOB](../../../sql-manual/sql-reference/Data-Manipulation-Statements/Load/CREATE-SYNC-JOB.html) to view the syntax help. Here is a detailed introduction to the precautions when creating a job.
 
+grammar:
+```
+CREATE SYNC [db.]job_name
+ (
+        channel_desc, 
+        channel_desc
+        ...
+ )
+binlog_desc
+```
 * job_name
 
 	`job_Name` is the unique identifier of the SyncJob in the current database. With a specified job name, only one SyncJob can be running at the same time.
diff --git a/docs/zh-CN/data-operate/import/import-way/binlog-load-manual.md b/docs/zh-CN/data-operate/import/import-way/binlog-load-manual.md
index 7694a22163..c35b6d32f3 100644
--- a/docs/zh-CN/data-operate/import/import-way/binlog-load-manual.md
+++ b/docs/zh-CN/data-operate/import/import-way/binlog-load-manual.md
@@ -342,23 +342,58 @@ Binlog Load只能支持Unique类型的目标表,且必须激活目标表的Bat
 示例:
 
 ```text
--- create target table
-CREATE TABLE `test1` (
-  `a` int(11) NOT NULL COMMENT "",
-  `b` int(11) NOT NULL COMMENT ""
+--create Mysql table
+CREATE TABLE `demo.source_test` (
+  `id` int(11) NOT NULL COMMENT "",
+  `name` int(11) NOT NULL COMMENT ""
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
+
+
+-- create Doris table
+CREATE TABLE `target_test` (
+  `id` int(11) NOT NULL COMMENT "",
+  `name` int(11) NOT NULL COMMENT ""
 ) ENGINE=OLAP
-UNIQUE KEY(`a`)
+UNIQUE KEY(`id`)
 COMMENT "OLAP"
-DISTRIBUTED BY HASH(`a`) BUCKETS 8;
+DISTRIBUTED BY HASH(`id`) BUCKETS 8;
 
 -- enable batch delete
 ALTER TABLE canal_test.test1 ENABLE FEATURE "BATCH_DELETE";
 ```
+**!!Doris表结构和Mysql表结构字段顺序必须保持一致!!**
 
 ### 创建同步作业
 
+```text
+CREATE SYNC `demo`.`job`
+(
+FROM `demo`.`source_test1` INTO `target_test`
+(id,name)
+)
+FROM BINLOG
+(
+"type" = "canal",
+"canal.server.ip" = "127.0.0.1",
+"canal.server.port" = "11111",
+"canal.destination" = "xxx",
+"canal.username" = "canal",
+"canal.password" = "canal"
+);
+```
+
 创建数据同步作业的的详细语法可以连接到 Doris 后,[CREATE SYNC JOB](../../../sql-manual/sql-reference/Data-Manipulation-Statements/Load/CREATE-SYNC-JOB.html) 查看语法帮助。这里主要详细介绍,创建作业时的注意事项。
 
+语法:
+```
+CREATE SYNC [db.]job_name
+ (
+        channel_desc, 
+        channel_desc
+        ...
+ )
+binlog_desc
+```
 - job_name
 
   `job_name`是数据同步作业在当前数据库内的唯一标识,相同`job_name`的作业只能有一个在运行。


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org