WO2022142666A1 - 数据处理方法、装置、终端设备及存储介质 - Google Patents

数据处理方法、装置、终端设备及存储介质 Download PDF

Info

Publication number
WO2022142666A1
WO2022142666A1 PCT/CN2021/127183 CN2021127183W WO2022142666A1 WO 2022142666 A1 WO2022142666 A1 WO 2022142666A1 CN 2021127183 W CN2021127183 W CN 2021127183W WO 2022142666 A1 WO2022142666 A1 WO 2022142666A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
message
data extraction
extraction rules
sub
Prior art date
Application number
PCT/CN2021/127183
Other languages
English (en)
French (fr)
Inventor
刘根生
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2022142666A1 publication Critical patent/WO2022142666A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Definitions

  • the present application belongs to the technical field of big data, and in particular, relates to a data processing method, apparatus, terminal device and storage medium.
  • a distributed data processing system is generally used to perform large batches of data processing.
  • the inventor realized that in the existing distributed data processing system, if the distributed data processing system directly distributes all the data to be processed to each server, the processing pressure of each server in the distributed data processing system will increase. If the data is divided into multiple parts and sent to each server, the data size of each part will be unevenly distributed, or there will be differences in the processing performance of the servers, which will cause the problem that the server resources cannot be fully utilized.
  • One of the purposes of the embodiments of the present application is to provide a data processing method, apparatus, terminal device and storage medium, aiming to solve the problem that server resources cannot be fully utilized when a large amount of data is sent to multiple servers for processing.
  • an embodiment of the present application provides a data processing method, including:
  • the sub-node server corresponding to the message partition extracts the data to be processed whose data ID conforms to the received data extraction rule from the database, and processes the to-be-processed data ;
  • the unexecuted data extraction rules are respectively allocated to the message partitions corresponding to the sub-node servers in the normal state, so that each of the sub-node servers in the normal state respectively completes the corresponding message partitions. All unexecuted data extraction rules have the same time.
  • an embodiment of the present application provides a data processing apparatus, including:
  • the first sending module is configured to send multiple data extraction rules preset in the master node server to multiple message partitions in the message queue, wherein the data extraction rules received by each message partition are different, and each message partition receives different data extraction rules.
  • Each message partition corresponds to a sub-node server;
  • the acquisition module is used to acquire the data IDs of multiple data to be processed in the database
  • the extraction module is configured to, for any message partition, extract the data to be processed whose data ID conforms to the received data extraction rule from the database through the sub-node server corresponding to the message partition, and process the data for the data to be processed for processing;
  • a determining module configured to determine the data extraction rules that are not executed in the fault message partition when the sub-node server corresponding to any of the message partitions fails;
  • the allocation module is used to allocate the unexecuted data extraction rules to the message partitions corresponding to the sub-node servers in the normal state according to the rebalancing strategy, so that each of the sub-node servers in the normal state has completed the execution respectively.
  • the times of all unexecuted data extraction rules in their corresponding message partitions are consistent.
  • a third aspect of the embodiments of the present application provides a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program When realized:
  • the sub-node server corresponding to the message partition extracts the data to be processed whose data ID conforms to the received data extraction rule from the database, and processes the to-be-processed data ;
  • the unexecuted data extraction rules are respectively allocated to the message partitions corresponding to the sub-node servers in the normal state, so that each of the sub-node servers in the normal state respectively completes the corresponding message partitions. All unexecuted data extraction rules have the same time.
  • a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement:
  • the sub-node server corresponding to the message partition extracts the data to be processed whose data ID conforms to the received data extraction rule from the database, and processes the to-be-processed data ;
  • a fifth aspect of the embodiments of the present application further provides a computer program product, which, when the computer program product runs on a terminal device, enables the terminal device to realize:
  • the sub-node server corresponding to the message partition extracts the data to be processed whose data ID conforms to the received data extraction rule from the database, and processes the to-be-processed data ;
  • the unexecuted data extraction rules are respectively allocated to the message partitions corresponding to the sub-node servers in the normal state, so that each of the sub-node servers in the normal state respectively completes the corresponding message partitions. All unexecuted data extraction rules have the same time.
  • the embodiments of the present application include the following advantages:
  • a plurality of data extraction rules are preset in the master node server, and are respectively sent to a plurality of message partitions in the message queue. Since each data extraction rule only corresponds to a part of the to-be-processed data, each sub-node server only needs to obtain a small-scale to-be-processed data from the database for processing each time. When the existing data processing system directly sends all the data to be processed to each server, it will increase the data processing pressure of each server. Afterwards, when any sub-node server fails, according to the rebalancing strategy, the unexecuted data extraction rule in the corresponding fault message partition is allocated to the message partition corresponding to the normal state sub-node server. Furthermore, the estimated processing time of each sub-node server in the normal state after processing all unexecuted data extraction rules corresponding to the respective message partitions can be consistent, so as to maximize the utilization of server resources.
  • FIG. 1 is an implementation flowchart of a data processing method provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of an implementation manner of S101 of a data processing method provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of an implementation manner of S105 of a data processing method provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of an implementation manner of S1052 of a data processing method provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of another implementation manner of S1052 of a data processing method provided by an embodiment of the present application.
  • FIG. 6 is an implementation flowchart of a data processing method provided by another embodiment of the present application.
  • FIG. 7 is an implementation flowchart of a data processing method provided by another embodiment of the present application.
  • FIG. 8 is a structural block diagram of a data processing apparatus provided by an embodiment of the present application.
  • FIG. 9 is a structural block diagram of a terminal device provided by an embodiment of the present application.
  • the data processing methods provided in the embodiments of the present application may be applied to a data processing system including multiple data processing servers, and the data processing system may be a distributed data processing system.
  • the distributed data processing system includes multiple sub-node servers and at least one master node server.
  • the main node server can be used to monitor the working status of each sub-node server, and the sub-node server is used to obtain the data to be processed from the database in the distributed data processing system for processing.
  • the distributed data processing system can be regarded as the distributed execution of data. That is, a large amount of data to be processed contained in a task is divided into multiple independent task items (small-scale data to be processed), and then each sub-node server executes one or several independent task items respectively. In this way, when a sub-node server crashes, it does not affect the normal work of the remaining sub-node servers.
  • the tasks originally assigned to the sub-node server need to be transferred to other sub-node servers for processing, usually the sub-node server
  • the task is transferred to the sub-node server that completes the task first.
  • the remaining sub-node servers will be in an idle state after completing their corresponding tasks in sequence, so that the server resources cannot be utilized to the fullest.
  • FIG. 1 shows a flowchart for realizing a data processing method provided by an embodiment of the present application, and the method includes the following steps:
  • master node server In the application, the purposes of the above-mentioned master node server and sub-node server have been described above, and will not be explained again. It should be added that the master node server is also used to monitor the working status of each sub-node server, and send the data extraction rules set by the staff to each message partition in the message queue.
  • the above data extraction rules can be set by staff according to business processing conditions, and are used to segment a large amount of data to be processed in the database.
  • the data extraction rule may be to use a preset amount of data to be processed as a data scale, thereby obtaining multiple data scales.
  • the preset amount of data to be processed may be determined according to the data ID of the data to be processed in the data scale.
  • the above-mentioned message queue is a container for storing messages in the process of message transmission.
  • a message can be understood as data transmitted between two devices.
  • the messages buffered in the above message queue can be considered as data extraction rules for multiple data to be processed.
  • the above message queues include but are not limited to RabbitMQ (reusable enterprise messaging system), Kafka (distributed message publishing and subscription system), and the like.
  • the Kafka message queue is used for description in this embodiment.
  • the picture uploading system stores batches of picture information in the database, and uploads the data extraction rules preset in the master node server to each message partition in the Kafka message queue.
  • the sub-node servers corresponding to the message partitions respectively obtain the data to be processed that meet the requirements from the database according to the data extraction rules.
  • the picture information in the database is a plurality of data to be processed.
  • each message partition corresponds to a sub-node server for obtaining data from the database for processing.
  • each message partition corresponds to a corresponding execution condition (data extraction rule).
  • a message partition can contain one or more data extraction rules at the same time, which is not limited.
  • an execution topic can be defined for each data extraction rule for identification.
  • the execution subject can be numbers, letters, and the task name input by the staff, which is not limited.
  • the master node server is used to monitor the working status of the sub-node servers
  • business logic for monitoring the working status of each sub-node server can also be set in any sub-node server.
  • the sub-node server also has the function of monitoring the working state of each sub-node server, and also has the function of processing the data to be processed. With this, the number of servers to be set can be reduced.
  • S102 Acquire data IDs of multiple data to be processed in the database.
  • the distributed data processing system can assign a data ID to each piece of data to be processed.
  • each data to be processed has a time sequence in the process of being transmitted to the database. Based on this, a corresponding data ID can be set for each data to be processed according to the time sequence.
  • the data ID can be generated through a Universally Unique Identifier (UUID) to ensure that the data ID generated by each data to be processed will not be repeated.
  • UUID Universally Unique Identifier
  • the above data extraction rules may be extraction conditions of data to be processed in the database. Since the database contains a large amount of data to be processed, if the distributed data processing system directly distributes all the data to be processed to each server, the processing pressure of each server in the distributed data processing system will be increased. Therefore, data extraction rules can be set up in the master node server and sent to multiple message partitions in the message queue. So that the sub-node server corresponding to each message partition can extract part of the data to be processed from the database each time according to the data extraction rules for processing, thereby reducing the processing pressure of the sub-node server.
  • Table 1 below:
  • each data extraction rule contains the same amount of data to be processed.
  • the above processing state is the state of the data to be processed in the database.
  • any sub-node server when any sub-node server is in a fault state, it means that the sub-node server can no longer obtain the data to be processed from the database for processing according to the corresponding data extraction rules in the message queue.
  • the message partition corresponding to the above-mentioned faulty sub-node server is the fault message partition.
  • the sub-node server may execute each data extraction rule in sequence according to the corresponding data ID size.
  • the first data extraction rule that includes data ID1 to data ID500 in the message partition and the second data extraction rule that includes data ID501 to data ID1000, it can be considered that the data ID corresponding to the second data rule is greater than the first data ID.
  • the sub-node server may execute the first data extraction rule first.
  • the first data extraction rule and the second data extraction rule need to be allocated to the remaining sub-nodes server. If multiple pieces of data to be processed corresponding to the first data extraction rule have been executed, only the second data extraction rule may be allocated to the remaining sub-node servers.
  • the above rebalancing strategy may be that when allocating the unexecuted data extraction rules in the fault message partition to the remaining sub-node servers, each assigned sub-node server should execute all unexecuted data respectively after the execution of all the unexecuted data.
  • the estimated processing time of the extraction rules is equal; or, after the unexecuted data extraction rules are allocated to the remaining sub-node servers, the number of unexecuted data extraction rules in each sub-node server is equal.
  • the time for each sub-node server to process data is basically the same. Therefore, the data extraction rules that are not executed in the message partition corresponding to the node server in each normal state (including the original data extraction rules that are not executed in the message partition corresponding to the sub-node server, and the unexecuted data extraction rules allocated according to the rebalancing strategy) When the number of data extraction rules) is the same, it can be considered that the estimated processing time for each sub-node server to process all unexecuted data extraction rules is the same.
  • the data extraction rules that are not executed in the fault message partition are redistributed through the rebalancing strategy, so as to avoid unbalanced distribution, which will cause a sub-node server to pre-process the data extraction rules in the corresponding message partition. , has been in the idle state. In this way, the maximum utilization of server resources is realized.
  • multiple data extraction rules are preset in the master node server, and are respectively sent to multiple message partitions in the message queue. Since each data extraction rule only corresponds to a part of the to-be-processed data, each sub-node server only needs to obtain a small-scale to-be-processed data from the database for processing each time. When the existing data processing system directly sends all the data to be processed to each server, it will increase the data processing pressure of each server. Afterwards, when any sub-node server fails, according to the rebalancing strategy, the unexecuted data extraction rule in the corresponding fault message partition is allocated to the message partition corresponding to the normal state sub-node server. Furthermore, the estimated processing time of each sub-node server in a normal state after processing all unexecuted data extraction rules corresponding to the respective message partitions can be consistent, so as to maximize the utilization of server resources.
  • multiple data extraction rules preset in the master node server are sent to multiple message partitions in the message queue, which specifically includes the following sub-steps S1011-S1012, which are described in detail. as follows:
  • the number of the above-mentioned sub-node servers can be specifically set according to the actual situation, and it can be set one-to-one with the message partition.
  • the number of sub-node servers and message partitions can be set to be three.
  • the unexecuted data extraction rules are respectively allocated to the message partitions corresponding to the sub-node servers in a normal state, which specifically includes the following sub-steps S1051- S1052, detailed as follows:
  • the sub-node server can execute each data extraction rule in sequence according to the data ID size of the data to be processed corresponding to each data extraction rule. Based on this, the sub-node server can sort each data extraction rule in the message partition, thereby determining the data extraction rules that are not executed. Based on this, the distributed data processing system can count the first number of unexecuted data extraction rules in the fault message partition, and the second number of unexecuted data extraction rules in each normal state message partition.
  • the data extraction rules that are not executed in the fault message partition are allocated to the normal state message partition.
  • the second number of data extraction rules may be evenly distributed to each normal state message partition; or, the total value of the first number and the second number may be calculated, and the total number of normal state message partitions may be counted. After that, divide the total value by the total quantity to get the target value. Finally, the difference between the target value and the second number in the message partition in the normal state is calculated. At this time, the difference can be considered as the number of unexecuted data extraction rules that should be allocated in the message partition in the normal state.
  • any sub-node server changes from a working state to an idle state, the unprocessed data extraction rules in the message partitions corresponding to the remaining sub-node servers are obtained, and the data extraction rules are reassigned to this sub-node server according to the rebalancing strategy.
  • Sub-node server Specifically, due to the actual situation, the processing time of each sub-node server for processing different data to be processed may be inconsistent. Therefore, there are one or more sub-node servers that execute the assigned data extraction rules in advance.
  • the data extraction rules that are not executed in the remaining sub-node servers can be obtained, and the data extraction rules can be redistributed to the sub-node servers according to the above rebalancing strategy, so as to maximize the utilization of server resources.
  • the data extraction rules that are not executed in the fault message partition are allocated to the message partition in the normal state, Specifically, it includes the following sub-steps S10521-S10523, which are detailed as follows:
  • the above-mentioned preset time period can be the time period preset by the staff; it can also be the time when the sub-node server obtains the data extraction rule as the starting time, and any sub-node server changes from the normal state to The time in the fault state is used as the end time, and the time period between the start time and the end time is the preset time period, which is not limited.
  • S1052 has described how to calculate the data extraction rules that are not executed in the message partition. Based on this, the executed number can be calculated according to the number of data extraction rules allocated by the master node server to each sub-node server, and the work efficiency of the sub-node server can be calculated according to a preset time period.
  • the first quantity, the second quantity, and the work efficiency respectively, allocate the data extraction rules that are not executed in the fault message partition to the message partitions in the normal state, so that each The time when the sub-node servers in the normal state respectively finish executing all the unexecuted data extraction rules in their corresponding message partitions is consistent.
  • each sub-node server after the work efficiency of each sub-node server is obtained, it can be calculated according to the ratio of each work efficiency, the second number of unexecuted data extraction rules in each normal state message partition, and the unexecuted data extraction rules in the fault message partition.
  • the first number of data extraction rules executed redistributing the data extraction rules in the fault message partition. So that the time when each sub-node server in the normal state finishes processing the unexecuted data extraction rules in the respective message partitions is consistent.
  • the second number is y, and there are two sub-node servers in a normal state.
  • the number of data extraction rules allocated to the message partition A can be set to be Xa.
  • the work efficiency b1 of the sub-node server b, and the second number B1 of unfinished data extraction rules in the message partition B corresponding to the sub-node server b the number of data extraction rules allocated to the message partition B can be set to be Xb.
  • the data extraction rules that are not executed in the fault message partition are allocated to the message partition in the normal state, Specifically, it includes the following sub-steps S10524-S10526, which are detailed as follows:
  • the average number of data extraction rules that should be executed by the sub-node server corresponding to each message partition in a normal state can be calculated. Based on this, for any message partition in a normal state, the number of executions that should be allocated to the message partition can be determined according to the difference between the average number and the second number, so that all the message partitions in each normal state after the allocation are not An equal number of data extraction rules are executed. Furthermore, the purpose of the rebalancing strategy is achieved.
  • the database records the processing status of each data to be processed, and the processing status includes a completed status, an unstarted status and an abnormal status; the data processing method further includes the following steps:
  • the state record of the data to be processed corresponding to each of the above data extraction rules is recorded after the state changes.
  • the distributed data processing system can change the processing state of the corresponding data to be processed in the database to the completed state after the sub-node server executes all the data to be processed corresponding to the data extraction rule.
  • the state records can be stored in the database in the form of tables.
  • the information recorded in the above status record includes but is not limited to the information of the data to be processed, each processing status and the time of recording each processing status, and the status record can be used to record all relevant information of the data to be processed from acquisition to completion of processing.
  • the sub-node server obtains a batch of data to be processed from the database according to the data extraction rules. Based on this, if any data to be processed is abnormal after the sub-node server processes the data to be processed, all the data to be processed corresponding to the data extraction rule need to be marked as abnormal in the database. It should be noted that, when the processing state of the data to be processed is marked in the database as an abnormal state, in the process of processing the data to be processed corresponding to the data extraction rule, if any data to be processed is abnormal during processing, that is, It is possible to stop processing the remaining data to be processed in the data extraction rule, and it is not necessary to process the to-be-processed data corresponding to the data extraction rule.
  • the database further records the processing times of the data to be processed, and after marking the processing state of the data to be processed as a completed state in the database in S108, the following steps S108A-S108B are further included , detailed as follows:
  • S108A Re-send the data extraction rule corresponding to the data to be processed in the abnormal state to the message partition of the message queue, so that the sub-node server corresponding to the message partition that has received the data extraction rule will download the The data to be processed in the abnormal state is extracted from the database.
  • S108B Record the number of processing times of the data to be processed in the abnormal state, and mark the data to be processed in the abnormal state after the number of processing times reaches a preset value.
  • the master node server may also poll the database according to preset execution conditions (for example, every preset time period), and retrieve the data from the database. Detect pending data whose processing status is abnormal. After that, according to the data ID corresponding to the data to be processed, the corresponding data extraction rules are re-sent to the Kafka message queue, waiting for the sub-node server to process again.
  • preset execution conditions for example, every preset time period
  • the database will also count the processing times of the to-be-processed data corresponding to the data extraction rule.
  • the data to be processed corresponding to the data extraction rule is marked.
  • the number of times of processing the data to be processed is recorded in the database, and for details, reference may be made to the value corresponding to the retry state in Table 1 above.
  • the distributed data processing system can feed back the state record of the abnormal state to the preset terminal equipment of the staff, so as to notify the staff to deal with it in time.
  • FIG. 8 is a structural block diagram of a data processing apparatus provided by an embodiment of the present application. Each module included in the data processing apparatus in this embodiment is used to execute each step in the embodiment corresponding to FIG. 1 to FIG. 7 .
  • the data processing apparatus 800 includes: a first sending module 810, an obtaining module 820, an extracting module 830, a determining module 840, and an assigning module 850, wherein:
  • the first sending module 810 is configured to send multiple data extraction rules preset in the master node server to multiple message partitions in the message queue, wherein the data extraction rules received by each message partition are different, and each message partition receives a different data extraction rule.
  • Each message partition corresponds to a sub-node server.
  • the obtaining module 820 is configured to obtain data IDs of multiple data to be processed in the database.
  • the extraction module 830 is configured to, for any message partition, extract the data to be processed whose data ID conforms to the received data extraction rule from the database through the sub-node server corresponding to the message partition, and process all the data to be processed.
  • the data to be processed is processed.
  • a determination module 840 configured to determine the data extraction rules that are not executed in the fault message partition when the sub-node server corresponding to any of the message partitions fails;
  • the allocation module 850 is configured to allocate the unexecuted data extraction rules to the message partitions corresponding to the sub-node servers in the normal state according to the rebalancing strategy, so that each sub-node server in the normal state executes the rules respectively.
  • the time when all unexecuted data extraction rules in their corresponding message partitions are completed is the same.
  • the first sending module 810 is further configured to:
  • the allocation module 850 is also used to:
  • the allocation module 850 is also used to:
  • the allocation module 850 is also used to:
  • the execution quantity of the data extraction rules that should be executed according to the first quantity, the second quantity and the execution quantity, allocate the data extraction rules that are not executed in the fault message partition, so that each distributed
  • the number of all unexecuted data extraction rules in each of the message partitions in the normal state is equal to the executed number.
  • the database records the processing status of each data to be processed, and the processing status includes a completed status, an unstarted status, and an abnormal status;
  • the data processing apparatus 800 further includes:
  • the first marking module is configured to mark the data to be processed corresponding to any of the data extraction rules in the database, if the data to be processed is not input into the sub-node server, then mark the data in the database. The processing status of the data to be processed is not started.
  • the second marking module is configured to mark the processing status of the to-be-processed data in the database as a completed state if the sub-node server has finished processing the to-be-processed data and no processing exception occurs during the processing .
  • a third marking module configured to mark the processing status of the data to be processed as abnormal in the database if the sub-node server has finished processing the data to be processed and a processing exception occurs during the processing state.
  • the generating module is configured to generate a state record of the data to be processed corresponding to each data extraction rule, and store the state record in a database.
  • FIG. 9 is a structural block diagram of a terminal device provided by another embodiment of the present application.
  • the terminal device 900 of this embodiment includes: a processor 910 , a memory 920 , and a computer program 930 stored in the memory 920 and executable on the processor 910 , such as a program of a data processing method.
  • the processor 910 executes the computer program 930, it implements the steps in the various embodiments of the foregoing data processing methods, for example, S101 to S105 shown in FIG. 1 . Specifically as follows:
  • a terminal device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, the processor implements when the processor executes the computer program:
  • the sub-node server corresponding to the message partition extracts the data to be processed whose data ID conforms to the received data extraction rule from the database, and processes the to-be-processed data ;
  • the unexecuted data extraction rules are respectively allocated to the message partitions corresponding to the sub-node servers in the normal state, so that each of the sub-node servers in the normal state respectively completes the corresponding message partitions. All unexecuted data extraction rules have the same time.
  • the processor when the processor executes the computer program, it further implements:
  • the processor when the processor executes the computer program, it further implements:
  • the processor when the processor executes the computer program, it further implements:
  • the processor when the processor executes the computer program, it further implements:
  • the execution quantity of the data extraction rules that should be executed according to the first quantity, the second quantity and the execution quantity, allocate the data extraction rules that are not executed in the fault message partition, so that each distributed
  • the number of all unexecuted data extraction rules in each of the message partitions in the normal state is equal to the executed number.
  • the processing status of each data to be processed is recorded in the database, and the processing status includes a completed status, an unstarted status and an abnormal status; when the processor executes the computer program, the processor further implements:
  • the processing status of the data to be processed is marked in the database is not started;
  • the sub-node server has finished processing the data to be processed and a processing exception occurs during the processing, marking the processing state of the data to be processed as an abnormal state in the database;
  • a state record of the data to be processed corresponding to each data extraction rule is generated, and the state record is stored in a database.
  • the database further records the number of times of processing the data to be processed; when the processor executes the computer program, it further implements:
  • a computer-readable storage medium stores a computer program, and the computer program is implemented when executed by a processor:
  • the sub-node server corresponding to the message partition extracts the data to be processed whose data ID conforms to the received data extraction rule from the database, and processes the to-be-processed data ;
  • the unexecuted data extraction rules are respectively allocated to the message partitions corresponding to the sub-node servers in the normal state, so that each of the sub-node servers in the normal state respectively completes the corresponding message partitions. All unexecuted data extraction rules have the same time.
  • the computer program when executed by the processor, further implements:
  • the computer program when executed by the processor, further implements:
  • the computer program when executed by the processor, further implements:
  • the computer program when executed by the processor, further implements:
  • the execution quantity of the data extraction rules that should be executed according to the first quantity, the second quantity and the execution quantity, allocate the data extraction rules that are not executed in the fault message partition, so that each distributed
  • the number of all unexecuted data extraction rules in each of the message partitions in the normal state is equal to the executed number.
  • the processing status of each data to be processed is recorded in the database, and the processing status includes a completed status, an unstarted status, and an abnormal status; when the computer program is executed by the processor, it further implements:
  • the processing status of the data to be processed is marked in the database is not started;
  • the sub-node server has finished processing the data to be processed and a processing exception occurs during the processing, marking the processing state of the data to be processed as an abnormal state in the database;
  • a state record of the data to be processed corresponding to each data extraction rule is generated, and the state record is stored in a database.
  • the database further records the number of times of processing the data to be processed; when the computer program is executed by the processor, it further implements:
  • the computer program 930 may be divided into one or more units, and the one or more units are stored in the memory 920 and executed by the processor 910 to complete the present application.
  • One or more units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 930 in the terminal device 900 .
  • the terminal device may include, but is not limited to, the processor 910 and the memory 920 .
  • FIG. 9 is only an example of the terminal device 900, and does not constitute a limitation to the terminal device 900, and may include more or less components than the one shown, or combine some components, or different components
  • the terminal device may also include an input and output device, a network access device, a bus, and the like.
  • the so-called processor 910 may be a central processing unit, and may also be other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components. Wait.
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 920 may be an internal storage unit of the terminal device 900 , such as a hard disk or a memory of the terminal device 900 .
  • the memory 920 may also be an external storage device of the terminal device 900 , such as a plug-in hard disk, a smart memory card, a flash memory card, etc., which are equipped on the terminal device 900 . Further, the memory 920 may also include both an internal storage unit of the terminal device 900 and an external storage device.
  • the embodiments of the present application provide a computer program product, which, when the computer program product runs on a mobile terminal, enables the terminal device to implement the steps in the various embodiments of the foregoing data processing methods.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium.
  • the computer-readable storage medium may be non-volatile or volatile.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer And Data Communications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请适用于大数据技术领域,提供了一种数据处理方法、装置、终端设备及存储介质,方法包括:将预置的多个数据提取规则,发送至消息队列中的多个消息分区;获取数据库中多个待处理数据的数据ID;针对任一消息分区,通过分节点服务器,根据数据提取规则和数据ID从数据库中提取待处理数据;当分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;根据再平衡策略,将未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中。采用上述方法在分节点服务器发送故障时,根据再平衡策略,将该分节点服务器对应的故障消息分区中未执行的数据提取规则进行再分配,以实现最大化利用服务器资源的目的。

