NoPr commented on issue #6794:
URL: https://github.com/apache/seatunnel/issues/6794#issuecomment-2227185988
> ### 讨论于#6793
> 最初由**pppeace**于2024 年 5 月 4 日发布 当我使用 rest-api
提交作业(mysql2mysql,一个简单的作业)时,它失败了。响应是`{"status":"fail","message":"null"}`
>
> 以下是我执行的步骤
>
> ```
> -- mysql 准备数据表
> mysql -h xxx -uroot -proot
>
> mysql> use test;
>
> mysql> create table st_src(id int, name varchar(255));
> Query OK, 0 rows affected (0.32 sec)
>
> mysql> create table st_sink like st_src;
> Query OK, 0 rows affected (0.25 sec)
>
> mysql> insert into st_src values(1, 'A');
> Query OK, 1 row affected (0.03 sec)
>
> mysql> insert into st_src values(2, 'B');
> Query OK, 1 row affected (0.09 sec)
>
> mysql> insert into st_src values(3, 'C');
> Query OK, 1 row affected (0.03 sec)
>
>
================================================================================================================================================================================================================================================
> -- seatunnel version: 2.3.3
> -- seatunnel api.conf
>
> # Set the basic configuration of the task to be performed
> env {
> execution.parallelism = 1
> job.mode = "BATCH"
> }
>
> source {
> Jdbc {
> url = "jdbc:mysql://xxx:3306/test"
> driver = "com.mysql.cj.jdbc.Driver"
> user = "root"
> password = "root"
> query = "select * from st_src"
> }
> }
>
> sink {
> Jdbc {
> url = "jdbc:mysql://xxx:3306/test"
> driver = "com.mysql.cj.jdbc.Driver"
> user = "root"
> password = "root"
> database = "test"
> table = "st_sink"
> query = "insert into st_sink values(?,?)"
> }
> }
>
>
================================================================================================================================================================================================================================================
> -- 启动集群
> ./bin/seatunnel-cluster.sh -d
>
> -- 查看集群服务
> jps | grep SeaTunnelServer
>
> -- 集群模式提交任务
> ./bin/seatunnel.sh --config config/api.conf
>
> ***********************************************
> Job Statistic Information
> ***********************************************
> Start Time : 2024-05-04 20:14:00
> End Time : 2024-05-04 20:14:04
> Total Time(s) : 3
> Total Read Count : 3
> Total Write Count : 3
> Total Failed Count : 0
> ***********************************************
>
> -- 这里可以确认 seatunnel cluster 配置和任务 conf 都没有问题
>
>
================================================================================================================================================================================================================================================
>
> -- Rest-api
> ---- 获取所有运行中任务(成功,空列表)
> curl -X GET http://localhost:5801/hazelcast/rest/maps/running-jobs
>
> ---- 获取所有已完成任务(无信息,未报错)
> curl -X GET http://localhost:5801/hazelcast/rest/maps/finished-jobs/
>
> ---- 获取系统监控指标信息(成功)
> curl -X GET
http://localhost:5801/hazelcast/rest/maps/system-monitoring-information | jq
>
> ---- 提交任务
> curl -X POST http://localhost:5801/hazelcast/rest/maps/submit-job \
> -H "Content-Type: application/json" \
> --data '{
> "env":{
> "job.mode":"batch"
> },
> "source":[
> {
> "plugin_name":"Jdbc",
> "url":"jdbc:mysql://xxx:3306/test",
> "driver":"com.mysql.cj.jdbc.Driver",
> "user":"root",
> "password":"root",
> "query":"select * from st_src"
> }
> ],
> "transform":[
>
> ],
> "sink":[
> {
> "plugin_name":"Jdbc",
> "url":"jdbc:mysql://xxx:3306/test",
> "driver":"com.mysql.cj.jdbc.Driver",
> "user":"root",
> "password":"root",
> "database":"test",
> "table":"st_sink",
> "query":"insert into st_sink values(?,?)"
> }
> ]
> }'
>
> ---- response
> {"status":"fail","message":"null"}
> ```
>
> 我也尝试查找日志以获取更多信息,但 ${SEATUNNEL_HOME}/logs/seatunnel-engine-server.log
中没有任何内容(只有一些“作业信息详情”,似乎是循环的)。
>
> 有人可以帮忙吗?非常感谢。
我给你一个成功的
{
"env": {
"parallelism": 1,
"job.mode": "BATCH"
},
"source": [
{
"plugin_name": "jdbc",
"result_table_name": "fake_1810212286042378240_fa",
"driver": "com.mysql.cj.jdbc.Driver",
"url":
"jdbc:mysql://192.168.4.53:3306/data_collection?serverTimezone=GMT%2b8",
"query": "select col1 from time_test_2 ",
"user": "root",
"password": "root@123"
}
],
"transform": [
{
"plugin_name": "Sql",
"result_table_name": "fake1_1810212286042378240_fa",
"source_table_name": "fake_1810212286042378240_fa",
"query " : "select col1 from fake_1810212286042378240_fa where
col1 > TO_DATE('2024-07-12 00:45:06','yyyy-MM-dd HH:mm:ss')"
},
{
"plugin_name": "Copy",
"result_table_name": "fake2_1810212286042378240_fa",
"source_table_name": "fake1_1810212286042378240_fa",
"fields": {
"col1": "col1"
}
}
],
"sink": [
{
"plugin_name": "hive",
"source_table_name": "fake2_1810212286042378240_fa",
"table_name": "seatunnel.time_test_2",
"metastore_uri": "thrift://192.168.4.52:9083"
}
]
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]