Task scheduling method, device, system, computer equipment and readable storage medium

By automatically determining the primary and backup roles of the target server in the server cluster and using database identifiers for task scheduling, the problems of easy error operation and low timeliness in task scheduling in the existing technology are solved, and the automation and efficiency of primary and backup server switching are realized.

CN115248722BActive Publication Date: 2026-11-24NETSUNION CLEARING CORP
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110459524.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-27
Publication Date
2026-11-24
Estimated Expiration
2041-04-27

AI Technical Summary

Technical Problem

Existing task scheduling methods are prone to errors and have low timeliness, especially when switching between primary and backup servers, which requires manual intervention and leads to insufficient timeliness of task batch processing systems.

Method used

The system automatically detects whether a target server is the master server within the server cluster. If it is the master server, the system executes the pending task data; otherwise, it abandons execution. This automatic determination is achieved using an identifier code in the database, avoiding manual intervention.

Benefits of technology

The process of switching between primary and backup servers has been automated, which has improved the timeliness and accuracy of task scheduling, avoided misoperation, and ensured the continuity of task processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115248722B_ABST
    Figure CN115248722B_ABST
Patent Text Reader

Abstract

This invention relates to the field of data processing technology, and discloses a task scheduling method, apparatus, system, computer equipment, and readable storage medium. The method includes: acquiring task data to be processed; determining whether a target server is a primary server; if the target server is a primary server, executing the task data to be processed; if the target server is a backup server, abandoning the execution of the task data to be processed. By implementing this invention, automatic switching between primary and backup servers is achieved, eliminating the need for manual intervention during task scheduling, improving the timeliness of the primary / backup switching process, and thus ensuring the timeliness of task processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and specifically to a task scheduling method, apparatus, system, computer equipment, and readable storage medium. Background Technology

[0002] To reduce application load, the data centralization platform used in the reserve fund system is typically deployed with a system architecture of one primary server and multiple backup servers. Correspondingly, the task batch processing system used in the reserve fund system is also typically deployed with a similar architecture. To avoid disruptions to task processing continuity in extreme situations (such as power outages in the data center), the data centralization platform needs to have the ability to quickly switch between primary and backup servers, and the task batch processing system also needs to have primary / backup switching capabilities and ensure synchronous switching with the data centralization platform.

[0003] In related technologies, task batch processing systems retrieve tasks from the scheduling system. When a master-slave switchover is required, operations personnel need to log into the scheduling system of the failed master server, manually shut down the scheduling tasks on the failed master server, and then log into the scheduling system of the new master server to manually start the scheduling tasks on the new master server. Therefore, during a master-slave switchover, the switching of the scheduling system requires manual intervention, which can easily lead to errors in the task batch processing system and results in low timeliness. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a task scheduling method, apparatus, computer device, and readable storage medium to solve the problems of easy misoperation and low timeliness of existing task scheduling methods.

[0005] According to a first aspect, embodiments of the present invention provide a task scheduling method, executed by any target server in a server cluster, wherein the server cluster includes a master server and several backup servers, and the task scheduling method includes the following steps: acquiring task data to be processed; determining whether the target server is the master server; if the target server is the master server, executing the task data to be processed; if the target server is a backup server, abandoning the execution of the task data to be processed.

[0006] The task scheduling method provided in this invention acquires task data to be processed and calculates whether the target server is the primary server. If the target server receiving the task data is the primary server, the task data is executed; if the target server is the backup server, the task data is abandoned. This achieves automatic primary / backup server detection. During primary / backup server switching, the original primary server can immediately stop executing the task data, while the new primary server can quickly begin executing it. This task scheduling process requires no manual intervention and can quickly complete the primary / backup server switchover, improving the timeliness of the switchover process and thus ensuring the timeliness of task processing.

[0007] In conjunction with the first aspect, in the first embodiment of the first aspect, determining whether the target server is the main server includes: querying a database to obtain the identifier code corresponding to the server and the main server identifier code from the database; comparing the identifier code with the main server identifier code; and determining whether the target server is the main server based on the comparison result of the identifier code and the main server identifier code.

