Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
淡淡忧伤的程序员
DolphinScheduler
提交
7f4c4936
DolphinScheduler
项目概览
淡淡忧伤的程序员
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
48
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
7f4c4936
编写于
5月 23, 2019
作者:
journey2018
提交者:
GitHub
5月 23, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #342 from qiaozhanwei/branch-1.0.2
master startup lock dev
上级
e689fb7b
2d617b56
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
11 deletion
+51
-11
escheduler-common/src/main/java/cn/escheduler/common/Constants.java
...-common/src/main/java/cn/escheduler/common/Constants.java
+5
-0
escheduler-common/src/main/resources/zookeeper.properties
escheduler-common/src/main/resources/zookeeper.properties
+1
-0
escheduler-server/src/main/java/cn/escheduler/server/zk/ZKMasterClient.java
...src/main/java/cn/escheduler/server/zk/ZKMasterClient.java
+45
-11
未找到文件。
escheduler-common/src/main/java/cn/escheduler/common/Constants.java
浏览文件 @
7f4c4936
...
@@ -162,6 +162,11 @@ public final class Constants {
...
@@ -162,6 +162,11 @@ public final class Constants {
*/
*/
public
static
final
String
ZOOKEEPER_ESCHEDULER_LOCK_FAILOVER_WORKERS
=
"zookeeper.escheduler.lock.failover.workers"
;
public
static
final
String
ZOOKEEPER_ESCHEDULER_LOCK_FAILOVER_WORKERS
=
"zookeeper.escheduler.lock.failover.workers"
;
/**
* MasterServer startup failover runing and fault tolerance process
*/
public
static
final
String
ZOOKEEPER_ESCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS
=
"zookeeper.escheduler.lock.failover.startup.masters"
;
/**
/**
* need send warn times when master server or worker server failover
* need send warn times when master server or worker server failover
*/
*/
...
...
escheduler-common/src/main/resources/zookeeper.properties
浏览文件 @
7f4c4936
...
@@ -16,6 +16,7 @@ zookeeper.escheduler.lock.workers=/escheduler/lock/workers
...
@@ -16,6 +16,7 @@ zookeeper.escheduler.lock.workers=/escheduler/lock/workers
#escheduler failover directory
#escheduler failover directory
zookeeper.escheduler.lock.failover.masters
=
/escheduler/lock/failover/masters
zookeeper.escheduler.lock.failover.masters
=
/escheduler/lock/failover/masters
zookeeper.escheduler.lock.failover.workers
=
/escheduler/lock/failover/workers
zookeeper.escheduler.lock.failover.workers
=
/escheduler/lock/failover/workers
zookeeper.escheduler.lock.failover.startup.masters
=
/escheduler/lock/failover/startup-masters
#escheduler failover directory
#escheduler failover directory
zookeeper.session.timeout
=
300
zookeeper.session.timeout
=
300
...
...
escheduler-server/src/main/java/cn/escheduler/server/zk/ZKMasterClient.java
浏览文件 @
7f4c4936
...
@@ -31,6 +31,7 @@ import cn.escheduler.dao.model.TaskInstance;
...
@@ -31,6 +31,7 @@ import cn.escheduler.dao.model.TaskInstance;
import
cn.escheduler.server.ResInfo
;
import
cn.escheduler.server.ResInfo
;
import
cn.escheduler.server.utils.ProcessUtils
;
import
cn.escheduler.server.utils.ProcessUtils
;
import
org.apache.curator.framework.CuratorFramework
;
import
org.apache.curator.framework.CuratorFramework
;
import
org.apache.curator.framework.imps.CuratorFrameworkState
;
import
org.apache.curator.framework.recipes.cache.PathChildrenCache
;
import
org.apache.curator.framework.recipes.cache.PathChildrenCache
;
import
org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent
;
import
org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent
;
import
org.apache.curator.framework.recipes.cache.PathChildrenCacheListener
;
import
org.apache.curator.framework.recipes.cache.PathChildrenCacheListener
;
...
@@ -111,21 +112,46 @@ public class ZKMasterClient extends AbstractZKClient {
...
@@ -111,21 +112,46 @@ public class ZKMasterClient extends AbstractZKClient {
// init dao
// init dao
this
.
initDao
();
this
.
initDao
();
// init system znode
InterProcessMutex
mutex
=
null
;
this
.
initSystemZNode
();
try
{
// create distributed lock with the root node path of the lock space as /escheduler/lock/failover/master
String
znodeLock
=
getMasterStartUpLockPath
();
mutex
=
new
InterProcessMutex
(
zkClient
,
znodeLock
);
mutex
.
acquire
();
// init system znode
this
.
initSystemZNode
();
// monitor master
this
.
listenerMaster
();
// monitor mast
er
// monitor work
er
this
.
listenerMast
er
();
this
.
listenerWork
er
();
// monitor work
er
// register mast
er
this
.
listenerWork
er
();
this
.
registMast
er
();
// register master
// check if fault tolerance is required,failure and tolerance
this
.
registMaster
();
if
(
getActiveMasterNum
()
==
1
)
{
processDao
.
selfFaultTolerant
(
ExecutionStatus
.
RUNNING_EXEUTION
.
ordinal
(),
ExecutionStatus
.
NEED_FAULT_TOLERANCE
.
ordinal
());
}
}
catch
(
Exception
e
){
logger
.
error
(
"master start up exception : "
+
e
.
getMessage
(),
e
);
}
finally
{
if
(
mutex
!=
null
){
try
{
mutex
.
release
();
}
catch
(
Exception
e
)
{
if
(
e
.
getMessage
().
equals
(
"instance must be started before calling this method"
)){
logger
.
warn
(
"lock release"
);
}
else
{
logger
.
error
(
"lock release failed : "
+
e
.
getMessage
(),
e
);
}
// check if fault tolerance is required,failure and tolerance
}
if
(
getActiveMasterNum
()
==
1
)
{
}
processDao
.
selfFaultTolerant
(
ExecutionStatus
.
RUNNING_EXEUTION
.
ordinal
(),
ExecutionStatus
.
NEED_FAULT_TOLERANCE
.
ordinal
());
}
}
}
}
...
@@ -417,6 +443,14 @@ public class ZKMasterClient extends AbstractZKClient {
...
@@ -417,6 +443,14 @@ public class ZKMasterClient extends AbstractZKClient {
return
conf
.
getString
(
Constants
.
ZOOKEEPER_ESCHEDULER_LOCK_MASTERS
);
return
conf
.
getString
(
Constants
.
ZOOKEEPER_ESCHEDULER_LOCK_MASTERS
);
}
}
/**
* get master start up lock path
* @return
*/
public
String
getMasterStartUpLockPath
(){
return
conf
.
getString
(
Constants
.
ZOOKEEPER_ESCHEDULER_LOCK_FAILOVER_STARTUP_MASTERS
);
}
/**
/**
* get master failover lock path
* get master failover lock path
* @return
* @return
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录