Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
3c0dae5e
Unverified
Commit
3c0dae5e
authored
Dec 03, 2022
by
aiwenmo
Committed by
GitHub
Dec 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature-1364][admin,flink] Add local environment with web UI (#1365)
Co-authored-by:
wenmo
<
32723967+wenmo@users.noreply.github.com
>
parent
635e4fae
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
152 additions
and
42 deletions
+152
-42
Job2MysqlHandler.java
...k-admin/src/main/java/com/dlink/job/Job2MysqlHandler.java
+14
-1
ClusterServiceImpl.java
.../main/java/com/dlink/service/impl/ClusterServiceImpl.java
+1
-2
JobHistoryServiceImpl.java
...in/java/com/dlink/service/impl/JobHistoryServiceImpl.java
+1
-1
TaskServiceImpl.java
...src/main/java/com/dlink/service/impl/TaskServiceImpl.java
+12
-3
MysqlCDCBuilder.java
...14/src/main/java/com/dlink/cdc/mysql/MysqlCDCBuilder.java
+25
-0
Asserts.java
dlink-common/src/main/java/com/dlink/assertion/Asserts.java
+4
-0
JobConfig.java
dlink-core/src/main/java/com/dlink/job/JobConfig.java
+36
-23
EnvironmentSetting.java
.../src/main/java/com/dlink/executor/EnvironmentSetting.java
+16
-7
LocalBatchExecutor.java
.../src/main/java/com/dlink/executor/LocalBatchExecutor.java
+6
-2
LocalStreamExecutor.java
...src/main/java/com/dlink/executor/LocalStreamExecutor.java
+6
-1
pom.xml
dlink-flink/dlink-flink-1.11/pom.xml
+5
-0
pom.xml
dlink-flink/dlink-flink-1.12/pom.xml
+6
-0
pom.xml
dlink-flink/dlink-flink-1.13/pom.xml
+5
-0
pom.xml
dlink-flink/dlink-flink-1.14/pom.xml
+5
-0
pom.xml
dlink-flink/dlink-flink-1.15/pom.xml
+5
-0
pom.xml
dlink-flink/dlink-flink-1.16/pom.xml
+5
-2
No files found.
dlink-admin/src/main/java/com/dlink/job/Job2MysqlHandler.java
View file @
3c0dae5e
...
@@ -142,6 +142,18 @@ public class Job2MysqlHandler implements JobHandler {
...
@@ -142,6 +142,18 @@ public class Job2MysqlHandler implements JobHandler {
if
(
Asserts
.
isNotNull
(
cluster
))
{
if
(
Asserts
.
isNotNull
(
cluster
))
{
clusterId
=
cluster
.
getId
();
clusterId
=
cluster
.
getId
();
}
}
}
else
if
(
GatewayType
.
LOCAL
.
equalsValue
(
job
.
getJobConfig
().
getType
())
&&
Asserts
.
isNotNullString
(
job
.
getJobManagerAddress
()))
{
cluster
=
clusterService
.
registersCluster
(
Cluster
.
autoRegistersCluster
(
job
.
getJobManagerAddress
(),
job
.
getJobId
(),
job
.
getJobConfig
().
getJobName
()
+
LocalDateTime
.
now
(),
job
.
getType
().
getLongValue
(),
null
,
taskId
));
if
(
Asserts
.
isNotNull
(
cluster
))
{
clusterId
=
cluster
.
getId
();
}
}
else
{
}
else
{
cluster
=
clusterService
.
getById
(
clusterId
);
cluster
=
clusterService
.
getById
(
clusterId
);
}
}
...
@@ -149,7 +161,8 @@ public class Job2MysqlHandler implements JobHandler {
...
@@ -149,7 +161,8 @@ public class Job2MysqlHandler implements JobHandler {
history
.
setClusterId
(
clusterId
);
history
.
setClusterId
(
clusterId
);
historyService
.
updateById
(
history
);
historyService
.
updateById
(
history
);
if
(
Asserts
.
isNullCollection
(
job
.
getJids
())
||
GatewayType
.
LOCAL
.
equalsValue
(
job
.
getJobConfig
().
getType
()))
{
if
(
Asserts
.
isNullCollection
(
job
.
getJids
())
||
(
GatewayType
.
LOCAL
.
equalsValue
(
job
.
getJobConfig
().
getType
())
&&
Asserts
.
isNullString
(
job
.
getJobManagerAddress
())))
{
return
true
;
return
true
;
}
}
...
...
dlink-admin/src/main/java/com/dlink/service/impl/ClusterServiceImpl.java
View file @
3c0dae5e
...
@@ -23,7 +23,6 @@ import com.dlink.assertion.Assert;
...
@@ -23,7 +23,6 @@ import com.dlink.assertion.Assert;
import
com.dlink.cluster.FlinkCluster
;
import
com.dlink.cluster.FlinkCluster
;
import
com.dlink.cluster.FlinkClusterInfo
;
import
com.dlink.cluster.FlinkClusterInfo
;
import
com.dlink.constant.FlinkConstant
;
import
com.dlink.constant.FlinkConstant
;
import
com.dlink.constant.NetConstant
;
import
com.dlink.db.service.impl.SuperServiceImpl
;
import
com.dlink.db.service.impl.SuperServiceImpl
;
import
com.dlink.mapper.ClusterMapper
;
import
com.dlink.mapper.ClusterMapper
;
import
com.dlink.model.Cluster
;
import
com.dlink.model.Cluster
;
...
@@ -86,7 +85,7 @@ public class ClusterServiceImpl extends SuperServiceImpl<ClusterMapper, Cluster>
...
@@ -86,7 +85,7 @@ public class ClusterServiceImpl extends SuperServiceImpl<ClusterMapper, Cluster>
try
{
try
{
InetAddress
inetAddress
=
InetAddress
.
getLocalHost
();
InetAddress
inetAddress
=
InetAddress
.
getLocalHost
();
if
(
inetAddress
!=
null
)
{
if
(
inetAddress
!=
null
)
{
return
inetAddress
.
getHostAddress
()
+
NetConstant
.
COLON
+
FlinkConstant
.
FLINK_REST_DEFAULT_PORT
;
return
inetAddress
.
getHostAddress
();
}
}
}
catch
(
UnknownHostException
e
)
{
}
catch
(
UnknownHostException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
dlink-admin/src/main/java/com/dlink/service/impl/JobHistoryServiceImpl.java
View file @
3c0dae5e
...
@@ -102,7 +102,7 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo
...
@@ -102,7 +102,7 @@ public class JobHistoryServiceImpl extends SuperServiceImpl<JobHistoryMapper, Jo
jobHistory
.
setId
(
id
);
jobHistory
.
setId
(
id
);
try
{
try
{
JsonNode
jobInfo
=
FlinkAPI
.
build
(
jobManagerHost
).
getJobInfo
(
jobId
);
JsonNode
jobInfo
=
FlinkAPI
.
build
(
jobManagerHost
).
getJobInfo
(
jobId
);
if
(
jobInfo
.
has
(
FlinkRestResultConstant
.
ERRORS
))
{
if
(
Asserts
.
isNull
(
jobInfo
)
||
jobInfo
.
has
(
FlinkRestResultConstant
.
ERRORS
))
{
final
JobHistory
dbHistory
=
getById
(
id
);
final
JobHistory
dbHistory
=
getById
(
id
);
if
(
Objects
.
nonNull
(
dbHistory
))
{
if
(
Objects
.
nonNull
(
dbHistory
))
{
jobHistory
=
dbHistory
;
jobHistory
=
dbHistory
;
...
...
dlink-admin/src/main/java/com/dlink/service/impl/TaskServiceImpl.java
View file @
3c0dae5e
...
@@ -229,7 +229,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
...
@@ -229,7 +229,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
// init UDF
// init UDF
udfService
.
init
(
task
.
getStatement
(),
config
);
udfService
.
init
(
task
.
getStatement
(),
config
);
loadDocker
(
id
,
config
.
getClusterConfigurationId
(),
config
.
getGatewayConfig
());
if
(
GatewayType
.
KUBERNETES_APPLICATION
.
equalsValue
(
config
.
getType
()))
{
loadDocker
(
id
,
config
.
getClusterConfigurationId
(),
config
.
getGatewayConfig
());
}
JobManager
jobManager
=
JobManager
.
build
(
config
);
JobManager
jobManager
=
JobManager
.
build
(
config
);
process
.
start
();
process
.
start
();
...
@@ -247,6 +249,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
...
@@ -247,6 +249,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
private
void
loadDocker
(
Integer
taskId
,
Integer
clusterConfigurationId
,
GatewayConfig
gatewayConfig
)
{
private
void
loadDocker
(
Integer
taskId
,
Integer
clusterConfigurationId
,
GatewayConfig
gatewayConfig
)
{
Map
dockerConfig
=
(
Map
)
clusterConfigurationService
.
getClusterConfigById
(
clusterConfigurationId
).
getConfig
()
Map
dockerConfig
=
(
Map
)
clusterConfigurationService
.
getClusterConfigById
(
clusterConfigurationId
).
getConfig
()
.
get
(
"dockerConfig"
);
.
get
(
"dockerConfig"
);
if
(
dockerConfig
==
null
)
{
return
;
}
String
params
=
SystemConfiguration
.
getInstances
().
getSqlSubmitJarParas
()
String
params
=
SystemConfiguration
.
getInstances
().
getSqlSubmitJarParas
()
+
buildParas
(
taskId
,
dockerConfig
.
getOrDefault
(
"dinky.remote.addr"
,
""
).
toString
());
+
buildParas
(
taskId
,
dockerConfig
.
getOrDefault
(
"dinky.remote.addr"
,
""
).
toString
());
...
@@ -535,6 +540,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
...
@@ -535,6 +540,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
@Override
@Override
public
JobStatus
checkJobStatus
(
JobInfoDetail
jobInfoDetail
)
{
public
JobStatus
checkJobStatus
(
JobInfoDetail
jobInfoDetail
)
{
JobConfig
jobConfig
=
new
JobConfig
();
JobConfig
jobConfig
=
new
JobConfig
();
if
(
Asserts
.
isNull
(
jobInfoDetail
.
getClusterConfiguration
()))
{
return
JobStatus
.
UNKNOWN
;
}
Map
<
String
,
Object
>
gatewayConfigMap
=
clusterConfigurationService
Map
<
String
,
Object
>
gatewayConfigMap
=
clusterConfigurationService
.
getGatewayConfig
(
jobInfoDetail
.
getClusterConfiguration
().
getId
());
.
getGatewayConfig
(
jobInfoDetail
.
getClusterConfiguration
().
getId
());
jobConfig
.
buildGatewayConfig
(
gatewayConfigMap
);
jobConfig
.
buildGatewayConfig
(
gatewayConfigMap
);
...
@@ -792,7 +800,6 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
...
@@ -792,7 +800,6 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
String
jobId
=
jobInstance
.
getJid
();
String
jobId
=
jobInstance
.
getJid
();
boolean
useGateway
=
false
;
boolean
useGateway
=
false
;
JobConfig
jobConfig
=
new
JobConfig
();
JobConfig
jobConfig
=
new
JobConfig
();
jobConfig
.
setAddress
(
cluster
.
getJobManagerHost
());
jobConfig
.
setType
(
cluster
.
getType
());
jobConfig
.
setType
(
cluster
.
getType
());
Task
task
=
this
.
getTaskInfoById
(
cluster
.
getTaskId
());
Task
task
=
this
.
getTaskInfoById
(
cluster
.
getTaskId
());
...
@@ -811,6 +818,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
...
@@ -811,6 +818,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
useGateway
=
true
;
useGateway
=
true
;
}
}
jobConfig
.
setTaskId
(
jobInstance
.
getTaskId
());
jobConfig
.
setTaskId
(
jobInstance
.
getTaskId
());
jobConfig
.
setAddress
(
cluster
.
getJobManagerHost
());
JobManager
jobManager
=
JobManager
.
build
(
jobConfig
);
JobManager
jobManager
=
JobManager
.
build
(
jobConfig
);
jobManager
.
setUseGateway
(
useGateway
);
jobManager
.
setUseGateway
(
useGateway
);
if
(
"canceljob"
.
equals
(
savePointType
))
{
if
(
"canceljob"
.
equals
(
savePointType
))
{
...
@@ -1287,7 +1295,8 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
...
@@ -1287,7 +1295,8 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
String
exceptionUrl
=
"http://"
+
jobManagerHost
+
"/#/job/"
+
jobInstance
.
getJid
()
+
"/exceptions"
;
String
exceptionUrl
=
"http://"
+
jobManagerHost
+
"/#/job/"
+
jobInstance
.
getJid
()
+
"/exceptions"
;
for
(
AlertInstance
alertInstance
:
alertGroup
.
getInstances
())
{
for
(
AlertInstance
alertInstance
:
alertGroup
.
getInstances
())
{
if
(
alertInstance
==
null
||
(
Asserts
.
isNotNull
(
alertInstance
.
getEnabled
())
&&
!
alertInstance
.
getEnabled
()))
{
if
(
alertInstance
==
null
||
(
Asserts
.
isNotNull
(
alertInstance
.
getEnabled
())
&&
!
alertInstance
.
getEnabled
()))
{
continue
;
continue
;
}
}
Map
<
String
,
String
>
map
=
JSONUtil
.
toMap
(
alertInstance
.
getParams
());
Map
<
String
,
String
>
map
=
JSONUtil
.
toMap
(
alertInstance
.
getParams
());
...
...
dlink-client/dlink-client-1.14/src/main/java/com/dlink/cdc/mysql/MysqlCDCBuilder.java
View file @
3c0dae5e
...
@@ -78,6 +78,11 @@ public class MysqlCDCBuilder extends AbstractCDCBuilder implements CDCBuilder {
...
@@ -78,6 +78,11 @@ public class MysqlCDCBuilder extends AbstractCDCBuilder implements CDCBuilder {
String
connectMaxRetries
=
config
.
getSource
().
get
(
"connect.max-retries"
);
String
connectMaxRetries
=
config
.
getSource
().
get
(
"connect.max-retries"
);
String
connectionPoolSize
=
config
.
getSource
().
get
(
"connection.pool.size"
);
String
connectionPoolSize
=
config
.
getSource
().
get
(
"connection.pool.size"
);
String
heartbeatInterval
=
config
.
getSource
().
get
(
"heartbeat.interval"
);
String
heartbeatInterval
=
config
.
getSource
().
get
(
"heartbeat.interval"
);
String
chunkSize
=
config
.
getSource
().
get
(
"scan.incremental.snapshot.chunk.size"
);
String
distributionFactorLower
=
config
.
getSource
().
get
(
"chunk-key.even-distribution.factor.upper-bound"
);
String
distributionFactorUpper
=
config
.
getSource
().
get
(
"chunk-key.even-distribution.factor.lower-bound"
);
String
scanNewlyAddedTableEnabled
=
config
.
getSource
().
get
(
"scan.newly-added-table.enabled"
);
String
schemaChanges
=
config
.
getSource
().
get
(
"schema.changes"
);
Properties
debeziumProperties
=
new
Properties
();
Properties
debeziumProperties
=
new
Properties
();
// 为部分转换添加默认值
// 为部分转换添加默认值
...
@@ -164,6 +169,26 @@ public class MysqlCDCBuilder extends AbstractCDCBuilder implements CDCBuilder {
...
@@ -164,6 +169,26 @@ public class MysqlCDCBuilder extends AbstractCDCBuilder implements CDCBuilder {
sourceBuilder
.
heartbeatInterval
(
Duration
.
ofMillis
(
Long
.
valueOf
(
heartbeatInterval
)));
sourceBuilder
.
heartbeatInterval
(
Duration
.
ofMillis
(
Long
.
valueOf
(
heartbeatInterval
)));
}
}
if
(
Asserts
.
isAllNotNullString
(
chunkSize
))
{
sourceBuilder
.
splitSize
(
Integer
.
parseInt
(
chunkSize
));
}
if
(
Asserts
.
isNotNullString
(
distributionFactorLower
))
{
sourceBuilder
.
distributionFactorLower
(
Double
.
valueOf
(
distributionFactorLower
));
}
if
(
Asserts
.
isNotNullString
(
distributionFactorUpper
))
{
sourceBuilder
.
distributionFactorUpper
(
Double
.
valueOf
(
distributionFactorUpper
));
}
if
(
Asserts
.
isEqualsIgnoreCase
(
scanNewlyAddedTableEnabled
,
"true"
))
{
sourceBuilder
.
scanNewlyAddedTableEnabled
(
true
);
}
if
(
Asserts
.
isEqualsIgnoreCase
(
schemaChanges
,
"true"
))
{
sourceBuilder
.
includeSchemaChanges
(
true
);
}
return
env
.
fromSource
(
sourceBuilder
.
build
(),
WatermarkStrategy
.
noWatermarks
(),
"MySQL CDC Source"
);
return
env
.
fromSource
(
sourceBuilder
.
build
(),
WatermarkStrategy
.
noWatermarks
(),
"MySQL CDC Source"
);
}
}
...
...
dlink-common/src/main/java/com/dlink/assertion/Asserts.java
View file @
3c0dae5e
...
@@ -45,6 +45,10 @@ public class Asserts {
...
@@ -45,6 +45,10 @@ public class Asserts {
return
object
==
null
;
return
object
==
null
;
}
}
public
static
boolean
isAllNotNull
(
Object
...
object
)
{
return
Arrays
.
stream
(
object
).
allMatch
(
Asserts:
:
isNotNull
);
}
public
static
boolean
isNullString
(
String
str
)
{
public
static
boolean
isNullString
(
String
str
)
{
return
isNull
(
str
)
||
str
.
isEmpty
();
return
isNull
(
str
)
||
str
.
isEmpty
();
}
}
...
...
dlink-core/src/main/java/com/dlink/job/JobConfig.java
View file @
3c0dae5e
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
package
com
.
dlink
.
job
;
package
com
.
dlink
.
job
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.constant.NetConstant
;
import
com.dlink.executor.ExecutorSetting
;
import
com.dlink.executor.ExecutorSetting
;
import
com.dlink.function.data.model.UDF
;
import
com.dlink.function.data.model.UDF
;
import
com.dlink.gateway.GatewayType
;
import
com.dlink.gateway.GatewayType
;
...
@@ -31,6 +32,7 @@ import com.dlink.gateway.config.SavePointStrategy;
...
@@ -31,6 +32,7 @@ import com.dlink.gateway.config.SavePointStrategy;
import
com.dlink.session.SessionConfig
;
import
com.dlink.session.SessionConfig
;
import
org.apache.flink.configuration.CoreOptions
;
import
org.apache.flink.configuration.CoreOptions
;
import
org.apache.flink.configuration.RestOptions
;
import
org.apache.http.util.TextUtils
;
import
org.apache.http.util.TextUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -85,8 +87,17 @@ public class JobConfig {
...
@@ -85,8 +87,17 @@ public class JobConfig {
public
JobConfig
()
{
public
JobConfig
()
{
}
}
public
void
setAddress
(
String
address
)
{
if
(
GatewayType
.
LOCAL
.
equalsValue
(
type
)
&&
Asserts
.
isNotNull
(
config
)
&&
config
.
containsKey
(
RestOptions
.
PORT
.
key
()))
{
this
.
address
=
address
+
NetConstant
.
COLON
+
config
.
get
(
RestOptions
.
PORT
.
key
());
}
else
{
this
.
address
=
address
;
}
}
public
JobConfig
(
String
type
,
boolean
useSession
,
boolean
useRemote
,
boolean
useSqlFragment
,
public
JobConfig
(
String
type
,
boolean
useSession
,
boolean
useRemote
,
boolean
useSqlFragment
,
boolean
useStatementSet
,
Integer
parallelism
,
Map
<
String
,
String
>
config
)
{
boolean
useStatementSet
,
Integer
parallelism
,
Map
<
String
,
String
>
config
)
{
this
.
type
=
type
;
this
.
type
=
type
;
this
.
useSession
=
useSession
;
this
.
useSession
=
useSession
;
this
.
useRemote
=
useRemote
;
this
.
useRemote
=
useRemote
;
...
@@ -97,13 +108,13 @@ public class JobConfig {
...
@@ -97,13 +108,13 @@ public class JobConfig {
}
}
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useChangeLog
,
boolean
useAutoCancel
,
boolean
useSession
,
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useChangeLog
,
boolean
useAutoCancel
,
boolean
useSession
,
String
session
,
Integer
clusterId
,
String
session
,
Integer
clusterId
,
Integer
clusterConfigurationId
,
Integer
jarId
,
Integer
taskId
,
String
jobName
,
Integer
clusterConfigurationId
,
Integer
jarId
,
Integer
taskId
,
String
jobName
,
boolean
useSqlFragment
,
boolean
useSqlFragment
,
boolean
useStatementSet
,
boolean
useBatchModel
,
Integer
maxRowNum
,
Integer
checkpoint
,
boolean
useStatementSet
,
boolean
useBatchModel
,
Integer
maxRowNum
,
Integer
checkpoint
,
Integer
parallelism
,
Integer
parallelism
,
Integer
savePointStrategyValue
,
String
savePointPath
,
Map
<
String
,
String
>
variables
,
Integer
savePointStrategyValue
,
String
savePointPath
,
Map
<
String
,
String
>
variables
,
Map
<
String
,
String
>
config
)
{
Map
<
String
,
String
>
config
)
{
this
.
type
=
type
;
this
.
type
=
type
;
this
.
useResult
=
useResult
;
this
.
useResult
=
useResult
;
this
.
useChangeLog
=
useChangeLog
;
this
.
useChangeLog
=
useChangeLog
;
...
@@ -129,11 +140,11 @@ public class JobConfig {
...
@@ -129,11 +140,11 @@ public class JobConfig {
}
}
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useChangeLog
,
boolean
useAutoCancel
,
boolean
useSession
,
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useChangeLog
,
boolean
useAutoCancel
,
boolean
useSession
,
String
session
,
boolean
useRemote
,
String
address
,
String
session
,
boolean
useRemote
,
String
address
,
String
jobName
,
boolean
useSqlFragment
,
String
jobName
,
boolean
useSqlFragment
,
boolean
useStatementSet
,
Integer
maxRowNum
,
Integer
checkpoint
,
Integer
parallelism
,
boolean
useStatementSet
,
Integer
maxRowNum
,
Integer
checkpoint
,
Integer
parallelism
,
Integer
savePointStrategyValue
,
String
savePointPath
,
Map
<
String
,
String
>
config
,
Integer
savePointStrategyValue
,
String
savePointPath
,
Map
<
String
,
String
>
config
,
GatewayConfig
gatewayConfig
)
{
GatewayConfig
gatewayConfig
)
{
this
.
type
=
type
;
this
.
type
=
type
;
this
.
useResult
=
useResult
;
this
.
useResult
=
useResult
;
this
.
useChangeLog
=
useChangeLog
;
this
.
useChangeLog
=
useChangeLog
;
...
@@ -141,7 +152,6 @@ public class JobConfig {
...
@@ -141,7 +152,6 @@ public class JobConfig {
this
.
useSession
=
useSession
;
this
.
useSession
=
useSession
;
this
.
session
=
session
;
this
.
session
=
session
;
this
.
useRemote
=
useRemote
;
this
.
useRemote
=
useRemote
;
this
.
address
=
address
;
this
.
jobName
=
jobName
;
this
.
jobName
=
jobName
;
this
.
useSqlFragment
=
useSqlFragment
;
this
.
useSqlFragment
=
useSqlFragment
;
this
.
useStatementSet
=
useStatementSet
;
this
.
useStatementSet
=
useStatementSet
;
...
@@ -152,10 +162,11 @@ public class JobConfig {
...
@@ -152,10 +162,11 @@ public class JobConfig {
this
.
savePointPath
=
savePointPath
;
this
.
savePointPath
=
savePointPath
;
this
.
config
=
config
;
this
.
config
=
config
;
this
.
gatewayConfig
=
gatewayConfig
;
this
.
gatewayConfig
=
gatewayConfig
;
setAddress
(
address
);
}
}
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useSession
,
String
session
,
boolean
useRemote
,
public
JobConfig
(
String
type
,
boolean
useResult
,
boolean
useSession
,
String
session
,
boolean
useRemote
,
Integer
clusterId
,
Integer
maxRowNum
)
{
Integer
clusterId
,
Integer
maxRowNum
)
{
this
.
type
=
type
;
this
.
type
=
type
;
this
.
useResult
=
useResult
;
this
.
useResult
=
useResult
;
this
.
useSession
=
useSession
;
this
.
useSession
=
useSession
;
...
@@ -166,12 +177,12 @@ public class JobConfig {
...
@@ -166,12 +177,12 @@ public class JobConfig {
}
}
public
JobConfig
(
String
type
,
Integer
step
,
boolean
useResult
,
boolean
useSession
,
boolean
useRemote
,
public
JobConfig
(
String
type
,
Integer
step
,
boolean
useResult
,
boolean
useSession
,
boolean
useRemote
,
Integer
clusterId
,
Integer
clusterId
,
Integer
clusterConfigurationId
,
Integer
jarId
,
Integer
taskId
,
String
jobName
,
Integer
clusterConfigurationId
,
Integer
jarId
,
Integer
taskId
,
String
jobName
,
boolean
useSqlFragment
,
boolean
useSqlFragment
,
boolean
useStatementSet
,
boolean
useBatchModel
,
Integer
checkpoint
,
Integer
parallelism
,
boolean
useStatementSet
,
boolean
useBatchModel
,
Integer
checkpoint
,
Integer
parallelism
,
Integer
savePointStrategyValue
,
Integer
savePointStrategyValue
,
String
savePointPath
,
Map
<
String
,
String
>
config
)
{
String
savePointPath
,
Map
<
String
,
String
>
config
)
{
this
.
type
=
type
;
this
.
type
=
type
;
this
.
step
=
step
;
this
.
step
=
step
;
this
.
useResult
=
useResult
;
this
.
useResult
=
useResult
;
...
@@ -238,7 +249,8 @@ public class JobConfig {
...
@@ -238,7 +249,8 @@ public class JobConfig {
if
(
config
.
containsKey
(
"flinkConfig"
)
if
(
config
.
containsKey
(
"flinkConfig"
)
&&
Asserts
.
isNotNullMap
((
Map
<
String
,
String
>)
config
.
get
(
"flinkConfig"
)))
{
&&
Asserts
.
isNotNullMap
((
Map
<
String
,
String
>)
config
.
get
(
"flinkConfig"
)))
{
gatewayConfig
.
setFlinkConfig
(
FlinkConfig
.
build
((
Map
<
String
,
String
>)
config
.
get
(
"flinkConfig"
)));
gatewayConfig
.
setFlinkConfig
(
FlinkConfig
.
build
((
Map
<
String
,
String
>)
config
.
get
(
"flinkConfig"
)));
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
put
(
CoreOptions
.
DEFAULT_PARALLELISM
.
key
(),
String
.
valueOf
(
parallelism
));
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
put
(
CoreOptions
.
DEFAULT_PARALLELISM
.
key
(),
String
.
valueOf
(
parallelism
));
}
}
if
(
config
.
containsKey
(
"kubernetesConfig"
))
{
if
(
config
.
containsKey
(
"kubernetesConfig"
))
{
Map
<
String
,
String
>
kubernetesConfig
=
(
Map
<
String
,
String
>)
config
.
get
(
"kubernetesConfig"
);
Map
<
String
,
String
>
kubernetesConfig
=
(
Map
<
String
,
String
>)
config
.
get
(
"kubernetesConfig"
);
...
@@ -246,7 +258,8 @@ public class JobConfig {
...
@@ -246,7 +258,8 @@ public class JobConfig {
}
}
// at present only k8s task have this
// at present only k8s task have this
if
(
config
.
containsKey
(
"taskCustomConfig"
))
{
if
(
config
.
containsKey
(
"taskCustomConfig"
))
{
Map
<
String
,
Map
<
String
,
String
>>
taskCustomConfig
=
(
Map
<
String
,
Map
<
String
,
String
>>)
config
.
get
(
"taskCustomConfig"
);
Map
<
String
,
Map
<
String
,
String
>>
taskCustomConfig
=
(
Map
<
String
,
Map
<
String
,
String
>>)
config
.
get
(
"taskCustomConfig"
);
if
(
taskCustomConfig
.
containsKey
(
"kubernetesConfig"
))
{
if
(
taskCustomConfig
.
containsKey
(
"kubernetesConfig"
))
{
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
putAll
(
taskCustomConfig
.
get
(
"kubernetesConfig"
));
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
putAll
(
taskCustomConfig
.
get
(
"kubernetesConfig"
));
}
}
...
...
dlink-executor/src/main/java/com/dlink/executor/EnvironmentSetting.java
View file @
3c0dae5e
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
package
com
.
dlink
.
executor
;
package
com
.
dlink
.
executor
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.assertion.Asserts
;
import
com.dlink.constant.FlinkConstant
;
import
com.dlink.constant.NetConstant
;
import
com.dlink.constant.NetConstant
;
import
lombok.Getter
;
import
lombok.Getter
;
...
@@ -35,8 +34,9 @@ import lombok.Setter;
...
@@ -35,8 +34,9 @@ import lombok.Setter;
@Getter
@Getter
@Setter
@Setter
public
class
EnvironmentSetting
{
public
class
EnvironmentSetting
{
private
String
host
;
private
String
host
;
private
int
port
;
private
Integer
port
;
private
String
[]
jarFiles
;
private
String
[]
jarFiles
;
private
boolean
useRemote
;
private
boolean
useRemote
;
...
@@ -47,25 +47,34 @@ public class EnvironmentSetting {
...
@@ -47,25 +47,34 @@ public class EnvironmentSetting {
this
.
useRemote
=
useRemote
;
this
.
useRemote
=
useRemote
;
}
}
public
EnvironmentSetting
(
String
host
,
int
port
,
String
...
jarFiles
)
{
public
EnvironmentSetting
(
String
...
jarFiles
)
{
this
.
useRemote
=
false
;
this
.
jarFiles
=
jarFiles
;
}
public
EnvironmentSetting
(
String
host
,
Integer
port
,
String
...
jarFiles
)
{
this
.
host
=
host
;
this
.
host
=
host
;
this
.
port
=
port
;
this
.
port
=
port
;
this
.
useRemote
=
true
;
this
.
useRemote
=
true
;
this
.
jarFiles
=
jarFiles
;
this
.
jarFiles
=
jarFiles
;
}
}
public
static
EnvironmentSetting
build
(
String
address
,
String
...
jarFiles
)
{
public
static
EnvironmentSetting
build
(
String
address
,
String
...
jarFiles
)
{
Asserts
.
checkNull
(
address
,
"Flink 地址不能为空"
);
Asserts
.
checkNull
(
address
,
"Flink 地址不能为空"
);
String
[]
strs
=
address
.
split
(
NetConstant
.
COLON
);
String
[]
strs
=
address
.
split
(
NetConstant
.
COLON
);
if
(
strs
.
length
>=
2
)
{
if
(
strs
.
length
>=
2
)
{
return
new
EnvironmentSetting
(
strs
[
0
],
Integer
.
parseInt
(
strs
[
1
]),
jarFiles
);
return
new
EnvironmentSetting
(
strs
[
0
],
Integer
.
parseInt
(
strs
[
1
]),
jarFiles
);
}
else
{
}
else
{
return
new
EnvironmentSetting
(
strs
[
0
],
FlinkConstant
.
FLINK_REST_DEFAULT_PORT
,
jarFiles
);
return
new
EnvironmentSetting
(
jarFiles
);
}
}
}
}
public
String
getAddress
()
{
public
String
getAddress
()
{
return
host
+
NetConstant
.
COLON
+
port
;
if
(
Asserts
.
isAllNotNull
(
host
,
port
))
{
return
host
+
NetConstant
.
COLON
+
port
;
}
else
{
return
""
;
}
}
}
}
}
dlink-executor/src/main/java/com/dlink/executor/LocalBatchExecutor.java
View file @
3c0dae5e
...
@@ -22,6 +22,7 @@ package com.dlink.executor;
...
@@ -22,6 +22,7 @@ package com.dlink.executor;
import
com.dlink.assertion.Asserts
;
import
com.dlink.assertion.Asserts
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.RestOptions
;
import
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
;
import
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
;
/**
/**
...
@@ -36,8 +37,11 @@ public class LocalBatchExecutor extends Executor {
...
@@ -36,8 +37,11 @@ public class LocalBatchExecutor extends Executor {
this
.
executorSetting
=
executorSetting
;
this
.
executorSetting
=
executorSetting
;
if
(
Asserts
.
isNotNull
(
executorSetting
.
getConfig
()))
{
if
(
Asserts
.
isNotNull
(
executorSetting
.
getConfig
()))
{
Configuration
configuration
=
Configuration
.
fromMap
(
executorSetting
.
getConfig
());
Configuration
configuration
=
Configuration
.
fromMap
(
executorSetting
.
getConfig
());
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironment
(
configuration
);
if
(
configuration
.
contains
(
RestOptions
.
PORT
))
{
}
else
{
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironmentWithWebUI
(
configuration
);
}
else
{
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironment
(
configuration
);
}
}
else
{
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironment
();
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironment
();
}
}
init
();
init
();
...
...
dlink-executor/src/main/java/com/dlink/executor/LocalStreamExecutor.java
View file @
3c0dae5e
...
@@ -22,6 +22,7 @@ package com.dlink.executor;
...
@@ -22,6 +22,7 @@ package com.dlink.executor;
import
com.dlink.assertion.Asserts
;
import
com.dlink.assertion.Asserts
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.RestOptions
;
import
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
;
import
org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
;
/**
/**
...
@@ -36,7 +37,11 @@ public class LocalStreamExecutor extends Executor {
...
@@ -36,7 +37,11 @@ public class LocalStreamExecutor extends Executor {
this
.
executorSetting
=
executorSetting
;
this
.
executorSetting
=
executorSetting
;
if
(
Asserts
.
isNotNull
(
executorSetting
.
getConfig
()))
{
if
(
Asserts
.
isNotNull
(
executorSetting
.
getConfig
()))
{
Configuration
configuration
=
Configuration
.
fromMap
(
executorSetting
.
getConfig
());
Configuration
configuration
=
Configuration
.
fromMap
(
executorSetting
.
getConfig
());
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironment
(
configuration
);
if
(
configuration
.
contains
(
RestOptions
.
PORT
))
{
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironmentWithWebUI
(
configuration
);
}
else
{
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironment
(
configuration
);
}
}
else
{
}
else
{
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironment
();
this
.
environment
=
StreamExecutionEnvironment
.
createLocalEnvironment
();
}
}
...
...
dlink-flink/dlink-flink-1.11/pom.xml
View file @
3c0dae5e
...
@@ -126,6 +126,11 @@
...
@@ -126,6 +126,11 @@
<artifactId>
flink-connector-jdbc_${scala.binary.version}
</artifactId>
<artifactId>
flink-connector-jdbc_${scala.binary.version}
</artifactId>
<version>
${flink.version}
</version>
<version>
${flink.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-runtime-web_${scala.binary.version}
</artifactId>
<version>
${flink.version}
</version>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencyManagement>
<dependencies>
<dependencies>
...
...
dlink-flink/dlink-flink-1.12/pom.xml
View file @
3c0dae5e
...
@@ -126,6 +126,11 @@
...
@@ -126,6 +126,11 @@
<artifactId>
flink-connector-jdbc_${scala.binary.version}
</artifactId>
<artifactId>
flink-connector-jdbc_${scala.binary.version}
</artifactId>
<version>
${flink.version}
</version>
<version>
${flink.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-runtime-web_${scala.binary.version}
</artifactId>
<version>
${flink.version}
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
dlink-flink/dlink-flink-1.13/pom.xml
View file @
3c0dae5e
...
@@ -154,5 +154,10 @@
...
@@ -154,5 +154,10 @@
<artifactId>
flink-shaded-guava
</artifactId>
<artifactId>
flink-shaded-guava
</artifactId>
<version>
18.0-13.0
</version>
<version>
18.0-13.0
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-runtime-web_${scala.binary.version}
</artifactId>
<version>
${flink.version}
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
dlink-flink/dlink-flink-1.14/pom.xml
View file @
3c0dae5e
...
@@ -188,5 +188,10 @@
...
@@ -188,5 +188,10 @@
<artifactId>
flink-json
</artifactId>
<artifactId>
flink-json
</artifactId>
<version>
${flink.version}
</version>
<version>
${flink.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-runtime-web_${scala.binary.version}
</artifactId>
<version>
${flink.version}
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
dlink-flink/dlink-flink-1.15/pom.xml
View file @
3c0dae5e
...
@@ -163,6 +163,11 @@
...
@@ -163,6 +163,11 @@
<artifactId>
flink-doris-connector-1.14_2.12
</artifactId>
<artifactId>
flink-doris-connector-1.14_2.12
</artifactId>
<version>
1.1.0
</version>
<version>
1.1.0
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-runtime-web
</artifactId>
<version>
${flink.version}
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
dlink-flink/dlink-flink-1.16/pom.xml
View file @
3c0dae5e
...
@@ -144,6 +144,10 @@
...
@@ -144,6 +144,10 @@
<artifactId>
commons-cli
</artifactId>
<artifactId>
commons-cli
</artifactId>
<version>
${commons.version}
</version>
<version>
${commons.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-runtime-web
</artifactId>
<version>
${flink.version}
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment