blob: 8ed331d33ff2329862f2f099ae3d17f0de078c03 [file] [log] [blame]
<!DOCTYPE html>
<html lang="cn" class="js csstransforms3d">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="generator" content="Hugo 0.70.0" />
<meta name="description" content="">
<meta name="buildDate" content="2020-10-19 20:55:12">
<link rel="shortcut icon" href="https://shardingsphere.apache.org/elasticjob/images/favicon.png" type="image/x-icon" />
<title>弹性调度 :: ElasticJob</title>
<link href="https://shardingsphere.apache.org/elasticjob/current/css/nucleus.css?1603112112" rel="stylesheet">
<link href="https://shardingsphere.apache.org/elasticjob/current/css/font-awesome.min.css?1603112112" rel="stylesheet">
<link href="https://shardingsphere.apache.org/elasticjob/current/css/hybrid.css?1603112112" rel="stylesheet">
<link href="https://shardingsphere.apache.org/elasticjob/current/css/featherlight.min.css?1603112112" rel="stylesheet">
<link href="https://shardingsphere.apache.org/elasticjob/current/css/perfect-scrollbar.min.css?1603112112" rel="stylesheet">
<link href="https://shardingsphere.apache.org/elasticjob/current/css/auto-complete.css?1603112112" rel="stylesheet">
<link href="https://shardingsphere.apache.org/elasticjob/current/css/theme.css?1603112112" rel="stylesheet">
<link href="https://shardingsphere.apache.org/elasticjob/current/css/hugo-theme.css?1603112112" rel="stylesheet">
<link href="https://shardingsphere.apache.org/elasticjob/current/css/theme-black.css?1603112112" rel="stylesheet">
<script src="https://shardingsphere.apache.org/elasticjob/current/js/jquery-2.x.min.js?1603112112"></script>
<style type="text/css">
:root #header + #content > #left > #rlblock_left{
display:none !important;
}
</style>
</head>
<body class="" data-url="/cn/features/elastic/">
<nav id="sidebar" class="">
<div id="header-wrapper">
<div id="header">
<img src="https://shardingsphere.apache.org/elasticjob/current/img/elasticjob.png" />
</div>
</div>
<div class="highlightable">
<ul class="topics">
<li data-nav-id="/cn/overview/" title="概览" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/overview/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
</i>
<b>1. </b>概览
</a>
</li>
<li data-nav-id="/cn/quick-start/" title="快速入门" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/quick-start/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>2. </b>快速入门
</a>
<ul>
<li data-nav-id="/cn/quick-start/elasticjob-lite/" title="ElasticJob-Lite" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/quick-start/elasticjob-lite/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>2.1. </b>ElasticJob-Lite
</a>
</li>
<li data-nav-id="/cn/quick-start/elasticjob-cloud/" title="ElasticJob-Cloud" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/quick-start/elasticjob-cloud/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>2.2. </b>ElasticJob-Cloud
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/features/" title="概念 &amp; 功能" class="dd-item
parent
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/features/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>3. </b>概念 &amp; 功能
</a>
<ul>
<li data-nav-id="/cn/features/schedule-model/" title="调度模型" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/features/schedule-model/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>3.1. </b>调度模型
</a>
</li>
<li data-nav-id="/cn/features/elastic/" title="弹性调度" class="dd-item active">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/features/elastic/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>3.2. </b>弹性调度
</a>
</li>
<li data-nav-id="/cn/features/resource/" title="资源分配" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/features/resource/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>3.3. </b>资源分配
</a>
</li>
<li data-nav-id="/cn/features/failover/" title="失效转移" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/features/failover/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>3.4. </b>失效转移
</a>
</li>
<li data-nav-id="/cn/features/misfire/" title="错过任务重执行" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/features/misfire/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>3.5. </b>错过任务重执行
</a>
</li>
<li data-nav-id="/cn/features/job-type/" title="作业开放生态" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/features/job-type/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>3.6. </b>作业开放生态
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/user-manual/" title="用户手册" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>4. </b>用户手册
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-lite/" title="ElasticJob-Lite" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>4.1. </b>ElasticJob-Lite
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/" title="使用手册" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>4.1.1 </b>使用手册
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/job-api/" title="作业 API" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/job-api/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
作业 API
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/job-api/job-interface/" title="作业开发" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/job-api/job-interface/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
作业开发
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/job-api/java-api/" title="使用 Java API" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/job-api/java-api/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
使用 Java API
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/job-api/spring-boot-starter/" title="使用 Spring Boot Starter" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/job-api/spring-boot-starter/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
使用 Spring Boot Starter
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/job-api/spring-namespace/" title="使用 Spring 命名空间" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/job-api/spring-namespace/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
使用 Spring 命名空间
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/job-listener/" title="作业监听器" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/job-listener/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
作业监听器
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/job-listener/listener-interface/" title="监听器开发" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/job-listener/listener-interface/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
监听器开发
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/job-listener/java-api/" title="使用 Java API" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/job-listener/java-api/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
使用 Java API
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/job-listener/spring-namespace/" title="使用 Spring 命名空间" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/job-listener/spring-namespace/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
使用 Spring 命名空间
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/tracing/" title="事件追踪" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/tracing/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
事件追踪
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/tracing/java-api/" title="使用 Java API" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/tracing/java-api/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
使用 Java API
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/tracing/spring-boot-starter/" title="使用 Spring Boot Starter" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/tracing/spring-boot-starter/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
使用 Spring Boot Starter
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/tracing/spring-namespace/" title="使用 Spring 命名空间" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/tracing/spring-namespace/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
使用 Spring 命名空间
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/tracing/table-structure/" title="表结构说明" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/tracing/table-structure/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
表结构说明
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/usage/operation-api/" title="操作 API" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/usage/operation-api/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
</i>
操作 API
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/configuration/" title="配置手册" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/configuration/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>4.1.2 </b>配置手册
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-lite/configuration/java-api/" title="Java API" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/configuration/java-api/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
Java API
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/configuration/spring-boot-starter/" title="Spring Boot Starter" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/configuration/spring-boot-starter/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
Spring Boot Starter
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/configuration/spring-namespace/" title="Spring 命名空间" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/configuration/spring-namespace/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
Spring 命名空间
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/configuration/built-in-strategy/" title="内置策略" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/configuration/built-in-strategy/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
内置策略
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-lite/configuration/built-in-strategy/sharding/" title="作业分片策略" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/configuration/built-in-strategy/sharding/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
作业分片策略
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/configuration/built-in-strategy/thread-pool/" title="线程池策略" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/configuration/built-in-strategy/thread-pool/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
线程池策略
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/configuration/built-in-strategy/error-handler/" title="错误处理策略" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/configuration/built-in-strategy/error-handler/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
错误处理策略
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/configuration/props/" title="作业属性配置" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/configuration/props/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
作业属性配置
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/operation/" title="运维手册" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/operation/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>4.1.3 </b>运维手册
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-lite/operation/deploy-guide/" title="部署指南" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/operation/deploy-guide/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
部署指南
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/operation/dump/" title="导出作业信息" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/operation/dump/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
导出作业信息
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/operation/execution-monitor/" title="作业运行状态监控" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/operation/execution-monitor/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
作业运行状态监控
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-lite/operation/web-console/" title="运维平台" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-lite/operation/web-console/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
运维平台
</a>
</li>
</ul>
</li>
</ul>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-cloud/" title="ElasticJob-Cloud" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-cloud/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>4.2. </b>ElasticJob-Cloud
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-cloud/usage/" title="使用手册" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-cloud/usage/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>4.2.1. </b>使用手册
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-cloud/usage/dev-guide/" title="开发指南" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-cloud/usage/dev-guide/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
开发指南
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-cloud/usage/local-executor/" title="本地运行模式" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-cloud/usage/local-executor/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
本地运行模式
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-cloud/configuration/" title="配置手册" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-cloud/configuration/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
</i>
<b>4.2.2. </b>配置手册
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-cloud/operation/" title="运维手册" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-cloud/operation/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>4.2.3. </b>运维手册
</a>
<ul>
<li data-nav-id="/cn/user-manual/elasticjob-cloud/operation/deploy-guide/" title="部署指南" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-cloud/operation/deploy-guide/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
部署指南
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-cloud/operation/high-availability/" title="高可用" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-cloud/operation/high-availability/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
高可用
</a>
</li>
<li data-nav-id="/cn/user-manual/elasticjob-cloud/operation/web-console/" title="运维平台" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/user-manual/elasticjob-cloud/operation/web-console/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
运维平台
</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li data-nav-id="/cn/dev-manual/" title="开发者手册" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/dev-manual/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg class="icon icon-down"
style="display: none;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M500.8 604.778667L267.306667 371.392l-45.226667 45.269333 278.741333 278.613334 278.485334-278.613334-45.248-45.248z" p-id="5376" ></path>
</svg>
<svg class="icon icon-right"
style="display: inline-block;"
viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#777">
<path d="M593.450667 512.128L360.064 278.613333l45.290667-45.226666 278.613333 278.762666L405.333333 790.613333l-45.226666-45.269333z" p-id="5605" ></path>
</svg>
</i>
<b>5. </b>开发者手册
</a>
<ul>
<li data-nav-id="/cn/dev-manual/sharding/" title="作业分片策略" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/dev-manual/sharding/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>5.1. </b>作业分片策略
</a>
</li>
<li data-nav-id="/cn/dev-manual/thread-pool/" title="线程池策略" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/dev-manual/thread-pool/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>5.2. </b>线程池策略
</a>
</li>
<li data-nav-id="/cn/dev-manual/error-handler/" title="错误处理策略" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/dev-manual/error-handler/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>5.3. </b>错误处理策略
</a>
</li>
<li data-nav-id="/cn/dev-manual/job-class-provider/" title="作业类名称提供策略" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/dev-manual/job-class-provider/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>5.4. </b>作业类名称提供策略
</a>
</li>
<li data-nav-id="/cn/dev-manual/roadmap/" title="线路规划" class="dd-item ">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/dev-manual/roadmap/">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
<b>5.5. </b>线路规划
</a>
</li>
</ul>
</li>
<li data-nav-id="/cn/downloads/" title="下载" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/downloads/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
</i>
<b>6. </b>下载
</a>
</li>
<li data-nav-id="/cn/powered-by/" title="采用公司" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/powered-by/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
</i>
<b>7. </b>采用公司
</a>
</li>
<li data-nav-id="/cn/faq/" title="FAQ" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/faq/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
</i>
<b>8. </b>FAQ
</a>
</li>
<li data-nav-id="/cn/blog/" title="博客" class="dd-item
">
<a href="https://shardingsphere.apache.org/elasticjob/current/cn/blog/">
<i class="collapse" style="display:inline; font-family:'courier';">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5375" width="20" height="20"></svg>
</i>
<b>9. </b>博客
</a>
</li>
</ul>
<section id="prefooter">
<hr/>
<ul>
<li>
<a class="padding">
<i class="fa fa-fw fa-language"></i>
<div class="select-style">
<select id="select-language" onchange="location = this.value;">
<option id="en" value="/elasticjob/current/en/features/elastic/">English</option>
<option id="cn" value="/elasticjob/current/cn/features/elastic/" selected>简体中文</option>
</select>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="255px" height="255px" viewBox="0 0 255 255" style="enable-background:new 0 0 255 255;" xml:space="preserve">
<g>
<g id="arrow-drop-down">
<polygon points="0,63.75 127.5,191.25 255,63.75 " />
</g>
</g>
</svg>
</div>
</a>
</li>
</ul>
</section>
<hr />
<a class="padding" href="https://shardingsphere.apache.org/pdf/shardingsphere-elasticjob_docs_cn.pdf">
<i class="fa fa-fw fa-file-pdf-o" ></i>&nbsp;下载PDF文档&nbsp;&nbsp;
</a>
<section id="footer">
<p></p>
</section>
</div>
</nav>
<section id="body">
<div id="overlay"></div>
<div class="padding highlightable">
<div>
<div id="top-bar">
<div id="top-github-link">
<a class="github-link" title='Edit this page' href="https://github.com/apache/shardingsphere/tree/master/docs/document/content/features/elastic.cn.md" target="blank">
<i class="fa fa-code-fork"></i>
<span id="top-github-link-text">Edit this page</span>
</a>
</div>
<div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
<span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle="">
<i class="fa fa-bars"></i>
</a>
</span>
<span class="links">
<a href='https://shardingsphere.apache.org/elasticjob/current/cn/'>ElasticJob</a> > <a href='https://shardingsphere.apache.org/elasticjob/current/cn/features/'>概念 & 功能</a> > 弹性调度
</span>
</div>
</div>
</div>
<div id="chapter">
<div id="body-inner">
<nav id="TableOfContents">
<ul>
<li><a href="#分片">分片</a>
<ul>
<li><a href="#分片项">分片项</a></li>
<li><a href="#个性化分片参数">个性化分片参数</a></li>
</ul>
</li>
<li><a href="#资源最大限度利用">资源最大限度利用</a></li>
<li><a href="#高可用">高可用</a></li>
<li><a href="#elasticjob-lite-实现原理">ElasticJob-Lite 实现原理</a>
<ul>
<li><a href="#弹性分布式实现">弹性分布式实现</a></li>
<li><a href="#注册中心数据结构">注册中心数据结构</a></li>
<li><a href="#config-节点">config 节点</a></li>
<li><a href="#instances-节点">instances 节点</a></li>
<li><a href="#sharding-节点">sharding 节点</a></li>
<li><a href="#servers-节点">servers 节点</a></li>
<li><a href="#leader-节点">leader 节点</a></li>
<li><a href="#流程图">流程图</a></li>
</ul>
</li>
</ul>
</nav>
<p>弹性调度是 ElasticJob 最重要的功能,也是这款产品名称的由来。
它是一款能够让任务通过分片进行水平扩展的任务处理系统。</p>
<h2 id="分片">分片</h2>
<p>ElasticJob 中任务分片项的概念,使得任务可以在分布式的环境下运行,每台任务服务器只运行分配给该服务器的分片。
随着服务器的增加或宕机,ElasticJob 会近乎实时的感知服务器数量的变更,从而重新为分布式的任务服务器分配更加合理的任务分片项,使得任务可以随着资源的增加而提升效率。</p>
<p>任务的分布式执行,需要将一个任务拆分为多个独立的任务项,然后由分布式的服务器分别执行某一个或几个分片项。</p>
<p>举例说明,如果作业分为 4 片,用两台服务器执行,则每个服务器分到 2 片,分别负责作业的 50% 的负载,如下图所示。</p>
<p><img src="https://shardingsphere.apache.org/elasticjob/current/img/elastic/sharding.png" alt="分片作业"></p>
<h3 id="分片项">分片项</h3>
<p>ElasticJob 并不直接提供数据处理的功能,而是将分片项分配至各个运行中的作业服务器,开发者需要自行处理分片项与业务的对应关系。
分片项为数字,始于 0 而终于分片总数减 1。</p>
<h3 id="个性化分片参数">个性化分片参数</h3>
<p>个性化参数可以和分片项匹配对应关系,用于将分片项的数字转换为更加可读的业务代码。</p>
<p>例如:按照地区水平拆分数据库,数据库 A 是北京的数据;数据库 B 是上海的数据;数据库 C 是广州的数据。
如果仅按照分片项配置,开发者需要了解 0 表示北京;1 表示上海;2 表示广州。
合理使用个性化参数可以让代码更可读,如果配置为 0=北京,1=上海,2=广州,那么代码中直接使用北京,上海,广州的枚举值即可完成分片项和业务逻辑的对应关系。</p>
<h2 id="资源最大限度利用">资源最大限度利用</h2>
<p>ElasticJob 提供最灵活的方式,最大限度的提高执行作业的吞吐量。
当新增加作业服务器时,ElasticJob 会通过注册中心的临时节点的变化感知到新服务器的存在,并在下次任务调度的时候重新分片,新的服务器会承载一部分作业分片,如下图所示。</p>
<p><img src="https://shardingsphere.apache.org/elasticjob/current/img/elastic/sacle-out.png" alt="作业扩容"></p>
<p>将分片项设置为大于服务器的数量,最好是大于服务器倍数的数量,作业将会合理的利用分布式资源,动态的分配分片项。</p>
<p>例如:3 台服务器,分成 10 片,则分片项分配结果为服务器 A = 0,1,2;服务器 B = 3,4,5;服务器 C = 6,7,8,9。
如果服务器 C 崩溃,则分片项分配结果为服务器 A = 0,1,2,3,4; 服务器 B = 5,6,7,8,9。
在不丢失分片项的情况下,最大限度的利用现有资源提高吞吐量。</p>
<h2 id="高可用">高可用</h2>
<p>当作业服务器在运行中宕机时,注册中心同样会通过临时节点感知,并将在下次运行时将分片转移至仍存活的服务器,以达到作业高可用的效果。
本次由于服务器宕机而未执行完的作业,则可以通过失效转移的方式继续执行。如下图所示。</p>
<p><img src="https://shardingsphere.apache.org/elasticjob/current/img/elastic/ha.png" alt="作业高可用"></p>
<p>将分片总数设置为 1,并使用多于 1 台的服务器执行作业,作业将会以 1 主 n 从的方式执行。
一旦执行作业的服务器宕机,等待执行的服务器将会在下次作业启动时替补执行。开启失效转移功能效果更好,可以保证在本次作业在执行时宕机的情况下,备机立即启动替补执行。</p>
<h2 id="elasticjob-lite-实现原理">ElasticJob-Lite 实现原理</h2>
<p>ElasticJob-Lite 并无作业调度中心节点,而是基于部署作业框架的程序在到达相应时间点时各自触发调度。
注册中心仅用于作业注册和监控信息存储。而主作业节点仅用于处理分片和清理等功能。</p>
<h3 id="弹性分布式实现">弹性分布式实现</h3>
<ul>
<li>第一台服务器上线触发主服务器选举。主服务器一旦下线,则重新触发选举,选举过程中阻塞,只有主服务器选举完成,才会执行其他任务。</li>
<li>某作业服务器上线时会自动将服务器信息注册到注册中心,下线时会自动更新服务器状态。</li>
<li>主节点选举,服务器上下线,分片总数变更均更新重新分片标记。</li>
<li>定时任务触发时,如需重新分片,则通过主服务器分片,分片过程中阻塞,分片结束后才可执行任务。如分片过程中主服务器下线,则先选举主服务器,再分片。</li>
<li>通过上一项说明可知,为了维持作业运行时的稳定性,运行过程中只会标记分片状态,不会重新分片。分片仅可能发生在下次任务触发前。</li>
<li>每次分片都会按服务器IP排序,保证分片结果不会产生较大波动。</li>
<li>实现失效转移功能,在某台服务器执行完毕后主动抓取未分配的分片,并且在某台服务器下线后主动寻找可用的服务器执行任务。</li>
</ul>
<h3 id="注册中心数据结构">注册中心数据结构</h3>
<p>注册中心在定义的命名空间下,创建作业名称节点,用于区分不同作业,所以作业一旦创建则不能修改作业名称,如果修改名称将视为新的作业。
作业名称节点下又包含4个数据子节点,分别是 config, instances, sharding, servers 和 leader。</p>
<h3 id="config-节点">config 节点</h3>
<p>作业配置信息,以 YAML 格式存储。</p>
<h3 id="instances-节点">instances 节点</h3>
<p>作业运行实例信息,子节点是当前作业运行实例的主键。
作业运行实例主键由作业运行服务器的 IP 地址和 PID 构成。
作业运行实例主键均为临时节点,当作业实例上线时注册,下线时自动清理。注册中心监控这些节点的变化来协调分布式作业的分片以及高可用。
可在作业运行实例节点写入 TRIGGER 表示该实例立即执行一次。</p>
<h3 id="sharding-节点">sharding 节点</h3>
<p>作业分片信息,子节点是分片项序号,从零开始,至分片总数减一。
分片项序号的子节点存储详细信息。每个分片项下的子节点用于控制和记录分片运行状态。
节点详细信息说明:</p>
<table>
<thead>
<tr>
<th>子节点名</th>
<th align="left">临时节点</th>
<th align="left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>instance</td>
<td align="left"></td>
<td align="left">执行该分片项的作业运行实例主键</td>
</tr>
<tr>
<td>running</td>
<td align="left"></td>
<td align="left">分片项正在运行的状态<br />仅配置 monitorExecution 时有效</td>
</tr>
<tr>
<td>failover</td>
<td align="left"></td>
<td align="left">如果该分片项被失效转移分配给其他作业服务器,则此节点值记录执行此分片的作业服务器 IP</td>
</tr>
<tr>
<td>misfire</td>
<td align="left"></td>
<td align="left">是否开启错过任务重新执行</td>
</tr>
<tr>
<td>disabled</td>
<td align="left"></td>
<td align="left">是否禁用此分片项</td>
</tr>
</tbody>
</table>
<h3 id="servers-节点">servers 节点</h3>
<p>作业服务器信息,子节点是作业服务器的 IP 地址。
可在 IP 地址节点写入 DISABLED 表示该服务器禁用。
在新的云原生架构下,servers 节点大幅弱化,仅包含控制服务器是否可以禁用这一功能。
为了更加纯粹的实现作业核心,servers 功能未来可能删除,控制服务器是否禁用的能力应该下放至自动化部署系统。</p>
<h3 id="leader-节点">leader 节点</h3>
<p>作业服务器主节点信息,分为 election,sharding 和 failover 三个子节点。
分别用于主节点选举,分片和失效转移处理。</p>
<p>leader节点是内部使用的节点,如果对作业框架原理不感兴趣,可不关注此节点。</p>
<table>
<thead>
<tr>
<th>子节点名</th>
<th align="left">临时节点</th>
<th align="left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>election\instance</td>
<td align="left"></td>
<td align="left">主节点服务器IP地址<br />一旦该节点被删除将会触发重新选举<br />重新选举的过程中一切主节点相关的操作都将阻塞</td>
</tr>
<tr>
<td>election\latch</td>
<td align="left"></td>
<td align="left">主节点选举的分布式锁<br />为 curator 的分布式锁使用</td>
</tr>
<tr>
<td>sharding\necessary</td>
<td align="left"></td>
<td align="left">是否需要重新分片的标记<br />如果分片总数变化,或作业服务器节点上下线或启用/禁用,以及主节点选举,会触发设置重分片标记<br />作业在下次执行时使用主节点重新分片,且中间不会被打断<br />作业执行时不会触发分片</td>
</tr>
<tr>
<td>sharding\processing</td>
<td align="left"></td>
<td align="left">主节点在分片时持有的节点<br />如果有此节点,所有的作业执行都将阻塞,直至分片结束<br />主节点分片结束或主节点崩溃会删除此临时节点</td>
</tr>
<tr>
<td>failover\items\分片项</td>
<td align="left"></td>
<td align="left">一旦有作业崩溃,则会向此节点记录<br />当有空闲作业服务器时,会从此节点抓取需失效转移的作业项</td>
</tr>
<tr>
<td>failover\items\latch</td>
<td align="left"></td>
<td align="left">分配失效转移分片项时占用的分布式锁<br />为 curator 的分布式锁使用</td>
</tr>
</tbody>
</table>
<h3 id="流程图">流程图</h3>
<h4 id="作业启动">作业启动</h4>
<p><img src="https://shardingsphere.apache.org/elasticjob/current/img/principles/job_start.jpg" alt="作业启动"></p>
<h4 id="作业执行">作业执行</h4>
<p><img src="https://shardingsphere.apache.org/elasticjob/current/img/principles/job_exec.jpg" alt="作业执行"></p>
<footer class=" footline" >
</footer>
</div>
</div>
</div>
<div id="navigation">
<a class="nav nav-prev" href="https://shardingsphere.apache.org/elasticjob/current/cn/features/schedule-model/" title="调度模型"> <i class="fa fa-chevron-left"></i></a>
<a class="nav nav-next" href="https://shardingsphere.apache.org/elasticjob/current/cn/features/resource/" title="资源分配" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>
</div>
</section>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/clipboard.min.js?1603112112"></script>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/perfect-scrollbar.min.js?1603112112"></script>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/perfect-scrollbar.jquery.min.js?1603112112"></script>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/jquery.sticky.js?1603112112"></script>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/featherlight.min.js?1603112112"></script>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/html5shiv-printshiv.min.js?1603112112"></script>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/highlight.pack.js?1603112112"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/modernizr.custom.71422.js?1603112112"></script>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/learn.js?1603112112"></script>
<script src="https://shardingsphere.apache.org/elasticjob/current/js/hugo-learn.js?1603112112"></script>
</body>
</html>