Description

数据处理方法、装置、终端设备及存储介质
本申请要求于2020年12月28日在中国专利局提交的、申请号为202011583891.X、发明名称为“数据处理方法、装置、终端设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于大数据技术领域,尤其涉及一种数据处理方法、装置、终端设备及存储介质。
背景技术
现有技术中,通常使用分布式数据处理系统来执行大批量的数据处理。然而,发明人意识到,现有的分布式数据处理系统中,若直接由分布式数据处理系统向各个服务器分发全部的待处理数据,则将增加分布式数据处理系统中各个服务器的处理压力。若将数据分为多个部分分别发送给各个服务器,则在每个部分的数据规模分布不均匀,或者,服务器处理性能存在差别时,将会产生服务器资源无法充分利用的问题。
技术问题
本申请实施例的目的之一在于:提供一种数据处理方法、装置、终端设备及存储介质,旨在解决将大量的数据分别发送给多个服务器进行处理时,不能充分利用服务器资源的问题。
技术解决方案
为解决上述技术问题,本申请实施例采用的技术方案是:
第一方面,本申请实施例提供了一种数据处理方法,包括:
将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
获取数据库中多个待处理数据的数据ID;
针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
第二方面,本申请实施例提供了一种数据处理装置,包括:
第一发送模块,用于将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
获取模块,用于获取数据库中多个待处理数据的数据ID;
提取模块,用于针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
确定模块,用于当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
分配模块,用于根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
本申请实施例的第三方面提供了一种终端设备,包括:存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实 现:
将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
获取数据库中多个待处理数据的数据ID;
针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现:
将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
获取数据库中多个待处理数据的数据ID;
针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。本申请实施例的第五方面还提供了一种计算机程序产品,当所述计算机程序产品在终端设备上运行时,使得所述终端设备实现:
将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
获取数据库中多个待处理数据的数据ID;
针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
有益效果
与现有技术相比,本申请实施例包括以下优点:
本申请实施例,通过在主节点服务器中预置多个数据提取规则,并分别发送至消息队列中的多个消息分区中。因每个数据提取规则只对应部分规模的待处理数据,因此,可使得每个分节点服务器每次只需从数据库中获取小规模的待处理数据进行处理。解决现有的数据处理系统直接向各个服务器发送全部的待处理数据时,将增加分各个服务器数据处理压力的问题。之后,在任一分节点服务器出现故障时,根据再平衡策略,将对应的故障消息分区中未执行数据提取规则分配给正常状态的分节点服务器对应的消息分区。进而,可使得每个正常状态的分节点服务器处理完各自对应消息分区 所有未执行的数据提取规则的预计处理时间一致,实现服务器资源的最大化利用。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或示范性技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1是本申请一实施例提供的一种数据处理方法的实现流程图;
图2是本申请一实施例提供的一种数据处理方法的S101的一种实现方式示意图;
图3是本申请一实施例提供的一种数据处理方法的S105的一种实现方式示意图;
图4是本申请一实施例提供的一种数据处理方法的S1052的一种实现方式示意图;
图5是本申请一实施例提供的一种数据处理方法的S1052的另一种实现方式示意图;
图6是本申请另一实施例提供的一种数据处理方法的实现流程图;
图7是本申请又一实施例提供的一种数据处理方法的实现流程图;
图8是本申请一实施例提供的一种数据处理装置的结构框图;
图9是本申请一实施例提供的一种终端设备的结构框图。
本发明的实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例提供的数据处理方法可以应用于包括多个数据处理服务器的数据处理系统上,该数据处理系统可以是分布式数据处理系统。其中,分布式数据处理系统包括多个分节点服务器,和至少一个主节点服务器。其中主节点服务器可用于监控各分节点服务器的工作状态,分节点服务器用于从分布式数据处理系统中的数据库获取待处理数据进行处理。其中,分布式数据处理系统,可认为是将数据进行分布式执行。即将一个任务中包含的大量待处理数据分割成多个独立的任务项(小规模的待处理数据),然后由各分节点服务器分别执行某一个或某几个独立的任务项。以此,当某个分节点服务器崩溃,也不影响其余分节点服务器的正常工作。
在实际过程中,分节点服务器崩溃时,需要将本来分配给该分节点服务器的任务(多个小规模的待处理数据)转交给其它分节点服务器进行处理时,通常是将该分节点服务器的任务转交给先完成任务的分节点服务器。然而,若此时其余分节点服务器在依次完成各自对应的任务后将处于空闲状态,以至于无法最大化利用服务器资源。
基于此,为解决上述问题,请参阅图1,图1示出了本申请实施例提供的一种数据处理方法的实现流程图,该方法包括如下步骤:
S101、将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器。
在应用中,上述主节点服务器和分节点服务器的用途已在上述说明,对此不再进行解释。需要补充的是,主节点服务器还用于监控各分节点服务器的工作状态,并将工作人员设置的数据提取规则分别发送至消息队列中的各个消息分区中。
在应用中,上述数据提取规则可以根据业务处理情况,由工作人员进行设定,用于对数据库中的大量待处理数据进行分割。其中,数据提取规则可以为将预设数量的待处理数据作为一个数据规模,以此得到多个数据规模。其中,预设数量的待处理数据可以根据待处理数据的数据ID,确定该数据规模中待处理数据的数量。
在应用中,上述消息队列为在消息的传输过程中保存消息的容器。其中,消息可以理解为是在两台设备之间传输的数据。可认为上述消息队列中缓存的消息为多个待处理数据的数据提取规则。上述消息队列包括但不限于RabbitMQ(可复用的企业消息系统)、Kafka (分布式消息发布订阅系统)等。为便于解释说明,本实施例中以kafka消息队列进行说明。示例性的,图片上传系统将图片信息批次存储在数据库中,并将预置在主节点服务器中的数据提取规则上传至Kafka消息队列中的各个消息分区。消息分区对应的分节点服务器分别根据数据提取规则,从数据库中获取满足要求的待处理数据。此时,数据库中的图片信息即为多个待处理数据。
需要说明的是,消息队列包含有多个消息分区,每个消息分区均对应有一个分节点服务器,用于从数据库中获取数据进行处理。其中,每个消息分区中均各自对应有相应的执行条件(数据提取规则)。一个消息分区可以同时包含一个或多个数据提取规则,对此不做限定。
可以理解是,因每个消息分区中接收到的数据提取规则不同。因此,为区分消息队列中的多个数据提取规则,可为每个数据提取规则定义一个执行主题进行标识。其中,执行主题可以为数字、字母,以及工作人员输入的任务名称,对此不作限定。
在其他应用中,因上述主节点服务器用于监控分节点服务器的工作状态,因此,还可在任一分节点服务器中设置用于监控各个分节点服务器工作状态的业务逻辑。此时,该分节点服务器同时具有监控每个分节点服务器的工作状态的功能,还具有对待处理数据进行数据处理的功能。以此,可减少设置的服务器的数量。
S102、获取数据库中多个待处理数据的数据ID。
在应用中,上述待处理数据在传输至数据库时,分布式数据处理系统可为每条待处理数据分配数据ID。具体的,每个待处理数据在传输至数据库的过程中均有时间先后顺序。基于此,可根据时间先后顺序为每个待处理数据设置对应的数据ID。例如,数据ID可以通过通用唯一识别码(Universally Unique Identifier,UUID)生成,以保证每个待处理数据所生成的数据ID都不会重复。
S103、针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理。
在应用中,上述数据提取规则可以为数据库中待处理数据的提取条件。因数据库中包含了大量的待处理数据,若直接由分布式数据处理系统直接向各个服务器分发全部的待处理数据,则将增加分布式数据处理系统中各个服务器的处理压力。因此,可在主节点服务器中设置数据提取规则,并发送至消息队列中的多个消息分区中。以使得每个消息分区对应的分节点服务器可根据数据提取规则,每次从数据库中提取部分待处理数据进行处理,以此减小分节点服务器的处理压力。具体可参照如下表1:
表1:
开始ID 结束ID 处理状态 重试状态
1 500 完成状态  
501 1000 未开始状态  
1 500 异常状态 1
1 500 未开始状态  
参照表1可知,上述每个数据提取规则对应的数据规模为500,第一个数据提取规则为开始ID(数据ID)为1以及结束ID(数据ID)为500之间的待处理数据。第二个数据提取规则为开始ID(数据ID)为501以及结束ID(数据ID)为1000之间的待处理数据。即多个数据提取规则中,每个数据提取规则中包含的待处理数据的数量一致。其中,上述处理状态为数据库中待处理数据的状态。
S104、当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则。
S105、根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对 应的消息分区中所有未执行的数据提取规则的时间一致。
在应用中,在任意分节点服务器处于故障状态时,表示该分节点服务器无法再根据消息队列中对应的数据提取规则,从数据库中获取待处理数据进行处理。此时,上述故障分节点服务器对应的消息分区即为故障消息分区。为执行故障消息分区中多个未执行的数据提取规则,需要将故障消息分区中未执行的数据提取规则分配至正常状态下的各个分节点服务器对应的消息分区中。
在应用中,对于一个同时包含多个数据提取规则的消息分区。因每个数据提取规则对应的待处理数据的数据ID大小不一致,因此,分节点服务器可根据对应的数据ID大小,依次执行每个数据提取规则。示例性的,对于消息分区中包含了数据ID1至数据ID500的第一数据提取规则,以及包含了数据ID501至数据ID1000的第二数据提取规则,可认为第二数据规则对应的数据ID大于第一数据提取规则对应的数据ID。因此,分节点服务器可先执行第一数据提取规则。基于此,若该消息分区对应的分节点服务器故障时,第一数据提取规则对应的多个待处理数据未执行完,则需将第一数据提取规则以及第二数据提取规则分配给其余分节点服务器。若第一数据提取规则对应的多个待处理数据已执行完,则可只将第二数据提取规则分配给其余分节点服务器。
在应用中,上述再平衡策略可以为在将故障消息分区中未执行的数据提取规则分配至其余分节点服务器时,应使分配后的每个分节点服务器,分别在执行完所有未执行的数据提取规则的预计处理时间相等;或者,将未执行的数据提取规则分配至其余分节点服务器后,各分节点服务器中未执行的数据提取规则的数量相等。
可以理解的是,在正常情况下,每个分节点服务器处理数据的时间基本一致。因此,在每个正常状态的节点服务器对应的消息分区中未执行的数据提取规则(包含该分节点服务器对应的消息分区中原本未执行的数据提取规则,以及根据再平衡策略分配的未执行的数据提取规则)的数量一致时,可认为每个分节点服务器处理完所有未执行的数据提取规则的预计处理时间一致。以此,通过再平衡策略来对处于故障消息分区中未执行的数据提取规则进行再分配,以避免因分配不平衡,造成某一分节点服务器在预先处理完对应消息分区中的数据提取规则后,一直处于空闲状态的情况。以此,实现服务器资源的最大化利用。
在本实施例中,通过在主节点服务器中预置多个数据提取规则,并分别发送至消息队列中的多个消息分区中。因每个数据提取规则只对应部分规模的待处理数据,因此,可使得每个分节点服务器每次只需从数据库中获取小规模的待处理数据进行处理。解决现有的数据处理系统直接向各个服务器发送全部的待处理数据时,将增加分各个服务器数据处理压力的问题。之后,在任一分节点服务器出现故障时,根据再平衡策略,将对应的故障消息分区中未执行数据提取规则分配给正常状态的分节点服务器对应的消息分区。进而,可使得每个正常状态的分节点服务器处理完各自对应消息分区所有未执行的数据提取规则的预计处理时间一致,实现服务器资源的最大化利用。
参照图2,在一具体实施例中,在S101将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区中,具体包括如下子步骤S1011-S1012,详述如下:
S1011、统计所述多个数据提取规则的规则数量,以及所述多个消息分区的分区数量。
S1012、根据所述规则数量以及所述分区数量,将所述多个数据提取规则平均分配至每个消息分区中。
在应用中,根据上述S103中的表1,可认为每个数据提取规则对应的待处理数据的数量相等。另外,在实际情况中,每个分节点服务器处理每个待处理数据的处理时间几乎一致。基于此,可统计所有数据提取规则的规则数量,以及所有消息分区的分区数量,而后,计算每个消息分区中所应包含的数据提取规则的平均数量。
在应用中,上述分节点服务器的数量具体可根据实际情况进行设置,其可与消息分区一对一进行设置。在本实施例中,可设置分节点服务器和消息分区的数量均为3。在主节 点服务器确定了数据提取规则的规则数量后,主节点服务器可根分区数量,对多个数据提取规则进行平均分配,使得每个分节点服务器所需处理数据提取规则的数量一致。
参照图3,在一具体实施例中,在S105根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,具体包括如下子步骤S1051-S1052,详述如下:
S1051、获取所述故障消息分区中未执行的数据提取规则的第一数量,以及分别获取每个所述正常状态的消息分区中的未执行的数据提取规则的第二数量。
S1052、根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中。
在应用中,上述S105中已说明分节点服务器可根据每个数据提取规则对应的待处理数据的数据ID大小,依次执行各个数据提取规则。基于此,分节点服务器可对消息分区中每个数据提取规则进行排序,以此,确定未执行的数据提取规则。基于此,分布式数据处理系统可统计故障消息分区中未执行的数据提取规则的第一数量,以及每个正常状态的消息分区中未执行的数据提取规则的第二数量。
在应用中,根据第一数量和第二数量,将故障消息分区中未执行的数据提取规则分配至正常状态的消息分区中。具体的,可将第二数量的数据提取规则平均分配给各个正常状态的消息分区;或者,计算第一数量和第二数量的总值,并统计正常状态的消息分区的总数量。之后,将总值除以总数量得到目标值。最后,计算目标值与正常状态的消息分区中第二数量的差值,此时,该差值即可认为是该正常状态的消息分区中所应分配的未执行的数据提取规则的数量。
在其他应用中,若任一分节点服务器由工作状态变为空闲状态,则获取其余分节点服务器对应的消息分区中未进行处理的数据提取规则,并根据再平衡策略重新分配数据提取规则至该分节点服务器。具体的,因实际情况下,每个分节点服务器处理不同待处理数据的处理时间可能不一致。因此,存在某个或多个分节点服务器提前执行完分配的数据提取规则。基于此,可获取其余分节点服务器中未执行的数据提取规则,并根据上述再平衡策略重新分配数据提取规则至该分节点服务器中,以达到最大化利用服务器资源的目的。
参照图4,在一具体实施例中,在S1052根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,具体包括如下子步骤S10521-S10523,详述如下:
S10521、分别获取预设时间段内,所述正常状态的消息分区中数据提取规则的已执行数量。
S10522、根据所述已执行数量和所述预设时间段,分别计算所述正常状态的消息分区对应的分节点服务器的工作效率。
在应用中,上述预设时间段可以为工作人员预先设定的时间段;也可以为分节点服务器分别将获取数据提取规则的时间作为起始时间,将任一分节点服务器由正常状态变为故障状态时的时间作为终止时间,该起始时间与终止时间内的时间段即为预设时间段,对此不作限定。上述已说明S1052中已说明如何计算消息分区中未执行的数据提取规则。基于此,可根据主节点服务器向每个分节点服务器分配的数据提取规则的数量计算已执行数量,并根据预设时间段计算该分节点服务器的工作效率。
S10523、分别根据所述第一数量、所述第二数量和所述工作效率,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,以使得每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
在应用中,在获取到每个分节点服务器的工作效率后,可根据每个工作效率的比值、每个正常状态的消息分区中未执行的数据提取规则的第二数量以及故障消息分区中未执行的数据提取规则的第一数量,对故障消息分区中的数据提取规则重新分配。以使得每个处 于正常状态的分节点服务器分别处理完各自消息分区中未执行的数据提取规则的时间一致。
示例性的,若第二数量为y,以及正常状态的分节点服务器有两个。在确定分节点服务器a的工作效率a1,分节点服务器a对应的消息分区A中未完成的数据提取规则的第二数量A1,可设分配给消息分区A的数据提取规则的数量为Xa。以及分节点服务器b的工作效率b1,分节点服务器b对应的消息分区B中未完成的数据提取规则的第二数量B1,可设分配给消息分区B的数据提取规则的数量为Xb。基于此,可建立方程组进行计算:
Figure PCTCN2021127183-appb-000001
Xa+Xb=y;其中,a1、A1、b1、B1和y均为已知数。基于此,可分别计算出消息分区A对应分配的据提取规则的数量为Xa,以及消息分区B对应分配的据提取规则的数量为Xb。
参照图5,在一具体实施例中,在S1052根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,具体包括如下子步骤S10524-S10526,详述如下:
S10524、计算所述第一数量和所有所述第二数量之间的总值。
S10525、根据所述总值以及所述正常状态的消息分区的数量,计算每个所述正常状态的消息分区对应的分节点服务器应执行的数据提取规则的执行数量;
S10526、根据所述第一数量、所述第二数量和所述执行数量,对所述故障消息分区中未执行的数据提取规则进行分配,以使得分配后的每个所述正常状态的消息分区中所有未执行的数据提取规则的数量与所述执行数量相等。
在应用中,在计算出第一数量和所有第二数量之间的总值后,可计算每个正常状态的消息分区对应的分节点服务器应执行的数据提取规则的平均数量。基于此,针对任一正常状态的消息分区,可将根据平均数量和第二数量之差,确定该消息分区所应分配的执行数量,以使得分配后的每个正常状态的消息分区中所有未执行的数据提取规则的数量相等。进而,达到再平衡策略的目的。
参照图6,在一实施例中,所述数据库中记录有每个待处理数据的处理状态,所述处理状态包括完成状态、未开始状态和异常状态;所述数据处理方法还包括如下步骤:
S106、针对所述数据库中任一所述数据提取规则对应的待处理数据,若所述待处理数据未被输入至所述分节点服务器中,则在所述数据库中标记所述待处理数据的处理状态为未开始状态。
S107、若所述分节点服务器在处理完所述待处理数据,且在处理过程中未出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为完成状态。
S108、若所述分节点服务器在处理完所述待处理数据,且在所述处理过程中出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为异常状态。
S109、生成每个数据提取规则对应的所述待处理数据的状态记录,并存储所述状态记录至数据库。
在应用中,上述每个数据提取规则对应的待处理数据的状态记录,是在状态发生改变后进行记录的。例如,对于处于未开始状态的待处理数据,在分节点服务器执行完该数据提取规则对应所有待处理数据后,分布式数据处理系统才可更改数据库中相应待处理数据的处理状态为完成状态。其中,状态记录可以以表格的形式存储在数据库中。上述状态记录记载的信息包括但不限于该待处理数据的信息、各处理状态和记录各处理状态的时间,该状态记录可用于记录待处理数据从获取至处理完成的所有相关信息。
在应用中,分节点服务器是根据数据提取规则从数据库中获取一批待处理数据。基于此,若分节点服务器在处理完待处理数据后,任一待处理数据异常,则该数据提取规则对应的全部待处理数据,均需在数据库中标记为异常状态。需要说明的是,上述在数据库中标记待处理数据的处理状态为异常状态时,在对数据提取规则对应的待处理数据进行处理 的过程中,若任一待处理数据在处理时出现异常,即可停止对该数据提取规则中其余的待处理数据进行处理,无需处理完该数据提取规则对应的待处理数据。
参照图7,在一实施例中,所述数据库还记录有所述待处理数据的处理次数,在S108数据库中标记所述待处理数据的处理状态为完成状态之后,还包括如下步骤S108A-S108B,详述如下:
S108A、将所述异常状态的待处理数据对应的数据提取规则重新发送至所述消息队列的消息分区中,以使接收到所述数据提取规则的消息分区所对应的所述分节点服务器再次从所述数据库中提取所述异常状态的待处理数据。
S108B、记录所述异常状态的待处理数据的处理次数,并在所述处理次数达到预设值后,对所述异常状态的待处理数据进行标记。
在应用中,在将每个数据提取规则对应的待处理数据的状态记录存储至数据库时,主节点服务器还可根据预先设置执行条件(例如,每隔预设时长)轮询数据库,并从数据库中检测处理状态为异常状态的待处理数据。之后,根据待处理数据对应的数据ID,重新将对应的数据提取规则发送至kafka消息队列中,等待分节点服务器再次进行处理。
需要说明的是,对于重新分配的数据提取规则,在该数据提取规则对应的待处理数据被再次执行时,数据库中还会统计该数据提取规则对应的待处理数据的处理次数。在统计到处理次数达到预设次数时,标记该数据提取规则对应的待处理数据。其中,在数据库中记录待处理数据的处理次数,具体可参照上述表1中重试状态对应的数值。之后,分布式数据处理系统可将该异常状态的状态记录反馈至预置的工作人员的终端设备上,以通知工作人员及时处理。
请参阅图8,图8是本申请实施例提供的一种数据处理装置的结构框图。本实施例中数据处理装置包括的各模块用于执行图1至图7对应的实施例中的各步骤。具体请参阅图1至图7以及图1至图7所对应的实施例中的相关描述。为了便于说明,仅示出了与本实施例相关的部分。参见图8,数据处理装置800包括:第一发送模块810、获取模块820、提取模块830、确定模块840以及分配模块850,其中:
第一发送模块810,用于将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器。
获取模块820,用于获取数据库中多个待处理数据的数据ID。
提取模块830,用于针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理。
确定模块840,用于当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
分配模块850,用于根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
在一实施例中,第一发送模块810还用于:
统计所述多个数据提取规则的规则数量,以及所述多个消息分区的分区数量;根据所述规则数量以及所述分区数量,将所述多个数据提取规则平均分配至每个消息分区中。
在一实施例中,分配模块850还用于:
获取所述故障消息分区中未执行的数据提取规则的第一数量,以及分别获取每个所述正常状态的消息分区中的未执行的数据提取规则的第二数量;根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中。
在一实施例中,分配模块850还用于:
分别获取预设时间段内,所述正常状态的消息分区中数据提取规则的已执行数量;根 据所述已执行数量和所述预设时间段,分别计算所述正常状态的消息分区对应的分节点服务器的工作效率;分别根据所述第一数量、所述第二数量和所述工作效率,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,以使得每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
在一实施例中,分配模块850还用于:
计算所述第一数量和所有所述第二数量之间的总值;根据所述总值以及所述正常状态的消息分区的数量,计算每个所述正常状态的消息分区对应的分节点服务器应执行的数据提取规则的执行数量;根据所述第一数量、所述第二数量和所述执行数量,对所述故障消息分区中未执行的数据提取规则进行分配,以使得分配后的每个所述正常状态的消息分区中所有未执行的数据提取规则的数量与所述执行数量相等。
在一实施例中,所述数据库中记录有每个待处理数据的处理状态,所述处理状态包括完成状态、未开始状态和异常状态;所述数据处理装置800还包括:
第一标记模块,用于针对所述数据库中任一所述数据提取规则对应的待处理数据,若所述待处理数据未被输入至所述分节点服务器中,则在所述数据库中标记所述待处理数据的处理状态为未开始状态。
第二标记模块,用于若所述分节点服务器在处理完所述待处理数据,且在处理过程中未出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为完成状态。
第三标记模块,用于若所述分节点服务器在处理完所述待处理数据,且在所述处理过程中出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为异常状态。
生成模块,用于生成每个数据提取规则对应的所述待处理数据的状态记录,并存储所述状态记录至数据库。当理解的是,图8示出的数据处理装置的结构框图中,各单元/模块用于执行图1至图7对应的实施例中的各步骤,而对于图1至图7对应的实施例中的各步骤已在上述实施例中进行详细解释,具体请参阅图1至图7以及图1至图7所对应的实施例中的相关描述,此处不再赘述。
图9是本申请另一实施例提供的一种终端设备的结构框图。如图9所示,该实施例的终端设备900包括:处理器910、存储器920以及存储在存储器920中并可在处理器910运行的计算机程序930,例如数据处理方法的程序。处理器910执行计算机程序930时实现上述各个数据处理方法各实施例中的步骤,例如图1所示的S101至S105。具体如下所述:
一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现:
将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
获取数据库中多个待处理数据的数据ID;
针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
在一个实施例中,所述处理器执行所述计算机程序时还实现:
统计所述多个数据提取规则的规则数量,以及所述多个消息分区的分区数量;根据所述规则数量以及所述分区数量,将所述多个数据提取规则平均分配至每个消息分区中。
在一个实施例中,所述处理器执行所述计算机程序时还实现:
获取所述故障消息分区中未执行的数据提取规则的第一数量,以及分别获取每个所述正常状态的消息分区中的未执行的数据提取规则的第二数量;根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中。
在一个实施例中,所述处理器执行所述计算机程序时还实现:
分别获取预设时间段内,所述正常状态的消息分区中数据提取规则的已执行数量;根据所述已执行数量和所述预设时间段,分别计算所述正常状态的消息分区对应的分节点服务器的工作效率;分别根据所述第一数量、所述第二数量和所述工作效率,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,以使得每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
在一个实施例中,所述处理器执行所述计算机程序时还实现:
计算所述第一数量和所有所述第二数量之间的总值;根据所述总值以及所述正常状态的消息分区的数量,计算每个所述正常状态的消息分区对应的分节点服务器应执行的数据提取规则的执行数量;根据所述第一数量、所述第二数量和所述执行数量,对所述故障消息分区中未执行的数据提取规则进行分配,以使得分配后的每个所述正常状态的消息分区中所有未执行的数据提取规则的数量与所述执行数量相等。
在一个实施例中,所述数据库中记录有每个待处理数据的处理状态,所述处理状态包括完成状态、未开始状态和异常状态;所述处理器执行所述计算机程序时还实现:
针对所述数据库中任一所述数据提取规则对应的待处理数据,若所述待处理数据未被输入至所述分节点服务器中,则在所述数据库中标记所述待处理数据的处理状态为未开始状态;
若所述分节点服务器在处理完所述待处理数据,且在处理过程中未出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为完成状态;
若所述分节点服务器在处理完所述待处理数据,且在所述处理过程中出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为异常状态;
生成每个数据提取规则对应的所述待处理数据的状态记录,并存储所述状态记录至数据库。
在一个实施例中,所述数据库还记录有所述待处理数据的处理次数;所述处理器执行所述计算机程序时还实现:
将所述异常状态的待处理数据对应的数据提取规则重新发送至所述消息队列的消息分区中,以使接收到所述数据提取规则的消息分区所对应的所述分节点服务器再次从所述数据库中提取所述异常状态的待处理数据;
记录所述异常状态的待处理数据的处理次数,并在所述处理次数达到预设值后,对所述异常状态的待处理数据进行标记。
一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现:
将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
获取数据库中多个待处理数据的数据ID;
针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服 务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
在一个实施例中,所述计算机程序被处理器执行时还实现:
统计所述多个数据提取规则的规则数量,以及所述多个消息分区的分区数量;根据所述规则数量以及所述分区数量,将所述多个数据提取规则平均分配至每个消息分区中。
在一个实施例中,所述计算机程序被处理器执行时还实现:
获取所述故障消息分区中未执行的数据提取规则的第一数量,以及分别获取每个所述正常状态的消息分区中的未执行的数据提取规则的第二数量;根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中。
在一个实施例中,所述计算机程序被处理器执行时还实现:
分别获取预设时间段内,所述正常状态的消息分区中数据提取规则的已执行数量;根据所述已执行数量和所述预设时间段,分别计算所述正常状态的消息分区对应的分节点服务器的工作效率;分别根据所述第一数量、所述第二数量和所述工作效率,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,以使得每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
在一个实施例中,所述计算机程序被处理器执行时还实现:
计算所述第一数量和所有所述第二数量之间的总值;根据所述总值以及所述正常状态的消息分区的数量,计算每个所述正常状态的消息分区对应的分节点服务器应执行的数据提取规则的执行数量;根据所述第一数量、所述第二数量和所述执行数量,对所述故障消息分区中未执行的数据提取规则进行分配,以使得分配后的每个所述正常状态的消息分区中所有未执行的数据提取规则的数量与所述执行数量相等。
在一个实施例中,所述数据库中记录有每个待处理数据的处理状态,所述处理状态包括完成状态、未开始状态和异常状态;所述计算机程序被处理器执行时还实现:
针对所述数据库中任一所述数据提取规则对应的待处理数据,若所述待处理数据未被输入至所述分节点服务器中,则在所述数据库中标记所述待处理数据的处理状态为未开始状态;
若所述分节点服务器在处理完所述待处理数据,且在处理过程中未出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为完成状态;
若所述分节点服务器在处理完所述待处理数据,且在所述处理过程中出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为异常状态;
生成每个数据提取规则对应的所述待处理数据的状态记录,并存储所述状态记录至数据库。
在一个实施例中,所述数据库还记录有所述待处理数据的处理次数;所述计算机程序被处理器执行时还实现:
将所述异常状态的待处理数据对应的数据提取规则重新发送至所述消息队列的消息分区中,以使接收到所述数据提取规则的消息分区所对应的所述分节点服务器再次从所述数据库中提取所述异常状态的待处理数据;
记录所述异常状态的待处理数据的处理次数,并在所述处理次数达到预设值后,对所述异常状态的待处理数据进行标记。
示例性的,计算机程序930可以被分割成一个或多个单元,一个或者多个单元被存储在存储器920中,并由处理器910执行,以完成本申请。一个或多个单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述计算机程序930在终端设备900中的执行过程。
终端设备可包括,但不仅限于,处理器910、存储器920。本领域技术人员可以理解,图9仅仅是终端设备900的示例,并不构成对终端设备900的限定,可以包括比图示更多 或更少的部件,或者组合某些部件,或者不同的部件,例如终端设备还可以包括输入输出设备、网络接入设备、总线等。
所称处理器910可以是中央处理单元,还可以是其他通用处理器、数字信号处理器、专用集成电路、现成可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
存储器920可以是终端设备900的内部存储单元,例如终端设备900的硬盘或内存。存储器920也可以是终端设备900的外部存储设备,例如终端设备900上配备的插接式硬盘,智能存储卡,闪存卡等。进一步地,存储器920还可以既包括终端设备900的内部存储单元也包括外部存储设备。
本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得终端设备执行时实现上述各个数据处理方法各实施例中的步骤。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。所述计算机可读存储介质可以是非易失性的,也可以是易失性的。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个数据处理方法各实施例中的步骤。
以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种数据处理方法,其中,包括:
    将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
    获取数据库中多个待处理数据的数据ID;
    针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
    当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
    根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
  2. 如权利要求1所述的数据处理方法,其中,所述将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,包括:
    统计所述多个数据提取规则的规则数量,以及所述多个消息分区的分区数量;
    根据所述规则数量以及所述分区数量,将所述多个数据提取规则平均分配至每个消息分区中。
  3. 如权利要求1或2所述的数据处理方法,其中,所述根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,包括:
    获取所述故障消息分区中未执行的数据提取规则的第一数量,以及分别获取每个所述正常状态的消息分区中的未执行的数据提取规则的第二数量;
    根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中。
  4. 如权利要求3所述的数据处理方法,其中,所述根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,包括:
    分别获取预设时间段内,所述正常状态的消息分区中数据提取规则的已执行数量;
    根据所述已执行数量和所述预设时间段,分别计算所述正常状态的消息分区对应的分节点服务器的工作效率;
    分别根据所述第一数量、所述第二数量和所述工作效率,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,以使得每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
  5. 如权利要求3所述的数据处理方法,其中,所述根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,包括:
    计算所述第一数量和所有所述第二数量之间的总值;
    根据所述总值以及所述正常状态的消息分区的数量,计算每个所述正常状态的消息分区对应的分节点服务器应执行的数据提取规则的执行数量;
    根据所述第一数量、所述第二数量和所述执行数量,对所述故障消息分区中未执行的数据提取规则进行分配,以使得分配后的每个所述正常状态的消息分区中所有未执行的数据提取规则的数量与所述执行数量相等。
  6. 如权利要求1所述的数据处理方法,其中,所述数据库中记录有每个待处理数据的处理状态,所述处理状态包括完成状态、未开始状态和异常状态;
    所述数据处理方法还包括:
    针对所述数据库中任一所述数据提取规则对应的待处理数据,若所述待处理数据未被 输入至所述分节点服务器中,则在所述数据库中标记所述待处理数据的处理状态为未开始状态;
    若所述分节点服务器在处理完所述待处理数据,且在处理过程中未出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为完成状态;
    若所述分节点服务器在处理完所述待处理数据,且在所述处理过程中出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为异常状态;
    生成每个数据提取规则对应的所述待处理数据的状态记录,并存储所述状态记录至数据库。
  7. 如权利要求6所述的数据处理方法,其中,所述数据库还记录有所述待处理数据的处理次数;
    在所述数据库中标记所述待处理数据的处理状态为完成状态之后,还包括:
    将所述异常状态的待处理数据对应的数据提取规则重新发送至所述消息队列的消息分区中,以使接收到所述数据提取规则的消息分区所对应的所述分节点服务器再次从所述数据库中提取所述异常状态的待处理数据;
    记录所述异常状态的待处理数据的处理次数,并在所述处理次数达到预设值后,对所述异常状态的待处理数据进行标记。
  8. 一种数据处理装置,其中,包括:
    第一发送模块,用于将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
    获取模块,用于获取数据库中多个待处理数据的数据ID;
    提取模块,用于针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
    确定模块,用于当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
    分配模块,用于根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
  9. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现:
    将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
    获取数据库中多个待处理数据的数据ID;
    针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
    当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
    根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
  10. 根据权利要求9所述的终端设备,其中,所述处理器执行所述计算机程序时还实现:
    统计所述多个数据提取规则的规则数量,以及所述多个消息分区的分区数量;
    根据所述规则数量以及所述分区数量,将所述多个数据提取规则平均分配至每个消息分区中。
  11. 根据权利要求9或10所述的终端设备,其中,所述处理器执行所述计算机程序时还实现:
    获取所述故障消息分区中未执行的数据提取规则的第一数量,以及分别获取每个所述正常状态的消息分区中的未执行的数据提取规则的第二数量;
    根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中。
  12. 根据权利要求11所述的终端设备,其中,所述处理器执行所述计算机程序时还实现:
    分别获取预设时间段内,所述正常状态的消息分区中数据提取规则的已执行数量;
    根据所述已执行数量和所述预设时间段,分别计算所述正常状态的消息分区对应的分节点服务器的工作效率;
    分别根据所述第一数量、所述第二数量和所述工作效率,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,以使得每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
  13. 根据权利要求11所述的终端设备,其中,所述处理器执行所述计算机程序时还实现:
    计算所述第一数量和所有所述第二数量之间的总值;
    根据所述总值以及所述正常状态的消息分区的数量,计算每个所述正常状态的消息分区对应的分节点服务器应执行的数据提取规则的执行数量;
    根据所述第一数量、所述第二数量和所述执行数量,对所述故障消息分区中未执行的数据提取规则进行分配,以使得分配后的每个所述正常状态的消息分区中所有未执行的数据提取规则的数量与所述执行数量相等。
  14. 根据权利要求9所述的终端设备,其中,所述数据库中记录有每个待处理数据的处理状态,所述处理状态包括完成状态、未开始状态和异常状态;所述处理器执行所述计算机程序时还实现:
    针对所述数据库中任一所述数据提取规则对应的待处理数据,若所述待处理数据未被输入至所述分节点服务器中,则在所述数据库中标记所述待处理数据的处理状态为未开始状态;
    若所述分节点服务器在处理完所述待处理数据,且在处理过程中未出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为完成状态;
    若所述分节点服务器在处理完所述待处理数据,且在所述处理过程中出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为异常状态;
    生成每个数据提取规则对应的所述待处理数据的状态记录,并存储所述状态记录至数据库。
  15. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序被处理器执行时实现:
    将主节点服务器中预置的多个数据提取规则,发送至消息队列中的多个消息分区,其中,每个消息分区接收到的数据提取规则不同,所述每个消息分区分别对应一个分节点服务器;
    获取数据库中多个待处理数据的数据ID;
    针对任一消息分区,通过所述消息分区对应的分节点服务器,从所述数据库中提取所述数据ID符合已接收到的所述数据提取规则的待处理数据并对所述待处理数据进行处理;
    当所述任一消息分区对应的所述分节点服务器发生故障时,确定故障消息分区中未执行的数据提取规则;
    根据再平衡策略,将所述未执行的数据提取规则分别分配至处于正常状态的分节点服务器对应的消息分区中,以使每个所述正常状态的分节点服务器分别执行完各自对应的消 息分区中所有未执行的数据提取规则的时间一致。
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述计算机程序被处理器执行时还实现:
    统计所述多个数据提取规则的规则数量,以及所述多个消息分区的分区数量;
    根据所述规则数量以及所述分区数量,将所述多个数据提取规则平均分配至每个消息分区中。
  17. 根据权利要求15或16所述的计算机可读存储介质,其中,所述计算机程序被处理器执行时还实现:
    获取所述故障消息分区中未执行的数据提取规则的第一数量,以及分别获取每个所述正常状态的消息分区中的未执行的数据提取规则的第二数量;
    根据所述第一数量和所述第二数量,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中。
  18. 根据权利要求17所述的计算机可读存储介质,其中,所述计算机程序被处理器执行时还实现:
    分别获取预设时间段内,所述正常状态的消息分区中数据提取规则的已执行数量;
    根据所述已执行数量和所述预设时间段,分别计算所述正常状态的消息分区对应的分节点服务器的工作效率;
    分别根据所述第一数量、所述第二数量和所述工作效率,将所述故障消息分区中未执行的数据提取规则分配至所述正常状态的消息分区中,以使得每个所述正常状态的分节点服务器分别执行完各自对应的消息分区中所有未执行的数据提取规则的时间一致。
  19. 根据权利要求17所述的计算机可读存储介质,其中,所述计算机程序被处理器执行时还实现:
    计算所述第一数量和所有所述第二数量之间的总值;
    根据所述总值以及所述正常状态的消息分区的数量,计算每个所述正常状态的消息分区对应的分节点服务器应执行的数据提取规则的执行数量;
    根据所述第一数量、所述第二数量和所述执行数量,对所述故障消息分区中未执行的数据提取规则进行分配,以使得分配后的每个所述正常状态的消息分区中所有未执行的数据提取规则的数量与所述执行数量相等。
  20. 根据权利要求15所述的计算机可读存储介质,其中,所述数据库中记录有每个待处理数据的处理状态,所述处理状态包括完成状态、未开始状态和异常状态;所述计算机程序被处理器执行时还实现:
    针对所述数据库中任一所述数据提取规则对应的待处理数据,若所述待处理数据未被输入至所述分节点服务器中,则在所述数据库中标记所述待处理数据的处理状态为未开始状态;
    若所述分节点服务器在处理完所述待处理数据,且在处理过程中未出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为完成状态;
    若所述分节点服务器在处理完所述待处理数据,且在所述处理过程中出现处理异常,则在所述数据库中标记所述待处理数据的处理状态为异常状态;
    生成每个数据提取规则对应的所述待处理数据的状态记录,并存储所述状态记录至数据库。