[0008] The task scheduling method provided in this invention determines whether the current server is the primary server by querying the database to obtain the identification code of the current server and the primary server identification code. This achieves automatic detection of the primary and backup servers without manual intervention, solving the problem of excessive time consumption caused by manual intervention in starting and stopping servers, and thus ensuring the timeliness of the scheduled task execution.

[0009] In conjunction with the first embodiment of the first aspect, in the second embodiment of the first aspect, if the server is the main server, executing the task data to be processed includes: obtaining the task identifier code corresponding to the task data to be processed; determining whether the identifier code matches the task identifier code; when the identifier code matches the task identifier code, the target server executes the task data to be processed.

[0010] In conjunction with the second embodiment of the first aspect, in the third embodiment of the first aspect, if the server is the master server and executes the task data to be processed, the step further includes: when the identifier code does not match the task identifier code, the target server does not execute the task data to be processed.

[0011] The task scheduling method provided in this embodiment of the invention obtains the task identifier code corresponding to the task data to be processed when the server is the master server, and determines whether the identifier code corresponding to the server matches the task identifier code. When the identifier code corresponding to the server matches the task identifier code, the target server executes the task data to be processed; when the identifier code corresponding to the server does not match the task identifier code, the target server discards the task data to be processed. This ensures that there is a one-to-one correspondence between the master server and the task data it executes, avoids errors in task execution, and thus ensures the accuracy of the tasks executed by the master server.

[0012] According to a second aspect, embodiments of the present invention provide a task scheduling device, which is set in any target server in a server cluster, the server cluster including a master server and several backup servers. The task scheduling device includes: an acquisition module for acquiring task data to be processed; a judgment module for judging whether the target server is the master server; an execution module for executing the task data to be processed if the target server is the master server; and an abandonment module for abandoning the execution of the task data to be processed if the target server is a backup server.

[0013] The task scheduling device provided in this embodiment of the invention acquires task data to be processed and calculates whether the target server is the primary server. If the target server receiving the task data is the primary server, the task data is executed; if the target server is the backup server, the task data is abandoned. This achieves automatic detection of primary and backup servers. During server primary / backup switching, the original primary server can immediately stop executing the task data, while the new primary server can quickly begin executing it. This task scheduling process requires no manual intervention and can quickly complete the primary / backup server switch for task data, improving the timeliness of the switchover process and thus ensuring the timeliness of task processing.

[0014] In conjunction with the second aspect, in the first embodiment of the second aspect, the judgment module includes: a query submodule, used to query a database and obtain the identifier code corresponding to the server and the main server identifier code from the database; a comparison submodule, used to compare the identifier code with the main server identifier code; and a determination submodule, used to determine whether the server is the main server based on the comparison result of the identifier code and the main server identifier code.

[0015] The task scheduling device provided in this embodiment of the invention obtains the identification code of the current server and the identification code of the master server by querying the database to determine whether the current server is the master server. This realizes the automatic detection of the master and backup servers without manual intervention, solves the problem of excessive time consumption caused by manual intervention in starting and stopping the server, and thus ensures the timeliness of the scheduled task execution.

[0016] According to a third aspect, embodiments of the present invention provide a task scheduling system, including: a first server and a second server; when the first server is a primary server and the second server is a backup server, the first server executes pending task data, and the second server discards the pending task data.

[0017] The task scheduling system provided in this embodiment of the invention includes a first server and at least one second server. When the first server is the primary server and the second server is the backup server, the first server executes the task data to be processed, and the second server discards the task data. This system ensures that the scheduled tasks are always executed on the primary server, so that when a primary / backup server switch occurs, the task data to be processed can be switched synchronously, thus ensuring the timeliness of the scheduled tasks.

[0018] In conjunction with the third aspect, in the first embodiment of the third aspect, when the first server fails, the second server is set as the master server; and the second server is controlled to execute the task data to be processed.

