All Products
Search
Document Center

SchedulerX:Use the SchedulerX agent to connect an application to SchedulerX (Script or HTTP jobs)

Last Updated:Oct 12, 2024

After you use the SchedulerX agent to connect your application to SchedulerX, you can create scheduled jobs, rerun jobs, view job run records, and view operational logs in a visualized manner in the SchedulerX console. This topic describes how to use the TAR package or image of the SchedulerX agent to connect a non-Java application to SchedulerX.

Prerequisites

Scenario

You can use the agent to connect your application to SchedulerX in the following scenarios:

  • You use a Shell script to clear the logs of all worker nodes or launch a service at a scheduled point in time.

  • You use a Python script to clear historical data in a database at a scheduled point in time.

  • You use an HTTP API to scan orders at a scheduled point in time.

Environment requirement

The runtime environment must be Java Runtime Environment (JRE) 1.8 or later.

Manually deploy the agent

  1. Download the package of the agent and decompress the package.

    If your worker node is assigned a public IP address, run the following command to download the package:

    Note

    Replace X.X.X with the required version number, such as 1.10.13.

    wget https://schedulerx2.oss-cn-hangzhou.aliyuncs.com/agent/schedulerxAgent-X.X.X.tar

    Version

    Download URL

    Description

    Agent 1.11.5

    https://schedulerx2.oss-cn-hangzhou.aliyuncs.com/agent/schedulerxAgent-1.11.5.tar

    Fixed issues:

    • Netty and Logback have security vulnerabilities.

    • The following error message appears when you run Kubernetes jobs: too old resource version.

    Agent 1.10.13

    https://schedulerx2.oss-cn-hangzhou.aliyuncs.com/agent/schedulerxAgent-1.10.13.tar

    New features:

    • Multiple agents can be deployed on one worker node at the same time.

    • HTTP agent jobs support responses that are larger than 1,000 bytes in size.

    • Logs are optimized to reduce historical log storage.

    Agent 1.10.5

    https://schedulerx2.oss-cn-hangzhou.aliyuncs.com/agent/schedulerxAgent-1.10.5.tar

    New features:

    • The graceful shutdown feature is supported.

    • Logs can be isolated by application group.

    Agent 1.9.8

    https://schedulerx2.oss-cn-hangzhou.aliyuncs.com/agent/schedulerxAgent-1.9.8.tar

    New features:

    • HTTP agent jobs are supported.

    • The final log entry can be retrieved if a script execution fails.

    • Kubernetes jobs are supported.

    Agent 1.7.10

    https://schedulerx2.oss-cn-hangzhou.aliyuncs.com/agent/schedulerxAgent-1.7.10.tar.gz

    Fixed issues:

    • Second-delay jobs run slowly.

    • Out of memory (OOM) issues may be caused by the logging feature.

    Agent 1.4.2

    https://schedulerx2.oss-cn-hangzhou.aliyuncs.com/agent/schedulerxAgent-1.4.2.tar.gz

    New feature: The logging feature is supported.

    Important

    Run the wget command to download the SchedulerX agent. If the connection to the website times out, assign a public IP address to the Elastic Compute Service (ECS) instance or see Upload a file to a Linux instance.

  2. Go to the schedulerxAgent/conf directory and configure the agent.properties file.

    Configure the following parameters:

    endpoint=addr-hz-internal.edas.aliyun.com
    namespace=fd2965c4-****-****-af52-bb62aa4*****
    groupId=hxm.test
    appKey=1234*****
    • endpoint: the endpoint of the agent. For more information, see Endpoints.

    • namespace: the ID of the SchedulerX namespace or the Enterprise Distributed Application Service (EDAS) microservices namespace. You can obtain the ID on the Namespace page in the SchedulerX console or the page in the EDAS console.

    • groupId: the unique ID of the application. appKey: the unique key of the application. You can obtain the ID and key of the application on the Application Management page in the SchedulerX console.

  3. Go to the schedulerxAgent/bin directory and run the start.sh script to deploy the agent.

    Note

    If you want to start the memory component of the agent, you can run the start-200m.sh, start-500m.sh, or start-1g.sh script.

    While the agent is being deployed, you can perform the following operations based on your business requirements:

    • Stop the agent: Go to the schedulerxAgent/bin directory and run the stop.sh script.

    • View the log: The path of the log is ${user.home}/logs/schedulerx/worker.log.

      You can run the ps aux | grep java command to obtain the value of user.home. If you use the admin account to launch the process, the log resides in the /home/admin/logs/schedulerx/worker.log path. If you use the root account to launch the process, the log resides in the /root/logs/schedulerx/worker.log path.

    If the returned information contains Schedulerx Worker started, the agent is deployed.

    Note

    Make sure that the runtime environment is JDK 1.8 to 14. If you use a JDK version later than 14, remove the -XX:+UseConcMarkSweepGC option from the schedulerxAgent/bin/start.sh file in the agent installation directory.

    image

Use a Docker image to deploy the SchedulerX agent

  1. Select a Docker image based on your network and CPU architecture.

    Network

    x86_64

    arm64

    Internet

    registry.cn-hangzhou.aliyuncs.com/schedulerx/agent:1.11.6-amd64

    registry.cn-hangzhou.aliyuncs.com/schedulerx/agent:1.11.6-arm64

    Virtual private cloud (VPC) in China (Hangzhou)

    registry-vpc.cn-hangzhou.aliyuncs.com/schedulerx/agent:1.11.6-amd64

    registry-vpc.cn-hangzhou.aliyuncs.com/schedulerx/agent:1.11.6-arm64

    VPC in a region other than China (Hangzhou)

    registry-vpc.{regionId}.aliyuncs.com/schedulerx/agent:1.11.6-amd64

    registry-vpc.{regionId}.aliyuncs.com/schedulerx/agent:1.11.6-arm64

  2. Deploy the SchedulerX agent.

    The following table describes the parameters.

    docker run  --env SCHEDULERX_ENDPOINT="addr-hz-internal.edas.aliyun.com" \
       --env SCHEDULERX_NAMESPACE="fd2965c4-****-****-af52-bb62aa4*****" \
       --env SCHEDULERX_GROUPID="hxm.test" \
       --env SCHEDULERX_APPKEY="1234*****" \
       -d {image id}
    • SCHEDULERX_ENDPOINT: the endpoint.

    • SCHEDULERX_NAMESPACE: the ID of the SchedulerX namespace or the EDAS microservices namespace. You can obtain the ID on the Namespace page in the SchedulerX console or the page in the EDAS console.

    • SCHEDULERX_GROUPID: the application ID. SCHEDULERX_APPKEY: the application key. You can obtain the ID and key of the application on the Application Management page in the SchedulerX console or the page in the EDAS console.

    After you start to deploy the agent, you can run the docker logs command to view logs.