打開菜單任務管理頁面,選擇添加任務mysql
按下圖中5個步驟進行配置git
1.-D是DataX參數的標識符,必配 2.-D後面的lastTime和currentTime是DataX json中where條件的時間字段標識符,必須和json中的變量名稱保持一致 3.='%s'是項目用來去替換時間的佔位符,比配而且格式要徹底一致 4.注意-DlastTime='%s'和-DcurrentTime='%s'中間有一個空格,空格必須保留而且是一個空格
注意,注意,注意: 配置必定要仔細看文檔(後面咱們也會對這塊配置進行優化,避免你們犯錯)github
datax.jsonweb
{ "job": { "setting": { "speed": { "channel": 16 } }, "content": [ { "reader": { "name": "mysqlreader", "parameter": { "splitPk": "id", "username": "root", "password": "root", "column": [ "*" ], "connection": [ { "jdbcUrl": [ "jdbc:mysql://localhost:3306/test?characterEncoding=utf8" ], "querySql": [ "select * from test_list where operationDate >= FROM_UNIXTIME(${lastTime}) and operationDate < FROM_UNIXTIME(${currentTime})" ] } ] } }, "writer": { "name": "mysqlwriter", "parameter": { "username": "root", "password": "123456", "column": [ "*" ], "batchSize": "4096", "connection": [ { "jdbcUrl": "jdbc:mysql://localhost:3307/test?characterEncoding=utf8", "table": [ "test_list" ] } ] } } } ] } }
select * from test_list where operationDate >= ${lastTime} and operationDate < ${currentTime}
-DlastTime='%s' -DcurrentTime='%s'中的lastTime,currentTime,注意字段必定要一致。sql
select * from test_list where operationDate >= FROM_UNIXTIME(${lastTime}) and operationDate < FROM_UNIXTIME(${currentTime})
打開菜單任務管理頁面,選擇添加任務數據庫
按下圖中4個步驟進行配置json
1.-D是DataX參數的標識符,必配 2.-D後面的startId和endId是DataX json中where條件的id字段標識符,必須和json中的變量名稱保持一致 3.='%s'是項目用來去替換時間的佔位符,比配而且格式要徹底一致 4.注意-DstartId='%s'和-DendId='%s' 中間有一個空格,空格必須保留而且是一個空格 5.reader數據源,選擇任務同步的讀數據源 6.配置reader數據源中須要同步數據的表名及該表的主鍵
注意,注意,注意: 必定要仔細看文檔(後續會對這塊配置進行優化,避免你們犯錯)函數
datax.json優化
{ "job": { "setting": { "speed": { "channel": 3, "byte": 1048576 }, "errorLimit": { "record": 0, "percentage": 0.02 } }, "content": [ { "reader": { "name": "mysqlreader", "parameter": { "username": "yRjwDFuoPKlqya9h9H2Amg==", "password": "yRjwDFuoPKlqya9h9H2Amg==", "splitPk": "", "connection": [ { "querySql": [ "select * from job_log where id>= ${startId} and id< ${endId}" ], "jdbcUrl": [ "jdbc:mysql://localhost:3306/datax_web" ] } ] } }, "writer": { "name": "mysqlwriter", "parameter": { "username": "mCFD+p1IMsa0rHicbQohcA==", "password": "PhYxJmA/nuBJD1OxKTRzZH8sxuRddOv83hdqDOVR+i0=", "column": [ "`id`", "`job_group`", "`job_id`", "`job_desc`", "`executor_address`", "`executor_handler`", "`executor_param`", "`executor_sharding_param`", "`executor_fail_retry_count`", "`trigger_time`", "`trigger_code`", "`trigger_msg`", "`handle_time`", "`handle_code`", "`handle_msg`", "`alarm_status`", "`process_id`", "`max_id`" ], "connection": [ { "table": [ "job_log" ], "jdbcUrl": "jdbc:mysql://47.98.125.243:3306/datax_web" } ] } } } ] } }
select * from job_log where id>= ${startId} and id< ${endId}
-DstartId='%s' -DendId='%s'中的startId,endId,注意字段必定要一致。spa
此選擇爲非必選,能夠配置DataX啓動時JVM的參數,具體配置不作詳解。
請查看issue列表或者提issue說明問題,咱們會盡快回復。