[0019] The task scheduling system provided in this invention, when the primary server fails, promptly starts a secondary server as a backup server and uses the secondary server as the primary server to execute pending task data. During primary / backup server switching, the system can quickly detect changes in the primary and backup servers and promptly control the original primary server to stop executing pending task data, while the new primary server begins executing it. Since the pending task data received by the backup server and the primary server are synchronized, there is no need to manually determine the details of pending tasks during primary / backup server switching, improving the timeliness of the switching process and ensuring the timely processing of scheduled tasks.

[0020] According to a fourth aspect, an embodiment of the present invention provides a computer device, including: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the task scheduling method described in the first aspect or any embodiment of the first aspect.

[0021] According to a fifth aspect, embodiments of the present invention provide a computer-readable storage medium storing computer instructions for causing a computer to perform the task scheduling method described in the first aspect or any embodiment of the first aspect. Attached Figure Description

[0022] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0023] Figure 1 This is a flowchart of a task scheduling method according to an embodiment of the present invention;

[0024] Figure 2 This is another flowchart of a task scheduling method according to an embodiment of the present invention;

[0025] Figure 3 This is a structural block diagram of a task scheduling device according to an embodiment of the present invention;

[0026] Figure 4 This is a structural block diagram of a task scheduling system according to an embodiment of the present invention;

[0027] Figure 5 This is a schematic diagram of the hardware structure of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0029] The current task batch processing system retrieves tasks from the scheduling system. When a master-slave switch is required, maintenance personnel need to log into the scheduling system of the failed master server, manually shut down the scheduling tasks on the failed master server, and then log into the scheduling system of the new master server to manually start the scheduling tasks on the new master server. Therefore, during a master-slave switch, the scheduling system requires manual intervention, which can easily lead to errors in the task batch processing system and results in low timeliness.

[0030] Based on this, the technical solution of the present invention automatically senses whether the current server is the master server to determine whether the task data to be processed should be executed on the current server. This eliminates the need for manual intervention in the switching of the scheduling system, thereby avoiding erroneous operations in the task batch processing system and ensuring the timeliness of task batch processing.

[0031] According to an embodiment of the present invention, an embodiment of a task scheduling method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0032] This embodiment provides a task scheduling method that can be used in application systems composed of server clusters, such as payment systems and Internet of Things (IoT) systems. This task scheduling method is executed by any target server in the server cluster, which includes one master server and several backup servers. Figure 1 This is a flowchart of a task scheduling method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:

[0033] S11, Obtain data for tasks to be processed.

[0034] The pending task data consists of scheduled tasks retrieved by the task batch processing system from the scheduling system. Taking the reserve fund system as an example, specifically, the task batch processing system corresponding to the main server and backup server of each reserve fund system will send a task retrieval request to the scheduling system. After receiving the task request information, the scheduling system determines the corresponding pending task data based on the task request information and sends the pending task data to the target server.

[0035] S12, determine whether the target server is the master server.

[0036] The task batch processing system of the backup server and the task batch processing system of the primary server simultaneously pull the task data to be processed from the scheduling system. At this time, it is necessary to intercept and verify the task to be processed in order to determine whether the target server pulling the task data is the primary server.

[0037] Both the primary server and the backup server have corresponding identifiers, which are stored in the database. When the task batch processing system corresponding to the target server retrieves the task data to be processed from the scheduling system, it can query the database for the target server's identifier and the primary server's identifier. By comparing whether the identifiers match, it determines whether the target server is the primary server. When the target server is the primary server, proceed to step S13; when the target server is the backup server, proceed to step S14.

[0038] S13, execute pending task data.

[0039] If the identifier code of the target server matches the identifier code of the master server, it indicates that the target server that retrieved the data to be processed is the master server. At this time, the target server becomes the server that executes the data to be processed and begins to execute the data it retrieved.

[0040] S14, Abandon processing pending task data.