PCT/CN2021/127183 2020-12-28 2021-10-28 数据处理方法、装置、终端设备及存储介质 WO2022142666A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011583891.X 2020-12-28
CN202011583891.XA CN112631805A (zh) 2020-12-28 2020-12-28 数据处理方法、装置、终端设备及存储介质

Publications (1)

Publication Number Publication Date
WO2022142666A1 true WO2022142666A1 (zh) 2022-07-07

Family

ID=75325753

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/127183 WO2022142666A1 (zh) 2020-12-28 2021-10-28 数据处理方法、装置、终端设备及存储介质

Country Status (2)

Country Link
CN (1) CN112631805A (zh)
WO (1) WO2022142666A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116821117A (zh) * 2023-08-30 2023-09-29 广州睿帆科技有限公司 流式数据处理方法、系统、设备及存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112631805A (zh) * 2020-12-28 2021-04-09 深圳壹账通智能科技有限公司 数据处理方法、装置、终端设备及存储介质
CN113901262A (zh) * 2021-09-24 2022-01-07 北京达佳互联信息技术有限公司 待处理数据的获取方法、装置、服务器和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100162260A1 (en) * 2008-12-18 2010-06-24 Veda Technology Limited Data Processing Apparatus
US20140304549A1 (en) * 2013-04-05 2014-10-09 Hewlett-Packard Development Company, L.P. Recovering a failure in a data processing system
CN106649804A (zh) * 2016-12-29 2017-05-10 深圳市优必选科技有限公司 数据查询服务器的数据处理方法及装置、数据处理系统
CN111078147A (zh) * 2019-12-16 2020-04-28 南京领行科技股份有限公司 一种缓存数据的处理方法、装置、设备及存储介质
CN112118315A (zh) * 2020-09-18 2020-12-22 北京有竹居网络技术有限公司 数据处理系统、方法、装置、电子设备和存储介质
CN112631805A (zh) * 2020-12-28 2021-04-09 深圳壹账通智能科技有限公司 数据处理方法、装置、终端设备及存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110458468A (zh) * 2019-08-16 2019-11-15 北京百度网讯科技有限公司 一种任务处理方法、装置、电子设备及存储介质
CN111078396B (zh) * 2019-11-22 2023-12-19 厦门安胜网络科技有限公司 一种基于多任务实例的分布式数据接入方法和系统
CN111708627B (zh) * 2020-06-22 2023-06-20 中国平安财产保险股份有限公司 基于分布式调度框架的任务调度方法以及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100162260A1 (en) * 2008-12-18 2010-06-24 Veda Technology Limited Data Processing Apparatus
US20140304549A1 (en) * 2013-04-05 2014-10-09 Hewlett-Packard Development Company, L.P. Recovering a failure in a data processing system
CN106649804A (zh) * 2016-12-29 2017-05-10 深圳市优必选科技有限公司 数据查询服务器的数据处理方法及装置、数据处理系统
CN111078147A (zh) * 2019-12-16 2020-04-28 南京领行科技股份有限公司 一种缓存数据的处理方法、装置、设备及存储介质
CN112118315A (zh) * 2020-09-18 2020-12-22 北京有竹居网络技术有限公司 数据处理系统、方法、装置、电子设备和存储介质
CN112631805A (zh) * 2020-12-28 2021-04-09 深圳壹账通智能科技有限公司 数据处理方法、装置、终端设备及存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
DING LIN: "Design and Iimplementation of Distributed Node Task Scheduling and Load Balancing For Telecom Data", MASTER THESIS, TIANJIN POLYTECHNIC UNIVERSITY, CN, no. 12, 15 December 2011 (2011-12-15), CN , XP055948234, ISSN: 1674-0246 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116821117A (zh) * 2023-08-30 2023-09-29 广州睿帆科技有限公司 流式数据处理方法、系统、设备及存储介质
CN116821117B (zh) * 2023-08-30 2023-12-12 广州睿帆科技有限公司 流式数据处理方法、系统、设备及存储介质

