mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-04 05:09:48 +08:00
add monitor
This commit is contained in:
parent
5199e4b8fb
commit
a3d9d56fec
@ -190,8 +190,14 @@ public enum Status {
|
|||||||
PROCESS_NODE_HAS_CYCLE(50019,"process node has cycle"),
|
PROCESS_NODE_HAS_CYCLE(50019,"process node has cycle"),
|
||||||
PROCESS_NODE_S_PARAMETER_INVALID(50020,"process node %s parameter invalid"),
|
PROCESS_NODE_S_PARAMETER_INVALID(50020,"process node %s parameter invalid"),
|
||||||
|
|
||||||
|
|
||||||
HDFS_NOT_STARTUP(60001,"hdfs not startup"),
|
HDFS_NOT_STARTUP(60001,"hdfs not startup"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* for monitor
|
||||||
|
*/
|
||||||
|
QUERY_DATABASE_STATE_ERROR(70001,"query database state error"),
|
||||||
|
QUERY_ZOOKEEPER_STATE_ERROR(70002,"query zookeeper state error"),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private int code;
|
private int code;
|
||||||
|
@ -453,7 +453,7 @@ public final class Constants {
|
|||||||
/**
|
/**
|
||||||
* task record configuration path
|
* task record configuration path
|
||||||
*/
|
*/
|
||||||
public static final String TASK_RECORD_PROPERTIES_PATH = "dao/data_source.properties";
|
public static final String DATA_SOURCE_PROPERTIES = "dao/data_source.properties";
|
||||||
|
|
||||||
public static final String TASK_RECORD_URL = "task.record.datasource.url";
|
public static final String TASK_RECORD_URL = "task.record.datasource.url";
|
||||||
|
|
||||||
|
@ -87,15 +87,6 @@ public abstract class AbstractZKClient {
|
|||||||
|
|
||||||
|
|
||||||
public AbstractZKClient() {
|
public AbstractZKClient() {
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
String[] zookeeperParamslist = conf.getStringArray(Constants.ZOOKEEPER_QUORUM);
|
|
||||||
for (String param : zookeeperParamslist) {
|
|
||||||
sb.append(param).append(Constants.COMMA);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sb.length() > 0){
|
|
||||||
sb.deleteCharAt(sb.length() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// retry strategy
|
// retry strategy
|
||||||
RetryPolicy retryPolicy = new ExponentialBackoffRetry(
|
RetryPolicy retryPolicy = new ExponentialBackoffRetry(
|
||||||
@ -105,7 +96,7 @@ public abstract class AbstractZKClient {
|
|||||||
try{
|
try{
|
||||||
// crate zookeeper client
|
// crate zookeeper client
|
||||||
zkClient = CuratorFrameworkFactory.builder()
|
zkClient = CuratorFrameworkFactory.builder()
|
||||||
.connectString(sb.toString())
|
.connectString(getZookeeperQuorum())
|
||||||
.retryPolicy(retryPolicy)
|
.retryPolicy(retryPolicy)
|
||||||
.sessionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_SESSION_TIMEOUT)))
|
.sessionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_SESSION_TIMEOUT)))
|
||||||
.connectionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_CONNECTION_TIMEOUT)))
|
.connectionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_CONNECTION_TIMEOUT)))
|
||||||
@ -327,6 +318,24 @@ public abstract class AbstractZKClient {
|
|||||||
return childrenList.size();
|
return childrenList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return zookeeper quorum
|
||||||
|
*/
|
||||||
|
public static String getZookeeperQuorum(){
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String[] zookeeperParamslist = conf.getStringArray(Constants.ZOOKEEPER_QUORUM);
|
||||||
|
for (String param : zookeeperParamslist) {
|
||||||
|
sb.append(param).append(Constants.COMMA);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sb.length() > 0){
|
||||||
|
sb.deleteCharAt(sb.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AbstractZKClient{" +
|
return "AbstractZKClient{" +
|
||||||
|
@ -45,7 +45,7 @@ public class MonitorDBDao {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
conf = new PropertiesConfiguration(Constants.DataSource_PROPERTIES_PATH);
|
conf = new PropertiesConfiguration(Constants.DATA_SOURCE_PROPERTIES);
|
||||||
}catch (ConfigurationException e){
|
}catch (ConfigurationException e){
|
||||||
logger.error("load configuration excetpion",e);
|
logger.error("load configuration excetpion",e);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
@ -46,7 +46,7 @@ public class TaskRecordDao {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
conf = new PropertiesConfiguration(Constants.TASK_RECORD_PROPERTIES_PATH);
|
conf = new PropertiesConfiguration(Constants.DATA_SOURCE_PROPERTIES);
|
||||||
}catch (ConfigurationException e){
|
}catch (ConfigurationException e){
|
||||||
logger.error("load configuration excetpion",e);
|
logger.error("load configuration excetpion",e);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user