Fast learning-Saturn creates homework

Create assignment

1 Login

Use a browser to visit saturn.vip.vip.com. If the login function is enabled (-Dauthentication.enabled=true), it will be redirected to CAS for identity authentication.

In order to get the best experience, it is recommended to use the Chrome browser.

After logging in, you will see the Saturn Home Page as follows:

Insert picture description here

Users need to enter the domain name you need to visit in the central search box.

The functions of the menu bar at the top of the homepage are as follows:

  • Job Management: Domain Search Page
  • Dashboard: Job/Executor operating status chart
  • Alarm Center: The global alarm market.
  • Registration Center: List of domain and ZK cluster information.
  • System configuration: system parameter settings.

If the authorization function is enabled, you may not see some menus due to permissions.

2 Job overview

Enter your domain name on the Home page, and then click Enter. If your domain name is not found, please add the domain first.

Insert picture description here

  1. Job overview: As shown in the screenshot, it displays all jobs and status in the domain, and provides some operations.

  2. Executor overview: See all executor information under the domain.

  3. Alarm Center: List all alarms related to this domain

  4. Job name: Different icons will be displayed in front of the job name according to different types. As an example above, 0326 shell is a Shell job, and demoJavaJob is a Java job.

  5. The job status is described as follows:

    • Ready : The job has been enabled, but is not running.

      If the report running status is set (non-second jobs are reported by default), "Ready" means that the job has not yet reached the running time. If the running status is not reported, "Ready" only means that the job has been activated, and it is not known whether it is running.

      Report running status: Switch of running status report of Executor job. See the "Detailed Job Settings" chapter below for details

    • Running : The job is running.

    • Stopped : The job is stopped and is not running.

    • Stopping : The job is disabled, but the job is running. It will change to "stopped" status after running.

  6. Assignment grouping: For management convenience, assignments can be grouped. How to group will be described in "Detailed Job Settings".

  7. Fragmentation: Shows how many different executors the job is fragmented to. The executor can be a container or a physical machine. Move the mouse to the icon to see the detailed executor name.

  8. Disable and copy operation of a single job: Disable operation icon and copy operation icon in turn.

    If a job has been enabled, you can disable it.

    It should be noted that disabling the job does not mean that the job will be terminated immediately. By default, it will wait for the completion of this execution. If you want to terminate it immediately, you need to enter the job detailed settings page and click "Terminate Now".

  9. Job operation button bar, in order:

    • Batch enable: Select jobs in the "stopped" state in batches to enable them.

    • Batch disable: batch select the jobs that are enabled (including in the ready and running state) and disable them.

    • Batch delete: batch delete jobs in the "stopped" state.

    • Batch priority (Executor): If you want to select a specific executor to run your job, you need to set a priority executor. The candidates in the drop-down box are all executors in the current domain.

      Note that in the case where the priority executor(s) is still online, Saturn will not schedule jobs to run to other executors that have not become priority, unless all priority executors are offline.

    • Add (single job): Quickly add a single job.

    • Import (job): define the job configuration in excel in advance (template is provided in the pop-up window), and then use this function to upload this excel to complete batch import.

    • Export (job): Export the configuration of all jobs under the domain to excel.

      Tips: If you want to transfer all the tasks in the test environment to the production environment, you only need to export an excel in the test environment and then import it into the production environment.

  10. Search for assignments: Search for your assignments by assignment name.

  11. Abnormal job overview: Display the number of abnormal jobs in the domain, click to enter the alarm center.

  12. Enabling and deleting a single job: If the job is in the "stopped" state, you can enable it through the enable button, or use the "delete" function to delete it.

3. Add your assignment

There are three different ways to add a job: create a brand new job, import your job from xls, or copy an existing job.

3.1 Create a new assignment

You can add different types of assignments by clicking the "Add" button in the assignment overview. Currently supports 2 types of jobs: Java timing jobs and Shell timing jobs.

3.1.1 Create Java Timer Job

Insert picture description here

  • Job name: The unique job name in the entire domain.

  • Job implementation class: the implementation class of Java job code.

  • Total number of shards: The same job can be divided into multiple shards for concurrent scheduling. The default total number of shards is 1.

  • Cron expression: based on Quartz's cron expression, the official tutorial is here , and the Chinese tutorial is here . You can click the " Forecast " button to check whether your Cron is correct.

  • Fragmentation parameters: The fragment sequence number and parameters are separated by an equal sign, and multiple key-value pairs are separated by commas. The fragment sequence number starts from 0 and cannot be greater than or equal to the total number of job fragments. For example: 0=a,1=b,2=c; Please use !! instead of English double quotation marks, use @@ instead of English equal signs, and ## instead of English commas.

    If no parameters are required for all fragments of the job, just keep the value 0. For example, if there are 2 fragments without parameters, it is "0=0".
    For jobs in local mode, the format is *=value. For an introduction to the local mode, see the chapter "Detailed Job Settings".

3.1.2 Create Shell Timing Job

Saturn's support for programming languages ​​is theoretically unlimited. For non-Java jobs, please use Shell type jobs to build.