[0041] If the identifier code of the target server does not match the identifier code of the primary server, it indicates that the target server for pulling the data to be processed is a backup server. In this case, the target server is not the server that will execute the data to be processed, and it will abandon its task of pulling the data and discard it.

[0042] The task scheduling method provided in this embodiment acquires the data of the task to be processed and calculates whether the target server is the primary server. If the target server receiving the data is the primary server, the task is executed; if the target server is the backup server, the task is abandoned. This achieves automatic detection of primary and backup servers. During server primary / backup switching, the original primary server can immediately stop executing the task, while the new primary server can quickly begin executing it. This task scheduling process requires no manual intervention and can quickly complete the primary / backup server switch for the task, improving the timeliness of the switchover process and thus ensuring the timeliness of task processing.

[0043] This embodiment provides a task scheduling method that can be used in application systems composed of server clusters, such as payment systems and Internet of Things (IoT) systems. This task scheduling method is executed by any target server in the server cluster, which includes one master server and several backup servers. Figure 2 This is a flowchart of a task scheduling method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:

[0044] S21, Obtain the data of the task to be processed. For detailed explanation, please refer to the relevant description of step S11 in the above embodiment, which will not be repeated here.

[0045] S22, determine whether the target server is the master server.

[0046] Specifically, step S22 above may include the following steps:

[0047] S221, query the database to obtain the server's corresponding identifier and the master server identifier.

[0048] The identifier code corresponding to each server is the Internet Data Center (IDC) identifier information for the current target server, and the master server identifier code is the Internet Data Center (IDC) identifier information for the master server. The identifier codes for each target server are stored in the database and used to determine whether the retrieved task data needs to be executed. While retrieving task data, the target server performs frequent database queries to obtain its corresponding identifier code and the master server identifier code.

[0049] S222, compare the identifier code with the master server identifier code.

[0050] The target server compares the identifier code with the master server identifier code to determine whether the target server identifier code matches the master server identifier code.

[0051] S223, Based on the comparison result between the identifier code and the master server identifier code, determine whether the target server is the master server.

[0052] The comparison result indicates whether the target server's identifier matches or does not match the master server's identifier. This comparison result determines whether the target server is the master server. Specifically, when the identifier matches the master server's identifier, the target server is the master server; when the identifier does not match the master server's identifier, the target server is the backup server.

[0053] S23, If the target server is the master server, execute the pending task data.

[0054] Specifically, step S23 above may include the following steps:

[0055] S231, Obtain the task identifier code corresponding to the task data to be processed.

[0056] The task identifier is the internet data identifier corresponding to the task data to be processed. The task data to be processed by the master server is usually configured with its internet identification information, i.e., IDC (Internet Data Center) identifier information. For example, the current reserve fund system has three master servers with identifiers of 10, 20, and 30. Since there is a one-to-one correspondence between the master server identifier and the task identifier, the corresponding task identifiers for the aforementioned master servers are 10, 20, and 30. Therefore, when the master server obtains a task to be processed, it needs to parse the IDC field in the task data to determine the corresponding task identifier.

[0057] S232, determine whether the identifier code matches the task identifier code.

[0058] Once the task identifier is obtained, it is compared with the identifier corresponding to the main server to determine if they match. If the server identifier matches the task identifier, proceed to step S233; otherwise, proceed to step S234.

[0059] For example, if the IDC identifier information of the main server of the reserve fund system is 20, and the IDC identifier information corresponding to the received task data is also 20, then the IDC identifier information of the task identifier is compared with the IDC identifier information of the main server to determine whether the IDC identifier information of the server identifier is consistent with the IDC identifier information of the task identifier.

[0060] S233, the target server executes pending task data.

[0061] When the identifier code corresponding to the target server matches the task identifier code corresponding to the task data to be processed, it indicates that the task to be processed corresponding to the current task identifier code belongs to the scheduling task that the master server needs to execute. For example, when the master server with identifier code 10 receives the task data to be processed, it determines whether its corresponding task identifier code is 10. If the task identifier code is 10, the master server executes the task data to be processed.

