This is an automated email from the ASF dual-hosted git repository.
wanghailin pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 708a72ce72 [Improve][Document] Update the guide and add example (#7388)
708a72ce72 is described below
commit 708a72ce727f6ac6771beebaf5ad59a926073623
Author: yujian <[email protected]>
AuthorDate: Thu Aug 22 12:03:30 2024 +0800
[Improve][Document] Update the guide and add example (#7388)
---
docs/en/connector-v2/source/Mysql.md | 5 --
docs/en/start-v2/locally/deployment.md | 12 +--
.../locally/quick-start-seatunnel-engine.md | 99 ++++++++++++++++++++++
docs/zh/start-v2/locally/deployment.md | 12 +--
.../locally/quick-start-seatunnel-engine.md | 98 +++++++++++++++++++++
5 files changed, 201 insertions(+), 25 deletions(-)
diff --git a/docs/en/connector-v2/source/Mysql.md
b/docs/en/connector-v2/source/Mysql.md
index 7766276d93..45a6bce18d 100644
--- a/docs/en/connector-v2/source/Mysql.md
+++ b/docs/en/connector-v2/source/Mysql.md
@@ -44,11 +44,6 @@ Read external data source data through JDBC.
|------------|----------------------------------------------------------|--------------------------|---------------------------------------|---------------------------------------------------------------------------|
| Mysql | Different dependency version has different driver class. |
com.mysql.cj.jdbc.Driver | jdbc:mysql://localhost:3306:3306/test |
[Download](https://mvnrepository.com/artifact/mysql/mysql-connector-java) |
-## Database Dependency
-
-> Please download the support list corresponding to 'Maven' and copy it to the
'$SEATNUNNEL_HOME/plugins/jdbc/lib/' working directory<br/>
-> For example Mysql datasource: cp mysql-connector-java-xxx.jar
$SEATNUNNEL_HOME/plugins/jdbc/lib/
-
## Data Type Mapping
| Mysql Data Type
|
SeaTunnel Data Type
|
diff --git a/docs/en/start-v2/locally/deployment.md
b/docs/en/start-v2/locally/deployment.md
index 740351101b..7940001b7f 100644
--- a/docs/en/start-v2/locally/deployment.md
+++ b/docs/en/start-v2/locally/deployment.md
@@ -27,7 +27,7 @@ tar -xzvf "apache-seatunnel-${version}-bin.tar.gz"
## Step 3: Download The Connector Plugins
-Starting from the 2.2.0-beta version, the binary package no longer provides
the connector dependencies by default. Therefore, when using it for the first
time, you need to execute the following command to install the connectors (Of
course, you can also manually download the connector from the [Apache Maven
Repository](https://repo.maven.apache.org/maven2/org/apache/seatunnel/), and
then move it to the `connectors/seatunnel` directory) :
+Starting from version 2.2.0-beta, the binary package no longer provides
connector dependencies by default. Therefore, the first time you use it, you
need to run the following command to install the connectors (Alternatively, you
can manually download the connectors from the [Apache Maven
Repository](https://repo.maven.apache.org/maven2/org/apache/seatunnel/) and
move them to the `connectors/` directory. For versions before 2.3.5, place them
in the `connectors/seatunnel` directory):
```bash
sh bin/install-plugin.sh
@@ -39,15 +39,7 @@ If you need a specific connector version, taking 2.3.8 as an
example, you need t
sh bin/install-plugin.sh 2.3.8
```
-Usually you don't need all connector plugins, so you can specify the plugins
you need through configuring `config/plugin_config`. For example, if you only
need the `connector-console` plugin, you can modify the plugin.properties
configuration file as follows:
-
-```plugin_config
---seatunnel-connectors--
-connector-console
---end--
-```
-
-If you want the example application to work properly, you need to add the
following plugins.
+Typically, you do not need all the connector plugins. You can specify the
required plugins by configuring `config/plugin_config`. For example, if you
want the sample application to work properly, you will need the
`connector-console` and `connector-fake` plugins. You can modify the
`plugin_config` configuration file as follows:
```plugin_config
--seatunnel-connectors--
diff --git a/docs/en/start-v2/locally/quick-start-seatunnel-engine.md
b/docs/en/start-v2/locally/quick-start-seatunnel-engine.md
index f7b42dacd5..eb7d74506c 100644
--- a/docs/en/start-v2/locally/quick-start-seatunnel-engine.md
+++ b/docs/en/start-v2/locally/quick-start-seatunnel-engine.md
@@ -94,6 +94,105 @@ The SeaTunnel console will print some logs as below:
2022-12-19 11:01:46,491 INFO
org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter -
subtaskIndex=0 rowIndex=16: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT:
mIJDt, 995616438
```
+## Extended Example: Batch Mode from MySQL to Doris
+
+## Step 1: Download the Connector
+
+First, you need to add the connector name to the
`${SEATUNNEL_HOME}/config/plugin_config` file. Then, execute the command to
install the connector (of course, you can also manually download the connector
from the [Apache Maven
Repository](https://repo.maven.apache.org/maven2/org/apache/seatunnel/) and
move it to the `connectors/` directory). Finally, make sure that the
`connector-jdbc` and `connector-doris` connectors are in the
`${SEATUNNEL_HOME}/connectors/` directory.
+
+```bash
+# Configure the connector name.
+--seatunnel-connectors--
+connector-jdbc
+connector-doris
+--end--
+```
+
+```bash
+# Install the connector.
+sh bin/install-plugin.sh
+```
+
+## Step 2: Place the MySQL Driver
+
+You need to download the [JDBC driver JAR
package](https://mvnrepository.com/artifact/mysql/mysql-connector-java) and
place it in the `${SEATUNNEL_HOME}/lib/` directory.
+
+## Step 3: Add Job Configuration File to Define the Job
+
+```bash
+cd seatunnel/job/
+
+vim st.conf
+
+env {
+ parallelism = 2
+ job.mode = "BATCH"
+}
+source {
+ Jdbc {
+ url = "jdbc:mysql://localhost:3306/test"
+ driver = "com.mysql.cj.jdbc.Driver"
+ connection_check_timeout_sec = 100
+ user = "user"
+ password = "pwd"
+ table_path = "test.table_name"
+ query = "select * from test.table_name"
+ }
+}
+
+sink {
+ Doris {
+ fenodes = "doris_ip:8030"
+ username = "user"
+ password = "pwd"
+ database = "test_db"
+ table = "table_name"
+ sink.enable-2pc = "true"
+ sink.label-prefix = "test-cdc"
+ doris.config = {
+ format = "json"
+ read_json_by_line="true"
+ }
+ }
+}
+```
+
+For more information about the configuration, please refer to [Basic Concepts
of Configuration](../../concept/config.md).
+
+## Step 4: Run the SeaTunnel Application
+
+You can start the application using the following command:
+
+```shell
+cd seatunnel/
+./bin/seatunnel.sh --config ./job/st.conf -m local
+
+```
+
+**Check the Output**: When you run the command, you can see its output in the
console. You can consider this as an indicator of whether the command has
succeeded or failed.
+
+The SeaTunnel console will print some log information like the following:
+
+```shell
+***********************************************
+ Job Statistic Information
+***********************************************
+Start Time : 2024-08-13 10:21:49
+End Time : 2024-08-13 10:21:53
+Total Time(s) : 4
+Total Read Count : 1000
+Total Write Count : 1000
+Total Failed Count : 0
+***********************************************
+```
+
+:::tip
+
+If you want to optimize your job, refer to the connector documentation for
[Source-MySQL](../../connector-v2/source/Mysql.md) and
[Sink-Doris](../../connector-v2/sink/Doris.md).
+
+:::
+
+
## What's More
- Start write your own config file now, choose the
[connector](../../connector-v2/source) you want to use, and configure the
parameters according to the connector's documentation.
diff --git a/docs/zh/start-v2/locally/deployment.md
b/docs/zh/start-v2/locally/deployment.md
index 46481fd8d7..a21612570e 100644
--- a/docs/zh/start-v2/locally/deployment.md
+++ b/docs/zh/start-v2/locally/deployment.md
@@ -27,7 +27,7 @@ tar -xzvf "apache-seatunnel-${version}-bin.tar.gz"
## 步骤 3: 下载连接器插件
-从2.2.0-beta版本开始,二进制包不再默认提供连接器依赖,因此在第一次使用时,您需要执行以下命令来安装连接器:(当然,您也可以从 [Apache
Maven Repository](https://repo.maven.apache.org/maven2/org/apache/seatunnel/)
手动下载连接器,然后将其移动至`connectors/seatunnel`目录下)。
+从2.2.0-beta版本开始,二进制包不再默认提供连接器依赖,因此在第一次使用时,您需要执行以下命令来安装连接器:(当然,您也可以从 [Apache
Maven Repository](https://repo.maven.apache.org/maven2/org/apache/seatunnel/)
手动下载连接器,然后将其移动至`connectors/`目录下,如果是2.3.5之前则需要放入`connectors/seatunnel`目录下)。
```bash
sh bin/install-plugin.sh
@@ -39,15 +39,7 @@ sh bin/install-plugin.sh
sh bin/install-plugin.sh 2.3.8
```
-通常您并不需要所有的连接器插件,可以通过配置`config/plugin_config`来指定您所需要的插件,例如,您只需要`connector-console`插件,那么您可以修改plugin.properties配置文件如下:
-
-```plugin_config
---seatunnel-connectors--
-connector-console
---end--
-```
-
-如果您希望示例应用程序能正常工作,那么您需要添加以下插件:
+通常情况下,你不需要所有的连接器插件。你可以通过配置`config/plugin_config`来指定所需的插件。例如,如果你想让示例应用程序正常工作,你将需要`connector-console`和`connector-fake`插件。你可以修改`plugin_config`配置文件,如下所示:
```plugin_config
--seatunnel-connectors--
diff --git a/docs/zh/start-v2/locally/quick-start-seatunnel-engine.md
b/docs/zh/start-v2/locally/quick-start-seatunnel-engine.md
index fd819e1ba9..515132c965 100644
--- a/docs/zh/start-v2/locally/quick-start-seatunnel-engine.md
+++ b/docs/zh/start-v2/locally/quick-start-seatunnel-engine.md
@@ -93,6 +93,104 @@ SeaTunnel控制台将会打印一些如下日志信息:
2022-12-19 11:01:46,491 INFO
org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter -
subtaskIndex=0 rowIndex=16: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT:
mIJDt, 995616438
```
+## 扩展示例:从 MySQL 到 Doris 批处理模式
+
+## 步骤1:下载连接器
+首先,您需要在`${SEATUNNEL_HOME}/config/plugin_config`文件中加入连接器名称,然后,执行命令来安装连接器(当然,您也可以从
[Apache Maven
Repository](https://repo.maven.apache.org/maven2/org/apache/seatunnel/)
手动下载连接器,然后将其移动至`connectors/`目录下),最后,确认连接器`connector-jdbc`、`connector-doris`在`${SEATUNNEL_HOME}/connectors/`目录下即可。
+
+```bash
+# 配置连接器名称
+--seatunnel-connectors--
+connector-jdbc
+connector-doris
+--end--
+```
+
+```bash
+# 安装连接器
+sh bin/install-plugin.sh
+```
+
+## 步骤2:放入 MySQL 驱动
+
+您需要下载 [jdbc driver jar
package](https://mvnrepository.com/artifact/mysql/mysql-connector-java) 驱动,并放置在
`${SEATUNNEL_HOME}/lib/`目录下
+
+## 步骤3:添加作业配置文件来定义作业
+
+```bash
+cd seatunnel/job/
+
+vim st.conf
+
+env {
+ parallelism = 2
+ job.mode = "BATCH"
+}
+source {
+ Jdbc {
+ url = "jdbc:mysql://localhost:3306/test"
+ driver = "com.mysql.cj.jdbc.Driver"
+ connection_check_timeout_sec = 100
+ user = "user"
+ password = "pwd"
+ table_path = "test.table_name"
+ query = "select * from test.table_name"
+ }
+}
+
+sink {
+ Doris {
+ fenodes = "doris_ip:8030"
+ username = "user"
+ password = "pwd"
+ database = "test_db"
+ table = "table_name"
+ sink.enable-2pc = "true"
+ sink.label-prefix = "test-cdc"
+ doris.config = {
+ format = "json"
+ read_json_by_line="true"
+ }
+ }
+}
+```
+
+关于配置的更多信息请查看[配置的基本概念](../../concept/config.md)
+
+## 步骤 4: 运行SeaTunnel应用程序
+
+您可以通过以下命令启动应用程序:
+
+```shell
+cd seatunnel/
+./bin/seatunnel.sh --config ./job/st.conf -m local
+
+```
+
+**查看输出**: 当您运行该命令时,您可以在控制台中看到它的输出。您可以认为这是命令运行成功或失败的标志。
+
+SeaTunnel控制台将会打印一些如下日志信息:
+
+```shell
+***********************************************
+ Job Statistic Information
+***********************************************
+Start Time : 2024-08-13 10:21:49
+End Time : 2024-08-13 10:21:53
+Total Time(s) : 4
+Total Read Count : 1000
+Total Write Count : 1000
+Total Failed Count : 0
+***********************************************
+```
+
+:::tip
+
+如果您想优化自己的作业,请参照连接器使用文档
+
+:::
+
+
## 此外
- 开始编写您自己的配置文件,选择您想要使用的[连接器](../../connector-v2/source),并根据连接器的文档配置参数。