-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
141 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 0 additions & 71 deletions
71
docs/content/user-manual/elasticjob-lite/usage/event-trace/event-trace.cn.md
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
docs/content/user-manual/elasticjob-lite/usage/event-trace/java-api.cn.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
+++ | ||
title = "使用 Java API" | ||
weight = 1 | ||
chapter = true | ||
+++ | ||
|
||
ElasticJob-Lite 在配置中提供了 TracingConfiguration,目前支持数据库方式配置。 | ||
开发者也可以通过 SPI 自行扩展。 | ||
|
||
```java | ||
// 初始化数据源 | ||
DataSource dataSource = ...; | ||
// 定义日志数据库事件溯源配置 | ||
TracingConfiguration tracingConfig = new TracingConfiguration<>("RDB", dataSource); | ||
// 初始化注册中心 | ||
CoordinatorRegistryCenter regCenter = ...; | ||
// 初始化作业配置 | ||
JobConfiguration jobConfig = ...; | ||
new ScheduleJobBootstrap(regCenter, jobConfig, tracingConfig).schedule(); | ||
``` |
2 changes: 1 addition & 1 deletion
2
...-lite/usage/event-trace/event-trace.en.md → ...job-lite/usage/event-trace/java-api.en.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
+++ | ||
title = "Event Trace" | ||
title = "Use Java API" | ||
weight = 1 | ||
chapter = true | ||
+++ | ||
|
7 changes: 7 additions & 0 deletions
7
...content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.cn.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
+++ | ||
title = "Spring Boot Starter" | ||
weight = 2 | ||
chapter = true | ||
+++ | ||
|
||
TODO |
7 changes: 7 additions & 0 deletions
7
...content/user-manual/elasticjob-lite/usage/event-trace/spring-boot-starter.en.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
+++ | ||
title = "Spring Boot Starter" | ||
weight = 2 | ||
chapter = true | ||
+++ | ||
|
||
TODO |
42 changes: 42 additions & 0 deletions
42
docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-namespace.cn.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
+++ | ||
title = "Spring 命名空间" | ||
weight = 3 | ||
chapter = true | ||
+++ | ||
|
||
## 事件追踪配置 | ||
|
||
```xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:elasticjob="http://shardingsphere.apache.org/schema/elasticjob" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
http://www.springframework.org/schema/beans/spring-beans.xsd | ||
http://shardingsphere.apache.org/schema/elasticjob | ||
http://shardingsphere.apache.org/schema/elasticjob/elasticjob.xsd | ||
"> | ||
<!--配置作业注册中心 --> | ||
<elasticjob:zookeeper id="regCenter" server-lists="yourhost:2181" namespace="my-job" base-sleep-time-milliseconds="1000" max-sleep-time-milliseconds="3000" max-retries="3" /> | ||
|
||
<!-- 配置作业 Bean --> | ||
<bean id="myJob" class="xxx.MyJob" /> | ||
|
||
<!-- 配置数据源 --> | ||
<bean id="tracingDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> | ||
<property name="driverClassName" value="${driver.class.name}" /> | ||
<property name="url" value="${url}" /> | ||
<property name="username" value="${username}" /> | ||
<property name="password" value="${password}" /> | ||
</bean> | ||
<!-- 配置事件追踪 --> | ||
<elasticjob:rdb-event-trace id="elasticJobTrace" data-source-ref="elasticJobTracingDataSource" /> | ||
|
||
<!-- 配置作业 --> | ||
<elasticjob:job id="${myJob.id}" job-ref="myJob" registry-center-ref="regCenter" tracing-ref="elasticJobTrace" sharding-total-count="3" cron="0/1 * * * * ?" /> | ||
</beans> | ||
``` | ||
|
||
## 作业启动 | ||
|
||
将配置 Spring 命名空间的 xml 通过 Spring 启动,作业将自动加载。 |
7 changes: 7 additions & 0 deletions
7
docs/content/user-manual/elasticjob-lite/usage/event-trace/spring-namespace.en.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
+++ | ||
title = "Spring Namespace" | ||
weight = 3 | ||
chapter = true | ||
+++ | ||
|
||
TODO |
48 changes: 48 additions & 0 deletions
48
docs/content/user-manual/elasticjob-lite/usage/event-trace/table-structure.cn.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
+++ | ||
title = "表结构说明" | ||
weight = 4 | ||
chapter = true | ||
+++ | ||
|
||
事件追踪的 event_trace_rdb_url 属性对应库自动创建 JOB_EXECUTION_LOG 和 JOB_STATUS_TRACE_LOG 两张表以及若干索引。 | ||
|
||
## JOB_EXECUTION_LOG 字段含义 | ||
|
||
| 字段名称 | 字段类型 | 是否必填 | 描述 | | ||
| ---------------- |:------------- |:-------- |:----------------------------------------------------- | | ||
| id | VARCHAR(40) | 是 | 主键 | | ||
| job_name | VARCHAR(100) | 是 | 作业名称 | | ||
| task_id | VARCHAR(1000) | 是 | 任务名称,每次作业运行生成新任务 | | ||
| hostname | VARCHAR(255) | 是 | 主机名称 | | ||
| ip | VARCHAR(50) | 是 | 主机IP | | ||
| sharding_item | INT | 是 | 分片项 | | ||
| execution_source | VARCHAR(20) | 是 | 作业执行来源。可选值为NORMAL_TRIGGER, MISFIRE, FAILOVER | | ||
| failure_cause | VARCHAR(2000) | 否 | 执行失败原因 | | ||
| is_success | BIT | 是 | 是否执行成功 | | ||
| start_time | TIMESTAMP | 是 | 作业开始执行时间 | | ||
| complete_time | TIMESTAMP | 否 | 作业结束执行时间 | | ||
|
||
JOB_EXECUTION_LOG 记录每次作业的执行历史。 | ||
分为两个步骤: | ||
|
||
1. 作业开始执行时向数据库插入数据,除 failure_cause 和 complete_time 外的其他字段均不为空。 | ||
1. 作业完成执行时向数据库更新数据,更新 is_success, complete_time 和 failure_cause(如果作业执行失败)。 | ||
|
||
## JOB_STATUS_TRACE_LOG 字段含义 | ||
|
||
| 字段名称 | 字段类型 | 是否必填 | 描述 | | ||
| ---------------- |:--------------|:---------|:------------------------------------------------------------------------------------------------------------- | | ||
| id | VARCHAR(40) | 是 | 主键 | | ||
| job_name | VARCHAR(100) | 是 | 作业名称 | | ||
| original_task_id | VARCHAR(1000) | 是 | 原任务名称 | | ||
| task_id | VARCHAR(1000) | 是 | 任务名称 | | ||
| slave_id | VARCHAR(1000) | 是 | 执行作业服务器的名称,Lite版本为服务器的IP地址,Cloud版本为Mesos执行机主键 | | ||
| source | VARCHAR(50) | 是 | 任务执行源,可选值为CLOUD_SCHEDULER, CLOUD_EXECUTOR, LITE_EXECUTOR | | ||
| execution_type | VARCHAR(20) | 是 | 任务执行类型,可选值为NORMAL_TRIGGER, MISFIRE, FAILOVER | | ||
| sharding_item | VARCHAR(255) | 是 | 分片项集合,多个分片项以逗号分隔 | | ||
| state | VARCHAR(20) | 是 | 任务执行状态,可选值为TASK_STAGING, TASK_RUNNING, TASK_FINISHED, TASK_KILLED, TASK_LOST, TASK_FAILED, TASK_ERROR | | ||
| message | VARCHAR(2000) | 是 | 相关信息 | | ||
| creation_time | TIMESTAMP | 是 | 记录创建时间 | | ||
|
||
JOB_STATUS_TRACE_LOG 记录作业状态变更痕迹表。 | ||
可通过每次作业运行的 task_id 查询作业状态变化的生命周期和运行轨迹。 |
7 changes: 7 additions & 0 deletions
7
docs/content/user-manual/elasticjob-lite/usage/event-trace/table-structure.en.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
+++ | ||
title = "Table Structure" | ||
weight = 4 | ||
chapter = true | ||
+++ | ||
|
||
TODO |