Also Published As

Publication number Publication date
CN112631805A (zh) 2021-04-09

Similar Documents

Publication Publication Date Title
WO2022142666A1 (zh) 数据处理方法、装置、终端设备及存储介质
US20220083410A1 (en) Query watchdog
WO2018149221A1 (zh) 一种设备管理方法及网管系统
US20160371122A1 (en) File processing workflow management
US11620168B2 (en) Managing metadata for a distributed processing system with manager agents and worker agents
WO2020119029A1 (zh) 分布式任务调度方法、系统及存储介质
CN111324435A (zh) 分布式任务调度及注册方法、设备和分布式任务调度系统
CN110764872A (zh) 一种基于云服务架构的自动报税方法、系统及相关设备
WO2017054650A1 (zh) 任务分发方法、装置及系统
JP2014191594A (ja) 分散処理システム
WO2018126771A1 (zh) 一种存储控制器及io请求处理方法
EP3208709A1 (en) Batch processing method and device for system invocation commands
CN105592110A (zh) 一种资源调度方法及装置
CN110599148A (zh) 集群数据处理方法、装置、计算机集群及可读存储介质
CN111490890A (zh) 基于微服务架构的分级注册方法、装置、存储介质及设备
CN109165135B (zh) 一种数据管理方法、计算机可读存储介质及终端设备
WO2021093323A1 (zh) 数据恢复方法及系统、数据存储节点、数据库管理节点
CN111400241B (zh) 数据重构方法和装置
CN108984105B (zh) 对网络存储设备中的复制任务进行分配的方法和设备
US10191815B2 (en) Parallel node backup for CSV
US20230185631A1 (en) Embedded capacity-computer module for microservice load balancing and distribution
WO2018205890A1 (zh) 一种分布式系统的任务分配方法及系统及其计算机可读存储介质和计算机设备
CN115658292A (zh) 资源调度方法、装置、计算机设备和存储介质
CN111796934B (zh) 任务下发方法、装置、存储介质和电子设备
CN114020420A (zh) 一种分布式待执行任务执行方法及系统、存储介质、终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21913410

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 021023)

122 Ep: pct application non-entry in european phase

Ref document number: 21913410

Country of ref document: EP

Kind code of ref document: A1