[0062] S234, The target server does not execute the pending task data.

[0063] When a task batch processing system or task scheduling system malfunctions, the task data retrieved by the target server through the batch processing system may not belong to the scheduled task it needs to execute. In other words, the task identifier code corresponding to the task data may not match the identifier code of the target server. In this case, the target server can intercept and discard the task data, refusing execution. For example, if the target server's identifier code is 10, when the target server receives the task data, it will check if the corresponding task identifier code is 10. If the received task data has an identifier code of 20, which does not match the target server's identifier code, the target server will intercept and discard the received task data.

[0064] S24, if the target server is a backup server, abandon the execution of the pending task data. For detailed explanation, please refer to the relevant description of step S14 in the above embodiment, which will not be repeated here.

[0065] The task scheduling method provided in this invention determines whether a server is the primary server by querying a database to obtain the identifier code of the current server and the primary server identifier code. This achieves automatic detection of primary and backup servers without manual intervention, solving the problem of excessive time consumption caused by manual intervention in starting and stopping servers, and thus ensuring the timeliness of scheduled task execution. When a server is the primary server, the method obtains the task identifier code corresponding to the task data to be processed and determines whether the server's identifier code matches the task identifier code. If the server's identifier code matches the task identifier code, the server executes the task data to be processed; if the server's identifier code does not match the task identifier code, the server discards the task data to be processed. This ensures a one-to-one correspondence between the primary server and the task data it executes, avoiding errors in task execution and thus ensuring the accuracy of the tasks executed by the primary server.

[0066] This embodiment also provides a task scheduling device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation or a combination of software and hardware is also possible and contemplated.

[0067] This embodiment provides a task scheduling device, such as... Figure 3 As shown, it includes:

[0068] The acquisition module 31 is used to acquire data for the tasks to be processed. For detailed explanations, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.

[0069] The determination module 32 is used to determine whether the target server is the master server. For detailed explanation, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.

[0070] Execution module 33 is used to execute the task data to be processed if the target server is the master server. For detailed explanation, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.

[0071] The abandonment module 34 is used to abandon the execution of pending task data if the target server is a backup server. For detailed explanations, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.

[0072] The task scheduling device provided in this embodiment acquires the data of the task to be processed and calculates whether the target server is the primary server. If the target server receiving the data is the primary server, the task is executed; if the target server is the backup server, the task is abandoned. This achieves automatic detection of primary and backup servers. During server switchover, the original primary server can immediately stop executing the task, while the new primary server can quickly begin executing it. This task scheduling process requires no manual intervention and can quickly complete the switchover, improving the timeliness of the switchover process and ensuring the timely processing of scheduled tasks.

[0073] Optionally, the above-mentioned judgment module 32 includes:

[0074] The query submodule is used to query the database and retrieve the server's corresponding identifier and the master server identifier. For detailed explanations, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.

[0075] The comparison submodule is used to compare the identifier code with the master server identifier code. For detailed explanations, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.

[0076] The determination submodule is used to determine whether a server is the master server based on the comparison result between the identifier code and the master server identifier code. For detailed explanation, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.

[0077] The task scheduling device provided in this embodiment of the invention obtains the identification code of the current server and the identification code of the master server by querying the database to determine whether the current server is the master server. This realizes the automatic detection of the master and backup servers without manual intervention, solves the problem of excessive time consumption caused by manual intervention in starting and stopping the server, and thus ensures the timeliness of the scheduled task execution.

[0078] In this embodiment, the task scheduling device is presented in the form of a functional unit. Here, a unit refers to an ASIC circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0079] Further functional descriptions of the above modules are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0080] This invention also provides a task scheduling system, such as... Figure 4As shown, the task scheduling system includes a first server 41 and a second server 42. When the first server 41 is the master server, the second server 42 is the backup server. In this case, the first server 41 executes the pending task data, while the second server 42 discards the pending task data.

