CN118779327A - Data processing method and device - Google Patents
Data processing method and device Download PDFInfo
- Publication number
- CN118779327A CN118779327A CN202310911732.5A CN202310911732A CN118779327A CN 118779327 A CN118779327 A CN 118779327A CN 202310911732 A CN202310911732 A CN 202310911732A CN 118779327 A CN118779327 A CN 118779327A
- Authority
- CN
- China
- Prior art keywords
- data
- time
- node
- identifier
- master node
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Computer Security & Cryptography (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本申请要求于2023年04月06日提交国家知识产权局、申请号为202310361323.2、申请名称为“一种一致性监控的方法、装置及其他设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on April 6, 2023, with application number 202310361323.2 and application name “A method, device and other equipment for consistency monitoring”, the entire contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请涉及云计算领域,尤其涉及数据处理方法及装置。The present application relates to the field of cloud computing, and in particular to a data processing method and device.
背景技术Background Art
随着计算机技术的快速发展,用户对服务器提供的服务的需求量越来越大,单一的服务器已经无法满足用户较大的服务需求,于是分布式集群应运而生。分布式集群是指利用高速计算机网络将物理上分散的多个服务器节点连接起来组成一个逻辑上统一的集群,基本思想是将原来集中式的数据分散存储到多个通过网络连接的服务器节点上,以获取更大的存储容量和更高的并发访问量。为了提升分布式集群的高可用性,可以将分布式集群设置为多节点与多副本模式,所谓的多节点与多副本模式是指将分布式集群中主节点服务器写入的数据同步到多个子节点服务器,以在子节点服务器中生成相应的数据副本,进而可以防止由于网络分区、服务器节点宕机、程序停顿等异常情况造成服务不可用。With the rapid development of computer technology, users have an increasing demand for services provided by servers. A single server can no longer meet users' large service needs, so distributed clusters came into being. Distributed clusters refer to the use of high-speed computer networks to connect multiple physically dispersed server nodes to form a logically unified cluster. The basic idea is to store the original centralized data in multiple server nodes connected through the network to obtain larger storage capacity and higher concurrent access. In order to improve the high availability of distributed clusters, distributed clusters can be set to multi-node and multi-copy mode. The so-called multi-node and multi-copy mode refers to synchronizing the data written by the master node server in the distributed cluster to multiple child node servers to generate corresponding data copies in the child node servers, thereby preventing service unavailability due to abnormal situations such as network partitions, server node downtime, and program pauses.
多节点与多副本模式的有效应用要求子节点存储的副本与主节点写入的数据具备较高的数据一致性。因此,需要对分布式集群中主节点与子节点之间的数据一致性进行检测。The effective application of multi-node and multi-copy mode requires that the replicas stored in the child nodes have a high degree of data consistency with the data written by the master node. Therefore, it is necessary to detect the data consistency between the master node and the child nodes in the distributed cluster.
发明内容Summary of the invention
本申请提供一种数据处理方法及装置,能够对分布式集群中主节点与子节点之间的数据一致性进行检测。The present application provides a data processing method and device, which can detect the data consistency between a master node and a sub-node in a distributed cluster.
第一方面,提供了一种数据处理方法,该方法应用于数据检测系统,数据检测系统用于对分布式系统的多个节点的业务数据进行一致性检测,分布式系统的多个节点包括主节点和至少一个子节点;数据检测系统包括存储设备,存储设备中存储有主节点和至少一个子节点的数据标识和对应的时间,数据标识用于指示主节点和至少一个子节点的业务数据的更新操作,该方法可以包括:In a first aspect, a data processing method is provided. The method is applied to a data detection system, the data detection system is used to perform consistency detection on business data of multiple nodes of a distributed system, the multiple nodes of the distributed system include a master node and at least one child node; the data detection system includes a storage device, the storage device stores data identifiers and corresponding times of the master node and the at least one child node, the data identifiers are used to indicate update operations of the business data of the master node and the at least one child node, the method may include:
获取存储设备中主节点的多个数据标识和主节点的多个数据标识对应的多个时间,以及目标子节点的第一时间和第一时间对应的第一数据标识;根据第一数据标识、主节点的多个数据标识以及主节点的多个数据标识对应的多个时间,确定第二时间;该第二时间为第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖的主节点的多个时间中的最早时间的前一个时间;确定第一时间和第二时间的时间差,该时间差用于表征主节点和目标子节点的业务数据一致性的。Acquire multiple data identifiers of a master node in a storage device and multiple times corresponding to the multiple data identifiers of the master node, as well as a first time of a target subnode and a first data identifier corresponding to the first time; determine a second time according to the first data identifier, the multiple data identifiers of the master node, and the multiple times corresponding to the multiple data identifiers of the master node; the second time is a time before the earliest time among the multiple times of the master node when the business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the master node; determine a time difference between the first time and the second time, and the time difference is used to characterize the consistency of the business data of the master node and the target subnode.
第一方面中,定义了表征主节点和目标子节点的业务数据一致性的时间差的计算方法。不要求主节点与子节点业务中的数据具备单调转移顺序的特性,泛用性较强。不同的子节点与主节点计算出的多个时间差可以比较,进而能够衡量不同子节点与主节点之间的全局数据一致性。In the first aspect, a calculation method for the time difference that characterizes the consistency of business data between the master node and the target sub-node is defined. It does not require the data in the business of the master node and the sub-node to have the characteristics of monotonic transfer order, and is more versatile. Multiple time differences calculated between different sub-nodes and the master node can be compared, and the global data consistency between different sub-nodes and the master node can be measured.
在一种可能的实现中,根据第一数据标识、主节点的多个数据标识以及主节点的多个数据标识对应的多个时间,确定第二时间,可以包括:分别比较目标子节点的第一数据标识与主节点的多个数据标识,以确定第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖的主节点的多个目标数据标识;从多个目标数据标识中确定第三数据标识,该第三数据标识对应的时间为第三时间;根据第三数据标识和对应的第三时间,确定第二时间。In one possible implementation, determining the second time based on the first data identifier, multiple data identifiers of the master node, and multiple times corresponding to the multiple data identifiers of the master node can include: respectively comparing the first data identifier of the target subnode with the multiple data identifiers of the master node to determine the multiple target data identifiers of the master node whose business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the master node; determining a third data identifier from the multiple target data identifiers, the time corresponding to the third data identifier being the third time; and determining the second time based on the third data identifier and the corresponding third time.
在该实现中,比较目标子节点的第一数据标识与主节点的多个数据标识,以确定主节点中的数据标识最早覆盖目标子节点的第一数据标识的第三时间,再根据第三时间确定第二时间,确定出的第二时间较为准确。In this implementation, the first data identifier of the target subnode is compared with multiple data identifiers of the main node to determine the third time when the data identifier in the main node earliest covers the first data identifier of the target subnode, and then the second time is determined based on the third time, and the determined second time is more accurate.
在一种可能的实现中,从多个目标数据标识中确定第三数据标识,包括:根据存储设备中主节点的多个目标数据标识对应的多个目标时间的排序,将多个目标数据标识中位于第一位次的目标数据标识确定为第三数据标识。In one possible implementation, determining a third data identifier from multiple target data identifiers includes: determining the target data identifier that is in the first order among the multiple target data identifiers as the third data identifier based on the order of multiple target times corresponding to the multiple target data identifiers of the master node in the storage device.
在该实现中将多个目标数据标识中位于第一位次的目标数据标识确定为第三数据标识,确定出的第三数据标识可以额用于确定第二时间。In this implementation, the target data identifier that is in the first order among the multiple target data identifiers is determined as the third data identifier, and the determined third data identifier can be used to determine the second time.
在一种可能的实现中,根据第三数据标识和对应的第三时间,确定第二时间,包括:根据存储设备中主节点的多个数据标识对应的多个时间的排序,确定第三时间的前一个时间为第二时间。In a possible implementation, determining the second time based on the third data identifier and the corresponding third time includes: determining the time before the third time as the second time based on the order of multiple times corresponding to multiple data identifiers of the master node in the storage device.
在该实现中,确定第三时间的前一个时间为第二时间,确定出的第二时间较为准确。In this implementation, the time before the third time is determined to be the second time, and the determined second time is more accurate.
在一种可能的实现中,数据标识包括版本标识;当数据标识为版本标识时,第二时间包括:目标子节点的第一版本标识小于主节点的多个版本标识对应的多个时间中的最早时间的前一个时间。In one possible implementation, the data identifier includes a version identifier; when the data identifier is a version identifier, the second time includes: the time before the first version identifier of the target child node is less than the earliest time among multiple times corresponding to multiple version identifiers of the master node.
在该实现中,定义了当数据标识为版本标识时的第二时间。In this implementation, a second time when the data identifier is a version identifier is defined.
在一种可能的实现中,数据标识包括位置标识;当数据标识为位置标识时,第二时间包括:目标子节点的第一位置标识小于主节点的多个版本标识对应的多个时间中的最早时间的前一个时间。In one possible implementation, the data identifier includes a location identifier; when the data identifier is a location identifier, the second time includes: the time before the first location identifier of the target child node is less than the earliest time among multiple times corresponding to multiple version identifiers of the master node.
在该实现中,定义了当数据标识为位置标识时的第二时间。In this implementation, a second time is defined when the data identifier is a location identifier.
在一种可能的实现中,方法还包括:将时间差存储至存储设备,以使得数据检测系统分析主节点和目标子节点的业务数据一致性。In a possible implementation, the method further includes: storing the time difference in a storage device so that a data detection system analyzes the consistency of business data of the master node and the target sub-node.
在该实现中,将时间差存储至存储设备中,能够使数据检测系统根据存储的时间差分析主节点和目标子节点的业务数据一致性。In this implementation, the time difference is stored in a storage device, which enables the data detection system to analyze the consistency of business data of the master node and the target sub-node based on the stored time difference.
第二方面,提供了一种数据一致性检测装置,该装置应用于数据检测系统,可以为数据检测系统的芯片或者片上系统,数据检测系统用于对分布式系统的多个节点的业务数据进行一致性检测,分布式系统的多个节点包括主节点和至少一个子节点;数据检测系统包括存储设备,存储设备中存储有主节点和至少一个子节点的数据标识和对应的时间,数据标识用于指示主节点和至少一个子节点的业务数据的更新操作;该数据处理装置可以实现上述第一方面或者第一方面可能的设计中数据检测系统所执行的功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个上述功能相应的模块。例如,该装置可以包括:In the second aspect, a data consistency detection device is provided, which is applied to a data detection system and can be a chip or system on chip of the data detection system. The data detection system is used to perform consistency detection on the business data of multiple nodes of a distributed system, and the multiple nodes of the distributed system include a master node and at least one child node; the data detection system includes a storage device, and the storage device stores data identifiers and corresponding times of the master node and at least one child node, and the data identifier is used to indicate the update operation of the business data of the master node and at least one child node; the data processing device can implement the functions performed by the data detection system in the above-mentioned first aspect or the possible design of the first aspect, and the functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions. For example, the device may include:
获取模块,用于获取存储设备中主节点的多个数据标识和主节点的多个数据标识对应的多个时间,以及目标子节点的第一时间和第一时间对应的第一数据标识;确定模块,用于根据第一数据标识、主节点的多个数据标识以及主节点的多个数据标识对应的多个时间,确定第二时间;其中,第二时间为第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖的主节点的多个时间中的最早时间的前一个时间;确定模块,还用于确定第一时间和第二时间的时间差,时间差用于表征主节点和目标子节点的业务数据一致性。An acquisition module is used to acquire multiple data identifiers of a master node in a storage device and multiple times corresponding to the multiple data identifiers of the master node, as well as a first time of a target subnode and a first data identifier corresponding to the first time; a determination module is used to determine a second time based on the first data identifier, multiple data identifiers of the master node and multiple times corresponding to the multiple data identifiers of the master node; wherein the second time is the time before the earliest time among the multiple times of the master node when the business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the master node; the determination module is also used to determine the time difference between the first time and the second time, and the time difference is used to characterize the consistency of the business data of the master node and the target subnode.
在一种可能的实现中,确定模块,具体用于:分别比较目标子节点的第一数据标识与主节点的多个数据标识,以确定第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖的主节点的多个目标数据标识;从多个目标数据标识中确定第三数据标识;其中,第三数据标识对应的时间为第三时间;根据第三数据标识和对应的第三时间,确定第二时间。In one possible implementation, the determination module is specifically used to: respectively compare the first data identifier of the target subnode with multiple data identifiers of the main node to determine multiple target data identifiers of the main node whose business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the main node; determine a third data identifier from the multiple target data identifiers; wherein the time corresponding to the third data identifier is the third time; and determine the second time based on the third data identifier and the corresponding third time.
在一种可能的实现中,确定模块,具体用于:根据存储设备中主节点的多个目标数据标识对应的多个目标时间的排序,将多个目标数据标识中位于第一位次的目标数据标识确定为第三数据标识。In a possible implementation, the determination module is specifically used to: determine the target data identifier in the first order among the multiple target data identifiers as the third data identifier according to the order of multiple target times corresponding to the multiple target data identifiers of the master node in the storage device.
在一种可能的实现中,确定模块,具体用于:根据存储设备中主节点的多个数据标识对应的多个时间的排序,确定第三时间的前一个时间为第二时间。In a possible implementation, the determination module is specifically used to determine the time before the third time as the second time according to the order of multiple times corresponding to multiple data identifiers of the master node in the storage device.
在一种可能的实现中,数据标识包括版本标识;当数据标识为版本标识时,第二时间包括:目标子节点的第一版本标识小于主节点的多个版本标识对应的多个时间中的最早时间的前一个时间。In one possible implementation, the data identifier includes a version identifier; when the data identifier is a version identifier, the second time includes: the time before the first version identifier of the target child node is less than the earliest time among multiple times corresponding to multiple version identifiers of the master node.
在一种可能的实现中,数据标识包括位置标识;当数据标识为位置标识时,第二时间包括:目标子节点的第一位置标识小于主节点的多个版本标识对应的多个时间中的最早时间的前一个时间。In one possible implementation, the data identifier includes a location identifier; when the data identifier is a location identifier, the second time includes: the time before the first location identifier of the target child node is less than the earliest time among multiple times corresponding to multiple version identifiers of the master node.
在一种可能的实现中,装置还包括存储模块,存储模块用于将时间差存储至存储设备,以使得数据检测系统分析主节点和目标子节点的业务数据一致性。In a possible implementation, the apparatus further includes a storage module, which is used to store the time difference in a storage device so that the data detection system analyzes the consistency of business data of the master node and the target sub-node.
第三方面,本申请提供一种计算设备集群,所述计算设备集群包括至少一个计算设备,所述至少一个计算设备中的每个设备包括至少一个处理器和至少一个存储器,所述至少一个存储器中存储有计算机可读指令;所述至少一个处理器执行所述计算机可读指令,以使得所述计算设备集群执行第一方面或第一方面的任一种可能的实现方式所描述的方法。In a third aspect, the present application provides a computing device cluster, wherein the computing device cluster includes at least one computing device, each of the at least one computing device includes at least one processor and at least one memory, and the at least one memory stores computer-readable instructions; the at least one processor executes the computer-readable instructions so that the computing device cluster performs the method described in the first aspect or any possible implementation of the first aspect.
第四方面,本申请提供一种包含指令的计算机程序产品,当指令被计算设备集群运行时,使得计算设备集群执行第一方面或第一方面的任一种可能的实现方式所描述的方法。In a fourth aspect, the present application provides a computer program product comprising instructions, which, when executed by a computing device cluster, causes the computing device cluster to execute the method described in the first aspect or any possible implementation of the first aspect.
第五方面,本申请提供一种计算机可读存储介质,计算机可读存储介质存储有计算机程序指令,当计算机程序指令由计算设备集群执行时,计算设备集群执行第一方面或第一方面的任一种可能的实现方式所描述的方法。In a fifth aspect, the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method described in the first aspect or any possible implementation of the first aspect.
其中,本申请中第二方面至第五方面描述的有益效果,可以对应参考第一方面的有益效果分析,此处不再赘述。Among them, the beneficial effects described in the second to fifth aspects of the present application can refer to the analysis of the beneficial effects of the first aspect, and will not be repeated here.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请实施例提供的一种分布式集群的结构示意图;FIG1 is a schematic diagram of the structure of a distributed cluster provided in an embodiment of the present application;
图2为本申请实施例提供的一种主节点和子节点的数据字段示意图;FIG2 is a schematic diagram of data fields of a master node and a sub-node provided in an embodiment of the present application;
图3为本申请实施例提供的一种主节点和子节点的位置信息示意图;FIG3 is a schematic diagram of location information of a master node and a sub-node provided in an embodiment of the present application;
图4为本申请实施例提供的一种数据检测系统的结构示意图;FIG4 is a schematic diagram of the structure of a data detection system provided in an embodiment of the present application;
图5为本申请实施例提供的一种数据处理方法的流程示意图;FIG5 is a schematic diagram of a flow chart of a data processing method provided in an embodiment of the present application;
图6为本申请实施例提供的另一种数据处理方法的流程示意图;FIG6 is a flow chart of another data processing method provided in an embodiment of the present application;
图7为本申请实施例提供的一种数据处理装置的结构示意图;FIG7 is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application;
图8为本申请实施例提供的一种计算设备的结构示意图;FIG8 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;
图9为本申请实施例提供的一种计算设备集群的结构示意图;FIG9 is a schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;
图10为本申请实施例提供的另一种计算设备集群的结构示意图。FIG. 10 is a schematic diagram of the structure of another computing device cluster provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
本申请实施例描述的网络架构以及业务场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,随着网络架构的演变和新业务场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person of ordinary skill in the art can appreciate that with the evolution of the network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
应当理解,在本申请实施例中,“至少一个(项)”是指一个或者多个,“多个”是指两个或两个以上,“至少两个(项)”是指两个或三个及三个以上,“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:只存在A,只存在B以及同时存在A和B三种情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a,b,c,“a和b”,“a和c”,“b和c”,或“a和b和c”,其中a,b,c可以是单个,也可以是多个。应理解,在本申请实施例中,“与A对应的B”表示B与A相关联。例如,可以根据A可以确定B。还应理解,根据A确定B并不意味着仅仅根据A确定B,还可以根据A和/或其它信息确定B。It should be understood that in the embodiments of the present application, "at least one (item)" refers to one or more, "multiple" refers to two or more, "at least two (items)" refers to two or three and more than three, and "and/or" is used to describe the association relationship of the associated objects, indicating that there can be three relationships. For example, "A and/or B" can represent: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character "/" generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following (items)" or similar expressions refers to any combination of these items, including any combination of single items (items) or plural items (items). For example, at least one of a, b or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple. It should be understood that in the embodiments of the present application, "B corresponding to A" means that B is associated with A. For example, B can be determined based on A. It should also be understood that determining B based on A does not mean determining B based solely on A. B can also be determined based on A and/or other information.
需要说明的是,本申请的说明书、权利要求书及附图中的术语“第一”和“第二”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first" and "second" in the specification, claims and drawings of the present application are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
在介绍本申请实施例之前,对本申请实施例涉及的一些名词进行解释。Before introducing the embodiments of the present application, some terms involved in the embodiments of the present application are explained.
高可用性(high availability,HA):系统无中断执行逻辑的能力,通常HA越高代表系统越稳定、鲁棒性更高。High availability (HA): The ability of a system to execute logic without interruption. Generally, a higher HA means a more stable and robust system.
多副本(replication):对数据存储的多份拷贝,以确保即使一个备份出现问题,依然可以使用其他备份为用户提供服务。Replication: Multiple copies of data storage to ensure that even if one backup fails, other backups can still be used to provide services to users.
一致性(consistency):指在分布式系统中,多个节点中的数据的值是一样的。Consistency: refers to the fact that in a distributed system, the values of data in multiple nodes are the same.
可用性(availability):在某个时间,系统能够正常运行的概率或者时间占有率的期望值。Availability: The probability that a system can operate normally at a certain time or the expected value of the time occupancy rate.
TP99:指的是满足99%的网络请求所需要的最低耗时。例如,TP99=10ms,表示这段时间99%的网络请求都在10毫秒以内。意思就是100个用户里面,99个用户的耗时上限为10ms。TP99: refers to the minimum time required to satisfy 99% of network requests. For example, TP99 = 10ms, which means that 99% of network requests during this period are within 10 milliseconds. This means that among 100 users, 99 users have a time limit of 10ms.
关系型数据库管理系统(relational database management system,RDBMS):关系数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性。例如,MySQL(my structured query language)、PostgreSQL(postgre structured query language)等。Relational database management system (RDBMS): A relational database stores data in different tables instead of putting all data in one large warehouse, which increases speed and flexibility. For example, MySQL (my structured query language), PostgreSQL (postgre structured query language), etc.
远程字典服务(remote dictionary server,Redis):是一个开源的使用美国国家标准协会(american national standards institute,ANSI)C语言编写的日志型数据库。Remote dictionary server (Redis): is an open source log-based database written in the American National Standards Institute (ANSI) C language.
二进制日志(Bin log):是MySQL中的一个二进制格式的文件(也可称为日志),用于记录用户对数据库更新的SQL语句信息,例如更改数据库表和更改内容的SQL语句都会记录到Bin log里,但是对库表等内容的查询不会记录。Binary log: It is a binary file (also called log) in MySQL, which is used to record the SQL statement information of the user to update the database. For example, SQL statements for changing database tables and changing contents will be recorded in Bin log, but queries on library tables and other contents will not be recorded.
分布式集群(又可称为分布式系统)可以是一组相互连接的计算机或服务器,它们协同工作以执行共同任务。分布式集群中的计算机或服务器(每个计算机或服务器可以称为一个节点,根据节点执行任务的不同,将不同节点划分为主节点和子节点)通常位于不同的物理位置,并通过网络相互连接。分布式集群通常用于为应用程序和服务提供高可用性、可扩展性和容错能力。A distributed cluster (also known as a distributed system) can be a group of interconnected computers or servers that work together to perform common tasks. Computers or servers in a distributed cluster (each computer or server can be called a node, and different nodes are divided into master nodes and sub-nodes according to the different tasks performed by the nodes) are usually located in different physical locations and connected to each other through a network. Distributed clusters are often used to provide high availability, scalability, and fault tolerance for applications and services.
除了上述介绍的分布式集群外,本申请实施例中的分布式集群还可以是云服务器,例如,公有云服务器、私有云服务器、混合云服务器等;虽然云服务器不是传统的分布式集群(因为云服务器不是一组相互连接的物理服务器),但它可以被认为是一个虚拟的分布式集群。这是因为云服务器通常托管在管理程序上,管理程序是一个虚拟化平台,允许多个虚拟机在单个物理服务器上运行。每个虚拟机相当于一个节点,多个节点构成了分布式集群。In addition to the distributed clusters described above, the distributed clusters in the embodiments of the present application may also be cloud servers, such as public cloud servers, private cloud servers, hybrid cloud servers, etc.; although a cloud server is not a traditional distributed cluster (because a cloud server is not a group of interconnected physical servers), it can be considered a virtual distributed cluster. This is because cloud servers are usually hosted on a hypervisor, which is a virtualization platform that allows multiple virtual machines to run on a single physical server. Each virtual machine is equivalent to a node, and multiple nodes constitute a distributed cluster.
分布式集群可以如图1所示,该示例中,分布式集群包括主节点和6个子节点(子节点11、子节点12、子节点13、子节点14、子节点15、子节点16)。本申请实施例对分布式集群中节点的数量不予限制。在分布式集群的多节点与多副本模式中,当主节点中的数据发生更新时,会以推或者拉的方式同步到子节点中。其中,推:通常指主节点将新的数据发送给需要同步的子节点。拉:通常指子节点定时的向主节点发起获取最新数据的请求,主节点响应于该请求,向子节点发送数据。具体地,主节点接收到数据写请求后,将数据写入磁盘的同时,会记录数据更新操作到binlog中,当binlog发生变化时,会将变化的数据推送给子节点;子节点接收到binlog的变化通知后,拉取更新的数据并写入本地文件中,完成数据同步。A distributed cluster can be shown as in Figure 1. In this example, the distributed cluster includes a master node and 6 child nodes (child node 11, child node 12, child node 13, child node 14, child node 15, and child node 16). The embodiment of the present application does not limit the number of nodes in the distributed cluster. In the multi-node and multi-copy mode of the distributed cluster, when the data in the master node is updated, it will be synchronized to the child node in a push or pull manner. Among them, push: usually refers to the master node sending new data to the child node that needs to be synchronized. Pull: usually refers to the child node periodically initiating a request to the master node to obtain the latest data, and the master node responds to the request and sends data to the child node. Specifically, after the master node receives the data write request, it will write the data to the disk and record the data update operation in the binlog. When the binlog changes, the changed data will be pushed to the child node; after the child node receives the change notification of the binlog, it pulls the updated data and writes it to the local file to complete the data synchronization.
由于不同的子节点的网络状况及其与主节点之间的位置关系是不一样的,导致数据同步的进度也是不一样的。例如,可能一个子节点已经同步完成所有的数据,但是另一个子节点只同步完成一半的数据。此时的分布式集群中各节点的数据不具有一致性,从而影响分布式集群的多节点与多副本模式的有效应用。因此,需要对分布式集群中主节点与子节点之间的数据一致性进行检测。Since the network conditions of different child nodes and their positional relationships with the master node are different, the progress of data synchronization is also different. For example, one child node may have synchronized all the data, but another child node has only synchronized half of the data. At this time, the data of each node in the distributed cluster is not consistent, which affects the effective application of the multi-node and multi-copy mode of the distributed cluster. Therefore, it is necessary to detect the data consistency between the master node and the child nodes in the distributed cluster.
在对分布式集群中主节点与子节点之间的数据一致性进行检测时,如果主节点与子节点业务中的数据具备单调转义顺序的特性,可以通过查询主节点与子节点中数据的值,并通过业务逻辑比较主节点与某个子节点之间数据的值是否一致。例如,如图2所示,数据中的某个字段(如状态)有单调转义顺序(Queue->Pending->Running->Complete,分别代表字段的四种不同的状态),如果子节点21中的数据的状态为Queue,主节点22中的同一数据的状态为Running,则认为子节点21和主节点22的数据并不一致,且子节点21落后主节点22两个状态(也可称为落后2个版本)。When testing the data consistency between the master node and the child node in a distributed cluster, if the data in the master node and the child node business has the characteristic of monotonic escape order, the values of the data in the master node and the child node can be queried, and the values of the data between the master node and a child node can be compared through business logic to see if they are consistent. For example, as shown in Figure 2, a field in the data (such as status) has a monotonic escape order (Queue->Pending->Running->Complete, representing four different states of the field respectively). If the state of the data in the child node 21 is Queue, and the state of the same data in the master node 22 is Running, it is considered that the data of the child node 21 and the master node 22 are inconsistent, and the child node 21 lags behind the master node 22 by two states (also known as 2 versions behind).
但是,该方法要求主节点与子节点业务中的数据具备单调转义特性,泛用性较差。此外,该方法仅能体现子节点和主节点之间数据的版本差异,无法体现子节点和主节点之间数据延迟量。由于不同字段流转时间不一定相等,无法在同一个维度下衡量不同字段的数据一致性的差异,进而无法衡量不同子节点与主节点之间的全局数据一致性。例如,字段甲的转义顺序为(Queue->Pending),而字段乙的转移顺序为(α->β),字段甲的从Queue变化为Pending的时间通常为1分钟,而字段乙从α变化为β的时间通常为10分钟,即字段甲和字段乙的流转时间不同。假设子节点A中的数据为字段甲,子节点B中的数据为字段乙,通过分别比较两个子节点(子节点A和子节点B)与主节点的数据的值,确定出子节点A落后主节点两个版本,子节点B落后主节点一个版本。由于字段甲和字段乙的流转时间不同(字段乙的流转时间大于字段甲的流转时间),而时间越久数据更新越大,这就使得子节点B落后主节点一个版本的数据延迟量甚至比子节点A落后主节点两个版本的数据延迟量还要大。也就是说,无法基于相对主节点的版本差异比较不同子节点之间的数据一致性。However, this method requires that the data in the main node and the sub-node business have monotonic escape characteristics, and its versatility is poor. In addition, this method can only reflect the version difference of the data between the sub-node and the main node, and cannot reflect the data delay between the sub-node and the main node. Since the flow time of different fields is not necessarily equal, it is impossible to measure the difference in data consistency of different fields under the same dimension, and thus it is impossible to measure the global data consistency between different sub-nodes and the main node. For example, the escape order of field A is (Queue->Pending), and the transfer order of field B is (α->β). The time for field A to change from Queue to Pending is usually 1 minute, while the time for field B to change from α to β is usually 10 minutes, that is, the flow time of field A and field B is different. Assuming that the data in sub-node A is field A and the data in sub-node B is field B, by comparing the values of the data of the two sub-nodes (sub-node A and sub-node B) with the data of the main node, it is determined that sub-node A lags behind the main node by two versions, and sub-node B lags behind the main node by one version. Since the transfer time of field A and field B is different (the transfer time of field B is longer than that of field A), and the longer the time, the larger the data update, the data delay of sub-node B lagging behind the master node by one version is even greater than the data delay of sub-node A lagging behind the master node by two versions. In other words, it is impossible to compare the data consistency between different sub-nodes based on the version difference relative to the master node.
为了避免主节点与子节点的数据不存在单调转义顺序无法进行一致性检测,还可以通过查询各个节点的数据位置信息、比较主节点和各个子节点的数据位置信息(用于表征节点中的数据量,例如,MySQL中的Bin log;PostgreSQL中的pg_current_xlog_location;Redis中INFO命令的执行结果中表示节点的当前复制偏移量的master_repl_offset以及表示一个副本的复制偏移量的slave_repl_offset等,简称位置信息或者位置标识)是否一致,确定数据是否一致,根据位置信息的差别,可以简单的计算主节点与某个子节点之间的数据位置差距及相差的数据量大小。例如,如图3所示,主节点30的位置信息为1000,而子节点31的位置信息为950,子节点32的位置信息为970。根据位置信息能够估算出子节点31和子节点32与主节点30之间相差的数据量,比如位置信息950到位置信息1000可能相差30GB数据,位置信息970到位置信息1000可能相差10GB数据。In order to avoid the situation that the data of the master node and the child node do not have a monotonic escape sequence and cannot be detected for consistency, it is also possible to determine whether the data is consistent by querying the data location information of each node and comparing the data location information of the master node and each child node (used to characterize the amount of data in the node, for example, Bin log in MySQL; pg_current_xlog_location in PostgreSQL; master_repl_offset representing the current replication offset of the node and slave_repl_offset representing the replication offset of a replica in the execution result of the INFO command in Redis, referred to as location information or location identification). According to the difference in location information, the data location gap between the master node and a child node and the amount of data difference can be simply calculated. For example, as shown in Figure 3, the location information of the master node 30 is 1000, while the location information of the child node 31 is 950, and the location information of the child node 32 is 970. Based on the location information, the amount of data difference between subnode 31 and subnode 32 and master node 30 can be estimated. For example, the difference between location information 950 and location information 1000 may be 30GB of data, and the difference between location information 970 and location information 1000 may be 10GB of data.
但是,该方法是通过衡量位置信息的差异计算得到的主节点和子节点之间的数据一致性的指标,由于不同子节点的位置信息更新时间间隔不一定相等。例如,一个子节点每隔10分钟更新一次,另一个子节点每隔5分钟更新一次。这种情况下,由于更新间隔的不一致,不同子节点的位置信息对应的数据写入量差异较大,比较位置信息的差异无法体现主节点与不同子节点之间的数据延迟量差异。However, this method is to calculate the data consistency index between the master node and the child nodes by measuring the difference in location information. The update time intervals of the location information of different child nodes are not necessarily equal. For example, one child node is updated every 10 minutes, and another child node is updated every 5 minutes. In this case, due to the inconsistency of the update intervals, the amount of data written corresponding to the location information of different child nodes varies greatly. Comparing the difference in location information cannot reflect the difference in data delay between the master node and different child nodes.
为了解决上述问题,本申请实施例提供一种数据处理方法,该方法通过存储设备存储主节点和子节点的数据标识和对应的时间,根据任意选取的时间子节点的数据标识,确定主节点的数据标识中,最晚能使子节点完全包含主节点的数据标识的时间,则上述任意选取的时间和主节点中找到的该数据标识对应的时间的时间差为该子节点的数据延时信息,能够计算得到分布式系统中每个子节点与主节点之间数据一致性的指标,泛用性较强,并且能够衡量不同子节点与主节点之间的全局数据一致性。In order to solve the above problems, an embodiment of the present application provides a data processing method, which stores the data identifiers and corresponding times of the master node and the child node through a storage device, and determines the latest time in the data identifier of the master node that can make the child node completely contain the data identifier of the master node based on the data identifier of the child node at an arbitrarily selected time. The time difference between the above arbitrarily selected time and the time corresponding to the data identifier found in the master node is the data delay information of the child node. The method can calculate the data consistency index between each child node and the master node in the distributed system, has strong versatility, and can measure the global data consistency between different child nodes and the master node.
本申请实施例提供的数据处理方法的触发机制可以灵活设置,例如,根据用户事件(用户操作数据检测系统)触发、每隔时间间隔(例如,每5min/次,用户可以根据自己的需求进行对应的调整,更快的频率提供更精准的数据,但是相对的耗费更多的资源;更低的频率提供更粗粒度的数据,但是相对的更节省资源)触发、接收来自电子设备的、指示执行检测的执行指令等,本申请实施例不予限制。The trigger mechanism of the data processing method provided in the embodiment of the present application can be flexibly set, for example, triggered by user events (user operation data detection system), triggered at time intervals (for example, every 5 minutes/time, users can make corresponding adjustments according to their own needs, faster frequencies provide more accurate data, but relatively consume more resources; lower frequencies provide coarser-grained data, but relatively save more resources), receiving execution instructions from electronic devices to instruct execution of detection, etc., which are not limited by the embodiments of the present application.
下面结合说明书附图,对本申请实施例提供的方法进行描述。The method provided in the embodiment of the present application is described below in conjunction with the accompanying drawings.
本申请实施例提供的数据处理方法应用于数据检测系统,如图4所示,数据检测系统用于对分布式系统的多个节点的业务数据进行一致性检测,具体的,数据检测系统首先通过存储设备存储主节点和子节点的数据标识和对应的时间,然后根据存储的数据对分布式系统的多个节点的业务数据进行一致性检测。其具体检测过程详见下文本申请实施例对数据处理方法的介绍。The data processing method provided in the embodiment of the present application is applied to a data detection system. As shown in FIG4 , the data detection system is used to perform consistency detection on the business data of multiple nodes of a distributed system. Specifically, the data detection system first stores the data identifiers and corresponding times of the master node and the child node through a storage device, and then performs consistency detection on the business data of multiple nodes of the distributed system based on the stored data. The specific detection process is detailed in the introduction of the data processing method in the embodiment of the present application below.
图5示出了本申请实施例提供的数据处理方法的流程示意图。如图5所示,该方法可以包括以下步骤:FIG5 shows a schematic flow chart of a data processing method provided in an embodiment of the present application. As shown in FIG5 , the method may include the following steps:
步骤S510,获取存储设备中主节点的多个数据标识和主节点的多个数据标识对应的多个时间,以及目标子节点的第一时间和第一时间对应的第一数据标识。Step S510, obtaining multiple data identifiers of a master node in a storage device and multiple times corresponding to the multiple data identifiers of the master node, as well as a first time of a target child node and a first data identifier corresponding to the first time.
其中,存储设备中存储有分布式集群中主节点和至少一个子节点的数据标识和对应的时间,存储设备在存储各节点的数据标识时,是按照时间先后顺序存储的。存储设备可以选用具备高流量、低延迟的存储功能的电子设备。例如,云存储设备或数据库服务器等。存储设备在存储上述数据时,会将上述数据存储成同一格式。目标子节点可以是至少一个子节点中的任意一个子节点。第一时间可以是存储设备存储的目标子节点的多个时间中的任意一个时间。数据标识对应的时间可以指数据标识生成的时间。主节点在更新业务数据时,生成对应的数据标识和时间,并向子节点同步更新的业务数据,子节点在接收到主节点的业务数据时,同时记录当前时间下主节点的业务数据对应的数据标识。Among them, the storage device stores the data identifiers and corresponding times of the main node and at least one child node in the distributed cluster. When the storage device stores the data identifiers of each node, it stores them in chronological order. The storage device can use electronic devices with high-flow and low-latency storage functions. For example, cloud storage devices or database servers, etc. When storing the above data, the storage device will store the above data in the same format. The target child node can be any one of the at least one child node. The first time can be any one of the multiple times of the target child node stored in the storage device. The time corresponding to the data identifier can refer to the time when the data identifier is generated. When the main node updates the business data, it generates the corresponding data identifier and time, and synchronizes the updated business data to the child node. When the child node receives the business data of the main node, it also records the data identifier corresponding to the business data of the main node at the current time.
示例性的,主节点在更新业务数据A时生成数据标识01和相应的时间15,主节点将业务数据A同步到子节点,相应的子节点接收来自主节点的业务数据B(由于传输延迟等因素,业务数据A和业务数据B在同一时间一般不同),子节点接收到业务数据B时对应的数据标识02和相应的时间15。Exemplarily, when the master node updates business data A, it generates data identifier 01 and corresponding time 15. The master node synchronizes business data A to the child node. The corresponding child node receives business data B from the master node (due to factors such as transmission delays, business data A and business data B are generally different at the same time). When the child node receives business data B, the corresponding data identifier 02 and corresponding time 15 are generated.
在更新业务数据时,主节点和子节点可以按照不同的时间粒度生成数据标识和对应的时间,例如,每15s生成一次,这种情况下,数据标识与时间之间的映射关系可以如表1所示。When updating business data, the master node and the child node can generate data identifiers and corresponding times according to different time granularities, for example, once every 15 seconds. In this case, the mapping relationship between the data identifier and the time can be shown in Table 1.
表1Table 1
数据标识为能够指示主节点和子节点的业务数据的更新操作的一类可以量化的信息。随着业务数据的更新操作的完成程度增加,表征数据标识的标量随之增大。业务数据的更新操作可以是新增业务数据、删除业务数据或更改业务数据等。示例性的,数据标识可以包括业务数据的版本标识、位置信息等。本申请实施例对数据标识的具体构成不予限制。The data identifier is a type of quantifiable information that can indicate the update operation of the business data of the main node and the child node. As the degree of completion of the update operation of the business data increases, the scalar representing the data identifier increases accordingly. The update operation of the business data can be to add new business data, delete business data, or change business data. Exemplarily, the data identifier may include a version identifier, location information, etc. of the business data. The embodiments of the present application do not limit the specific composition of the data identifier.
步骤S520,根据第一数据标识、主节点的多个数据标识以及主节点的多个数据标识对应的多个时间,确定第二时间。Step S520, determining the second time according to the first data identifier, multiple data identifiers of the master node, and multiple times corresponding to the multiple data identifiers of the master node.
其中,第一时间可以是存储设备存储的目标子节点的多个时间中的任意一个时间,第一时间对应的目标子节点的数据标识为第一数据标识。第二时间为第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖的主节点的多个时间中的最早时间的前一个时间。第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖指的是:第一数据标识所指示的业务数据的更新操作的完成程度小于主节点的多个数据标识所指示的业务数据的更新操作的完成程度。为简洁描述,下文中将“XX数据标识对应的业务数据覆盖YY数据标识对应的业务数据”简称为“XX数据标识覆盖YY数据标识”。Among them, the first time can be any one of the multiple times of the target subnode stored in the storage device, and the data identifier of the target subnode corresponding to the first time is the first data identifier. The second time is the time before the earliest time among the multiple times of the master node at which the business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the master node. The business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the master node, which means that the degree of completion of the update operation of the business data indicated by the first data identifier is less than the degree of completion of the update operation of the business data indicated by the multiple data identifiers of the master node. For the sake of concise description, "business data corresponding to XX data identifier covers business data corresponding to YY data identifier" is referred to as "XX data identifier covers YY data identifier" in the following.
示例性的,当数据标识为版本标识时,第二时间可以包括:目标子节点的第一版本标识小于主节点的多个版本标识对应的多个时间中的最早时间的前一个时间;当数据标识为位置标识时,第二时间可以包括:目标子节点的第一位置标识小于主节点的多个版本标识对应的多个时间中的最早时间的前一个时间。Exemplarily, when the data identifier is a version identifier, the second time may include: the previous time when the first version identifier of the target child node is smaller than the earliest time among the multiple times corresponding to the multiple version identifiers of the main node; when the data identifier is a position identifier, the second time may include: the previous time when the first position identifier of the target child node is smaller than the earliest time among the multiple times corresponding to the multiple version identifiers of the main node.
在一个具体示例中,数据标识为位置标识,主节点(以及目标子节点)按照15s/次生成数据标识和对应的时间。如表2所示,表2示出了一个主节点的位置标识-时间的映射表和目标子节点的位置标识-时间的映射表。In a specific example, the data identifier is a location identifier, and the master node (and the target subnode) generates the data identifier and the corresponding time at 15s/time. As shown in Table 2, Table 2 shows a mapping table of a master node's location identifier-time and a mapping table of a target subnode's location identifier-time.
表2Table 2
在表2所示示例中,选取第一时间为45时,对应的第一数据标识为109,可以看出,第一数据标识109被主节点的多个数据标识(位置标识110、位置标识130)覆盖,多个数据标识(位置标识110、位置标识130)对应的多个时间为时间30和时间45,将时间30和时间45中的最早时间30确定为第三时间,位置标识30的前一个时间为时间15,则根据上述对第二时间的介绍,可以确定出该示例中第二时间为15。In the example shown in Table 2, when the first time is selected as 45, the corresponding first data identifier is 109. It can be seen that the first data identifier 109 is covered by multiple data identifiers of the master node (position identifier 110, position identifier 130). The multiple times corresponding to the multiple data identifiers (position identifier 110, position identifier 130) are time 30 and time 45. The earliest time 30 between time 30 and time 45 is determined as the third time, and the previous time of position identifier 30 is time 15. According to the above introduction to the second time, it can be determined that the second time in this example is 15.
在另一个具体示例中,数据标识为版本标识,主节点(以及目标子节点)按照15s/次生成数据标识和对应的时间。如表3所示,表3示出了一个主节点的版本标识-时间的映射表和目标子节点的版本标识-时间的映射表。In another specific example, the data identifier is a version identifier, and the master node (and the target subnode) generates the data identifier and the corresponding time at 15s/time. As shown in Table 3, Table 3 shows a mapping table of version identifier-time of a master node and a mapping table of version identifier-time of a target subnode.
表3Table 3
在表3所示示例中,选取第一时间为45时,对应的第一数据标识为1.09,可以看出,第一数据标识1.09被主节点的多个数据标识(版本标识1.10、版本标识1.15)覆盖,多个数据标识(版本标识1.10、版本标识1.15)对应的多个时间为时间45和时间60,其中最早时间为时间45,确定为第三时间,第三时间45的前一个时间为时间30,则根据上述对第二时间的介绍,可以确定出该示例中第二时间为30。In the example shown in Table 3, when the first time is selected as 45, the corresponding first data identifier is 1.09. It can be seen that the first data identifier 1.09 is covered by multiple data identifiers of the master node (version identifier 1.10, version identifier 1.15). The multiple times corresponding to the multiple data identifiers (version identifier 1.10, version identifier 1.15) are time 45 and time 60, among which the earliest time is time 45, which is determined to be the third time. The previous time of the third time 45 is time 30. According to the above introduction to the second time, it can be determined that the second time in this example is 30.
步骤S530,确定第一时间和第二时间的时间差。Step S530, determining the time difference between the first time and the second time.
其中,在确定出第一时间和第二时间后,即可确定二者的时间差。该时间差用于表征主节点和目标子节点的业务数据一致性。时间差的计算,可以表示为:After determining the first time and the second time, the time difference between the two can be determined. The time difference is used to characterize the consistency of the business data of the master node and the target sub-node. The calculation of the time difference can be expressed as:
Consistent=Tcurrent-Tmaster Consistent=T current -T master
其中:Consistent代表时间差、Tcurrent代表第一时间、Tmaster代表第二时间。Wherein: Consistent represents the time difference, T current represents the first time, and T master represents the second time.
示例性的,如表2所示示例,第一时间为45,第二时间为15,则第一时间和第二时间的时间差为45-15=30。Exemplarily, as shown in Table 2, the first time is 45, the second time is 15, and the time difference between the first time and the second time is 45-15=30.
在一种实施例中,可以将步骤S530确定出的时间差存储至存储设备。将时间差存储至存储设备后,可以分析主节点和目标子节点的业务数据一致性。存储设备能够存储多个时间周期下确定出的目标子节点与主节点的多个时间差,该多个时间差可以用于多个应用场景,例如,历史数据回溯、目标子节点与主节点的业务数据一致性的变化趋势分析等。In one embodiment, the time difference determined in step S530 may be stored in a storage device. After the time difference is stored in the storage device, the business data consistency of the master node and the target subnode may be analyzed. The storage device is capable of storing multiple time differences between the target subnode and the master node determined in multiple time periods, and the multiple time differences may be used in multiple application scenarios, such as historical data backtracking, change trend analysis of the business data consistency between the target subnode and the master node, etc.
本申请实施例中,定义了表征主节点和目标子节点的业务数据一致性的时间差的计算方法。不要求主节点与子节点业务中的数据具备单调转移顺序的特性,泛用性较强。不同的子节点与主节点计算出的多个时间差可以比较,进而能够衡量不同子节点与主节点之间的全局数据一致性。In the embodiment of the present application, a method for calculating the time difference that characterizes the consistency of the business data of the master node and the target sub-node is defined. The data in the business of the master node and the sub-node are not required to have the characteristics of monotonic transfer order, and the versatility is strong. The multiple time differences calculated by different sub-nodes and the master node can be compared, and then the global data consistency between different sub-nodes and the master node can be measured.
在一种实施例中,如图6所示,执行步骤S520时具体可以通过以下步骤S521至步骤S523,来确定第二时间:In one embodiment, as shown in FIG. 6 , when executing step S520, the second time may be determined by specifically performing the following steps S521 to S523:
步骤S521,分别比较目标子节点的第一数据标识与主节点的多个数据标识,以确定多个目标数据标识。Step S521 : Compare the first data identifier of the target child node with the multiple data identifiers of the main node respectively to determine multiple target data identifiers.
其中,多个目标数据标识为主节点的多个数据标识中,覆盖第一数据标识的数据标识,如表2所示示例中,多个目标数据标识为(数据标识110和数据标识130)。在比较第一数据标识与主节点的多个数据标识以确定多个目标数据标识时,可以根据多个数据标识对应的时间顺序依次比较。示例性的,如表2所示,主节点的多个数据标识按时间顺序依次为:数据标识95、数据标识100、数据标识110以及数据标识130,第一数据标识为109,将109依次与数据标识95、数据标识100、数据标识110以及数据标识130比较,即可确定出第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖的主节点的数据标识(即多个目标数据标识),包括数据标识110和数据标识130。Among them, the multiple target data identifiers are data identifiers that cover the first data identifier among the multiple data identifiers of the master node. In the example shown in Table 2, the multiple target data identifiers are (data identifier 110 and data identifier 130). When comparing the first data identifier with the multiple data identifiers of the master node to determine the multiple target data identifiers, they can be compared in sequence according to the time sequence corresponding to the multiple data identifiers. Exemplarily, as shown in Table 2, the multiple data identifiers of the master node are in chronological order: data identifier 95, data identifier 100, data identifier 110 and data identifier 130, and the first data identifier is 109. By comparing 109 with data identifier 95, data identifier 100, data identifier 110 and data identifier 130 in sequence, it can be determined that the data identifier of the master node (i.e., multiple target data identifiers) whose business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the master node, including data identifier 110 and data identifier 130.
在另一个示例中,还可以根据多个数据标识对应的时间倒序比较目标子节点的第一数据标识与主节点的多个数据标识,并且按时间倒序比较的效率较高。示例性的,如表2所示,主节点的多个数据标识按时间倒序依次为:数据标识130、数据标识110、数据标识100以及数据标识95。第一数据标识为109,将109依次与数据标识130、数据标识110以及数据标识100比较。由于数据标识100无法覆盖第一数据标识109,故比较到数据标识100时即可停止比较。即可确定出第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖的主节点的数据标识,也就是多个目标数据标识,包括数据标识110和数据标识130。In another example, the first data identifier of the target child node can also be compared with the multiple data identifiers of the main node according to the reverse time order corresponding to the multiple data identifiers, and the efficiency of the comparison in reverse time order is higher. Exemplarily, as shown in Table 2, the multiple data identifiers of the main node are in reverse time order: data identifier 130, data identifier 110, data identifier 100 and data identifier 95. The first data identifier is 109, and 109 is compared with data identifier 130, data identifier 110 and data identifier 100 in turn. Since data identifier 100 cannot cover the first data identifier 109, the comparison can be stopped when data identifier 100 is compared. It can be determined that the data identifier of the main node whose business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the main node, that is, multiple target data identifiers, including data identifier 110 and data identifier 130.
在又一个示例中,有可能存在主节点的多个数据标识的数量较多的情况,这时采用时间顺序或者时间倒序逐个比较效率较低,可以应用二分查找法确定多个目标数据标识以提升确定效率。在应用二分查找法确定多个目标数据标识时,将主节点的多个数据标识中的中间位置的数据标识与第一数据标识比较,如果两者相同,则将主节点的中间位置之后的数据标识确定为目标数据标识;否则利用中间位置将主节点的多个数据标识分成前、后两个部分,如果中间位置记录的数据标识覆盖第一数据标识,则将后部分的数据标识确定为目标数据标识,并进一步查找前部分数据标识中的目标数据标识;如果中间位置记录的数据标识未覆盖第一数据标识,则从后部分的数据标识差值目标数据标识。重复以上过程,直到确定出所有的目标数据标识。这种确定方法的确定效率较高。In another example, there may be a situation where there are a large number of multiple data identifiers of the main node. At this time, it is inefficient to compare one by one in chronological order or in reverse chronological order. The binary search method can be applied to determine multiple target data identifiers to improve the determination efficiency. When applying the binary search method to determine multiple target data identifiers, the data identifier at the middle position of the multiple data identifiers of the main node is compared with the first data identifier. If the two are the same, the data identifier after the middle position of the main node is determined as the target data identifier; otherwise, the multiple data identifiers of the main node are divided into the front and rear parts using the middle position. If the data identifier recorded in the middle position covers the first data identifier, the data identifier in the rear part is determined as the target data identifier, and the target data identifier in the data identifier in the front part is further searched; if the data identifier recorded in the middle position does not cover the first data identifier, the target data identifier is obtained from the difference of the data identifier in the rear part. Repeat the above process until all target data identifiers are determined. This determination method has a high determination efficiency.
以上所述介绍了确定多个目标数据标识的几种示例,在确定多个目标数据标识时,还可以采用其他方法,本申请实施例不予限制。The above describes several examples of determining multiple target data identifiers. When determining multiple target data identifiers, other methods may also be used, which are not limited in the embodiments of the present application.
步骤S522,从多个目标数据标识中确定第三数据标识。Step S522: determine a third data identifier from multiple target data identifiers.
其中,在确定第三数据标识时,可以根据存储设备中主节点的多个目标数据标识对应的多个目标时间的排序,将多个目标数据标识中位于第一位次的目标数据标识确定为第三数据标识,第三数据标识对应的时间为第三时间。示例性的,如表4所示,目标数据标识包括目标数据标识110和目标数据标识130,目标数据标识110位于第一位次,则第三数据标识为目标数据标识110。Wherein, when determining the third data identifier, the target data identifier in the first order among the multiple target data identifiers can be determined as the third data identifier according to the order of the multiple target times corresponding to the multiple target data identifiers of the master node in the storage device, and the time corresponding to the third data identifier is the third time. Exemplarily, as shown in Table 4, the target data identifier includes the target data identifier 110 and the target data identifier 130, and the target data identifier 110 is in the first order, and the third data identifier is the target data identifier 110.
表4Table 4
步骤S523,根据第三数据标识和对应的第三时间,确定第二时间。Step S523: determine the second time according to the third data identifier and the corresponding third time.
其中,在确定第二时间时,可以根据存储设备中主节点的多个数据标识对应的多个时间的排序,确定第三时间的前一个时间为第二时间。When determining the second time, the time before the third time can be determined as the second time according to the order of multiple times corresponding to multiple data identifiers of the master node in the storage device.
上面介绍了第二时间的确定过程,第二时间的确定原理用算式可以表示为:The above describes the process of determining the second time. The principle of determining the second time can be expressed by the formula:
Tmaster=max[T(Positionmaster≤Positionslave)]T master =max[T(Position master ≤Position slave )]
其中:Tmaster代表第二时间、T表示时间、max[……]表示取最大值、Positionmaster代表主节点的数据标识、Positionslave代表目标子节点的第一数据标识。Wherein: T master represents the second time, T represents time, max[……] represents the maximum value, Position master represents the data identifier of the master node, and Position slave represents the first data identifier of the target child node.
示例性的,如表4所示,第三时间为30,30的前一个时间为时间15,则该示例中的第二时间为时间15。Exemplarily, as shown in Table 4, the third time is 30, and the time before 30 is time 15, so the second time in this example is time 15.
上面在介绍应用二分查找法确定多个目标数据标识时,说明了会有主节点的数据标识与目标子节点的第一数据标识相同的情形(称这种情形下的主节点的数据标识为第四数据标识),会不会存在这种情形主要取决于主节点和子节点生成数据标识的时间粒度,该时间粒度越小,出现主节点的数据标识与目标子节点的第一数据标识相同的情形概率越大。这种情形中,参考本申请实施例中步骤S520对“覆盖”的说明:第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖指的是:第一数据标识所指示的业务数据的更新操作的完成程度小于主节点的多个数据标识所指示的业务数据的更新操作的完成程度。可见,由于第一数据标识所指示的业务数据的更新操作的完成程度不小于(而是等于)第四数据标识所指示的业务数据的更新操作的完成程度,则第四数据标识并未覆盖第一数据标识。主节点的多个数据标识中,第四数据标识的下一个数据标识为第三数据,将第三时间的前一个时间确定为第二时间也就意味着将第四数据标识对应的时间确定为第二时间。When introducing the application of binary search method to determine multiple target data identifiers, it is explained that there will be a situation where the data identifier of the main node is the same as the first data identifier of the target child node (the data identifier of the main node in this situation is called the fourth data identifier). Whether there is such a situation depends mainly on the time granularity of the main node and the child node to generate the data identifier. The smaller the time granularity, the greater the probability of the situation where the data identifier of the main node is the same as the first data identifier of the target child node. In this case, refer to the description of "coverage" in step S520 in the embodiment of the present application: the business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the main node, which means that the completion degree of the update operation of the business data indicated by the first data identifier is less than the completion degree of the update operation of the business data indicated by the multiple data identifiers of the main node. It can be seen that since the completion degree of the update operation of the business data indicated by the first data identifier is not less than (but equal to) the completion degree of the update operation of the business data indicated by the fourth data identifier, the fourth data identifier does not cover the first data identifier. Among the multiple data identifiers of the main node, the next data identifier of the fourth data identifier is the third data, and determining the time before the third time as the second time means that the time corresponding to the fourth data identifier is determined as the second time.
本申请实施例中,比较目标子节点的第一数据标识与主节点的多个数据标识,以确定主节点中的数据标识最早覆盖目标子节点的第一数据标识的第三时间,再根据第三时间确定第二时间,确定出的第二时间较为准确。In an embodiment of the present application, the first data identifier of the target subnode is compared with multiple data identifiers of the main node to determine the third time when the data identifier in the main node earliest covers the first data identifier of the target subnode, and then the second time is determined based on the third time, and the determined second time is more accurate.
在一种实施例中,分布式集群的多个子节点均根据本申请实施例介绍的方法确定时间差,并存储至存储设备。数据检测系统可以分析多个子节点的时间差以确定分布式集群的运转是否正常,示例性的,可以计算多个子节点的时间差的均值,并将计算出的均值与分布式集群运转正常的期望值比较以确定分布式集群的运转是否正常,示例性的,分布式集群运转正常的期望值可以设置为30s,如果多个子节点的时间差的均值小于30s,则视为分布式集群的运转正常,否则视为分布式集群的运转异常。此时可以对分布式集群进行排障、和优化等操作。In one embodiment, multiple sub-nodes of a distributed cluster determine the time difference according to the method described in the embodiment of the present application, and store it in a storage device. The data detection system can analyze the time difference of multiple sub-nodes to determine whether the operation of the distributed cluster is normal. For example, the mean of the time difference of multiple sub-nodes can be calculated, and the calculated mean can be compared with the expected value of the normal operation of the distributed cluster to determine whether the operation of the distributed cluster is normal. For example, the expected value of the normal operation of the distributed cluster can be set to 30s. If the mean of the time difference of multiple sub-nodes is less than 30s, the operation of the distributed cluster is considered normal, otherwise it is considered that the operation of the distributed cluster is abnormal. At this time, the distributed cluster can be troubleshooted and optimized.
在另一个示例中,还可以应用TP99算法分析多个子节点的时间差。TP99算法可以预先设定一个基线值,该基线值用于判断分布式集群的运转是否正常,例如,该基线值可以设置为30s,这这种设置下的TP99算法要求99%的子节点与主节点的时间差在30s以内。也就是说,要求100个子节点里面,99个子节点的时间差不可以大于30s。In another example, the TP99 algorithm can also be applied to analyze the time difference of multiple child nodes. The TP99 algorithm can pre-set a baseline value, which is used to determine whether the operation of the distributed cluster is normal. For example, the baseline value can be set to 30s. Under this setting, the TP99 algorithm requires that the time difference between 99% of the child nodes and the master node is within 30s. In other words, it is required that the time difference of 99 child nodes out of 100 child nodes cannot be greater than 30s.
上述介绍了两种算法根据多个子节点的时间差分析分布式集群的运转状态,在分析分布式集群的运转状态时,还可以采用其他算法,本申请实施例不予限制。The above introduces two algorithms for analyzing the operating status of a distributed cluster based on the time difference of multiple sub-nodes. When analyzing the operating status of a distributed cluster, other algorithms can also be used, which is not limited by the embodiments of the present application.
本申请实施例中,根据多个子节点的时间差分析分布式集群的运转状态,能够监控分布式集群的健康状况。In the embodiment of the present application, the operation status of the distributed cluster is analyzed according to the time difference of multiple sub-nodes, so that the health status of the distributed cluster can be monitored.
在一种实施例中,还可以显示目标子节点对应的时间差,以供用户需要时查看。In one embodiment, the time difference corresponding to the target sub-node may also be displayed for the user to view when needed.
在一种实施例中,在目标子节点对应的时间差符合预设告警条件的情况下,可以生成告警信息,并显示告警信息。In one embodiment, when the time difference corresponding to the target sub-node meets the preset alarm condition, alarm information may be generated and displayed.
示例性的,预设告警条件可以是目标子节点在不同周期确定出的多个时间差中超过预设比例的时间差超出预设阈值。或者,预设告警条件还可以是目标子节点对应的多个时间差的平均值超出预设阈值。预设告警条件可以灵活设置,本申请实施例不做限制。告警信息也可以根据用户需要灵活设置,示例性的,告警信息可以是“网络异常”;告警信息还可以直接指示哪些子节点网络异常,例如“XX子节点网络异常”等。Exemplarily, the preset alarm condition may be that the time difference exceeding a preset proportion among multiple time differences determined by the target sub-node in different periods exceeds a preset threshold. Alternatively, the preset alarm condition may also be that the average value of multiple time differences corresponding to the target sub-node exceeds the preset threshold. The preset alarm condition may be flexibly set, and the embodiments of the present application are not limited thereto. The alarm information may also be flexibly set according to user needs. Exemplarily, the alarm information may be "network abnormality"; the alarm information may also directly indicate which sub-nodes have network abnormalities, such as "XX sub-node network abnormality".
本申请实施例在目标子节点对应的时间差符合预设告警条件的情况下生成告警信息,并显示告警信息,能够及时提醒用户网络存在的问题。The embodiment of the present application generates an alarm message when the time difference corresponding to the target sub-node meets the preset alarm condition, and displays the alarm message, so as to promptly remind the user of the problems existing in the network.
综上所述,本申请提供了一种数据处理方法,该方法通过存储设备存储主节点和子节点的数据标识和对应的时间。并基于上述存储设备存储的数据,根据任意选取的时间对应的子节点的数据标识,确定主节点的数据标识中,能被上述任意选取的子节点的数据标识完全包含的多个数据标识对应的多个时间中的最晚时间,则上述任意选取的时间和上述最晚时间的时间差表征该子节点与主节点之间的数据一致性。基于此,能够计算得到分布式系统中每个子节点与主节点之间数据一致性的指标,泛用性较强,并且能够衡量不同子节点与主节点之间的全局数据一致性。In summary, the present application provides a data processing method, which stores the data identifiers and corresponding times of the master node and the child node through a storage device. Based on the data stored in the above storage device, according to the data identifier of the child node corresponding to the arbitrarily selected time, the latest time among the multiple times corresponding to the multiple data identifiers in the data identifier of the master node that can be completely contained in the data identifier of the arbitrarily selected child node is determined, and the time difference between the arbitrarily selected time and the latest time represents the data consistency between the child node and the master node. Based on this, the index of data consistency between each child node and the master node in the distributed system can be calculated, which has strong versatility and can measure the global data consistency between different child nodes and the master node.
本申请还提供一种数据处理装置,如图7所示,该数据处理装置800包括:The present application also provides a data processing device, as shown in FIG7 , the data processing device 800 includes:
获取模块810,用于获取存储设备中主节点的多个数据标识和主节点的多个数据标识对应的多个时间,以及目标子节点的第一时间和第一时间对应的第一数据标识。The acquisition module 810 is used to acquire multiple data identifiers of the master node and multiple times corresponding to the multiple data identifiers of the master node in the storage device, as well as the first time of the target child node and the first data identifier corresponding to the first time.
确定模块820,用于根据第一数据标识、主节点的多个数据标识以及主节点的多个数据标识对应的多个时间,确定第二时间。其中,第二时间为第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖的主节点的多个时间中的最早时间的前一个时间。The determination module 820 is used to determine a second time according to the first data identifier, multiple data identifiers of the master node, and multiple times corresponding to the multiple data identifiers of the master node, wherein the second time is a time before the earliest time among the multiple times of the master node at which the business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the master node.
确定模块820,还用于确定第一时间和第二时间的时间差,时间差用于表征主节点和目标子节点的业务数据一致性。The determination module 820 is further used to determine the time difference between the first time and the second time, where the time difference is used to characterize the consistency of the business data of the master node and the target sub-node.
在一种实施例中,确定模块820,具体用于:分别比较目标子节点的第一数据标识与主节点的多个数据标识,以确定第一数据标识对应的业务数据被主节点的多个数据标识对应的业务数据覆盖的主节点的多个目标数据标识。从多个目标数据标识中确定第三数据标识。其中,第三数据标识对应的时间为第三时间。根据第三数据标识和对应的第三时间,确定第二时间。In one embodiment, the determination module 820 is specifically used to: respectively compare the first data identifier of the target subnode with the multiple data identifiers of the master node to determine the multiple target data identifiers of the master node whose business data corresponding to the first data identifier is covered by the business data corresponding to the multiple data identifiers of the master node. Determine a third data identifier from the multiple target data identifiers. The time corresponding to the third data identifier is the third time. Determine the second time based on the third data identifier and the corresponding third time.
在一种实施例中,确定模块820,具体用于:根据存储设备中主节点的多个目标数据标识对应的多个目标时间的排序,将多个目标数据标识中位于第一位次的目标数据标识确定为第三数据标识。In one embodiment, the determination module 820 is specifically used to: determine the target data identifier in the first order among the multiple target data identifiers as the third data identifier according to the order of multiple target times corresponding to the multiple target data identifiers of the master node in the storage device.
在一种实施例中,确定模块820,具体用于:根据存储设备中主节点的多个数据标识对应的多个时间的排序,确定第三时间的前一个时间为第二时间。In one embodiment, the determination module 820 is specifically used to determine the previous time of the third time as the second time according to the order of multiple times corresponding to multiple data identifiers of the master node in the storage device.
在一种实施例中,数据标识包括版本标识。当数据标识为版本标识时,第二时间包括:目标子节点的第一版本标识小于主节点的多个版本标识对应的多个时间中的最早时间的前一个时间。In one embodiment, the data identifier includes a version identifier. When the data identifier is a version identifier, the second time includes: a time before the first version identifier of the target child node is smaller than the earliest time among multiple times corresponding to multiple version identifiers of the master node.
在一种实施例中,数据标识包括位置标识。当数据标识为位置标识时,第二时间包括:目标子节点的第一位置标识小于主节点的多个版本标识对应的多个时间中的最早时间的前一个时间。In one embodiment, the data identifier includes a location identifier. When the data identifier is a location identifier, the second time includes: a time before the first location identifier of the target child node is smaller than the earliest time among multiple times corresponding to multiple version identifiers of the master node.
在一种实施例中,装置还包括存储模块830,存储模块830用于将时间差存储至存储设备,以使得数据检测系统分析主节点和目标子节点的业务数据一致性。In one embodiment, the apparatus further includes a storage module 830, and the storage module 830 is used to store the time difference in a storage device so that the data detection system analyzes the consistency of the business data of the master node and the target sub-node.
其中,上述介绍各模块均可以通过软件实现,或者可以通过硬件实现。示例性的,接下来以获取模块810为例,介绍获取模块810的实现方式。类似的,确定模块820和存储模块830的实现方式可以参考获取模块810的实现方式。Among them, each module described above can be implemented by software or by hardware. Exemplarily, the following takes the acquisition module 810 as an example to introduce the implementation of the acquisition module 810. Similarly, the implementation of the determination module 820 and the storage module 830 can refer to the implementation of the acquisition module 810.
模块作为软件功能单元的一种举例,获取模块810可以包括运行在计算实例上的代码。其中,计算实例可以包括物理主机(计算设备)、虚拟机、容器中的至少一种。进一步地,上述计算实例可以是一台或者多台。例如,获取模块810可以包括运行在多个主机/虚拟机/容器上的代码。需要说明的是,用于运行该代码的多个主机/虚拟机/容器可以分布在相同的区域(region)中,也可以分布在不同的region中。进一步地,用于运行该代码的多个主机/虚拟机/容器可以分布在相同的可用区(availability zone,AZ)中,也可以分布在不同的AZ中,每个AZ包括一个数据中心或多个地理位置相近的数据中心。其中,通常一个region可以包括多个AZ。As an example of a software functional unit, the acquisition module 810 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the acquisition module 810 may include code running on multiple hosts/virtual machines/containers. It should be noted that the multiple hosts/virtual machines/containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts/virtual machines/containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with close geographical locations. Among them, usually a region may include multiple AZs.
同样,用于运行该代码的多个主机/虚拟机/容器可以分布在同一个虚拟私有云(virtual private cloud,VPC)中,也可以分布在多个VPC中。其中,通常一个VPC设置在一个region内,同一region内两个VPC之间,以及不同region的VPC之间跨区通信需在每个VPC内设置通信网关,经通信网关实现VPC之间的互连。Similarly, multiple hosts/virtual machines/containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
模块作为硬件功能单元的一种举例,获取模块810可以包括至少一个计算设备,如服务器等。或者,获取模块810也可以是利用专用集成电路(application-specificintegrated circuit,ASIC)实现、或可编程逻辑器件(programmable logic device,PLD)实现的设备等。其中,上述PLD可以是复杂程序逻辑器件(complex programmable logicaldevice,CPLD)、现场可编程门阵列(field-programmable gate array,FPGA)、通用阵列逻辑(generic array logic,GAL)或其任意组合实现。As an example of a hardware functional unit, the acquisition module 810 may include at least one computing device, such as a server, etc. Alternatively, the acquisition module 810 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
获取模块810包括的多个计算设备可以分布在相同的region中,也可以分布在不同的region中。获取模块810包括的多个计算设备可以分布在相同的AZ中,也可以分布在不同的AZ中。同样,获取模块810包括的多个计算设备可以分布在同一个VPC中,也可以分布在多个VPC中。其中,所述多个计算设备可以是服务器、ASIC、PLD、CPLD、FPGA和GAL等计算设备的任意组合。The multiple computing devices included in the acquisition module 810 can be distributed in the same region or in different regions. The multiple computing devices included in the acquisition module 810 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the acquisition module 810 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
需要说明的是,在其他实施例中,获取模块810可以用于执行数据处理方法中的任意步骤,确定模块820可以用于执行数据处理方法中的任意步骤,存储模块830可以用于执行数据处理方法中的任意步骤,获取模块810、确定模块820、以及存储模块830负责实现的步骤可根据需要指定,通过获取模块810、确定模块820、以及存储模块830分别实现数据处理方法中不同的步骤来实现数据处理装置的全部功能。It should be noted that, in other embodiments, the acquisition module 810 can be used to execute any step in the data processing method, the determination module 820 can be used to execute any step in the data processing method, and the storage module 830 can be used to execute any step in the data processing method. The steps that the acquisition module 810, the determination module 820, and the storage module 830 are responsible for implementing can be specified as needed. The full functions of the data processing device are realized by respectively implementing different steps in the data processing method through the acquisition module 810, the determination module 820, and the storage module 830.
本申请还提供一种计算设备100。如图8所示,计算设备100包括:总线102、处理器104、存储器106和通信接口108。处理器104、存储器106和通信接口108之间通过总线102通信。计算设备100可以是服务器或终端设备。应理解,本申请不限定计算设备100中的处理器、存储器的个数。The present application also provides a computing device 100. As shown in FIG8 , the computing device 100 includes: a bus 102, a processor 104, a memory 106, and a communication interface 108. The processor 104, the memory 106, and the communication interface 108 communicate with each other through the bus 102. The computing device 100 may be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 100.
总线102可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图8中仅用一条线表示,但并不表示仅有一根总线或一种类型的总线。总线104可包括在计算设备100各个部件(例如,存储器106、处理器104、通信接口108)之间传送信息的通路。The bus 102 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, FIG8 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 104 may include a path for transmitting information between various components of the computing device 100 (e.g., the memory 106, the processor 104, and the communication interface 108).
处理器104可以包括中央处理器(central processing unit,CPU)、图形处理器(graphics processing unit,GPU)、微处理器(micro processor,MP)或者数字信号处理器(digital signal processor,DSP)等处理器中的任意一种或多种。The processor 104 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
存储器106可以包括易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM)。处理器104还可以包括非易失性存储器(non-volatilememory),例如只读存储器(read-only memory,ROM),快闪存储器,机械硬盘(hard diskdrive,HDD)或固态硬盘(solid state drive,SSD)。The memory 106 may include a volatile memory, such as a random access memory (RAM). The processor 104 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
存储器106中存储有可执行的程序代码,处理器104执行该可执行的程序代码以分别实现前述获取模块810、确定模块820和存储模块830的功能,从而实现数据处理方法。也即,存储器106上存有用于执行数据处理方法的指令。The memory 106 stores executable program codes, and the processor 104 executes the executable program codes to respectively implement the functions of the acquisition module 810, the determination module 820 and the storage module 830, thereby implementing the data processing method. That is, the memory 106 stores instructions for executing the data processing method.
或者,存储器106中存储有可执行的代码,处理器104执行该可执行的代码以分别实现前述数据处理装置的功能,从而实现数据处理方法。也即,存储器106上存有用于执行数据处理方法的指令。Alternatively, the memory 106 stores executable codes, and the processor 104 executes the executable codes to respectively implement the functions of the aforementioned data processing apparatus, thereby implementing the data processing method. That is, the memory 106 stores instructions for executing the data processing method.
通信接口103使用例如但不限于网络接口卡、收发器一类的收发模块,来实现计算设备100与其他设备或通信网络之间的通信。The communication interface 103 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 100 and other devices or a communication network.
本申请实施例还提供了一种计算设备集群。该计算设备集群包括至少一台计算设备。该计算设备可以是服务器,例如是中心服务器、边缘服务器,或者是本地数据中心中的本地服务器。在一些实施例中,计算设备也可以是台式机、笔记本电脑或者智能手机等终端设备。The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
如图9所示,所述计算设备集群包括至少一个计算设备100。计算设备集群中的一个或多个计算设备100中的存储器106中可以存有相同的用于执行数据处理方法的指令。As shown in Fig. 9, the computing device cluster includes at least one computing device 100. The memory 106 in one or more computing devices 100 in the computing device cluster may store the same instructions for executing the data processing method.
在一些可能的实现方式中,该计算设备集群中的一个或多个计算设备100的存储器106中也可以分别存有用于执行数据处理方法的部分指令。换言之,一个或多个计算设备100的组合可以共同执行用于执行数据处理方法的指令。In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing the data processing method. In other words, the combination of one or more computing devices 100 may jointly execute instructions for executing the data processing method.
需要说明的是,计算设备集群中的不同的计算设备100中的存储器106可以存储不同的指令,分别用于执行数据处理装置的部分功能。也即,不同的计算设备100中的存储器106存储的指令可以实现获取模块810、确定模块820和存储模块830中的一个或多个模块的功能。It should be noted that the memory 106 in different computing devices 100 in the computing device cluster may store different instructions, which are respectively used to execute part of the functions of the data processing apparatus. That is, the instructions stored in the memory 106 in different computing devices 100 may implement the functions of one or more of the acquisition module 810, the determination module 820 and the storage module 830.
在一些可能的实现方式中,计算设备集群中的一个或多个计算设备可以通过网络连接。其中,所述网络可以是广域网或局域网等等。图10示出了一种可能的实现方式。如图10所示,两个计算设备100A和100B之间通过网络进行连接。具体地,通过各个计算设备中的通信接口与所述网络进行连接。在这一类可能的实现方式中,计算设备100A中的存储器106中存有执行获取模块810的功能的指令。同时,计算设备100B中的存储器106中存有执行确定模块820和存储模块830的功能的指令。In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network. The network may be a wide area network or a local area network, etc. FIG. 10 shows a possible implementation. As shown in FIG. 10 , two computing devices 100A and 100B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 106 in the computing device 100A stores instructions for executing the functions of the acquisition module 810. At the same time, the memory 106 in the computing device 100B stores instructions for executing the functions of the determination module 820 and the storage module 830.
图10所示的计算设备集群之间的连接方式可以是考虑到本申请提供的数据处理方法的需要,因此考虑将确定模块820和存储模块830实现的功能交由计算设备100B执行。The connection method between the computing device clusters shown in Figure 10 may be based on the needs of the data processing method provided in this application, so it is considered to hand over the functions implemented by the determination module 820 and the storage module 830 to the computing device 100B for execution.
应理解,图10中示出的计算设备100A的功能也可以由多个计算设备100完成。同样,计算设备100B的功能也可以由多个计算设备100完成。It should be understood that the functions of the computing device 100A shown in FIG10 may also be completed by multiple computing devices 100. Similarly, the functions of the computing device 100B may also be completed by multiple computing devices 100.
本申请实施例还提供了另一种计算设备集群。该计算设备集群中各计算设备之间的连接关系可以类似的参考图9和图10所述计算设备集群的连接方式。不同的是,该计算设备集群中的一个或多个计算设备100中的存储器106中可以存有相同的用于执行数据处理方法的指令。The embodiment of the present application also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to the connection mode of the computing device cluster described in Figures 9 and 10. The difference is that the memory 106 in one or more computing devices 100 in the computing device cluster can store the same instructions for executing the data processing method.
在一些可能的实现方式中,该计算设备集群中的一个或多个计算设备100的存储器106中也可以分别存有用于执行数据处理方法的部分指令。换言之,一个或多个计算设备100的组合可以共同执行用于执行数据处理方法的指令。In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing the data processing method. In other words, the combination of one or more computing devices 100 may jointly execute instructions for executing the data processing method.
需要说明的是,计算设备集群中的不同的计算设备100中的存储器106可以存储不同的指令,用于执行数据检测系统的部分功能。也即,不同的计算设备100中的存储器106存储的指令可以实现数据处理装置的功能。It should be noted that the memory 106 in different computing devices 100 in the computing device cluster may store different instructions for executing partial functions of the data detection system. That is, the instructions stored in the memory 106 in different computing devices 100 may implement the functions of the data processing apparatus.
本申请实施例还提供了一种包含指令的计算机程序产品。所述计算机程序产品可以是包含指令的,能够运行在计算设备上或被储存在任何可用介质中的软件或程序产品。当所述计算机程序产品在至少一个计算设备上运行时,使得至少一个计算设备执行数据处理方法,或数据处理方法。The embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes a data processing method or a data processing method.
本申请实施例还提供了一种计算机可读存储介质。所述计算机可读存储介质可以是计算设备能够存储的任何可用介质或者是包含一个或多个可用介质的数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘)等。该计算机可读存储介质包括指令,所述指令指示计算设备执行数据处理方法,或指示计算设备执行数据处理方法。The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct a computing device to execute a data processing method, or instructs a computing device to execute a data processing method.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的保护范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims (15)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2023/139313 WO2024207801A1 (en) | 2023-04-06 | 2023-12-16 | Data processing method and apparatus |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310361323 | 2023-04-06 | ||
CN2023103613232 | 2023-04-06 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118779327A true CN118779327A (en) | 2024-10-15 |
Family
ID=92984957
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310911732.5A Pending CN118779327A (en) | 2023-04-06 | 2023-07-24 | Data processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118779327A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN119377326A (en) * | 2024-12-25 | 2025-01-28 | 苏州吉呗思数据技术有限公司 | Delayed playback method, device, equipment and product for backup node in database |
-
2023
- 2023-07-24 CN CN202310911732.5A patent/CN118779327A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN119377326A (en) * | 2024-12-25 | 2025-01-28 | 苏州吉呗思数据技术有限公司 | Delayed playback method, device, equipment and product for backup node in database |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20220335034A1 (en) | Multi-master architectures for distributed databases | |
CN108121782B (en) | Distribution method of query request, database middleware system and electronic equipment | |
US9092430B2 (en) | Assigning shared catalogs to cache structures in a cluster computing system | |
JP6325001B2 (en) | Method and system using recursive event listeners in nodes of hierarchical data structures | |
US10331625B2 (en) | Managing sequential data store | |
US20180225152A1 (en) | Managing distributed analytics on device groups | |
WO2019057193A1 (en) | Data deletion method and distributed storage system | |
CN109684410B (en) | System, method and storage medium for determining synchronization delay of master database and slave database | |
US11748215B2 (en) | Log management method, server, and database system | |
CN111552701A (en) | Method for determining data consistency in distributed cluster and distributed data system | |
CN113626869A (en) | Data processing method, system, electronic device and storage medium | |
CN118779327A (en) | Data processing method and device | |
CN110018932B (en) | A method and device for monitoring container disks | |
US11113311B2 (en) | Technology agnostic system and method for achieving eventually-consistent data replication | |
CN110309206B (en) | Order information collection method and system | |
WO2024207801A1 (en) | Data processing method and apparatus | |
CN118069672A (en) | Data consensus method and distributed system, electronic device and storage medium | |
CN117555966A (en) | Database master-slave synchronization method, device, equipment and readable storage medium | |
WO2024040902A1 (en) | Data access method, distributed database system and computing device cluster | |
US20220255826A1 (en) | Reducing the impact of network latency during a restore operation | |
US20250110928A1 (en) | Data processing method and related apparatus | |
CN115629918B (en) | Data processing method, device, electronic equipment and storage medium | |
US20240232418A1 (en) | Incremental synchronization of metadata | |
EP4485224A1 (en) | Method for processing read request, distributed database and server | |
US11487738B1 (en) | Replica performance for transactions submitted to log-first distributed databases |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication |