com.alibaba.schedulerx.SchedulerxProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of schedulerx2-spring-boot-starter Show documentation
Show all versions of schedulerx2-spring-boot-starter Show documentation
schedulerx2-spring-boot-starter
package com.alibaba.schedulerx;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import com.alibaba.schedulerx.common.domain.ContactInfo;
import com.alibaba.schedulerx.common.util.JsonUtil;
import com.alibaba.schedulerx.worker.domain.WorkerConstants;
import com.alibaba.schedulerx.worker.log.LogFactory;
import com.alibaba.schedulerx.worker.log.Logger;
/**
* schedulerx worker启动配置
*
* @author 陆昆
**/
@ConfigurationProperties(prefix = "spring.schedulerx2")
public class SchedulerxProperties implements InitializingBean {
private static final Logger LOGGER = LogFactory.getLogger(SchedulerxProperties.class);
/**
* 对应不同环境SchedulerX控制台域名
* 文档见:https://yuque.antfin-inc.com/schedulerx/igu2vh/hbdgke
*/
private String domainName;
/**
* 分组id:控制台应用管理界面查看
*/
private String groupId;
/**
* 特殊场景多网卡或vpc环境指定客户端ip使用
* https://yuque.antfin-inc.com/schedulerx/igu2vh/fvrpgq#664063c9
*/
private String host;
/**
* 用户自定义schedulerx-worker的端口
*/
private int port = 0;
/**
* 单元隔离白名单指定触发单元使用:多个单元以逗号分隔,不能带空格
* 具体参考文档:https://yuque.antfin-inc.com/schedulerx/igu2vh/fvrpgq#664063c9
*/
private String enableUnits;
/**
* 单元隔离黑名单指定不可触发单元:多个单元以逗号分隔,不能带空格,如果设置了白名单,以白名单为准,黑名单失效
* 具体参考文档:https://yuque.antfin-inc.com/schedulerx/igu2vh/fvrpgq#664063c9
*/
private String disableUnits;
/**
* 机房隔离白名单,多个机房以逗号分隔,不能带空格
*/
private String enableSites;
/**
* 单元隔离黑名单,如果设置了白名单,以白名单为准,黑名单失效
*/
private String disableSites;
/**
* 是否启用网格计算,默认不启用。开启这个开关,客户端启动会增加20秒+时间,
* 如果没有用到网格计算不建议设置。如果用到了网格计算,建议开启,否则每台机器的第一次触发会延迟20秒+才运行。
*/
private boolean enableBatchWork;
/**
* 默认true启动starter;false则关闭该starter
*/
private boolean enabled = true;
/**
* 应用名称
*/
private String appName;
/**
* groupId的appKey
*/
private String appKey;
/**
* 阿里云ramRole
*/
private String aliyunRamRole;
/**
* 阿里云ak
*/
private String aliyunAccessKey;
/**
* 阿里云sk
*/
private String aliyunSecretKey;
/**
* STS ak
*/
private String stsAccessKey;
/**
* STS sk
*/
private String stsSecretKey;
/**
* STS secret token
*/
private String stsToken;
/**
* 命名空间uid
*/
private String namespace;
/**
* 寻址服务地址
*/
private String endpoint;
/**
* 寻址服务端口号
*/
private String endpointPort;
/**
* 命名空间来源
*/
private String namespaceName;
/**
* 命名空间来源
*/
private String namespaceSource;
/**
* 用户自定义taskBody大小,单位byte
*/
private int maxTaskBodySize = WorkerConstants.TASK_BODY_SIZE_MAX_DEFAULT;
private boolean blockAppStart = true;
/**
* SLS日志收集器开关
*/
private boolean slsCollectorEnable = true;
/**
* 是否开启共享containerPool的开关
*/
private boolean shareContainerPool = false;
/**
* 执行线程池模型
*/
private String threadPoolMode;
/**
* 共享containerPool的自定义线程池大小
*/
private int sharePoolSize = WorkerConstants.SHARE_POOL_SIZE_DEFAULT;
/**
* 共享containerPool的自定义队列大小
*/
private int sharePoolQueueSize = Integer.MAX_VALUE;
/**
* Work集群内部标签,同标签将会启动一个
*/
private String label;
private String labelPath = "/etc/podinfo/labels";
/**
* 如果使用了非alios的docker环境(包括k8s),需要开启该开关
*/
private boolean enableCgroupMetrics = false;
/**
* 默认cgroup路径为/sys/fs/cgroup/cpu/,如果不同需要修改,否则无法采集到cgroup数据
*/
private String cgroupPathPrefix = "/sys/fs/cgroup/cpu/";
/**
* akka remoting被隔离了,是否自动恢复
*/
private boolean akkaRemotingAutoRecover = true;
/**
* 是否启用heartbeat日志
*
* @return
*/
private boolean enableHeartbeatLog = true;
/**
* Map模型状态检查间隔(ms)
*
* @return
*/
private int mapMasterStatusCheckInterval = WorkerConstants.Map_MASTER_STATUS_CHECK_INTERVAL_DEFAULT;
/**
* 启动second_delay间隔单位为ms,默认为秒
*
* @return
*/
private boolean enableSecondDealyCycleIntervalMs = false;
/**
* 启用MapMaster failover能力,默认启用
*/
private boolean enableMapMasterFailover = true;
/**
* 启动单机秒级别任务分发执行,默认不启用
*/
private boolean enableSecondDelayStandaloneDispatch = false;
/**
* schedulerx worker请求console接口的http超时时间,默认10秒
*
* @return
*/
// private Long httpConnectionTimeout;
/**
* 分批发送子任务和拉取子任务的pageSize
*/
private int pageSize = 1000;
/**
* worker停机延迟
*/
@Deprecated
private long workerShutdownDelay = WorkerConstants.GRACE_SHUTDOWN_TIMEOUT_DEFAULT;
/**
* worker停机模式
*/
@Deprecated
private Integer workerShutdownMode;
/**
* 优雅停机模式 WAIT_ALL:优雅下线 WAIT_RUNNING:部分优雅下线
*/
private String graceShutdownMode;
/**
* 优雅停机超时时间
*/
private long graceShutdownTimeout = WorkerConstants.GRACE_SHUTDOWN_TIMEOUT_DEFAULT;
/**
* 广播分发线程池大小
*/
private int broadcastDispatchThreadNum = 4;
/**
* 广播分发尝试次数
*/
private int broadcastDispatchRetryTimes = 1;
/**
* 开启广播分发线程池
*/
private boolean broadcastDispatchThreadEnable = false;
/**
* 广播主节点是否参与执行
*/
private boolean broadcastMasterExecEnable = true;
/**
* 开启map任务随机分发
*/
private boolean mapMasterDispatchRandom = false;
private Integer mapMasterRouterStrategy;
private String regionId;
/**
* H2数据库用户名
*/
private String h2DatabaseUser;
/**
* H2数据库密码
*/
private String h2DatabasePassword;
/**
* 是否开启Http服务
*/
private Boolean httpServerEnable;
/**
* Http服务端口
*/
private Integer httpServerPort;
/**
* Map任务最大磁盘使用率
*/
private Float maxMapDiskPercent;
private Map jobs = new LinkedHashMap<>();
private String alarmChannel;
private Map alarmUsers = new LinkedHashMap<>();
private Map processorPoolSize = new HashMap<>();
/**
* http agent 任务连接池最大连接数
*/
private Integer httpClientMaxTotalConnections;
public String getDomainName() {
return domainName;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getEnableUnits() {
return enableUnits;
}
public void setEnableUnits(String enableUnits) {
this.enableUnits = enableUnits;
}
public String getDisableUnits() {
return disableUnits;
}
public void setDisableUnits(String disableUnits) {
this.disableUnits = disableUnits;
}
public String getEnableSites() {
return enableSites;
}
public void setEnableSites(String enableSites) {
this.enableSites = enableSites;
}
public String getDisableSites() {
return disableSites;
}
public void setDisableSites(String disableSites) {
this.disableSites = disableSites;
}
public boolean isEnableBatchWork() {
return enableBatchWork;
}
public void setEnableBatchWork(boolean enableBatchWork) {
this.enableBatchWork = enableBatchWork;
}
public String getAliyunAccessKey() {
return aliyunAccessKey;
}
public void setAliyunAccessKey(String aliyunAccessKey) {
this.aliyunAccessKey = aliyunAccessKey;
}
public String getAliyunSecretKey() {
return aliyunSecretKey;
}
public void setAliyunSecretKey(String aliyunSecretKey) {
this.aliyunSecretKey = aliyunSecretKey;
}
public String getNamespace() {
return namespace;
}
public void setNamespace(String namespace) {
this.namespace = namespace;
}
public String getEndpoint() {
return endpoint;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
public String getEndpointPort() {
return endpointPort;
}
public void setEndpointPort(String endpointPort) {
this.endpointPort = endpointPort;
}
public String getNamespaceName() {
return namespaceName;
}
public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}
public String getNamespaceSource() {
return namespaceSource;
}
public void setNamespaceSource(String namespaceSource) {
this.namespaceSource = namespaceSource;
}
public int getMaxTaskBodySize() {
return maxTaskBodySize;
}
public void setMaxTaskBodySize(int maxTaskBodySize) {
this.maxTaskBodySize = maxTaskBodySize;
}
public boolean isBlockAppStart() {
return blockAppStart;
}
public void setBlockAppStart(boolean blockAppStart) {
this.blockAppStart = blockAppStart;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public String getStsAccessKey() {
return stsAccessKey;
}
public void setStsAccessKey(String stsAccessKey) {
this.stsAccessKey = stsAccessKey;
}
public String getStsSecretKey() {
return stsSecretKey;
}
public void setStsSecretKey(String stsSecretKey) {
this.stsSecretKey = stsSecretKey;
}
public String getStsToken() {
return stsToken;
}
public String getAliyunRamRole() {
return aliyunRamRole;
}
public void setAliyunRamRole(String aliyunRamRole) {
this.aliyunRamRole = aliyunRamRole;
}
public void setStsToken(String stsToken) {
this.stsToken = stsToken;
}
public boolean isSlsCollectorEnable() {
return slsCollectorEnable;
}
public void setSlsCollectorEnable(boolean slsCollectorEnable) {
this.slsCollectorEnable = slsCollectorEnable;
}
public boolean isShareContainerPool() {
return shareContainerPool;
}
public void setShareContainerPool(boolean shareContainerPool) {
this.shareContainerPool = shareContainerPool;
}
public int getSharePoolSize() {
return sharePoolSize;
}
public void setSharePoolSize(int sharePoolSize) {
this.sharePoolSize = sharePoolSize;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
if (label != null) {
if (label.startsWith("#") && label.endsWith("#")) {
String labelKey = label.substring(1,label.length()-1);
this.label = System.getenv(labelKey);
return;
}
}
this.label = label;
}
public String getLabelPath() {
return labelPath;
}
public void setLabelPath(String labelPath) {
this.labelPath = labelPath;
}
public boolean isEnableCgroupMetrics() {
return enableCgroupMetrics;
}
public void setEnableCgroupMetrics(boolean enableCgroupMetrics) {
this.enableCgroupMetrics = enableCgroupMetrics;
}
public String getCgroupPathPrefix() {
return cgroupPathPrefix;
}
public void setCgroupPathPrefix(String cgroupPathPrefix) {
this.cgroupPathPrefix = cgroupPathPrefix;
}
public boolean isAkkaRemotingAutoRecover() {
return akkaRemotingAutoRecover;
}
public void setAkkaRemotingAutoRecover(boolean akkaRemotingAutoRecover) {
this.akkaRemotingAutoRecover = akkaRemotingAutoRecover;
}
public boolean isEnableHeartbeatLog() {
return enableHeartbeatLog;
}
public void setEnableHeartbeatLog(boolean enableHeartbeatLog) {
this.enableHeartbeatLog = enableHeartbeatLog;
}
public int getMapMasterStatusCheckInterval() {
return mapMasterStatusCheckInterval;
}
public void setMapMasterStatusCheckInterval(int mapMasterStatusCheckInterval) {
this.mapMasterStatusCheckInterval = mapMasterStatusCheckInterval;
}
public boolean isEnableSecondDealyCycleIntervalMs() {
return enableSecondDealyCycleIntervalMs;
}
public void setEnableSecondDealyCycleIntervalMs(boolean enableSecondDealyCycleIntervalMs) {
this.enableSecondDealyCycleIntervalMs = enableSecondDealyCycleIntervalMs;
}
public boolean isEnableMapMasterFailover() {
return enableMapMasterFailover;
}
public void setEnableMapMasterFailover(boolean enableMapMasterFailover) {
this.enableMapMasterFailover = enableMapMasterFailover;
}
public boolean isEnableSecondDelayStandaloneDispatch() {
return enableSecondDelayStandaloneDispatch;
}
public void setEnableSecondDelayStandaloneDispatch(boolean enableSecondDelayStandaloneDispatch) {
this.enableSecondDelayStandaloneDispatch = enableSecondDelayStandaloneDispatch;
}
public int getPageSize() {
return pageSize;
}
@Deprecated
public long getWorkerShutdownDelay() {
return workerShutdownDelay;
}
@Deprecated
public void setWorkerShutdownDelay(long workerShutdownDelay) {
this.workerShutdownDelay = workerShutdownDelay;
}
@Deprecated
public Integer getWorkerShutdownMode() {
return workerShutdownMode;
}
@Deprecated
public void setWorkerShutdownMode(Integer workerShutdownMode) {
this.workerShutdownMode = workerShutdownMode;
}
public String getGraceShutdownMode() {
return graceShutdownMode;
}
public void setGraceShutdownMode(String graceShutdownMode) {
this.graceShutdownMode = graceShutdownMode;
}
public long getGraceShutdownTimeout() {
return graceShutdownTimeout;
}
public void setGraceShutdownTimeout(long graceShutdownTimeout) {
this.graceShutdownTimeout = graceShutdownTimeout;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getRegionId() {
return regionId;
}
public void setRegionId(String regionId) {
this.regionId = regionId;
}
public Map getJobs() {
return jobs;
}
public void setJobs(Map jobs) {
this.jobs = jobs;
}
public String getAlarmChannel() {
return alarmChannel;
}
public void setAlarmChannel(String alarmChannel) {
this.alarmChannel = alarmChannel;
}
public Map getAlarmUsers() {
return alarmUsers;
}
public void setAlarmUsers(Map alarmUsers) {
this.alarmUsers = alarmUsers;
}
public int getBroadcastDispatchThreadNum() {
return broadcastDispatchThreadNum;
}
public void setBroadcastDispatchThreadNum(int broadcastDispatchThreadNum) {
this.broadcastDispatchThreadNum = broadcastDispatchThreadNum;
}
public boolean isBroadcastDispatchThreadEnable() {
return broadcastDispatchThreadEnable;
}
public void setBroadcastDispatchThreadEnable(boolean broadcastDispatchThreadEnable) {
this.broadcastDispatchThreadEnable = broadcastDispatchThreadEnable;
}
public String getThreadPoolMode() {
return threadPoolMode;
}
public void setThreadPoolMode(String threadPoolMode) {
this.threadPoolMode = threadPoolMode;
}
public Map getProcessorPoolSize() {
return processorPoolSize;
}
public void setProcessorPoolSize(Map processorPoolSize) {
this.processorPoolSize = processorPoolSize;
}
public int getSharePoolQueueSize() {
return sharePoolQueueSize;
}
public void setSharePoolQueueSize(int sharePoolQueueSize) {
this.sharePoolQueueSize = sharePoolQueueSize;
}
public boolean isMapMasterDispatchRandom() {
return mapMasterDispatchRandom;
}
public void setMapMasterDispatchRandom(boolean mapMasterDispatchRandom) {
this.mapMasterDispatchRandom = mapMasterDispatchRandom;
}
public boolean isBroadcastMasterExecEnable() {
return broadcastMasterExecEnable;
}
public void setBroadcastMasterExecEnable(boolean broadcastMasterExecEnable) {
this.broadcastMasterExecEnable = broadcastMasterExecEnable;
}
public int getBroadcastDispatchRetryTimes() {
return broadcastDispatchRetryTimes;
}
public void setBroadcastDispatchRetryTimes(int broadcastDispatchRetryTimes) {
this.broadcastDispatchRetryTimes = broadcastDispatchRetryTimes;
}
public Integer getMapMasterRouterStrategy() {
return mapMasterRouterStrategy;
}
public void setMapMasterRouterStrategy(Integer mapMasterRouterStrategy) {
this.mapMasterRouterStrategy = mapMasterRouterStrategy;
}
public String getH2DatabaseUser() {
return h2DatabaseUser;
}
public void setH2DatabaseUser(String h2DatabaseUser) {
this.h2DatabaseUser = h2DatabaseUser;
}
public String getH2DatabasePassword() {
return h2DatabasePassword;
}
public void setH2DatabasePassword(String h2DatabasePassword) {
this.h2DatabasePassword = h2DatabasePassword;
}
public Boolean getHttpServerEnable() {
return httpServerEnable;
}
public void setHttpServerEnable(Boolean httpServerEnable) {
this.httpServerEnable = httpServerEnable;
}
public Integer getHttpServerPort() {
return httpServerPort;
}
public void setHttpServerPort(Integer httpServerPort) {
this.httpServerPort = httpServerPort;
}
public Float getMaxMapDiskPercent() {
return maxMapDiskPercent;
}
public void setMaxMapDiskPercent(float maxMapDiskPercent) {
this.maxMapDiskPercent = maxMapDiskPercent;
}
public Integer getHttpClientMaxTotalConnections() {
return httpClientMaxTotalConnections;
}
public void setHttpClientMaxTotalConnections(Integer httpClientMaxTotalConnections) {
this.httpClientMaxTotalConnections = httpClientMaxTotalConnections;
}
@Override
public void afterPropertiesSet() throws Exception {
LOGGER.info("SchedulerxProperties->"+JsonUtil.toJson(this));
}
}