[0081] When the first server 41 and the second server 42 receive the task data to be processed, they will determine whether they are the main server for executing the task data. If they determine that they are the main server, they will pull the task data to be processed. If they determine that they are not the main server, i.e., the backup server, they will discard the task data to be processed.

[0082] The task scheduling system provided in this embodiment can ensure that the scheduled tasks are always executed on the main server, so that when the main and backup servers switch, the data of the tasks to be processed can be switched synchronously, thus ensuring the timeliness of the scheduling tasks.

[0083] Optionally, when the first server 41 fails, the second server 42 is set as the primary server, and the second server 42 executes the pending task data. Specifically, when the first server 41, which is the primary server, fails, the pending task data running on it will also be interrupted. At this time, the second server 42, which is the backup server, can be set as the primary server so that the pending task data can be executed on the second server 42, ensuring the continuity of the pending task data execution. The failure can be a disaster recovery drill, a power outage risk, or server damage, etc. This application does not specifically limit the types of failures, and those skilled in the art can determine them according to actual needs.

[0084] It should be noted that when the primary server recovers from the fault and returns to normal operation, the backup server can either switch the pending task data it is executing to the primary server for execution, or continue to execute on the backup server. When the pending task data is retrieved again, it will be executed directly on the primary server that has recovered to normal operation, and the backup server will be restored to the backup server corresponding to the current primary server, until the primary server fails again, at which point the pending task data will be switched to the backup server for execution.

[0085] The task scheduling system provided in this invention, when the primary server fails, promptly starts a secondary server as a backup server and uses the secondary server as the primary server to execute pending task data. During primary / backup server switching, the system can quickly detect changes in the primary and backup servers and promptly control the original primary server to stop executing pending task data, while the new primary server begins executing it. Since the pending task data received by the backup server and the primary server are synchronized, there is no need to manually determine the details of pending tasks during primary / backup server switching, improving the timeliness of the switching process and ensuring the timely processing of scheduled tasks.

[0086] This invention also provides a computer device having the above-described features. Figure 3 The task scheduling device shown.

[0087] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 5 As shown, the computer device may include: at least one processor 51, such as a CPU (Central Processing Unit), at least one communication interface 53, memory 54, and at least one communication bus 52. The communication bus 52 is used to enable communication between these components. The communication interface 53 may include a display screen and a keyboard; optionally, the communication interface 53 may also include a standard wired interface or a wireless interface. The memory 54 may be high-speed RAM (Random Access Memory) or non-volatile memory, such as at least one disk storage device. Optionally, the memory 54 may also be at least one storage device located remotely from the aforementioned processor 51. The processor 51 may be combined with... Figure 3 The described apparatus has an application program stored in memory 54, and the processor 51 calls the program code stored in memory 54 to perform any of the above method steps.

[0088] The communication bus 52 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus 52 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0089] The memory 54 may include volatile memory, such as random-access memory (RAM); the memory may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 54 may also include a combination of the above types of memory.

[0090] The processor 51 can be a central processing unit (CPU), a network processor (NP), or a combination of CPU and NP.

[0091] The processor 51 may further include a hardware chip. This hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0092] Optionally, memory 54 is also used to store program instructions. Processor 51 can invoke program instructions to implement the functions described in this application. Figure 1 and 2 The task scheduling method shown in the embodiment.

[0093] This invention also provides a non-transitory computer storage medium storing computer-executable instructions that can execute the task scheduling method processing method in any of the above method embodiments. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.

