mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-03 01:30:50 +08:00
invoke load driver in static block
This commit is contained in:
parent
3d35c22424
commit
3b7bf92edf
@ -16,8 +16,6 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class TDengineReader extends Reader {
|
public class TDengineReader extends Reader {
|
||||||
|
|
||||||
@ -239,32 +237,13 @@ public class TDengineReader extends Reader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Long parseSplitInterval(String splitInterval) throws Exception {
|
static {
|
||||||
final long second = 1000;
|
try {
|
||||||
final long minute = 60 * second;
|
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
||||||
final long hour = 60 * minute;
|
Class.forName("com.taosdata.jdbc.rs.RestfulDriver");
|
||||||
final long day = 24 * hour;
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
Pattern compile = Pattern.compile("^(\\d+)([dhms])$");
|
|
||||||
Matcher matcher = compile.matcher(splitInterval);
|
|
||||||
while (matcher.find()) {
|
|
||||||
long value = Long.parseLong(matcher.group(1));
|
|
||||||
if (value == 0)
|
|
||||||
throw new Exception("invalid splitInterval: 0");
|
|
||||||
char unit = matcher.group(2).charAt(0);
|
|
||||||
switch (unit) {
|
|
||||||
case 'd':
|
|
||||||
return value * day;
|
|
||||||
default:
|
|
||||||
case 'h':
|
|
||||||
return value * hour;
|
|
||||||
case 'm':
|
|
||||||
return value * minute;
|
|
||||||
case 's':
|
|
||||||
return value * second;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Exception("invalid splitInterval: " + splitInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"job": {
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"reader": {
|
||||||
|
"name": "tdenginereader",
|
||||||
|
"parameter": {
|
||||||
|
"username": "root",
|
||||||
|
"password": "taosdata",
|
||||||
|
"column": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"connection": [
|
||||||
|
{
|
||||||
|
"table": [
|
||||||
|
"stb1"
|
||||||
|
],
|
||||||
|
"jdbcUrl": "jdbc:TAOS://192.168.56.105:6030/db1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"writer": {
|
||||||
|
"name": "rdbmswriter",
|
||||||
|
"parameter": {
|
||||||
|
"connection": [
|
||||||
|
{
|
||||||
|
"table": [
|
||||||
|
"stb2"
|
||||||
|
],
|
||||||
|
"jdbcUrl": "jdbc:dm://192.168.0.72:5236"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"username": "TESTUSER",
|
||||||
|
"password": "test123456",
|
||||||
|
"table": "stb2",
|
||||||
|
"column": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"setting": {
|
||||||
|
"speed": {
|
||||||
|
"channel": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"job": {
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"reader": {
|
||||||
|
"name": "tdenginereader",
|
||||||
|
"parameter": {
|
||||||
|
"username": "root",
|
||||||
|
"password": "taosdata",
|
||||||
|
"column": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"connection": [
|
||||||
|
{
|
||||||
|
"table": [
|
||||||
|
"stb1"
|
||||||
|
],
|
||||||
|
"jdbcUrl": "jdbc:TAOS-RS://192.168.56.105:6041/db1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"writer": {
|
||||||
|
"name": "rdbmswriter",
|
||||||
|
"parameter": {
|
||||||
|
"connection": [
|
||||||
|
{
|
||||||
|
"table": [
|
||||||
|
"stb2"
|
||||||
|
],
|
||||||
|
"jdbcUrl": "jdbc:dm://192.168.0.72:5236"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"username": "TESTUSER",
|
||||||
|
"password": "test123456",
|
||||||
|
"table": "stb2",
|
||||||
|
"column": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"setting": {
|
||||||
|
"speed": {
|
||||||
|
"channel": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,3 +3,4 @@
|
|||||||
scp dm2t-update.json root@192.168.56.105:/root/workspace/tmp/datax/job
|
scp dm2t-update.json root@192.168.56.105:/root/workspace/tmp/datax/job
|
||||||
scp dm2t_sync.sh root@192.168.56.105:/root/workspace/tmp/datax
|
scp dm2t_sync.sh root@192.168.56.105:/root/workspace/tmp/datax
|
||||||
scp clean_env.sh root@192.168.56.105:/root/workspace/tmp/datax
|
scp clean_env.sh root@192.168.56.105:/root/workspace/tmp/datax
|
||||||
|
scp
|
Loading…
Reference in New Issue
Block a user