You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/07/19 05:25:33 UTC

[shardingsphere-elasticjob] branch master updated: Add document for usage of snapshot service (#1158)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob.git


The following commit(s) were added to refs/heads/master by this push:
     new bb05378  Add document for usage of snapshot service (#1158)
bb05378 is described below

commit bb0537817f25eb16f22debdac028c084d398087f
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Jul 19 13:25:23 2020 +0800

    Add document for usage of snapshot service (#1158)
    
    * Update java-api
    
    * Update spring namespace
---
 .../elasticjob-lite/operation/dump.cn.md           |  2 +-
 .../elasticjob-lite/operation/dump.en.md           |  2 +-
 .../elasticjob-lite/usage/job-api/java-api.cn.md   | 23 ++++++++++++++++
 .../elasticjob-lite/usage/job-api/java-api.en.md   | 32 ++++++++++++++++++++--
 .../usage/job-api/spring-namespace.cn.md           | 28 +++++++++++++++++++
 .../usage/job-api/spring-namespace.en.md           | 27 ++++++++++++++++--
 6 files changed, 108 insertions(+), 6 deletions(-)

diff --git a/docs/content/user-manual/elasticjob-lite/operation/dump.cn.md b/docs/content/user-manual/elasticjob-lite/operation/dump.cn.md
index 4fe1a85..390c68a 100644
--- a/docs/content/user-manual/elasticjob-lite/operation/dump.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/operation/dump.cn.md
@@ -1,5 +1,5 @@
 +++
-title = "Dump 作业运行信息"
+title = "导出作业信息"
 weight = 2
 chapter = true
 +++
diff --git a/docs/content/user-manual/elasticjob-lite/operation/dump.en.md b/docs/content/user-manual/elasticjob-lite/operation/dump.en.md
index e3d44be..e5bc79d 100644
--- a/docs/content/user-manual/elasticjob-lite/operation/dump.en.md
+++ b/docs/content/user-manual/elasticjob-lite/operation/dump.en.md
@@ -1,5 +1,5 @@
 +++
-title = "Dump Job Runtime Info"
+title = "Dump Job Information"
 weight = 2
 chapter = true
 +++
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.cn.md
index 38434b4..7506d5b 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.cn.md
@@ -68,3 +68,26 @@ public class JobDemo {
     }
 }
 ```
+
+## 配置作业导出端口
+
+使用 ElasticJob-Lite 过程中可能会碰到一些分布式问题,导致作业运行不稳定。
+
+由于无法在生产环境调试,通过 dump 命令可以把作业内部相关信息导出,方便开发者调试分析;
+
+导出命令的使用请参见[运维指南](/cn/user-manual/elasticjob-lite/operation/dump)。
+
+以下示例用于展示如何通过 SnapshotService 开启用于导出命令的监听端口。
+
+```java
+public class JobMain {
+    
+    public static void main(final String[] args) {
+        SnapshotService snapshotService = new SnapshotService(regCenter, 9888).listen();
+    }
+    
+    private static CoordinatorRegistryCenter createRegistryCenter() {
+        // 创建注册中心
+    }
+}
+```
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.en.md
index 140479c..f3d374b 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/java-api.en.md
@@ -43,7 +43,7 @@ public class JobDemo {
 }
 ```
 
-### One-time scheduling
+### One-Off scheduling
 
 ```java
 public class JobDemo {
@@ -67,4 +67,32 @@ public class JobDemo {
         ...
     }
 }
-```
\ No newline at end of file
+```
+
+## Job Dump
+
+Using ElasticJob may meet some distributed problem which is not easy to observe.
+
+Because of developer can not debug in production environment, ElasticJob provide `dump` command to export job runtime information for debugging.
+
+Please refer to [Operation Manual](/cn/user-manual/elasticjob-lite/operation/dump) for more details.
+
+The example below is how to configure spring namespace for open listener port to dump.
+
+```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
+                         ">
+    <!--Configure register center -->
+    <elasticjob:zookeeper id="regCenter" server-lists="yourhost:2181" namespace="dd-job" base-sleep-time-milliseconds="1000" max-sleep-time-milliseconds="3000" max-retries="3" />
+    
+    <!--Configure snapshot for dump service -->
+    <elasticjob:snapshot id="jobSnapshot" registry-center-ref="regCenter" dump-port="9999" />    
+</beans>
+```
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.cn.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.cn.md
index 8b9ab5d..5c52987 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.cn.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.cn.md
@@ -42,3 +42,31 @@ ElasticJob-Lite 提供自定义的 Spring 命名空间,可以与 Spring 容器
 ## 作业启动
 
 将配置 Spring 命名空间的 xml 通过 Spring 启动,作业将自动加载。
+
+## 配置作业导出端口
+
+使用 ElasticJob-Lite 过程中可能会碰到一些分布式问题,导致作业运行不稳定。
+
+由于无法在生产环境调试,通过 dump 命令可以把作业内部相关信息导出,方便开发者调试分析;
+
+导出命令的使用请参见[运维指南](/cn/user-manual/elasticjob-lite/operation/dump)。
+
+以下示例用于展示如何通过 Spring 命名空间开启用于导出命令的监听端口。
+
+```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="dd-job" base-sleep-time-milliseconds="1000" max-sleep-time-milliseconds="3000" max-retries="3" />
+    
+    <!--配置任务快照导出服务 -->
+    <elasticjob:snapshot id="jobSnapshot" registry-center-ref="regCenter" dump-port="9999" />    
+</beans>
+```
diff --git a/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
index bd1022c..85c45c0 100644
--- a/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
+++ b/docs/content/user-manual/elasticjob-lite/usage/job-api/spring-namespace.en.md
@@ -7,7 +7,7 @@ chapter = true
 ElasticJob-Lite provides a custom Spring namespace, which can be used with the Spring.
 Through the way of DI (Dependency Injection), developers can easily use data sources and other objects that managed by the Spring container in their jobs, and use placeholders to get values ​​from property files.
 
-## Job configuration
+## Job Configuration
 
 ```xml
 <?xml version="1.0" encoding="UTF-8"?>
@@ -39,6 +39,29 @@ Through the way of DI (Dependency Injection), developers can easily use data sou
 </beans>
 ```
 
-## Job start
+## Job Start
 
 If the Spring container start, the `XML` that configures the Spring namespace will be loaded, and the job will be automatically started.
+
+## Job Dump
+
+Using ElasticJob may meet some distributed problem which is not easy to observe.
+
+Because of developer can not debug in production environment, ElasticJob provide `dump` command to export job runtime information for debugging.
+
+Please refer to [Operation Manual](/cn/user-manual/elasticjob-lite/operation/dump) for more details.
+
+The example below is how to configure SnapshotService for open listener port to dump.
+
+```java
+public class JobMain {
+    
+    public static void main(final String[] args) {
+        SnapshotService snapshotService = new SnapshotService(regCenter, 9888).listen();
+    }
+    
+    private static CoordinatorRegistryCenter createRegistryCenter() {
+        // Create registry center
+    }
+}
+```