# elastic-job
**Repository Path**: lx_git_osc/elastic-job
## Basic Information
- **Project Name**: elastic-job
- **Description**: Elastic-Job是一个分布式调度解决方案,由两个相互独立的子项目Elastic-Job-Lite和Elastic-Job-Cloud组成。
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 611
- **Created**: 2017-09-05
- **Last Updated**: 2020-12-18
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Elastic-Job - distributed scheduled job solution
[](https://travis-ci.org/dangdangdotcom/elastic-job)
[](https://maven-badges.herokuapp.com/maven-central/com.dangdang/elastic-job)
[](https://coveralls.io/github/dangdangdotcom/elastic-job?branch=master)
[](https://github.com/dangdangdotcom/elastic-job/releases)
[](http://www.apache.org/licenses/LICENSE-2.0.html)
# [Homepage](http://elasticjob.io/)
# [中文主页](http://elasticjob.io/index_zh.html)
# Elastic-Job-Lite Console [](https://dangdangdotcom.github.io/elastic-job/elastic-job-lite/dist/elastic-job-lite-console-2.1.4.tar.gz)
# Elastic-Job-Cloud Framework[](https://dangdangdotcom.github.io/elastic-job/elastic-job-cloud/dist/elastic-job-cloud-scheduler-2.1.4.tar.gz)
# Overview
Elastic-Job is a distributed scheduled job solution. Elastic-Job is composited from 2 independent sub projects: Elastic-Job-Lite and Elastic-Job-Cloud.
Elastic-Job-Lite is a centre-less solution, use lightweight jar to coordinate distributed jobs.
Elastic-Job-Cloud is a Mesos framework which use Mesos + Docker(todo) to manage and isolate resources and processes.
Elastic-Job-Lite and Elastic-Job-Cloud provide unified API. Developers only need code one time, then decide to deploy Lite or Cloud as you want.
# Features
## 1. Elastic-Job-Lite
* Distributed schedule job coordinate
* Elastic scale in and scale out supported
* Failover
* Misfired jobs refire
* Sharding consistently, same sharding item for a job only one running instance
* Self diagnose and recover when distribute environment unstable
* Parallel scheduling supported
* Job lifecycle operation
* Lavish job types
* Spring integrated and namespace supported
* Web console
## 2. Elastic-Job-Cloud
* All Elastic-Job-Lite features included
* Application distributed automatically
* Fenzo based resources allocated elastically
* Docker based processes isolation support (TBD)
# Architecture
## Elastic-Job-Lite

***
## Elastic-Job-Cloud

# [Release Notes](https://github.com/dangdangdotcom/elastic-job/releases)
# [Roadmap](ROADMAP.md)
# Quick Start
## Elastic-Job-Lite
### Add maven dependency
```xml
com.dangdang
elastic-job-lite-core
${lasted.release.version}
com.dangdang
elastic-job-lite-spring
${lasted.release.version}
```
### Job development
```java
public class MyElasticJob implements SimpleJob {
@Override
public void execute(ShardingContext context) {
switch (context.getShardingItem()) {
case 0:
// do something by sharding item 0
break;
case 1:
// do something by sharding item 1
break;
case 2:
// do something by sharding item 2
break;
// case n: ...
}
}
}
```
### Job configuration
```xml
```
***
## Elastic-Job-Cloud
### Add maven dependency
```xml
com.dangdang
elastic-job-cloud-executor
${lasted.release.version}
```
### Job development
Same with `Elastic-Job-Lite`
### Job App configuration
```shell
curl -l -H "Content-type: application/json" -X POST -d '{"appName":"yourAppName","appURL":"http://app_host:8080/foo-job.tar.gz","cpuCount":0.1,"memoryMB":64.0,"bootstrapScript":"bin/start.sh","appCacheEnable":true}' http://elastic_job_cloud_host:8899/api/app
```
### Job configuration
```shell
curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"foo_job","appName":"yourAppName","jobClass":"yourJobClass","jobType":"SIMPLE","jobExecutionType":"TRANSIENT","cron":"0/5 * * * * ?","shardingTotalCount":5,"cpuCount":0.1,"memoryMB":64.0,"failover":true,"misfire":true,"bootstrapScript":"bin/start.sh"}' http://elastic_job_cloud_host:8899/api/job/register
```