CN113778744B - Task processing method, device, system and storage medium - Google Patents
Task processing method, device, system and storage medium Download PDFInfo
- Publication number
- CN113778744B CN113778744B CN202110008134.8A CN202110008134A CN113778744B CN 113778744 B CN113778744 B CN 113778744B CN 202110008134 A CN202110008134 A CN 202110008134A CN 113778744 B CN113778744 B CN 113778744B
- Authority
- CN
- China
- Prior art keywords
- state
- task
- data backup
- server
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 33
- 238000013475 authorization Methods 0.000 claims abstract description 124
- 238000012790 confirmation Methods 0.000 claims abstract description 26
- 238000000034 method Methods 0.000 claims description 54
- 238000012545 processing Methods 0.000 claims description 42
- 238000012544 monitoring process Methods 0.000 claims description 16
- 238000004590 computer program Methods 0.000 claims description 3
- 238000007726 management method Methods 0.000 description 31
- 238000012360 testing method Methods 0.000 description 12
- 238000010586 diagram Methods 0.000 description 4
- 238000013500 data storage Methods 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Hardware Redundancy (AREA)
Abstract
The application provides a task processing method, equipment, a system and a storage medium, which comprise the steps of obtaining the running state of other servers when executing a data backup task, generating an authorization request according to the task identification of the data backup task if the running state is a fault state, and sending the authorization request to a central server so that the central server generates confirmation authorization information when determining that the state indicated by the authorization identification associated with the data backup task is an unlocking state, and executing the data backup task if the confirmation authorization information sent by the central server is received. The scheme monitors the running state of other servers when executing the data backup task, and timely competes for executing the data backup task when faults occur, so that the data backup effectiveness in the current backup period can be ensured.
Description
Technical Field
The present application relates to the field of database technologies, and in particular, to a task processing method, device, system, and storage medium.
Background
The data server cluster is used for providing mass data storage and reading operations for users. In general, data of each data server in the data server cluster needs to be backed up periodically to prevent the data loss after the data server fails.
As one of the data backup schemes, the central management node is connected to the control end of the data server, and the central management node issues a backup instruction to the control end of the data server to call mysqldump, xtrabackup and other instructions to execute data backup. Alternatively, a timed task script is deployed at the data server using a crontab to invoke mysqldump, xtrabackup to perform a backup.
However, after the control end or the data server fails, the backup scheme cannot continue the backup task of the current backup period, and needs to wait until the next backup period to execute the data backup again, so that the risk of data loss of the current backup period exists.
Disclosure of Invention
The embodiment of the application provides a task processing method, equipment, a system and a storage medium, and aims to provide a method, a device and a system which can enable other servers to continue to execute a data backup task after the data backup task executed by the data server fails and ensure the effectiveness of data backup in the current backup period.
In a first aspect, an embodiment of the present application provides a task processing method, where the method is applied to a current server, and the method includes:
Acquiring the running states of other servers when executing data backup tasks, wherein the current server and the other servers are slave data servers;
if the running state is a fault state, generating an authorization request according to a task identifier of the data backup task;
Sending an authorization request to a central server so that the central server generates confirmation authorization information when determining that the state indicated by the authorization identification associated with the data backup task is an unlocking state;
And if the confirmation authorization information sent by the central server is received, executing a data backup task.
Optionally, the method further comprises:
generating heartbeat data if the state of the heartbeat timer is determined to be an expiration state;
And sending the heartbeat data to the central server so that the central server updates the running state of the current server according to the heartbeat data.
Optionally, acquiring the running state of other servers when executing the data backup task specifically includes:
Sending a monitoring request to a central server; wherein the monitoring request includes node identification of other servers performing data backup tasks;
And receiving the running states of other servers corresponding to the node identifiers returned by the central server.
In the above embodiment, each slave data server sends heartbeat data to the central server, so that the central server can update the running state of the data server, the slave data server monitors the running state of the slave data server when executing the data backup task in real time, and when the running state is a fault state, the slave data server competes in time to process the data backup task, and the backup is not required to be performed until the next backup period, so that the effectiveness of the data backup in the current backup period can be ensured.
Optionally, after sending the authorization request to the central server, the method further comprises:
Receiving an authorization identifier which is sent by a central server and is associated with a data backup task;
if the state indicated by the authorization identification is determined to be an unlocking state, generating a locking request according to the node identification and the locking duration of the current server;
and sending a locking request to the central server so that the central server switches the state indicated by the authorization identification associated with the data backup task to a locking state.
In the above embodiment, when the current server competes for the right to process the data backup task, the authorization identifier is switched to the lock state, so that the other slave data servers cannot continue to compete for processing the data backup task.
Optionally, after the data backup task is executed if the confirmation authorization information sent by the central server is received, the method further includes:
and sending completion indication information for indicating that the data backup task is completed to the central server.
Optionally, the method further comprises:
A task query request is sent to a central server, so that the central server determines a trigger identifier corresponding to a data backup task;
receiving a trigger identifier corresponding to a data backup task returned by the central server;
and sending an authorization request to the central server when the state of the trigger is determined to be the trigger state.
In the above embodiment, the trigger of the data backup task is monitored, and the data backup task is contended for processing when the trigger is determined to be in the triggered state.
In a second aspect, the present application provides a task processing method, where the method is applied to a central server, and the method includes:
Receiving an authorization request sent by a current server, wherein the authorization request is generated when the running state of other servers is a fault state when the data backup task is executed, and the authorization request comprises a task identifier of the data backup task;
determining an authorization identifier associated with the data backup task according to the task identifier;
generating confirmation authorization information if the state indicated by the authorization identifier is an unlocking state;
And sending authorization information to the current server so that the current server executes the data backup task.
Optionally, the method further comprises:
Receiving heartbeat data sent by a current server, wherein the heartbeat data is generated when a heartbeat timer expires;
The operation state of the current server transmitting the heartbeat data is set to a normal state.
Optionally, the method further comprises:
and if the heartbeat data sent by the current server is not received, setting the running state of the current server which does not send the heartbeat data as a fault state.
Optionally, the method further comprises:
Receiving a monitoring request sent by a current server, wherein the monitoring request comprises node identifiers of other servers for executing data backup tasks;
Acquiring the running state of other servers in executing the data backup task according to the node identification;
and sending the running states of other servers in the process of executing the data backup task to the current server.
Optionally, receiving a locking request sent by the current server, wherein the locking request comprises a node identifier and a locking duration of the current server;
switching the state indicated by the authorization identification associated with the data backup task to a locked state;
And generating a setting instruction and a starting instruction according to the locking time length, wherein the setting instruction is used for setting the timing time length of the state timer to be the locking time length, and the starting instruction is used for starting the state timer.
Optionally, after sending the authorization information to the current server, the method further comprises:
Receiving completion indication information for indicating completion of the data backup task;
and switching the execution state of the data backup task to a completed state according to the completion indication information.
Optionally, the method further comprises:
Receiving a trigger instruction sent by a management server, wherein the trigger instruction is generated when the management task device determines that the state of a task timer is an expiration state and the execution state of a data backup task is an unexecuted state;
and switching the state of the trigger mark corresponding to the data backup task to the trigger state according to the trigger instruction.
In the above embodiment, the management server monitors the timing state of the task timer, and generates the trigger instruction when determining that the task timer expires and the execution state of the data backup task is the unexecuted state, so as to switch the state of the trigger identifier corresponding to the data backup task, and further trigger the competition processing data backup task of the current server.
Optionally, the method further comprises:
receiving a task query request sent by a current server;
And sending the state of the trigger corresponding to the data backup task to the current server so that the current server generates an authorization request when determining that the state of the trigger indicates the trigger state.
In a third aspect, the present application provides a data server comprising: a memory, a processor;
A memory; a memory for storing processor-executable instructions;
wherein the processor is configured to implement the task processing method according to the first aspect and the alternatives.
In a fourth aspect, the present application provides a central server comprising: a memory, a processor;
A memory; a memory for storing processor-executable instructions;
wherein the processor is configured to implement the task processing method according to the first aspect and the alternatives.
In a fifth aspect, the present application provides a task processing system, including the data server according to the third aspect, the central server according to the fourth aspect, and the management server.
In a sixth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions for implementing the task processing method according to the first aspect and the alternative or according to the second aspect and the alternative when executed by a processor.
In a seventh aspect, the present application provides a computer program product comprising instructions which when executed by a processor implement the task processing method as claimed in the first aspect and the alternative or as claimed in the second aspect and the alternative.
The embodiment of the application provides a task processing method, device, system and storage medium, wherein a current server monitors the running state of other servers when executing data alternative tasks, generates an authorization request when determining that the running state is a fault state so as to compete for processing the data alternative tasks with a central server, and authorizes the current server to execute the data alternative tasks when determining that an authorization identifier associated with the data alternative tasks indicates an unlocking state, so that backup is not required to be performed until the next backup period, and the effectiveness of data backup in the current backup period can be ensured. In addition, the data server periodically sends heartbeat data to the central server, so that the central server updates the running state of each slave data server, and when the central server cannot receive the heartbeat data, the running state of the corresponding slave data server is switched to a fault state, and further other slave data servers can compete for the data alternative tasks which are not successfully executed. In addition, the data backup task is only executed by the slave data server, so that the data processing amount of the master data server can be reduced, and the performance of the master data server for providing data service is ensured.
Drawings
FIG. 1 is a schematic diagram of a task processing system according to an embodiment of the present application
FIG. 2 is a flow chart of a task processing method according to an embodiment of the present application;
FIG. 3 is a flow chart of a task processing method according to another embodiment of the present application;
FIG. 4 is a flowchart of a task processing method according to another embodiment of the present application;
FIG. 5 is a flowchart of a task processing method according to another embodiment of the present application;
FIG. 6 is a schematic diagram of a task processing device according to another embodiment of the present application;
FIG. 7 is a schematic diagram of a task processing device according to another embodiment of the present application;
fig. 8 is a schematic structural diagram of a server according to another embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The application provides a task processing method, equipment, a system and a storage medium, and aims to provide a method for ensuring the effectiveness of data backup in the current backup period by enabling other data servers to compete for a data backup task in time when the data backup task is executed and fails. The application is characterized in that: the data server monitors the running state of other servers in real time when executing the data backup task, and if the running state is a fault state, the data backup task is executed in a competing manner in time so as to ensure the data backup effectiveness of the current backup period. In addition, the data server periodically sends heartbeat data to the central server, so that the central server can acquire the running states of all the data servers, the data server can monitor the running states of other data servers through the central server, and further the data server can compete for the data backup task in time after the other servers fail when the data backup task is executed.
As shown in fig. 1, a task processing system according to an embodiment of the present application includes a plurality of data servers 101, a central server 102, and a management server 103. Wherein each data server 101 is communicatively connected to the central server 102, and the management server 103 is also communicatively connected to the central server 102.
The plurality of data servers 101 form a data server cluster, any one data server in the data server cluster can be selected as a master data server, and other data servers are slave data servers. The data server is the same as the data server, and the data server cluster is used for providing data storage, query and other services.
By deploying a service daemon of the client on each data server, the slave data server 101 listens to the running states of the other slave data servers 101, and when one slave data server determines that the other slave data server fails in executing the database backup task, the central server competes for processing the database backup task. And sending confirmation authorization information to the slave data server at the central server so that the slave data server can continue to process the database backup task.
The management server 103 is configured to poll the task timers of the database backup tasks, if the task timers expire, continue to determine the execution state of the database backup task, and if the execution state indicates that the execution state is not complete, send task information of the database backup task to the central server, so that the central server can newly create a trigger identifier of the database backup task, and the state of the trigger identifier is set to the trigger state. The status of the trigger is monitored from the data server 101 and when it is determined that the trigger indicates a trigger status, the data backup task is performed. It should be further noted that, in order to improve the performance of the management server, the management data server is configured for the management server, and is used for storing metadata of the management server in a service providing process, for example: task information of a data backup task, account information of each management account, and the like.
It should be noted that, instead of the data server adopting a server cluster, the central server and the management server may also adopt a server cluster, so as to improve the reliability of the service provided by the central server and the management server.
When the service daemon of the client is deployed on each data server, the database service deployed based on the physical machine can be deployed, that is, the service daemon of the client is deployed on each data server respectively. The service daemon of the client may also be deployed based on the container orchestration engine, for example: kubernetes the service daemon of the client can be deployed in two ways. The first is to deploy the service daemon of the client in the same container as the database instance. The second is to deploy in the side-car mode (sidecar) and to isolate the database instance at the container level, deploying the client's service daemon in the sidecar container.
As shown in fig. 2, a task processing method according to another embodiment of the present application is applied to the task processing system, and for clarity of description, a plurality of slave data servers are respectively labeled as a current server and other servers, and the method includes the following steps:
s201, the current server obtains the running state of other servers in executing the data backup task.
The data backup task refers to backing up data from a data server, and the running states of other servers are divided into a fault state and a running state.
S202, the current server determines that the running state is a fault state, and generates an authorization request according to the task identification of the data backup task.
If it is determined that the other data devices fail when executing the data backup task, the current server competes for processing the data backup task. And acquiring the task identification of the data backup task being executed, and performing processing such as coding, packaging and the like on the task identification of the data backup task to generate an authorization request so as to request the central server to process the data backup task.
S203, the current server sends an authorization request to the central server.
S204, the central server determines an authorization identifier associated with the data backup task.
The central server analyzes the authorization request, obtains the task identification of the data backup task competing by the current server, and determines the authorization identification associated with the data backup task according to the task identification of the data backup task.
S205, the central server generates confirmation authorization information when determining that the state indicated by the authorization identification associated with the data backup task is an unlocking state.
And identifying the state indicated by the authorization identifier associated with the data backup task, and generating confirmation authorization information if the authorization identifier indicates the unlocking state. And if the authorization identifier indicates the locking state, returning prompt information of authorization failure.
S206, the central server sends confirmation authorization information to the current server.
S207, the current server executes a data backup task.
After receiving the confirmation authorization information, the current server analyzes the authorization information to obtain task information of the data backup task, and performs data backup according to the task information of the data backup task.
In the task processing method provided by the embodiment of the application, the current server monitors the running state of other servers when executing the data backup task, and when determining that the current server fails, the current server timely competes for executing the data backup task with the central server.
As shown in fig. 3, another embodiment of the present application provides a task processing method, which is applied to the task processing system, and includes the following steps:
S301, the current server generates heartbeat data when the heartbeat timer expires.
And a heartbeat timer is newly built in the current server and is used for triggering and generating heartbeat data. That is, if it is determined that the heartbeat timer expires, heartbeat data is generated, and the heartbeat server is started again, so that the current server can periodically generate the heartbeat data.
The other servers are also internally provided with heartbeat timers, the heartbeat timers periodically trigger the other servers to generate heartbeat data, and the heartbeat data are sent to the central server.
S302, the current server sends heartbeat data to the central server.
S303, the central server sets the running state of the current server for sending the heartbeat data to be a normal state.
The heartbeat data comprises node identifiers of the current servers, and when the central server receives the heartbeat data, the running state list of the current servers stored locally can be updated according to the node identifiers analyzed from the heartbeat data, so that the running state of the current servers corresponding to the heartbeat data is in a normal state.
After receiving the heartbeat data of other servers, the central server also keeps the operation states of the other servers in a normal state.
And S304, setting the running state of the current server for sending the heartbeat data as a fault state when the central server does not receive the heartbeat data.
If the central server does not receive the heartbeat data sent by the corresponding current server, updating the running state list of the current server stored locally, so that the running state of the current server corresponding to the heartbeat data is a fault state.
And after the central server does not receive the heartbeat data of other servers, the running states of the other servers are switched to the fault state.
Here, S301 to S304 may be any steps from S305 to S311, which is not limited herein.
S305, the current server sends a monitoring request to the central server.
Wherein the monitoring request includes node identification of other servers that are performing the data backup task. The monitoring request is used to query the operational status of other servers that are performing data backup tasks.
S306, the central server obtains the running states of other servers according to the node identifiers of the other servers.
The central server searches the running state list of the current server stored locally according to the node identification of the other servers, and determines the running states of the other servers executing the data backup task.
S307, the running states of other servers are sent to the current server.
S308, the current server determines that the running state is a fault state, and generates an authorization request according to the task identification of the data backup task.
When the current server determines that other servers which are executing the data backup task fail, the data backup task is executed in competition with the central server. That is, an authorization request is generated according to the task identification of the data backup task to request the central server to process the data backup task.
S309, the current server sends an authorization request to the central server.
S310, the central server determines an authorization identifier associated with the data backup task.
When receiving the authorization request, the central server inquires an authorization identifier associated with the data backup task and determines whether the data backup task is being processed by other servers.
And S311, when the central server determines that the state indicated by the authorization identification associated with the data backup task is an unlocking state, confirmation authorization information is generated.
And if the authorization identifier associated with the data backup task is in an unlocking state, the data backup task is not processed from the data server, and confirmation authorization information is generated so that the current server can execute the data backup task. If the authorization identification associated with the data backup task is determined to be in a locking state, the data backup task is processed by other servers, and prompt information of failed request is returned.
S312, the central server sends confirmation authorization information to the current server.
S313, the current server processes the data backup task.
After receiving the confirmation authorization information, the current server analyzes the authorization information to obtain the task information of the data backup task, and performs data backup according to the task information of the data backup task.
In the task processing method provided by the embodiment of the application, the current server periodically sends the heartbeat data to the central server, if the central server does not receive the heartbeat data, the central server can determine that the current server is in a fault state, and when other servers monitor the running state of the current server, the current server can timely return to the other servers, so that the other servers can timely compete for processing the data backup task when determining that the server breaks down when executing the data backup, and the data backup effectiveness of the backup period can be ensured.
As shown in fig. 4, another embodiment of the present application provides a task processing method, which is applied to the task processing system, and includes the following steps:
S401, the current server obtains the running state of other servers when executing the data backup task.
S402, the current server determines that the running state is a fault state, and generates an authorization request according to the task identification of the data backup task.
S403, the current server sends an authorization request to the central server.
S404, the central server determines an authorization identifier associated with the data backup task.
S405, when the state indicated by the central server authorization identification is an unlocking state, confirmation authorization information is generated.
S406, the central server sends confirmation authorization information to the current server.
S407, the current server executes the data backup task.
Among them, S402 to S407 have been described in detail in the above embodiments.
S408, the current server sends completion indication information to the central server.
After the current server completes the data backup task, completion indication information may be generated, where the completion indication information is used to indicate that the data backup task has been completed.
S409, switching the execution state of the data backup task to the completed state according to the completion instruction information.
After receiving the completion indication information, that is, after the data backup task is completed, the central server switches the execution state of the data backup task to the completed state.
S410, the central server sends an authorization identification associated with the data backup task.
S411, when the current server determines that the state indicated by the authorization identification is an unlocking state, a locking request is generated according to the node identification and the locking time length of the current server.
If the state indicated by the authorization identifier is an unlocked state, that is, no other server processes the data backup task, the current server competes for the data backup task.
And randomly generating a locking duration within a threshold range of the locking duration, and generating a locking request according to the node identification of the current server and the locking duration to request to switch the state of the authorization identification associated with the data backup task to the locking state.
S412, the current server sends a locking request to the central server.
S413, the central server switches the state indicated by the authorization identification to a locking state.
After receiving the locking request sent by the current server, the central server switches the state indicated by the authorization identifier associated with the data backup task to the locking state, so that other servers can not compete for processing the data backup task.
S414, the central server generates a setting instruction and a starting instruction.
The central server establishes a state timer for switching the indication state of the authorization identifier. The setting instruction is used for setting the timing duration of the state timer to be the locking duration, and the starting instruction is used for starting the state timer.
S415, the central server switches the state indicated by the authorization identification to the unlocking state when the state timer is determined to expire.
If the state timer expires, it is determined that the authorization identifier associated with the data backup task indicates that the locking state has continued for a locking period, and the indication state of the authorization identifier needs to be switched to the unlocking state. If other servers processing the data backup task fail and cannot continue to process the data backup task, the mechanism can enable the other servers to continue competing for the data backup task.
In the task processing method provided by the embodiment of the application, when the current server determines that the authorization identifier associated with the data backup task is in an unlocking state, a locking request is generated so that other servers cannot continuously compete for the data backup task, in addition, locking time is set in the locking request, timing time of a state timer is set as locking duration, the authorization identifier associated with the data backup task can be switched to the unlocking state when the state timer expires, and if other servers which are processing the data backup task have faults, the other servers can continuously compete for the data backup task through the mechanism.
The following is an example description of providing services to a cluster of data servers based on ETCD in connection with a cluster of central servers.
ETCD is an open source project initiated by CoreOS team at month 6 of 2013, whose goal is to build a highly available distributed key-value pair (key-value) database. The ETCD is internally implemented on the basis of the Go language by adopting a raft protocol as a consistency algorithm.
The data server cluster includes 3 data servers, 1 master data server and 2 slave data servers, and the 3 data servers register related information in the central server cluster. The management server also registers the relevant information with the central server.
The directory structure in ETCD is as follows:
catalog/clusters represents clusters root catalog;
catalog/clusters/cluster_test indicates that the cluster name is cluster_test;
Catalog/clusters/cluster_test/cron indicates where the trigger is stored;
Catalog/clusters/cluster_test/lock represents the memory address of the authorization identifier;
catalog/clusters/cluster_test/status represents the memory address of the execution status of the data backup task;
directory/clusters/cluster_test/workers represents the storage address of the IP list of the data server;
catalog clusters/cluster_test/workers/192.168.0.1 represents the primary data server;
Catalog/clusters/cluster_test/workers/192.168.0.2 represents a slave data server;
catalog/clusters/cluster_test/workers/192.168.0.3 represents a slave data server.
It should be noted that, the management server may register the task information of each data backup task in the central server cluster, and register the initial state of the trigger identifier of each data backup task as the waiting state.
As shown in fig. 5, another embodiment of the present application provides a task processing method, which includes the following steps:
s501, a management server polls task timers of all data backup tasks.
And constructing task timers for the data backup tasks in the management server, and setting the timing duration of the task timers according to the backup requirements of the data backup tasks. The management server monitors the timing state of each task timer and generates an execution state query request after determining that the task timer expires.
S502, the management server determines that the task timer expires and generates an execution state query request.
When the task timer of a certain data backup task is determined to expire, an execution state query request is generated according to the task identification of the data backup task.
S503, the management server sends an execution state query request to the central server.
S504, the central server acquires the execution state of the data backup task.
The central server analyzes the execution state query request, obtains a task identifier of the data backup task to be queried, and queries the execution state of the data backup task in an execution state table of the data backup task according to the task identifier. I.e., in the directory/clusters/cluster_test/status.
S505, the central server sends the execution state of the data backup task to the management server.
S506, when the management server determines that the execution state of the data backup task is the unexecuted state, a trigger instruction is generated.
When the management server determines that the execution state of the data backup task is the unexecuted state, a trigger instruction for triggering the execution of the data backup task is generated.
S507, the management server sends a trigger instruction to the central server.
S508, the central server switches the state of the trigger corresponding to the data backup task to the trigger state.
When the central server receives the trigger instruction, the central server analyzes the task identifier of the data backup task from the trigger instruction, and switches the state indicated by the trigger identifier corresponding to the task identifier of the data backup task to the trigger state. That is, the value of cron corresponding to the data backup task is modified in the directory/clusters/cluster_test/cron.
S509, the current server sends a task query request to the central server.
The task query request is used for monitoring trigger identifiers of all data backup tasks, and when the trigger identifiers are determined to be in a trigger state, the current server competes for the data backup tasks.
S510, the central server acquires the state of the determined trigger according to the task query request.
And analyzing the task identifier from the task query request, and reading the trigger identifier corresponding to the task identifier from the trigger identifier list according to the task identifier, namely reading the value of the cron corresponding to the task identifier from the catalog/clusters/cluster_test/cron.
S511, the central server sends the state of the trigger to the current server.
And S512, the current server sends an authorization request to the central server when the state indicated by the trigger identifier is determined to be the trigger state.
When the central server determines that the state indicated by the trigger identifier is switched to the trigger state, an authorization request is generated to compete for the data backup task.
S513, the central server determines an authorization identifier associated with the data backup task.
S514, the central server determines that the state indicated by the authorization identification associated with the data backup task is an unlocking state.
S515, the central server generates confirmation authorization information.
S516, the central server sends confirmation authorization information to the current server.
S517, the current server processes the data backup task.
Among them, S513 to S517 have been described in detail in the above embodiments, and are not described here.
Other slave data servers may monitor the operational status of the data server while the slave data server performs the data backup task and compete for the data backup task when the slave data server fails. This process is already described in detail in the above embodiments and will not be described here again.
In the data processing method provided by the embodiment of the application, the management server monitors the timing state of each task timer, and requests the central server to modify the trigger mark when the timer expires, so that the slave data server can monitor that the data backup task is triggered, and then compete for processing the data backup task, so that other slave data servers can continuously monitor the running state of the slave data server, and compete for the data backup task in time when faults occur.
As shown in fig. 6, another embodiment of the present application provides a task processing device 600, the device 600 including:
The acquiring module 601 is configured to acquire an operation state of another server when executing a data backup task;
The first processing module 602 is configured to generate an authorization request according to a task identifier of the data backup task if the running state is a failure state;
A first sending module 603, configured to send an authorization request to a central server, so that the central server generates confirmation authorization information when determining that a state indicated by an authorization identifier associated with a data backup task is an unlocked state;
The first processing module 602 is further configured to perform a data backup task if acknowledgement authorization information sent by the central server is received.
Optionally, the first processing module 602 is further configured to generate heartbeat data if it is determined that the state of the heartbeat timer is an expired state;
the first sending module 603 is further configured to send heartbeat data to the central server, so that the central server updates the running state of the current server according to the heartbeat data.
Optionally, the apparatus comprises a first receiving module 604;
the first sending module 603 is further configured to send a monitoring request to the central server; wherein the monitoring request includes node identification of other servers performing data backup tasks;
The first receiving module 604 is configured to receive an operation state of another server corresponding to the node identifier returned by the central server.
Optionally, the first receiving module 604 is configured to receive an authorization identifier associated with a data backup task sent by the central server;
the first processing module 602 is further configured to generate a lock request according to the node identifier and the lock duration of the current server if it is determined that the state indicated by the authorization identifier is an unlocked state;
The first sending module 603 is further configured to send a lock request to the central server, so that the central server switches the state indicated by the authorization identifier associated with the data backup task to the locked state.
Optionally, the first sending module 603 is further configured to send, to the central server, completion indication information for indicating that the data backup task is completed.
Optionally, the first sending module 603 is further configured to send a task query request to the central server, so that the central server determines a trigger identifier corresponding to the data backup task;
The first receiving module 604 is configured to receive a trigger identifier corresponding to a data backup task returned by the central server;
The first sending module 603 is further configured to send an authorization request to the central server when the status of the trigger identifier is determined to be the trigger status.
As shown in fig. 7, another embodiment of the present application provides a task processing device 700, where the device 700 includes:
A second receiving module 701, configured to receive an authorization request sent by a current server, where the authorization request is generated when an operation state of the other server when executing a data backup task is a failure state, and the authorization request includes a task identifier of the data backup task;
a second processing module 702, configured to determine an authorization identifier associated with the data backup task according to the task identifier;
The second processing module 702 is further configured to generate confirmation authorization information if the state indicated by the authorization identifier is an unlocked state;
and the second sending module 703 is configured to send authorization information to the current server, so that the current server performs a data backup task.
Optionally, the second receiving module 701 is further configured to receive heartbeat data sent by the current server, where the heartbeat data is generated when the heartbeat timer expires;
the second processing module 702 is further configured to set an operation state of a current server that transmits heartbeat data to a normal state.
Optionally, the second processing module 702 is further configured to set an operation state of the current server that does not send the heartbeat data to a failure state if the heartbeat data sent by the current server is not received.
Optionally, the second receiving module 701 is further configured to receive a monitoring request sent by the current server, where the monitoring request includes a node identifier of another server that performs a data backup task;
The second processing module 702 is further configured to obtain an operation state of the other servers in executing the data backup task according to the node identifier;
the second sending module 703 is further configured to send, to the current server, an operation state of the other servers in performing the data backup task.
Optionally, the second receiving module 701 is further configured to receive a lock request sent by the current server, where the lock request includes a node identifier and a lock duration of the current server;
the second processing module 702 is further configured to switch a state indicated by an authorization identifier associated with the data backup task to a locked state;
The second processing module 702 is further configured to generate a setting instruction and a starting instruction according to the locking duration, where the setting instruction is used to set the timing duration of the state timer to the locking duration, and the starting instruction is used to start the state timer.
Optionally, the second receiving module 701 is further configured to receive completion indication information for indicating that the data backup task is completed;
The second processing module 702 is further configured to switch the execution state of the data backup task to a completed state according to the completion indication information.
Optionally, the second receiving module 701 is further configured to receive a trigger instruction sent by the management server, where the trigger instruction is generated when the management task device determines that the state of the task timer is an expired state and the execution state of the data backup task is an unexecuted state;
the second processing module 702 is further configured to switch a state of a trigger identifier corresponding to the data backup task to a trigger state according to the trigger instruction.
Optionally, the second receiving module 701 is further configured to receive a task query request sent by the current server;
the second sending module 703 is further configured to send a status of a trigger corresponding to the data backup task to the current server, so that the current server generates an authorization request when determining that the status of the trigger indicates the trigger status.
As shown in fig. 8, a server 800 according to another embodiment of the present application includes: a transmitter 801, a receiver 802, a memory 803, and a processor 804. The server may be any one of a data server, a management server, and a central server.
Wherein the transmitter 801 is configured to transmit instructions and data, the receiver 802 is configured to receive instructions and data, the memory 803 is configured to store computer-executable instructions, and the processor 804 is configured to execute the computer-executable instructions stored in the memory, so as to implement the steps executed by the task processing method in the above embodiment. Reference may be made in particular to the description of the task processing method embodiments described above.
Alternatively, the memory 803 may be separate or integrated with the processor 804. When the memory 803 is provided separately, the processing device further comprises a bus for connecting the memory 803 and the processor 804.
The embodiment of the application also provides a computer readable storage medium, wherein computer execution instructions are stored in the computer readable storage medium, and when the processor executes the computer execution instructions, the task processing method executed by the processing device is realized.
Embodiments of the present application also provide a computer program product comprising instructions which, when executed by a processor, implement a task processing method as performed by a processing device as above.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.
Claims (17)
1. A method for processing tasks, wherein the method is applied to a current server, the method comprising:
Acquiring the running states of other servers when executing data backup tasks, wherein the current server and the other servers are slave data servers;
if the running state is a fault state, generating an authorization request according to the task identifier of the data backup task;
Sending the authorization request to a central server, so that the central server generates confirmation authorization information when determining that the state indicated by the authorization identification associated with the data backup task is an unlocking state;
If the confirmation authorization information sent by the central server is received, executing the data backup task;
The method for acquiring the running state of the other servers when executing the data backup task specifically comprises the following steps:
Sending a monitoring request to the central server; wherein the monitoring request includes node identification at other servers performing the data backup task;
and receiving the running states of other servers corresponding to the node identifiers returned by the central server.
2. The method according to claim 1, wherein the method further comprises:
generating heartbeat data if the state of the heartbeat timer is determined to be an expiration state;
And sending the heartbeat data to the central server so that the central server updates the running state of the current server according to the heartbeat data.
3. The method according to claim 1 or 2, characterized in that after sending the authorization request to a central server, the method further comprises:
Receiving an authorization identifier which is sent by the central server and is associated with the data backup task;
if the state indicated by the authorization identification is determined to be an unlocking state, a locking request is generated according to the node identification and the locking time length of the current server;
And sending the locking request to the central server so that the central server switches the state indicated by the authorization identification associated with the data backup task to a locking state.
4. The method according to claim 1 or 2, wherein after the performing of the data backup task if the confirmation authorization information sent by the central server is received, the method further comprises:
And sending completion indication information for indicating that the data backup task is completed to the central server.
5. The method according to claim 1 or 2, characterized in that the method further comprises:
sending a task query request to the central server so that the central server determines a trigger identifier corresponding to the data backup task;
receiving a trigger identifier corresponding to the data backup task sent by the central server;
And sending an authorization request to the central server when the state of the trigger identifier is determined to be the trigger state.
6. A method of task processing, the method being applied to a central server, the method comprising:
Receiving an authorization request sent by a current server, wherein the authorization request is generated when the running state of other servers is a fault state when the data backup task is executed, and the authorization request comprises a task identifier of the data backup task;
Determining an authorization identifier associated with the data backup task according to the task identifier;
generating confirmation authorization information if the state indicated by the authorization identifier is an unlocking state;
transmitting the confirmation authorization information to the current server so that the current server executes the data backup task;
wherein the method further comprises:
receiving a monitoring request sent by the current server, wherein the monitoring request comprises node identifiers of other servers executing the data backup task;
acquiring the running states of the other servers when the data backup task is executed according to the node identification;
and sending the running states of the other servers when the data backup task is executed to the current server.
7. The method of claim 6, wherein the method further comprises:
receiving heartbeat data sent by the current server, wherein the heartbeat data is generated when a heartbeat timer expires;
And setting the running state of the current server for transmitting the heartbeat data to be a normal state.
8. The method of claim 6, wherein the method further comprises:
And if the heartbeat data sent by the current server is not received, setting the running state of the current server which does not send the heartbeat data as a fault state.
9. The method according to any one of claims 6 to 8, further comprising:
receiving a locking request sent by the current server, wherein the locking request comprises a node identifier and a locking duration of the current server;
switching the state indicated by the authorization identification associated with the data backup task to a locked state;
and generating a setting instruction and a starting instruction according to the locking time length, wherein the setting instruction is used for setting the timing time length of a state timer to be the locking time length, and the starting instruction is used for starting the state timer.
10. The method according to any one of claims 6 to 8, wherein after said sending of said authorization information to said current server, the method further comprises:
receiving completion indication information for indicating completion of the data backup task;
And switching the execution state of the data backup task to a completed state according to the completion indication information.
11. The method according to any one of claims 6 to 8, further comprising:
receiving a trigger instruction sent by a management server, wherein the trigger instruction is generated when a management task device determines that the state of a task timer is an expiration state and the execution state of the data backup task is an unexecuted state;
And switching the state of the trigger mark corresponding to the data backup task to a trigger state according to the trigger instruction.
12. The method according to any one of claims 6 to 8, further comprising:
Receiving a task query request sent by the current server;
And sending the state of the trigger corresponding to the data backup task to the current server, so that the current server generates an authorization request when determining that the state of the trigger indicates the trigger state.
13. A data server, comprising: a memory, a processor;
A memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to implement the task processing method according to any one of claims 1 to 5.
14. A central server, comprising: a memory, a processor;
A memory; a memory for storing the processor-executable instructions;
wherein the processor is configured to implement a task processing method as claimed in any one of claims 6 to 12.
15. A task processing system comprising a plurality of data servers according to claim 13, a central server according to claim 14, and a management server.
16. A computer-readable storage medium, wherein computer-executable instructions are stored in the computer-readable storage medium, which when executed by a processor, are adapted to implement the task processing method of any one of claims 1 to 5 or any one of claims 6 to 12.
17. A computer program product comprising instructions which, when executed by a processor, implement the task processing method of any one of claims 1 to 5 or any one of claims 6 to 12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110008134.8A CN113778744B (en) | 2021-01-05 | 2021-01-05 | Task processing method, device, system and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110008134.8A CN113778744B (en) | 2021-01-05 | 2021-01-05 | Task processing method, device, system and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113778744A CN113778744A (en) | 2021-12-10 |
CN113778744B true CN113778744B (en) | 2024-06-18 |
Family
ID=78835394
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110008134.8A Active CN113778744B (en) | 2021-01-05 | 2021-01-05 | Task processing method, device, system and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113778744B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114666389B (en) * | 2022-03-14 | 2024-05-17 | 京东科技信息技术有限公司 | Method and device for detecting node state in distributed system and computer equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102467508A (en) * | 2010-11-04 | 2012-05-23 | 中兴通讯股份有限公司 | Method for providing database service and database system |
CN103019889A (en) * | 2012-12-21 | 2013-04-03 | 曙光信息产业(北京)有限公司 | Distributed file system and failure processing method thereof |
Family Cites Families (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103813369A (en) * | 2012-11-13 | 2014-05-21 | 北京信威通信技术股份有限公司 | Distributed telecommunication switching device backup method |
JP2014229088A (en) * | 2013-05-23 | 2014-12-08 | ソニー株式会社 | Data processing system, data processing device, and storage medium |
CN103823727B (en) * | 2014-02-13 | 2016-04-13 | 深圳市同洲电子股份有限公司 | A kind of backup method of live recording and device |
CN105447029B (en) * | 2014-08-27 | 2019-06-21 | 阿里巴巴集团控股有限公司 | Method for processing business and equipment when a kind of database failure |
CN106528327B (en) * | 2016-09-30 | 2019-06-21 | 华为技术有限公司 | A kind of data processing method and backup server |
CN108628717A (en) * | 2018-03-02 | 2018-10-09 | 北京辰森世纪科技股份有限公司 | A kind of Database Systems and monitoring method |
CN109508261B (en) * | 2018-08-31 | 2019-12-13 | 云南电网有限责任公司信息中心 | Power grid data node backup method and system based on big data |
CN109936481B (en) * | 2019-03-22 | 2021-06-18 | 北京达佳互联信息技术有限公司 | Master-slave server switching method and device, electronic equipment and storage medium |
CN110737545B (en) * | 2019-09-24 | 2021-12-17 | 华青融天(北京)软件股份有限公司 | Data processing method and device, electronic equipment and storage medium |
-
2021
- 2021-01-05 CN CN202110008134.8A patent/CN113778744B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102467508A (en) * | 2010-11-04 | 2012-05-23 | 中兴通讯股份有限公司 | Method for providing database service and database system |
CN103019889A (en) * | 2012-12-21 | 2013-04-03 | 曙光信息产业(北京)有限公司 | Distributed file system and failure processing method thereof |
Also Published As
Publication number | Publication date |
---|---|
CN113778744A (en) | 2021-12-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI753880B (en) | Distributed system-based task processing method, device and system | |
CN107153660B (en) | Fault detection processing method and system for distributed database system | |
CN103530200A (en) | Server hot backup system and method | |
CN110716793B (en) | Method, device, equipment and storage medium for executing distributed transaction | |
CN111400104B (en) | Data synchronization method and device, electronic equipment and storage medium | |
CN112650572A (en) | Distributed task scheduling method and device, computer equipment and storage medium | |
CN109144748B (en) | Server, distributed server cluster and state driving method thereof | |
CN105354108A (en) | Data backup method and node | |
CN107153595B (en) | Fault detection method and system for distributed database system | |
CN112506702A (en) | Data center disaster tolerance method, device, equipment and storage medium | |
CN113505012B (en) | Message queue processing method, medium, device and system | |
WO2013145325A1 (en) | Information processing system, problem detection method and information processing device | |
CN113778744B (en) | Task processing method, device, system and storage medium | |
CN110109772B (en) | CPU restarting method, communication equipment and readable storage medium | |
CN109257396B (en) | Distributed lock scheduling method and device | |
CN105373563B (en) | Database switching method and device | |
CN110704172B (en) | Cluster system timing task scheduling method and cluster system | |
CN106557522B (en) | Method and equipment for providing timing function | |
CN113467953A (en) | Service state switching method and device, server and storage medium | |
JP2012059193A (en) | Monitoring control system, monitoring control method used therefor, and monitoring control method | |
CN109450757B (en) | Method for starting CANopen master station and overall management device thereof | |
CN112787868B (en) | Information synchronization method and device | |
CN110113395B (en) | Shared file system maintenance method and device | |
JP5503512B2 (en) | Computer system and control method in case of failure | |
CN110188008B (en) | Job scheduling master-slave switching method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |