You can refer to this section to create a scheduled task. Scheduled tasks allow you to configure automatic execution of tasks for execution objects such as tenants and tables on dimensions such as minutes, days, weeks, and months, thereby improving your O&M efficiency.
Considerations
The execution of scheduled tasks consumes hardware resources of the system such as CPU, memory, and I/O. It is recommended that you reasonably evaluate the resource consumption based on the current business load of the system before creating a scheduled task to avoid affecting normal business operations due to task execution.
Procedure
Log in to OCP.
In the left-side navigation pane, choose O&M Management > Scheduled Tasks.
Click Create Task.
In the Create Scheduled Task panel, configure the execution details of the scheduled task.
a. Configure the basic information of the scheduled task.
ParameterDescriptionTask Name The name of the scheduled task, which must be unique and meet the following requirements: - It must start with a Chinese or English letter and end with a Chinese character, number, or English letter.
- It must be 2 to 32 characters in length.
- The only supported special symbol is the underscore (_).
Execution Object You can select the execution object from the Tenant or Table dimension. Select Tenant/Member Tenant Select the execution object as needed. Ensure the cluster to which the tenant belongs is V4.2.1.0 or later.
When the execution object is Tenant:- You can click Add to add multiple tenants.
- When All is selected for the cluster or tenant, you can use Excluded Objects to exclude objects that do not need to execute the scheduled task.
Task Type Select the execution type of the scheduled task. - When the execution object is Tenant, the following two task types are supported: Tenant-Level Major Compaction and Statistical Information Collection and Tenant-Level Major Compaction.
- Tenant-Level Major Compaction and Statistical Information Collection: Triggers tenant major compaction and statistical information collection periodically to optimize storage space and query performance. (Only the primary tenant can initiate the major compaction operation.)
- Tenant-Level Major Compaction: Triggers tenant major compaction periodically to optimize storage space and query performance. (Only the primary tenant can initiate the major compaction operation.)
- When the execution object is Table, only Table-Level Statistical Information Collection is supported. Collects table statistics periodically to optimize query performance.
Statistic Collection Object When the execution object is Table, you can select specific databases or tables. Up to 50 tables are supported. Schema Statistics Parameters When the task type is set to Tenant-Level Major Compaction and Statistical Information Collection or Table-Level Statistical Information Collection, OCP provides default configurations for parameters such as collection method, collection parallelism, and collection granularity. You can use the existing system configuration directly or click the edit button next to a parameter to modify it based on actual business needs. For detailed parameter descriptions, refer to Modify parameters for automatic statistical information collection in Collect statistical information. b. Configure the execution parameters of the scheduled task.
ParameterDescriptionScheduling Plan Select the execution mode of the scheduled task. Three types are supported: Repeated Execution, Expression Setting, and One-Time Execution. - Repeated Execution: Executes the task at fixed intervals.
- Expression Setting: Executes the task according to a custom expression.
- One-Time Execution: The task runs only once.
Execution Frequency Fill in when the scheduling plan is Repeated Execution. Supported frequencies include per minute, per day, per week, and per month. Expression Fill in when the scheduling plan is Expression Setting. You can configure the task execution frequency using a Crontab expression. For fields and values of the Crontab expression, refer to Scheduling Expression in Background tasks list. </main id="notice" type='notice'> Note
- The Crontab expression does not support configuring the
secondfield. Other fields can be configured by referring to this document. - Ensure the expression format is entered accurately. Incorrect formats (such as entering non-existent dates or having extra spaces in the expression) will prevent the scheduled task from executing.
Execution Time Select the specific execution time of the scheduled task. End Date Select the end time of the scheduled task. Two types are supported: Infinite and Custom. - Infinite: The task will continue to run until manually stopped.
- Custom: Set a specific time, and the task will stop at that point.
Whether to Allow Concurrent Execution of Multiple Tasks with the Same Object Fill in when the scheduling plan is Repeated Execution or Expression Setting. When Allow is selected, the system creates new scheduled tasks before the previous one is completed, and multiple tasks can run in parallel. c. Configure the scheduling expiration strategy for the scheduled task.
ParameterDescriptionMaximum Delay Time Select the maximum allowable delay for the scheduled task. Whether to Execute After Exceeding Maximum Delay Time When the task execution exceeds the maximum delay time, you can choose whether to discard the task and stop its execution. d. Choose whether to enable the scheduled task. After enabling, the scheduled task takes effect immediately upon successful creation.
(Optional) Add remarks for the scheduled task.
Click Create.