The parameters of Shell type jobs are basically the same as Java timing jobs. Below are 2 examples.

Shell script

If you want to run a shell script named "helloworld.sh", you can set the following in the slice parameters. Among them, some_folder is the directory of your script in the executor.

0=/bin/sh some_folder/helloword.sh

Linux Command

0=echo 'hello world'

PHP

0=php helloworld.php
3.1.3 Create a passive job

Note, please use version 3.3.0 and above for this function.

Insert picture description here

  • Passive jobs are used for job scheduling. When the upstream job is executed successfully, it will trigger the downstream job to be executed immediately.

  • Only passive jobs can configure upstream jobs. Downstream operations must be passive operations.

  • The upstream job cannot be a local mode job, and the number of fragments can only be 1.

  • The configured upstream and downstream operation chain cannot form a loop.

3.2 Import job

See the introduction of "Import (Job)" and "Export (Job)" in the chapter "Job Overview".

A common usage scenario is to migrate batch jobs between different environments.

3.3 Copy job

Copy a new job from an existing job.

See the introduction of "Disabling and Copying a Single Job" in the "Job Overview" chapter.

4. Detailed job settings

Click on job settings, you will see more job configuration parameters.

4.1 Java job detailed settings

Insert picture description here

  • User-defined parameters: can be referenced in the form of alias in the fragment sequence number/parameter comparison table, the format is {key1}; the job implementation class can be obtained through the SaturnJobExecutionContext#getJobParameter method.

    Configuration format: Multiple configurations are separated by commas (key1=value1, key2=value2).

  • Priority Executor: If you want to select a specific physical machine executor to run your job, you need to set a priority executor. The candidates in the drop-down box are all online executors in the current domain.

    Note that when the priority executor(s) is online, Saturn will not schedule jobs to run to other executors that have not become priority, unless all priority executors are offline.

  • Only use the priority executor: If the priority executor is offline, it will not failover to other machines.

  • Local mode: There are some timing tasks (such as regular cleaning of local logs, regular updates of local configuration, etc.) that require regular execution, and can only be executed by one process (thread); when new machines are continuously added, the newly added machines can Automatically participate in timing execution; when a machine goes offline, no other machine is required to take over its task, and no failover is required. Such tasks (jobs) are often related to local operations, and we call them local mode operations.
    Insert picture description here

  • Timeout alarm: Send an alarm if this threshold is exceeded (the alarm only provides an interface, and each user needs to implement the alarm logic by himself). 0 means not set (default).

  • Forced kill over time: If the threshold is exceeded, the player will be forced to kill. 0 means not set (default).

  • Owning group: The group to which the configuration job belongs. You can filter by group on the job overview page. Configure environment variables or the -D parameter VIP_SATURN_INIT_JOB_BY_GROUPS when the Executor starts to support starting only the jobs belonging to the relevant group.

  • Job load: The core idea of ​​the Saturn Executor job fragmentation scheduling algorithm is to try to ensure that the executor load of the entire domain is even. The load of Executor is equal to the weight of all job fragments multiplied by the load. Simply put, if you want the job to take up more resources (Executor), set the secondary load to a large number.

  • Statistical processing interval: Executor periodically reports some statistical data to the Console. This setting item sets the size of this period.

  • Console output log: After enabling, all jobs printed to the console log will be displayed here. Not enabled by default. It is recommended to use it only during operation debugging. Because a large number of logs will affect the performance of ZK.

  • Report running status: If this function is enabled, the executor will report whether the job is running or has completed running status to ZK. For timed jobs (including Java and Shell), if the scheduling frequency is higher than 5 seconds, it will be reported by default, otherwise it will not be reported. For message jobs, it is not reported by default.

  • Failover (failover): After enabling, if the executor suddenly drops during the operation of the job, the shards running on the executor will failover to other executors, waiting to be re-executed during the next scheduling. The subordinate situation will not failover:

    • Jobs that do not report running status (such as second-level jobs)
    • Local mode operation
  • Retry for outdated and not run: Provide a one-time compensation mechanism, so that outdated and unrun jobs have a chance to run again. This function is mainly for low-frequency jobs . You can turn on this option when you schedule jobs more than half a day or execute jobs at once.

  • Downstream jobs: starting from version 3.3.0, used for job scheduling.

  • Suspended date: the job will not run during this date. Support multiple date ranges, separated by commas. For example, 03/12-03/15, 11/23-12/25. When the date is empty and the time period is not empty, it means that those time periods are suspended every day

  • Pause time period: the job will not run during this time period. Support multiple time periods, separated by commas. For example, 12:23-13:23,16:00-17:00. When the date is not empty and the time period is empty, it means that those dates are suspended for 24 hours

    • Example: How to set a job suspension between 19:50 and 20:30 on 11/10, see below

Insert picture description here

4.2 Shell job detailed settings

The description is consistent with the detailed settings of the Java job above.

5. Enable job

After adding a job, it needs to be enabled to be executed by the executor.

There are several ways to enable jobs:

  • Enable batches or enable single jobs on the job preview page, as shown below:

Insert picture description here

  • Enable the job in the job operation bar, as shown below:
    Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_42528266/article/details/108602799