|
| 1 | +--- |
| 2 | + |
| 3 | +sidebar_position: 2 |
| 4 | +------------------- |
| 5 | + |
| 6 | +# SeaTunnel Engine快速开始 |
| 7 | + |
| 8 | +## 步骤 1: 部署SeaTunnel及连接器 |
| 9 | + |
| 10 | +在开始前,请确保您已经按照[部署](deployment.md)中的描述下载并部署了SeaTunnel |
| 11 | + |
| 12 | +## 步骤 2: 添加作业配置文件来定义作业 |
| 13 | + |
| 14 | +编辑`config/v2.batch.config.template`,它决定了当seatunnel启动后数据输入、处理和输出的方式及逻辑。 |
| 15 | +下面是配置文件的示例,它与上面提到的示例应用程序相同。 |
| 16 | + |
| 17 | +```hocon |
| 18 | +env { |
| 19 | + parallelism = 1 |
| 20 | + job.mode = "BATCH" |
| 21 | +} |
| 22 | +
|
| 23 | +source { |
| 24 | + FakeSource { |
| 25 | + result_table_name = "fake" |
| 26 | + row.num = 16 |
| 27 | + schema = { |
| 28 | + fields { |
| 29 | + name = "string" |
| 30 | + age = "int" |
| 31 | + } |
| 32 | + } |
| 33 | + } |
| 34 | +} |
| 35 | +
|
| 36 | +transform { |
| 37 | + FieldMapper { |
| 38 | + source_table_name = "fake" |
| 39 | + result_table_name = "fake1" |
| 40 | + field_mapper = { |
| 41 | + age = age |
| 42 | + name = new_name |
| 43 | + } |
| 44 | + } |
| 45 | +} |
| 46 | +
|
| 47 | +sink { |
| 48 | + Console { |
| 49 | + source_table_name = "fake1" |
| 50 | + } |
| 51 | +} |
| 52 | +
|
| 53 | +``` |
| 54 | + |
| 55 | +关于配置的更多信息请查看[配置的基本概念](../../../en/concept/config.md) |
| 56 | + |
| 57 | +## 步骤 3: 运行SeaTunnel应用程序 |
| 58 | + |
| 59 | +您可以通过以下命令启动应用程序 |
| 60 | + |
| 61 | +```shell |
| 62 | +cd "apache-seatunnel-${version}" |
| 63 | +./bin/seatunnel.sh --config ./config/v2.batch.config.template -e local |
| 64 | +
|
| 65 | +``` |
| 66 | + |
| 67 | +**查看输出**: 当您运行该命令时,您可以在控制台中看到它的输出。您可以认为这是命令运行成功或失败的标志。 |
| 68 | + |
| 69 | +SeaTunnel控制台将会打印一些如下日志信息: |
| 70 | + |
| 71 | +```shell |
| 72 | +2022-12-19 11:01:45,417 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - output rowType: name<STRING>, age<INT> |
| 73 | +2022-12-19 11:01:46,489 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=1: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: CpiOd, 8520946 |
| 74 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=2: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: eQqTs, 1256802974 |
| 75 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=3: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: UsRgO, 2053193072 |
| 76 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=4: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: jDQJj, 1993016602 |
| 77 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=5: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: rqdKp, 1392682764 |
| 78 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=6: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: wCoWN, 986999925 |
| 79 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=7: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: qomTU, 72775247 |
| 80 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=8: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: jcqXR, 1074529204 |
| 81 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=9: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: AkWIO, 1961723427 |
| 82 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=10: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: hBoib, 929089763 |
| 83 | +2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=11: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: GSvzm, 827085798 |
| 84 | +2022-12-19 11:01:46,491 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=12: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: NNAYI, 94307133 |
| 85 | +2022-12-19 11:01:46,491 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=13: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: EexFl, 1823689599 |
| 86 | +2022-12-19 11:01:46,491 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=14: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: CBXUb, 869582787 |
| 87 | +2022-12-19 11:01:46,491 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=15: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: Wbxtm, 1469371353 |
| 88 | +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 |
| 89 | +``` |
| 90 | + |
| 91 | +## 此外 |
| 92 | + |
| 93 | +现在,您已经快速浏览了SeaTunnel,你可以通过[连接器](../../../en/connector-v2/source/FakeSource.md)来找到SeaTunnel所支持的所有source和sink。 |
| 94 | +如果您想要了解更多关于信息,请参阅[SeaTunnel引擎](../../../en/seatunnel-engine/about.md). |
| 95 | + |
| 96 | +SeaTunnel还支持在Spark/Flink中运行作业。您可以查看[Spark快速开始](../../../en/start-v2/locally/quick-start-spark.md)或[Flink快速开始](../../../en/start-v2/locally/quick-start-flink.md)。 |
0 commit comments