[0094] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A task scheduling method, characterized in that, The task scheduling method, which involves executing the task on any target server in a server cluster including one master server and several backup servers, includes the following steps: Obtain pending task data, which is the scheduled tasks to be executed pulled by the task batch processing system from the scheduling system; Determining whether the target server is the master server includes: querying a database to obtain the identifier code corresponding to the target server and the master server identifier code from the database; comparing the identifier code of the target server with the master server identifier code; and determining whether the target server is the master server based on the comparison result of the identifier code of the target server and the master server identifier code; wherein, the identifier code corresponding to the target server is the Internet identification information corresponding to the target server; If the target server is the master server, executing the pending task data includes: obtaining the task identifier code corresponding to the pending task data; determining whether the identifier code of the target server matches the task identifier code; when the identifier code of the target server matches the task identifier code, the target server executes the pending task data; wherein, the task identifier code is the Internet data identifier corresponding to the pending task data, and the identifier code of the master server and the task identifier code are in one-to-one correspondence; If the target server is a backup server, the pending task data will be abandoned. The backup server's task batch processing system and the main server's task batch processing system simultaneously pull the task data to be processed from the scheduling system and intercept and verify the task data to be processed.

2. The method according to claim 1, characterized in that, If the server is the master server, the process of executing the task data to be processed further includes: If the identifier of the target server does not match the identifier of the task, the target server will not execute the task data to be processed.

3. A task scheduling device, characterized in that, The task scheduling device is configured to be located on any target server in a server cluster, wherein the server cluster includes one master server and several backup servers, and the task scheduling device includes: The acquisition module is used to acquire data of tasks to be processed, which are scheduled tasks to be executed pulled by the task batch processing system from the scheduling system. A judgment module is used to determine whether the target server is a master server. The judgment module includes: a query submodule, used to query a database to obtain the identifier code corresponding to the target server and the master server identifier code from the database; wherein the identifier code corresponding to the target server is the Internet identification information corresponding to the target server; a comparison submodule, used to compare the identifier code of the target server with the master server identifier code; and a determination submodule, used to determine whether the server is a master server based on the comparison result of the identifier code of the target server and the master server identifier code. An execution module is configured to execute the pending task data if the target server is the master server, including: obtaining a task identifier code corresponding to the pending task data; determining whether the identifier code of the target server matches the task identifier code; and when the identifier code of the target server matches the task identifier code, the target server executes the pending task data; wherein the task identifier code is an Internet data identifier corresponding to the pending task data, and the identifier code of the master server corresponds one-to-one with the task identifier code; The abandonment module is used to abandon the execution of the pending task data if the target server is a backup server. The backup server's task batch processing system and the main server's task batch processing system simultaneously pull the task data to be processed from the scheduling system and intercept and verify the task data to be processed.

4. A task scheduling system, characterized in that, include: A first server and a second server; the first server and the second server are used to determine, upon receiving data for a task to be processed, whether they are the main server executing the data for the task to be processed. When the first server is the primary server and the second server is the backup server, the first server executes the pending task data, and the second server discards the pending task data. Determining whether it is the primary server includes: querying a database to obtain the identifier code corresponding to the target server and the primary server identifier code; wherein the identifier code corresponding to the target server is the Internet identification information corresponding to the target server; comparing the identifier code of the target server with the primary server identifier code; and determining whether it is the primary server based on the comparison result. When the first server is the primary server, executing the pending task data includes: obtaining... The task identification code corresponds to the task data to be processed; it is determined whether the identification code of the first server matches the task identification code; when the identification code of the first server matches the task identification code, the first server executes the task data to be processed; wherein, the task identification code is the Internet data identifier corresponding to the task data to be processed, and the identification code of the main server corresponds one-to-one with the task identification code; the task data to be processed is the scheduled task to be executed pulled by the task batch processing system from the scheduling system; the task batch processing system of the backup server and the task batch processing system of the main server simultaneously pull the task data to be processed from the scheduling system and intercept and verify the task data to be processed.

5. The system according to claim 4, characterized in that, When the first server fails, the second server is set as the master server; the second server is controlled to execute the pending task data.

6. A computer device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the task scheduling method according to any one of claims 1-2.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the task scheduling method according to any one of claims 1-2.

Citation Information

Patent Citations

  • Method and device for data synchronization based on cluster server system

    CN104753994A

  • Zookeeper-based master-slave local timing task processing method and system

    CN110266779A

  • Method for determining main node in cluster, electronic equipment and storage medium

    CN111538763A