CN115834603A - Data synchronization method and device, storage medium and processor - Google Patents

Data synchronization method and device, storage medium and processor Download PDF

Info

Publication number
CN115834603A
CN115834603A CN202211466310.3A CN202211466310A CN115834603A CN 115834603 A CN115834603 A CN 115834603A CN 202211466310 A CN202211466310 A CN 202211466310A CN 115834603 A CN115834603 A CN 115834603A
Authority
CN
China
Prior art keywords
node
transit
data
nodes
target data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211466310.3A
Other languages
Chinese (zh)
Other versions
CN115834603B (en
Inventor
余祖愿
万腾飞
代应浪
沈亚琪
卢梦梦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Hillstone Networks Information Technology Co ltd
Hillstone Networks Co Ltd
Original Assignee
Hillstone Networks Co Ltd
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 Hillstone Networks Co Ltd filed Critical Hillstone Networks Co Ltd
Priority to CN202211466310.3A priority Critical patent/CN115834603B/en
Publication of CN115834603A publication Critical patent/CN115834603A/en
Application granted granted Critical
Publication of CN115834603B publication Critical patent/CN115834603B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Hardware Redundancy (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请公开了一种数据的同步方法及装置、存储介质和处理器。该方法包括:通过第二中转节点获取多个目标数据和多个第一中转节点;通过第二中转节点确定多个目标数据的数量和每个第一中转节点处理数据的效率;通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器。通过本申请,解决了相关技术中采用集群环境中的源服务器与用于处理数据的中转节点静态绑定的方法,将集群环境中源服务器的数据同步给目的服务器,导致数据同步的效果较差的问题。

Figure 202211466310

The application discloses a data synchronization method and device, a storage medium and a processor. The method includes: obtaining a plurality of target data and a plurality of first transfer nodes through a second transfer node; determining the quantity of the plurality of target data and the efficiency of processing data of each first transfer node through the second transfer node; The node allocates each target data to each first transfer node according to the quantity of multiple target data and the efficiency of processing data by each first transfer node, so that each first transfer node processes each target data, The processed multiple target data are obtained, and the processed multiple target data are synchronized to the destination server. Through this application, the method of statically binding the source server in the cluster environment and the transfer node for processing data in the related technology is solved, and the data of the source server in the cluster environment is synchronized to the destination server, resulting in poor data synchronization effect The problem.

Figure 202211466310

Description

数据的同步方法及装置、存储介质和处理器Data synchronization method and device, storage medium and processor

技术领域technical field

本申请涉及计算机技术领域,具体而言,涉及一种数据的同步方法及装置、存储介质和处理器。The present application relates to the field of computer technology, and in particular, to a data synchronization method and device, a storage medium, and a processor.

背景技术Background technique

集群(cluster)技术是一种较新的技术,通过集群技术,可以在付出较低成本的情况下获得在性能、可靠性、灵活性方面的相对较高的收益,其任务调度则是集群系统中的核心技术。Cluster (cluster) technology is a relatively new technology. Through cluster technology, relatively high benefits in terms of performance, reliability, and flexibility can be obtained at a lower cost. Its task scheduling is a cluster system core technology in.

而且,一些集群部署的服务器,通常需要向目标网络同步数据,由于数据源服务器与目的服务器所提供的接口不兼容,或者需要的数据形式不一致,需要中转节点将数据进行处理后再进行同步。这里的中转节点既可以是大型服务器,也可以是PC(PersonalComputer,个人计算机)上安装的数据处理软件。以下列举三种应用场景:Moreover, some cluster-deployed servers usually need to synchronize data to the target network. Because the interfaces provided by the data source server and the destination server are incompatible, or the required data formats are inconsistent, the transfer node needs to process the data before synchronizing. The transfer node here can be a large server, or a data processing software installed on a PC (Personal Computer, personal computer). Three application scenarios are listed below:

(1)在网络安全的审计和控制中,安全厂商常常通过在内部网络中部署代理软件,从集群部署的认证服务器中同步用户,代理软件将用户数据转发至网络安全设备,以帮助网络安全设备完成流量的实名审计和控制。(1) In the audit and control of network security, security vendors often deploy proxy software in the internal network to synchronize users from authentication servers deployed in clusters, and the proxy software forwards user data to network security devices to help network security devices Complete real-name audit and control of traffic.

(2)在复杂审计系统中,各种设备的日志通常各不相同,为了将日志汇总到日志平台进行统一管理,可以设置中转节点对日志进行统一处理和格式化。(2) In a complex audit system, the logs of various devices are usually different. In order to aggregate the logs to the log platform for unified management, a transfer node can be set up to process and format the logs uniformly.

(3)在小型网络中,集群部署的服务器1存储着可供用户访问的资源,服务器2用于反向代理用户请求,为用户提供资源,服务器1和服务器2之间设置中转节点,进行数据解码、分类、格式化等处理操作。(3) In a small network, server 1 deployed in a cluster stores resources accessible to users, server 2 is used to reverse proxy user requests and provide resources for users, and a transfer node is set between server 1 and server 2 to transfer data Decoding, classification, formatting and other processing operations.

但是,上述的中转节点可能处理数据的能力有限,稳定性也相对有限。为了保证同步效率和同步的稳定性,通常我们需要进行负载均衡和冗余部署,使用多个中转节点对接集群环境中的多个源服务器,将数据处理并转发至目的服务器。However, the above-mentioned transit nodes may have limited ability to process data and relatively limited stability. In order to ensure synchronization efficiency and stability, we usually need to perform load balancing and redundant deployment, use multiple transfer nodes to connect to multiple source servers in the cluster environment, and process and forward data to the destination server.

相关技术中,采用一对多的方式同步数据,即使用一个中转节点对接集群环境中的多个源服务器,将源服务器的数据同步至目标网络。但是,此方法的缺点在于,单一中转节点处理能力不足,或不具备稳定性,可能造成数据同步节点的拥塞、甚至彻底瘫痪。In related technologies, data is synchronized in a one-to-many manner, that is, a transit node is used to connect to multiple source servers in a cluster environment, and the data of the source server is synchronized to the target network. However, the disadvantage of this method is that the processing capacity of a single transit node is insufficient, or it does not have stability, which may cause congestion or even complete paralysis of the data synchronization node.

另外,相关技术中,还采用简单的N对N的方式同步数据,即存在多个中转节点,每个中转节点绑定一个源服务器,将源服务器的数据同步至目标网络。但是,此方法的缺点在于,由于存在绑定关系,因此不方便进行冗余部署,为了防止某个中转节点瘫痪,必须为其设定一个备份的冗余节点,当瘫痪的节点数量大于冗余的节点数量时,同步将会中断或部分中断,此外,由于每个源服务器需要同步的数据量,每个中转节点的实际承载能力都是不同的,静态的绑定关系会使得同步资源分布不均匀,使得部分中转节点过于拥塞,部分中转节点过于空闲。In addition, in related technologies, a simple N-to-N method is also used to synchronize data, that is, there are multiple transit nodes, each transit node is bound to a source server, and the data of the source server is synchronized to the target network. However, the disadvantage of this method is that due to the binding relationship, it is inconvenient to deploy redundantly. In order to prevent a transit node from being paralyzed, a backup redundant node must be set for it. When the number of nodes is large, the synchronization will be interrupted or partially interrupted. In addition, due to the amount of data that each source server needs to synchronize, the actual carrying capacity of each transfer node is different, and the static binding relationship will make the distribution of synchronization resources uneven. Evenly, some transit nodes are too congested, and some transit nodes are too idle.

针对相关技术中采用集群环境中的源服务器与用于处理数据的中转节点静态绑定的方法,将集群环境中源服务器的数据同步给目的服务器,导致数据同步的效果较差的问题,目前尚未提出有效的解决方案。Aiming at the problem that the source server in the cluster environment is statically bound to the transfer node used to process data in the related technology, and the data of the source server in the cluster environment is synchronized to the destination server, resulting in poor data synchronization effect, there is currently no Come up with effective solutions.

发明内容Contents of the invention

本申请的主要目的在于提供一种数据的同步方法及装置、存储介质和处理器,以解决相关技术中采用集群环境中的源服务器与用于处理数据的中转节点静态绑定的方法,将集群环境中源服务器的数据同步给目的服务器,导致数据同步的效果较差的问题。The main purpose of this application is to provide a data synchronization method and device, storage medium and processor to solve the problem of statically binding the source server in the cluster In the environment, the data of the source server is synchronized to the destination server, resulting in poor data synchronization effect.

为了实现上述目的,根据本申请的一个方面,提供了一种数据的同步方法。该方法应用在数据同步系统中,所述数据同步系统中至少包括:多个第一中转节点和第二中转节点,所述第一中转节点用于处理数据,所述第二中转节点用于调度所述多个第一中转节点,若所述多个第一中转节点中存在故障节点,则采用所述第一中转节点中除故障节点之外的中转节点代替所述故障节点,若所述第二中转节点发生故障,则采用所述多个第一中转节点中的任意一个中转节点代替所述第二中转节点,包括:通过所述第二中转节点获取多个目标数据和所述多个第一中转节点,其中,每个目标数据为集群环境中多个源服务器待同步至目的服务器的数据;通过所述第二中转节点确定所述多个目标数据的数量和每个第一中转节点处理数据的效率;通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将所述处理后的多个目标数据同步至所述目的服务器。In order to achieve the above purpose, according to one aspect of the present application, a method for synchronizing data is provided. The method is applied in a data synchronization system, and the data synchronization system includes at least: a plurality of first transfer nodes and a second transfer node, the first transfer nodes are used for processing data, and the second transfer nodes are used for scheduling For the multiple first transit nodes, if there is a faulty node among the multiple first transit nodes, use a transit node other than the faulty node among the first transit nodes to replace the faulty node, if the first transitive node If the second transit node fails, using any one of the plurality of first transit nodes to replace the second transit node includes: acquiring multiple target data and the multiple first transit nodes through the second transit node A transfer node, wherein each target data is the data to be synchronized from multiple source servers to the destination server in the cluster environment; the quantity of the multiple target data and the processing of each first transfer node are determined by the second transfer node Data efficiency: through the second transit node, each target data is assigned to each first transit node according to the quantity of the plurality of target data and the efficiency of processing data by each first transit node, so that each The first transfer node processes each target data, obtains multiple processed target data, and synchronizes the processed multiple target data to the destination server.

进一步地,通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点包括:依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,计算得到分配给每个第一中转节点的数据量;基于分配给每个第一中转节点的数据量,将每个目标数据分配给每个第一中转节点。Further, assigning each target data to each first transit node by the second transit node according to the quantity of the plurality of target data and the data processing efficiency of each first transit node includes: according to the multiple The quantity of target data and the efficiency of each first transit node to process data are calculated to obtain the amount of data allocated to each first transit node; based on the amount of data allocated to each first transit node, each target data is allocated for each first transit node.

进一步地,在通过所述第二中转节点确定所述多个目标数据的数量和每个第一中转节点处理数据的效率之前,所述方法还包括:确定多个目标中转节点,其中,所述多个目标中转节点中至少包括所述多个第一中转节点;从所述多个目标中转节点中确定所述第二中转节点,以通过所述第二中转节点确定所述多个目标数据的数量和每个第一中转节点处理数据的效率,其中,所述第二中转节点为所述多个目标中转节点中除所述多个第一中转节点之外的中转节点。Further, before the second transit node determines the quantity of the plurality of target data and the data processing efficiency of each first transit node, the method further includes: determining a plurality of target transit nodes, wherein the The plurality of target transit nodes at least include the plurality of first transit nodes; determining the second transit node from the plurality of target transit nodes, so as to determine the plurality of target data through the second transit node The quantity and the data processing efficiency of each first transit node, wherein the second transit node is a transit node in the plurality of target transit nodes except the plurality of first transit nodes.

进一步地,在通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点之后,所述方法还包括:判断所述多个第一中转节点中是否存在故障节点;若所述多个第一中转节点中存在故障节点,则从所述多个第一中转节点中确定除故障节点之外的多个第三中转节点,其中,所述第三中转节点用于代替所述第一中转节点对所述多个目标数据进行处理;获取每个第三中转节点处理数据的效率;依据所述多个目标数据的数量和每个第三中转节点处理数据的效率,将每个目标数据分配给每个第三中转节点。Further, after the second transit node allocates each target data to each first transit node according to the quantity of the plurality of target data and the data processing efficiency of each first transit node, the method It also includes: judging whether there is a faulty node in the plurality of first transit nodes; if there is a faulty node in the plurality of first transit nodes, then determining from the plurality of first transit nodes other than the faulty node A plurality of third transfer nodes, wherein the third transfer node is used to replace the first transfer node to process the plurality of target data; obtain the data processing efficiency of each third transfer node; according to the multiple The quantity of each target data and the efficiency of each third transit node to process data, assign each target data to each third transit node.

进一步地,在从所述多个目标中转节点中确定所述第二中转节点之后,所述方法还包括:判断所述第二中转节点是否发生故障;若所述第二中转节点发生故障,则从所述多个第一中转节点中确定第四中转节点,其中,所述第四中转节点用于代替所述第二中转节点调度所述多个第一中转节点中除所述第四中转节点之外的中转节点。Further, after the second transit node is determined from the plurality of target transit nodes, the method further includes: judging whether the second transit node fails; if the second transit node fails, then Determining a fourth transit node from the plurality of first transit nodes, wherein the fourth transit node is used to replace the second transit node in scheduling the plurality of first transit nodes except the fourth transit node other transit nodes.

进一步地,通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点包括:判断所述多个目标数据的数据量是否大于预设数据量;若所述多个目标数据的数据量大于所述预设数据量,则通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使所述第一中转节点从所述多个源服务器中获取所述多个目标数据,并对所述多个目标数据进行处理;若所述多个目标数据的数据量不大于所述预设数据量,则通过所述第二中转节点从所述多个源服务器中获取所述多个目标数据;依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将从所述多个源服务器中获取的每个目标数据分配给每个第一中转节点。Further, assigning each target data to each first transit node by the second transit node according to the quantity of the plurality of target data and the data processing efficiency of each first transit node includes: judging the multiple Whether the data volume of each target data is greater than the preset data volume; if the data volume of the multiple target data is greater than the preset data volume, then through the second transit node according to the number of the multiple target data and each the efficiency of data processing by a first transit node, assign each target data to each first transit node, so that the first transit node obtains the plurality of target data from the plurality of source servers, and assigns each target data to each first transit node. Processing the plurality of target data; if the data volume of the multiple target data is not greater than the preset data volume, acquiring the multiple target data from the multiple source servers through the second transit node Data: assigning each target data obtained from the multiple source servers to each first transit node according to the quantity of the multiple target data and the data processing efficiency of each first transit node.

进一步地,从所述多个目标中转节点中确定所述第二中转节点包括:获取每个目标中转节点对应的编号信息;基于每个目标中转节点对应的编号信息,确定所述多个目标中转节点中编号最小的中转节点;将所述多个目标中转节点中编号最小的中转节点作为所述第二中转节点。Further, determining the second transit node from the multiple target transit nodes includes: acquiring number information corresponding to each target transit node; and determining the multiple target transit nodes based on the number information corresponding to each target transit node The transit node with the smallest number among the nodes; the transit node with the smallest number among the plurality of target transit nodes is used as the second transit node.

进一步地,所述方法还包括:获取每个源服务器在单位时间内待同步至目的服务器的数据量;依据每个源服务器在单位时间内待同步至目的服务器的数据量,计算得到每个第一中转节点的平均排队长度,其中,所述平均排队长度用于表示在第一时间段内所述多个目标数据的堆积情况;确定每个第一中转节点的实时排队长度,其中,所述实时排队长度用于表示在第二时间段内每个第一中转节点的负载压力情况,所述第二时间段的长度小于所述第一时间段的长度;基于每个第一中转节点的平均排队长度和实时排队长度,向目标对象发送提醒信息,其中,所述提醒信息用于提醒所述目标对象调整将所述多个目标数据同步至所述目的服务器的策略。Further, the method further includes: acquiring the amount of data to be synchronized from each source server to the destination server within unit time; calculating the amount of data for each source server to be synchronized to the destination server within unit time; An average queue length of a transit node, wherein the average queue length is used to represent the accumulation of the plurality of target data within the first time period; determine the real-time queue length of each first transit node, wherein the The real-time queue length is used to represent the load pressure situation of each first transit node in the second time period, the length of the second time period is less than the length of the first time period; based on the average of each first transit node The queue length and the real-time queue length send reminder information to the target object, wherein the reminder information is used to remind the target object to adjust a strategy for synchronizing the plurality of target data to the destination server.

进一步地,在获取多个目标数据和多个第一中转节点之后,所述方法还包括:判断所述多个第一中转节点中的第五中转节点是否处于空闲状态;若所述多个第一中转节点中的第五中转节点处于空闲状态,则将多个目标数据中的第一数据分配给所述第五中转节点,以使所述第五中转节点对所述第一数据进行处理,得到处理后的第一数据,并将所述处理后的第一数据同步至所述目的服务器;若所述多个第一中转节点中的第五中转节点不处于空闲状态,则判断所述多个第一中转节点中的第六中转节点是否处于空闲状态;若所述多个第一中转节点中的第六中转节点处于空闲状态,则将多个目标数据中的第一数据分配给所述第六中转节点,以使所述第六中转节点对所述第一数据进行处理,得到处理后的第一数据,并将所述处理后的第一数据同步至所述目的服务器。Further, after acquiring multiple target data and multiple first transit nodes, the method further includes: judging whether a fifth transit node among the multiple first transit nodes is in an idle state; if the multiple first transit nodes a fifth transit node among the transit nodes is in an idle state, allocating the first data among the plurality of target data to the fifth transit node, so that the fifth transit node processes the first data, Obtaining the processed first data, and synchronizing the processed first data to the destination server; if the fifth transit node among the multiple first transit nodes is not Whether the sixth transit node among the first transit nodes is in an idle state; if the sixth transit node among the plurality of first transit nodes is in an idle state, then distribute the first data among the plurality of target data to the A sixth transit node, so that the sixth transit node processes the first data to obtain processed first data, and synchronizes the processed first data to the destination server.

为了实现上述目的,根据本申请的另一方面,提供了一种数据的同步装置。该装置应用在数据同步系统中,所述数据同步系统中至少包括:多个第一中转节点和第二中转节点,所述第一中转节点用于处理数据,所述第二中转节点用于调度所述多个第一中转节点,若所述多个第一中转节点中存在故障节点,则采用所述第一中转节点中除故障节点之外的中转节点代替所述故障节点,若所述第二中转节点发生故障,则采用所述多个第一中转节点中的任意一个中转节点代替所述第二中转节点,包括:第一获取模块,用于通过所述第二中转节点获取多个目标数据和所述多个第一中转节点,其中,每个目标数据为集群环境中多个源服务器待同步至目的服务器的数据;第一确定模块,用于通过所述第二中转节点确定所述多个目标数据的数量和每个第一中转节点处理数据的效率;第一处理模块,用于通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将所述处理后的多个目标数据同步至所述目的服务器。In order to achieve the above purpose, according to another aspect of the present application, a data synchronization device is provided. The device is applied in a data synchronization system, and the data synchronization system at least includes: a plurality of first transfer nodes and a second transfer node, the first transfer nodes are used for processing data, and the second transfer nodes are used for scheduling For the multiple first transit nodes, if there is a faulty node among the multiple first transit nodes, use a transit node other than the faulty node among the first transit nodes to replace the faulty node, if the first transitive node If the second transit node fails, use any one of the multiple first transit nodes to replace the second transit node, including: a first acquisition module, configured to acquire multiple targets through the second transit node data and the plurality of first transfer nodes, wherein each target data is data to be synchronized from multiple source servers to a destination server in a cluster environment; a first determination module is configured to determine the The quantity of multiple target data and the data processing efficiency of each first transit node; the first processing module is configured to process data according to the quantity of multiple target data and each first transit node through the second transit node efficiency, assigning each target data to each first transit node, so that each first transit node processes each target data, obtains a plurality of processed target data, and distributes the processed multi-target data The target data is synchronized to the target server.

进一步地,所述第一处理模块包括:第一计算单元,用于依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,计算得到分配给每个第一中转节点的数据量;第一分配单元,用于基于分配给每个第一中转节点的数据量,将每个目标数据分配给每个第一中转节点。Further, the first processing module includes: a first computing unit, configured to calculate and obtain the value assigned to each first transit node according to the quantity of the plurality of target data and the efficiency of processing data by each first transit node. Data volume; a first allocation unit configured to allocate each target data to each first transit node based on the data volume allocated to each first transit node.

进一步地,所述装置还包括:第二确定模块,用于在通过所述第二中转节点确定所述多个目标数据的数量和每个第一中转节点处理数据的效率之前,确定多个目标中转节点,其中,所述多个目标中转节点中至少包括所述多个第一中转节点;第三确定模块,用于从所述多个目标中转节点中确定所述第二中转节点,以通过所述第二中转节点确定所述多个目标数据的数量和每个第一中转节点处理数据的效率,其中,所述第二中转节点为所述多个目标中转节点中除所述多个第一中转节点之外的中转节点。Further, the device further includes: a second determination module, configured to determine the multiple targets before determining the quantity of the multiple target data and the data processing efficiency of each first transit node through the second transit node A transit node, wherein the plurality of target transit nodes include at least the plurality of first transit nodes; a third determining module, configured to determine the second transit node from the plurality of target transit nodes, to pass The second transit node determines the quantity of the plurality of target data and the data processing efficiency of each first transit node, wherein the second transit node is one of the plurality of target transit nodes except the plurality of first transit nodes A transit node other than a transit node.

进一步地,所述装置还包括:第一判断模块,用于在通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点之后,判断所述多个第一中转节点中是否存在故障节点;第四确定模块,用于若所述多个第一中转节点中存在故障节点,则从所述多个第一中转节点中确定除故障节点之外的多个第三中转节点,其中,所述第三中转节点用于代替所述第一中转节点对所述多个目标数据进行处理;第二获取模块,用于获取每个第三中转节点处理数据的效率;第一分配模块,用于依据所述多个目标数据的数量和每个第三中转节点处理数据的效率,将每个目标数据分配给每个第三中转节点。Further, the device further includes: a first judging module, configured to convert each target data to After being assigned to each first transit node, it is judged whether there is a faulty node in the plurality of first transit nodes; the fourth determining module is configured to, if there is a faulty node in the plurality of first transit nodes, then from the Determining a plurality of third transit nodes other than the faulty node among the plurality of first transit nodes, wherein the third transit node is used to replace the first transit node to process the plurality of target data; the second An acquisition module, configured to acquire the efficiency of data processing by each third transfer node; a first distribution module, configured to assign each target data to Assigned to each third transit node.

进一步地,所述装置还包括:第二判断模块,用于在从所述多个目标中转节点中确定所述第二中转节点之后,判断所述第二中转节点是否发生故障;第五确定模块,用于若所述第二中转节点发生故障,则从所述多个第一中转节点中确定第四中转节点,其中,所述第四中转节点用于代替所述第二中转节点调度所述多个第一中转节点中除所述第四中转节点之外的中转节点。Further, the device further includes: a second judging module, configured to judge whether the second transit node fails after determining the second transit node from the plurality of target transit nodes; a fifth determining module , used to determine a fourth transit node from the plurality of first transit nodes if the second transit node fails, wherein the fourth transit node is used to replace the second transit node to schedule the A transit node other than the fourth transit node among the plurality of first transit nodes.

进一步地,所述第一处理模块包括:第一判断单元,用于判断所述多个目标数据的数据量是否大于预设数据量;第二分配单元,用于若所述多个目标数据的数据量大于所述预设数据量,则通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使所述第一中转节点从所述多个源服务器中获取所述多个目标数据,并对所述多个目标数据进行处理;第一获取单元,用于若所述多个目标数据的数据量不大于所述预设数据量,则通过所述第二中转节点从所述多个源服务器中获取所述多个目标数据;第三分配单元,用于依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将从所述多个源服务器中获取的每个目标数据分配给每个第一中转节点。Further, the first processing module includes: a first judging unit, configured to judge whether the data volume of the plurality of target data is greater than a preset data volume; a second allocation unit, configured to determine whether the data volume of the multiple target data If the amount of data is greater than the preset amount of data, then the second transit node distributes each target data to each first a transfer node, so that the first transfer node obtains the multiple target data from the multiple source servers, and processes the multiple target data; the first obtaining unit is configured to if the multiple If the data volume of the target data is not greater than the preset data volume, the multiple target data are obtained from the multiple source servers through the second transit node; the third allocation unit is configured to The quantity of target data and the data processing efficiency of each first transit node, assigning each target data obtained from the plurality of source servers to each first transit node.

进一步地,所述第三确定模块包括:第二获取单元,用于获取每个目标中转节点对应的编号信息;第一确定单元,用于基于每个目标中转节点对应的编号信息,确定所述多个目标中转节点中编号最小的中转节点;第二确定单元,用于将所述多个目标中转节点中编号最小的中转节点作为所述第二中转节点。Further, the third determining module includes: a second acquiring unit, configured to acquire number information corresponding to each target transit node; a first determining unit, configured to determine the number information corresponding to each target transit node A transit node with the smallest number among the multiple target transit nodes; a second determination unit configured to use the transit node with the smallest number among the multiple target transit nodes as the second transit node.

进一步地,所述装置还包括:第三获取模块,用于获取每个源服务器在单位时间内待同步至目的服务器的数据量;第一计算模块,用于依据每个源服务器在单位时间内待同步至目的服务器的数据量,计算得到每个第一中转节点的平均排队长度,其中,所述平均排队长度用于表示在第一时间段内所述多个目标数据的堆积情况;第六确定模块,用于确定每个第一中转节点的实时排队长度,其中,所述实时排队长度用于表示在第二时间段内每个第一中转节点的负载压力情况,所述第二时间段的长度小于所述第一时间段的长度;第一发送模块,用于基于每个第一中转节点的平均排队长度和实时排队长度,向目标对象发送提醒信息,其中,所述提醒信息用于提醒所述目标对象调整将所述多个目标数据同步至所述目的服务器的策略。Further, the device further includes: a third acquisition module, configured to acquire the amount of data to be synchronized to the destination server by each source server within a unit time; The amount of data to be synchronized to the destination server is calculated to obtain the average queue length of each first transit node, wherein the average queue length is used to represent the accumulation of the plurality of target data within the first time period; sixth A determining module, configured to determine the real-time queue length of each first transit node, wherein the real-time queue length is used to represent the load pressure situation of each first transit node within a second time period, and the second time period The length is less than the length of the first time period; the first sending module is configured to send reminder information to the target object based on the average queue length and real-time queue length of each first transit node, wherein the reminder information is used for Reminding the target object to adjust a strategy for synchronizing the plurality of target data to the target server.

进一步地,所述装置还包括:第三判断模块,用于在获取多个目标数据和多个第一中转节点之后,判断所述多个第一中转节点中的第五中转节点是否处于空闲状态;第二分配模块,用于若所述多个第一中转节点中的第五中转节点处于空闲状态,则将多个目标数据中的第一数据分配给所述第五中转节点,以使所述第五中转节点对所述第一数据进行处理,得到处理后的第一数据,并将所述处理后的第一数据同步至所述目的服务器;第四判断模块,用于若所述多个第一中转节点中的第五中转节点不处于空闲状态,则判断所述多个第一中转节点中的第六中转节点是否处于空闲状态;第三分配模块,用于若所述多个第一中转节点中的第六中转节点处于空闲状态,则将多个目标数据中的第一数据分配给所述第六中转节点,以使所述第六中转节点对所述第一数据进行处理,得到处理后的第一数据,并将所述处理后的第一数据同步至所述目的服务器。Further, the device further includes: a third judging module, configured to judge whether a fifth transit node among the plurality of first transit nodes is in an idle state after acquiring a plurality of target data and a plurality of first transit nodes a second allocation module, configured to allocate the first data among the plurality of target data to the fifth transit node if the fifth transit node among the plurality of first transit nodes is in an idle state, so that all The fifth transit node processes the first data to obtain the processed first data, and synchronizes the processed first data to the destination server; the fourth judging module is configured to If the fifth transit node among the first transit nodes is not in an idle state, it is judged whether the sixth transit node among the plurality of first transit nodes is in an idle state; A sixth transit node among the transit nodes is in an idle state, allocating the first data among the plurality of target data to the sixth transit node, so that the sixth transit node processes the first data, The processed first data is obtained, and the processed first data is synchronized to the destination server.

为了实现上述目的,根据本申请的另一方面,提供了一种计算机可读存储介质,所述存储介质存储程序,其中,所述程序执行上述的任意一项所述的数据的同步方法。In order to achieve the above object, according to another aspect of the present application, a computer-readable storage medium is provided, the storage medium stores a program, wherein the program executes the data synchronization method described in any one of the above.

为了实现上述目的,根据本申请的另一方面,提供了一种处理器,所述处理器用于运行程序,其中,所述程序运行时执行上述的任意一项所述的数据的同步方法。In order to achieve the above object, according to another aspect of the present application, a processor is provided, the processor is used to run a program, wherein, when the program is running, the method for synchronizing data described in any one of the above items is executed.

通过本申请,采用以下步骤:通过第二中转节点获取多个目标数据和多个第一中转节点,其中,每个目标数据为集群环境中多个源服务器待同步至目的服务器的数据;通过第二中转节点确定多个目标数据的数量和每个第一中转节点处理数据的效率;通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器,解决了相关技术中采用集群环境中的源服务器与用于处理数据的中转节点静态绑定的方法,将集群环境中源服务器的数据同步给目的服务器,导致数据同步的效果较差的问题。通过第二中转节点依据确定的多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器,从而提升了数据同步的高效性和稳定性,进而提升了数据同步的效果。Through this application, the following steps are adopted: obtain a plurality of target data and a plurality of first transfer nodes through the second transfer node, wherein each target data is data to be synchronized from multiple source servers to the destination server in the cluster environment; through the second transfer node The second transit node determines the quantity of multiple target data and the data processing efficiency of each first transit node; through the second transit node, each target The data is distributed to each first transit node, so that each first transit node processes each target data, obtains multiple processed target data, and synchronizes the processed multiple target data to the destination server, solving The method of statically binding the source server in the cluster environment and the transfer node for processing data in the related technology is used to synchronize the data of the source server in the cluster environment to the destination server, resulting in poor data synchronization effect. According to the determined number of target data and the data processing efficiency of each first transit node, the second transit node assigns each target data to each first transit node, so that each first transit node The target data is processed to obtain multiple target data after processing, and the multiple target data after processing are synchronized to the destination server, thereby improving the efficiency and stability of data synchronization, and further improving the effect of data synchronization.

附图说明Description of drawings

构成本申请的一部分的附图用来提供对本申请的进一步理解,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings constituting a part of the application are used to provide further understanding of the application, and the schematic embodiments and descriptions of the application are used to explain the application, and do not constitute an improper limitation to the application. In the attached picture:

图1是根据本申请实施例提供的数据的同步方法的流程图;Fig. 1 is a flowchart of a data synchronization method provided according to an embodiment of the present application;

图2是根据本申请实施例提供的部署数据同步装置的示意图;Fig. 2 is a schematic diagram of deploying a data synchronization device according to an embodiment of the present application;

图3是本申请实施例中当需要处理的数据占据大量带宽时调度节点作任务数据转发的示意图;Fig. 3 is a schematic diagram of scheduling nodes performing task data forwarding when the data to be processed occupies a large amount of bandwidth in the embodiment of the present application;

图4是本申请实施例中当需要处理的数据无需占据大量带宽时调度节点作任务数据转发的示意图;Fig. 4 is a schematic diagram of scheduling nodes performing task data forwarding when the data to be processed does not need to occupy a large amount of bandwidth in the embodiment of the present application;

图5是根据本申请实施例提供的数据的同步方法的流程图一;FIG. 5 is a flow chart 1 of a data synchronization method provided according to an embodiment of the present application;

图6是根据本申请实施例提供的可选的数据的同步方法的流程图;FIG. 6 is a flowchart of an optional data synchronization method provided according to an embodiment of the present application;

图7是根据本申请实施例提供的数据的同步装置的示意图。Fig. 7 is a schematic diagram of an apparatus for synchronizing data according to an embodiment of the present application.

具体实施方式Detailed ways

需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and embodiments.

为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiment of the application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiment of the application. Obviously, the described embodiment is only It is an embodiment of a part of the application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.

需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first" and "second" in the description and claims of the present application and the above drawings are used to distinguish similar objects, but not necessarily used to describe a specific sequence or sequence. It should be understood that the data so used may be interchanged under appropriate circumstances for the embodiments of the application described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.

实施例1Example 1

下面结合优选的实施步骤对本发明进行说明,图1是根据本申请实施例提供的数据的同步方法的流程图,如图1所示,该方法应用在数据同步系统中,所述数据同步系统中至少包括:多个第一中转节点和第二中转节点,所述第一中转节点用于处理数据,所述第二中转节点用于调度所述多个第一中转节点,若所述多个第一中转节点中存在故障节点,则采用所述第一中转节点中除故障节点之外的中转节点代替所述故障节点,若所述第二中转节点发生故障,则采用所述多个第一中转节点中的任意一个中转节点代替所述第二中转节点,并包括如下步骤:The present invention will be described below in conjunction with preferred implementation steps. Fig. 1 is a flow chart of the data synchronization method provided according to the embodiment of the application. As shown in Fig. 1, the method is applied in a data synchronization system, and in the data synchronization system At least include: a plurality of first transfer nodes and a second transfer node, the first transfer nodes are used to process data, the second transfer nodes are used to schedule the plurality of first transfer nodes, if the plurality of first transfer nodes If there is a faulty node in a transit node, use a transit node other than the faulty node in the first transit node to replace the faulty node, and if the second transit node fails, use the multiple first transit nodes Any one of the transit nodes in the nodes replaces the second transit node, and includes the following steps:

步骤S101,通过第二中转节点获取多个目标数据和多个第一中转节点,其中,每个目标数据为集群环境中多个源服务器待同步至目的服务器的数据。In step S101, a plurality of target data and a plurality of first transfer nodes are acquired through a second transfer node, wherein each target data is data to be synchronized from a plurality of source servers to a destination server in a cluster environment.

例如,图2是根据本申请实施例提供的部署数据同步装置的示意图,如图2所示,数据同步装置中目的服务器的数量可以为多个,由于本申请实施例不关注目的服务器与各个中转节点的绑定关系,因此可以将目的服务器视为一个。For example, Fig. 2 is a schematic diagram of deploying a data synchronization device according to the embodiment of the application. As shown in Fig. 2, the number of destination servers in the data synchronization device can be multiple, since the embodiment of the application does not focus on the destination server and each transit The binding relationship of nodes, so the destination server can be regarded as one.

比如,假定存在m个源服务器,n个中转节点,中转节点从源服务器同步数据,经过处理,并发送给目的服务器。For example, suppose there are m source servers and n transit nodes, and the transit nodes synchronize data from the source server, process it, and send it to the destination server.

另外,所有中转节点中,将其中一个中转节点视作调度节点(上述的第二中转节点),调度节点负责所有中转节点的调度安排,其它节点负责数据处理,也称作数据处理节点(上述的第一中转节点)。且对于任何一个中转节点,其内部结构都由网络模块和多进程的数据处理模块构成,前者负责数据的收发,后者负责数据的处理。调度节点与数据处理节点没有区别,只是在实际运行时被选举出来,用于调度其它节点,如有必要,任何一个中转节点都可以作为调度节点。也即,若一个或多个数据处理节点发生故障时,调度节点可以记录故障的数据处理节点,并选取无故障的数据处理节点接替故障的数据处理节点的工作。若当前调度节点发生故障时,可以按照编号顺序从数据处理节点中选举新的调度节点,例如若编号为1的调度节点故障,则编号为2的节点为新的调度节点,若编号为2的调度节点故障,则编号为3的节点为新的调度节点。In addition, among all transit nodes, one of the transit nodes is regarded as a scheduling node (the above-mentioned second transit node), and the scheduling node is responsible for the scheduling of all transit nodes, and other nodes are responsible for data processing, also known as data processing nodes (the above-mentioned first transit point). And for any transit node, its internal structure is composed of a network module and a multi-process data processing module. The former is responsible for sending and receiving data, and the latter is responsible for data processing. There is no difference between a scheduling node and a data processing node, but it is elected during actual operation to schedule other nodes. If necessary, any transit node can be used as a scheduling node. That is, if one or more data processing nodes fail, the scheduling node can record the failed data processing nodes, and select a non-faulty data processing node to take over the work of the failed data processing nodes. If the current scheduling node fails, a new scheduling node can be elected from the data processing nodes according to the order of numbers. For example, if the scheduling node numbered 1 fails, the node numbered 2 will be the new scheduling node. If the scheduling node fails, the node numbered 3 is the new scheduling node.

例如,由调度节点确定需要从集群环境中的多个源服务器同步至目的服务器的数据(上述的多个目标数据),并确定数据同步装置中存在哪些数据处理节点。For example, the scheduling node determines the data that needs to be synchronized from multiple source servers in the cluster environment to the destination server (the aforementioned multiple target data), and determines which data processing nodes exist in the data synchronization device.

步骤S102,通过第二中转节点确定多个目标数据的数量和每个第一中转节点处理数据的效率。In step S102, the quantity of multiple target data and the data processing efficiency of each first transit node are determined by the second transit node.

例如,通过调度节点确定需要从集群环境中的多个源服务器同步至目的服务器的数据的数量,并计算每个数据处理节点单位时间内处理的数据量,即平均处理率(上述的每个第一中转节点处理数据的效率)。For example, determine the amount of data that needs to be synchronized from multiple source servers in the cluster environment to the destination server through the scheduling node, and calculate the amount of data processed by each data processing node per unit time, that is, the average processing rate (each of the above-mentioned The efficiency of a transit node to process data).

步骤S103,通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器。Step S103, distribute each target data to each first transit node through the second transit node according to the quantity of multiple target data and the data processing efficiency of each first transit node, so that each first transit node is Each target data is processed to obtain multiple processed target data, and the processed multiple target data are synchronized to the target server.

例如,调度节点根据需要从集群环境中的多个源服务器同步至目的服务器的数据的数量和每个数据处理节点单位时间内处理的数据量(平均处理率),将待同步的数据分配给每个数据处理节点进行处理。然后每个数据处理节点接收到分配给其的数据之后,对自己分配到的数据进行处理,得到处理后的数据,再将处理后的数据同步给目的服务器。For example, the scheduling node allocates the data to be synchronized to each data processing nodes for processing. After each data processing node receives the data allocated to it, it processes the data allocated to it, obtains the processed data, and then synchronizes the processed data to the destination server.

通过上述的步骤S101至S103,通过第二中转节点依据确定的多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器,从而提升了数据同步的高效性和稳定性,进而提升了数据同步的效果。Through the above-mentioned steps S101 to S103, the second transit node assigns each target data to each first transit node according to the determined number of target data and the data processing efficiency of each first transit node, so that Each first transit node processes each target data, obtains multiple processed target data, and synchronizes the processed multiple target data to the destination server, thereby improving the efficiency and stability of data synchronization, and further Improved the effect of data synchronization.

为了快速准确的确定第二中转节点,在本申请实施例提供的数据的同步方法中,还可以通过以下步骤确定第二中转节点:确定多个目标中转节点,其中,多个目标中转节点中至少包括多个第一中转节点;从多个目标中转节点中确定第二中转节点,以通过第二中转节点确定多个目标数据的数量和每个第一中转节点处理数据的效率,其中,第二中转节点为多个目标中转节点中除多个第一中转节点之外的中转节点。In order to quickly and accurately determine the second transit node, in the data synchronization method provided by the embodiment of the present application, the second transit node may also be determined through the following steps: determine multiple target transit nodes, wherein at least including a plurality of first transfer nodes; determining a second transfer node from the plurality of target transfer nodes, so as to determine the quantity of multiple target data and the efficiency of processing data by each first transfer node through the second transfer node, wherein, the second The transit node is a transit node in the multiple target transit nodes except the multiple first transit nodes.

例如,如图2所示,数据同步装置中可以存在多个中转节点(即对应图2中的中转节点1、中转节点2、中转节点3、中转节点4等),且图2中的中转节点1、中转节点2、中转节点3、中转节点4等可以为上述的目标中转节点。然后可以从中转节点1、中转节点2、中转节点3、中转节点4等这些中转节点中选取任意一个中转节点作为调度节点(上述的第二中转节点),再由调度节点确定需要从集群环境中的多个源服务器同步至目的服务器的数据的数量,并计算每个数据处理节点单位时间内处理的数据量,即平均处理率(上述的每个第一中转节点处理数据的效率)。另外,如果将中转节点1、中转节点2、中转节点3、中转节点4等这些中转节点中的中转节点1作为调度节点,则将剩余的中转节点2、中转节点3、中转节点4等这些中转节点作为数据处理节点(上述的多个第一中转节点)。For example, as shown in Figure 2, there may be multiple transit nodes in the data synchronization device (that is, corresponding to transit node 1, transit node 2, transit node 3, transit node 4, etc. in Fig. 2), and the transit nodes in Fig. 2 1. Transit node 2, transit node 3, transit node 4, etc. may be the above-mentioned target transit nodes. Then, any one of the transit nodes can be selected from transit nodes 1, 2, 3, 4, etc. The number of data synchronized from multiple source servers to the destination server, and calculate the amount of data processed by each data processing node per unit time, that is, the average processing rate (the above-mentioned efficiency of processing data by each first transfer node). In addition, if transit node 1 among transit nodes 1, 2, 3, and 4 is used as a scheduling node, the rest of transit nodes 2, 3, 4, etc. The node serves as a data processing node (the aforementioned multiple first transit nodes).

综上所述,设计多节点的同步装置,并选取一个节点为调度节点,利用调度节点统一对接集群的各个服务器,处理节点基于负载均衡完成处理工作,易于部署,同时能够避免单一节点负载不足。To sum up, a multi-node synchronization device is designed, and one node is selected as the scheduling node. The scheduling node is used to connect to each server in the cluster in a unified manner. The processing node completes the processing work based on load balancing, which is easy to deploy and avoids insufficient load on a single node.

为了快速准确的确定第二中转节点,在本申请实施例提供的数据的同步方法中,还可以通过以下步骤确定第二中转节点:获取每个目标中转节点对应的编号信息;基于每个目标中转节点对应的编号信息,确定多个目标中转节点中编号最小的中转节点;将多个目标中转节点中编号最小的中转节点作为第二中转节点。In order to quickly and accurately determine the second transit node, in the data synchronization method provided in the embodiment of the present application, the second transit node can also be determined through the following steps: obtain the serial number information corresponding to each target transit node; The number information corresponding to the node determines the transit node with the smallest number among the multiple target transit nodes; the transit node with the smallest number among the multiple target transit nodes is used as the second transit node.

例如,可以按照加入系统的时间,给中转节点自动编号,并可以将编号为1的中转节点自动选举为调度节点,调度节点负责节点的调度和任务的分配,不负责数据处理。For example, the transfer nodes can be automatically numbered according to the time of joining the system, and the transfer node numbered 1 can be automatically elected as a scheduling node. The scheduling node is responsible for node scheduling and task assignment, not data processing.

通过上述的方案,可以快速准确的从多个中转节点中确定出调度节点。Through the above solution, the scheduling node can be quickly and accurately determined from multiple transit nodes.

为了快速准确的将每个目标数据分配给每个第一中转节点,在本申请实施例提供的数据的同步方法中,还可以通过以下步骤将每个目标数据分配给每个第一中转节点:判断多个目标数据的数据量是否大于预设数据量;若多个目标数据的数据量大于预设数据量,则通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使第一中转节点从多个源服务器中获取多个目标数据,并对多个目标数据进行处理;若多个目标数据的数据量不大于预设数据量,则通过第二中转节点从多个源服务器中获取多个目标数据;依据多个目标数据的数量和每个第一中转节点处理数据的效率,将从多个源服务器中获取的每个目标数据分配给每个第一中转节点。In order to quickly and accurately assign each target data to each first transit node, in the data synchronization method provided in the embodiment of the present application, each target data can also be assigned to each first transit node through the following steps: Judging whether the data volume of the multiple target data is greater than the preset data volume; if the data volume of the multiple target data is greater than the preset data volume, the second transit node processes according to the quantity of multiple target data and each first transit node Data efficiency, assigning each target data to each first transit node, so that the first transit node obtains multiple target data from multiple source servers, and processes multiple target data; if multiple target data If the amount of data is not greater than the preset data amount, multiple target data will be obtained from multiple source servers through the second transfer node; according to the number of multiple target data and the efficiency of processing data at each first transfer node, the Each target data obtained from source servers is assigned to each first transit node.

例如,当需要处理的数据占据大量带宽,而调度节点传输能力有限时,调度节点作任务分配时,其过程为:调度节点从源服务器获取任务相关信息,如数据的编号等,不实际同步数据。当需要将数据同步工作分配给其它中转节点时,发送消息告知其它中转节点,任务对应的源服务器、数据的编号、数量等信息,由中转节点自行从源服务器获取数据。且当需要处理的数据占据大量带宽时,调度节点作任务数据转发的示意图,如图3所示。For example, when the data to be processed occupies a large amount of bandwidth and the transmission capacity of the scheduling node is limited, when the scheduling node allocates tasks, the process is as follows: the scheduling node obtains task-related information from the source server, such as the serial number of the data, without actually synchronizing the data . When the data synchronization work needs to be assigned to other transit nodes, a message is sent to inform other transit nodes of the source server corresponding to the task, the data number, quantity and other information, and the transit node obtains the data from the source server by itself. And when the data to be processed occupies a large amount of bandwidth, a schematic diagram of scheduling nodes forwarding task data is shown in Figure 3 .

例如,当需要处理的数据无需占据大量带宽,而调度节点传输能力充足时,调度节点作任务分配时,其过程为:调度节点从源服务器获取任务相关信息以及数据本身。当需要将数据同步工作分配给其它中转节点时,发送消息将数据转发给其它中转节点,此时无需其它中转节点与源服务器建立连接。且当需要处理的数据无需占据大量带宽时,调度节点作任务数据转发的示意图,如图4所示。For example, when the data to be processed does not need to occupy a large amount of bandwidth and the transmission capacity of the scheduling node is sufficient, when the scheduling node allocates tasks, the process is: the scheduling node obtains task-related information and the data itself from the source server. When the data synchronization work needs to be assigned to other transit nodes, a message is sent to forward the data to other transit nodes, and there is no need for other transit nodes to establish a connection with the source server at this time. And when the data to be processed does not need to occupy a large amount of bandwidth, the schematic diagram of the scheduling node forwarding task data is shown in Figure 4.

综上所述,可以根据同步的数据类型,设置两种部署方式,当数据占据大量带宽时,调度节点作任务指派,当数据不占据大量带宽时,调度节点作实际的任务数据分发。To sum up, two deployment methods can be set according to the type of data to be synchronized. When the data occupies a large amount of bandwidth, the scheduling node assigns tasks. When the data does not occupy a large amount of bandwidth, the scheduling node distributes the actual task data.

为了快速准确的得到处理后的第一数据,在本申请实施例提供的数据的同步方法中,还可以通过以下步骤得到处理后的第一数据:判断多个第一中转节点中的第五中转节点是否处于空闲状态;若多个第一中转节点中的第五中转节点处于空闲状态,则将多个目标数据中的第一数据分配给第五中转节点,以使第五中转节点对第一数据进行处理,得到处理后的第一数据,并将处理后的第一数据同步至目的服务器;若多个第一中转节点中的第五中转节点不处于空闲状态,则判断多个第一中转节点中的第六中转节点是否处于空闲状态;若多个第一中转节点中的第六中转节点处于空闲状态,则将多个目标数据中的第一数据分配给第六中转节点,以使第六中转节点对第一数据进行处理,得到处理后的第一数据,并将处理后的第一数据同步至目的服务器。In order to quickly and accurately obtain the processed first data, in the data synchronization method provided in the embodiment of the present application, the processed first data may also be obtained through the following steps: determine the fifth transit among multiple first transit nodes Whether the node is in an idle state; if the fifth transit node in a plurality of first transit nodes is in an idle state, then the first data in the plurality of target data will be assigned to the fifth transit node, so that the fifth transit node is to the first transit node The data is processed to obtain the processed first data, and the processed first data is synchronized to the destination server; if the fifth transit node among the multiple first transit nodes is not in an idle state, then it is judged that the multiple first transit nodes Whether the sixth transit node in the node is in an idle state; if the sixth transit node in a plurality of first transit nodes is in an idle state, the first data in the plurality of target data is allocated to the sixth transit node, so that the sixth transit node The six transit nodes process the first data, obtain the processed first data, and synchronize the processed first data to the destination server.

例如,系统初始运行时,采用相对简单的轮询负载均衡方法,其过程如下:调度节点从各个源服务器获取任务,每次遍历其它中转节点,将固定量的任务分配给各个中转节点。分配前查询目标中转节点是否空闲,若空闲则将任务分配给该中转节点,若不空闲则查询下一个中转节点。For example, when the system is initially running, a relatively simple round-robin load balancing method is adopted. The process is as follows: the scheduling node obtains tasks from each source server, traverses other transit nodes each time, and assigns a fixed amount of tasks to each transit node. Before allocation, query whether the target transit node is free. If it is free, assign the task to the transit node. If it is not free, query the next transit node.

通过上述的方案,初始时调度节点可以按照轮询负载均衡法,快速的将待同步的数据分配给每个源服务器进行处理。Through the above-mentioned solution, the initial scheduling node can quickly distribute the data to be synchronized to each source server for processing according to the round-robin load balancing method.

图5是根据本申请实施例提供的数据的同步方法的流程图一,如图5所示,在本申请实施例提供的数据的同步方法中,通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点包括:Fig. 5 is a flow chart 1 of the data synchronization method provided according to the embodiment of the present application. As shown in Fig. 5, in the data synchronization method provided in the embodiment of the present application, according to the number of multiple target data through the second transit node and the efficiency of data processing by each first transit node, distributing each target data to each first transit node includes:

步骤S501,依据多个目标数据的数量和每个第一中转节点处理数据的效率,计算得到分配给每个第一中转节点的数据量;Step S501, calculating the amount of data allocated to each first transfer node according to the quantity of multiple target data and the data processing efficiency of each first transfer node;

步骤S502,基于分配给每个第一中转节点的数据量,将每个目标数据分配给每个第一中转节点。Step S502, based on the amount of data allocated to each first transit node, assign each target data to each first transit node.

例如,在进行指标监测时,可以先计算空闲时间,具体为,对于任一个中转节点,每间隔一段时间接受调度节点分配任务。由中转节点接受调度节点分配的任务,接受任务后进行处理,处理完毕后等待下一次任务的到来,期间调度节点可能会多次询问该节点是否空闲,因为当前任务未处理完,调度节点不会为其分配新的任务。现假定某次接受任务的时间为t1,本次任务处理完毕的时间为t2,下次接受任务的时间为t3。t2介于t1与t3之间,在t1到t3时间内,其空闲时间Tidle=t3-t2。For example, when performing index monitoring, the idle time can be calculated first, specifically, for any transit node, accept the task assigned by the scheduling node at intervals. The transfer node accepts the task assigned by the scheduling node, processes it after accepting the task, and waits for the next task to arrive after processing. During this period, the scheduling node may ask whether the node is idle multiple times, because the current task has not been processed, and the scheduling node will not Assign it a new task. Now assume that the time to accept a task is t1, the time when this task is completed is t2, and the time to accept the task next time is t3. t2 is between t1 and t3, and during the time from t1 to t3, the idle time Tidle=t3-t2.

然后计算平均处理率,且设定μ为中转节点单位时间处理的数据量,即平均处理率。并且,不同类型的数据通常采用不同的计量单位,例如,本申请实施例通过中转节点处理源服务器日志时,可以将日志条数作为计量单位,其计算公式为:Then calculate the average processing rate, and set μ to be the amount of data processed by the transit node per unit time, that is, the average processing rate. In addition, different types of data usually use different units of measurement. For example, when processing source server logs through a transfer node in this embodiment of the application, the number of log entries can be used as the unit of measurement. The calculation formula is:

Figure BDA0003957658110000121
Figure BDA0003957658110000121

其中,p为统计时间内该中转节点处理的数据量总和,Tidle为统计时间内该中转节点空闲时间总和(即实际不处理数据的时间段),T为统计时间。Among them, p is the total amount of data processed by the transit node within the statistical time, Tidle is the total idle time of the transit node within the statistical time (that is, the time period when the data is not actually processed), and T is the statistical time.

例如,调度节点从各个源服务器获取任务,以μ作为权值加权分配任务。假定调度节点一次获取各个源服务器的n条数据,各个处理节点的μ值分别为μ1,μ2,...,μn-1。For example, the scheduling node obtains tasks from each source server, and uses μ as the weight to assign tasks weightedly. Assume that the scheduling node obtains n pieces of data from each source server at a time, and the μ values of each processing node are μ1, μ2, ..., μn-1.

则分配给中转节点k的数据量为:Then the amount of data allocated to transit node k is:

Figure BDA0003957658110000122
Figure BDA0003957658110000122

然后,调度节点可以根据计算得到的分配给每个数据处理中转节点的数据量,将待同步至目的服务器的数据分配给每个数据处理中转节点。Then, the scheduling node can allocate the data to be synchronized to the destination server to each data processing intermediate node according to the calculated data volume allocated to each data processing intermediate node.

综上所述,基于统计指标进行动态负载均衡,能够根据节点负载能力分摊同步任务,尽可能降低各个节点的负载。To sum up, dynamic load balancing based on statistical indicators can distribute synchronization tasks according to the load capacity of nodes and reduce the load of each node as much as possible.

为了快速准确的将多个目标数据同步至目的服务器,在本申请实施例提供的数据的同步方法中,还可以通过以下步骤将多个目标数据同步至目的服务器:获取每个源服务器在单位时间内待同步至目的服务器的数据量;依据每个源服务器在单位时间内待同步至目的服务器的数据量,计算得到每个第一中转节点的平均排队长度,其中,平均排队长度用于表示在第一时间段内多个目标数据的堆积情况;确定每个第一中转节点的实时排队长度,其中,实时排队长度用于表示在第二时间段内每个第一中转节点的负载压力情况,第二时间段的长度小于第一时间段的长度;基于每个第一中转节点的平均排队长度和实时排队长度,向目标对象发送提醒信息,其中,提醒信息用于提醒目标对象调整将多个目标数据同步至目的服务器的策略。In order to quickly and accurately synchronize multiple target data to the destination server, in the data synchronization method provided by the embodiment of the present application, multiple target data can also be synchronized to the target server through the following steps: Obtain each source server at a unit time The amount of data to be synchronized to the destination server within; according to the amount of data to be synchronized to the destination server by each source server per unit time, the average queue length of each first transit node is calculated, wherein the average queue length is used to represent the The accumulation of a plurality of target data in the first time period; determine the real-time queue length of each first transit node, wherein the real-time queue length is used to represent the load pressure situation of each first transit node in the second time period, The length of the second time period is less than the length of the first time period; based on the average queuing length and real-time queuing length of each first transit node, a reminder message is sent to the target object, wherein the reminder message is used to remind the target object to adjust multiple The strategy for synchronizing target data to the target server.

例如,调度节点可以记录如下指标:λ,为所有源服务器单位时间需要同步的数据量,即平均到达率,其计量单位与μ相同。λ的计算公式为:For example, the scheduling node can record the following indicators: λ, the amount of data that needs to be synchronized per unit time for all source servers, that is, the average arrival rate, and its measurement unit is the same as μ. The calculation formula of λ is:

Figure BDA0003957658110000123
Figure BDA0003957658110000123

其中,T为统计时间,q为统计时间内所有源服务器所需要同步的数据量总和。Among them, T is the statistical time, and q is the sum of data volumes that need to be synchronized by all source servers within the statistical time.

然后,调度节点可以关注当前负载情况是否过重,计算相关指标并提供给用户。其计算指标包括实时排队长度L1和平均排队长度L2,实时排队长度L1是调度节点记录的当前未能完成分配的数据量,实时排队长度反映了当前短时间内中转节点负载压力情况。Then, the scheduling node can pay attention to whether the current load situation is too heavy, calculate relevant indicators and provide them to users. Its calculation indicators include the real-time queue length L1 and the average queue length L2. The real-time queue length L1 is the amount of data recorded by the scheduling node that cannot be allocated at present, and the real-time queue length reflects the current load pressure of the transit node in a short period of time.

平均排队长度L2,反映较长时间里的数据堆积情况,反映了中转节点设置是否合理,若该值较大,建议增加中转节点。其计算公式如下:The average queuing length L2 reflects the accumulation of data over a long period of time, and reflects whether the setting of transit nodes is reasonable. If the value is large, it is recommended to add transit nodes. Its calculation formula is as follows:

Figure BDA0003957658110000131
Figure BDA0003957658110000131

式子中,λ:所有源服务器单位时间需要同步的数据量,μ:中转节点单位时间处理的数据量总和,即

Figure BDA0003957658110000132
In the formula, λ: the amount of data that needs to be synchronized per unit time of all source servers, μ: the sum of the amount of data processed by the transit node per unit time, that is
Figure BDA0003957658110000132

通过上述的方案,在将源服务器中的数据同步至目的服务器时,可以及时的提醒用户对数据同步的方法进行调整,从而提升数据同步的稳定性和高效性。Through the above solution, when the data in the source server is synchronized to the destination server, the user can be promptly reminded to adjust the data synchronization method, thereby improving the stability and efficiency of data synchronization.

为了快速准确的对中转节点进行故障处理,在本申请实施例提供的数据的同步方法中,还可以通过以下步骤对中转节点进行故障处理:判断第二中转节点是否发生故障;若第二中转节点发生故障,则从多个第一中转节点中确定第四中转节点,其中,第四中转节点用于代替第二中转节点调度多个第一中转节点中除第四中转节点之外的中转节点。In order to quickly and accurately troubleshoot the transit node, in the data synchronization method provided in the embodiment of the present application, the transit node can also be troubleshooted through the following steps: determine whether the second transit node fails; if the second transit node When a failure occurs, a fourth transit node is determined from the plurality of first transit nodes, wherein the fourth transit node is used to replace the second transit node to schedule transit nodes other than the fourth transit node among the plurality of first transit nodes.

例如,本申请实施例所设计的装置除了可以根据排队模型实现动态负载均衡之外,还可以具备故障顶替功能。For example, in addition to realizing dynamic load balancing according to the queuing model, the device designed in the embodiment of the present application may also have a fault replacement function.

即当装置中的任一中转节点发生故障,该装置能够实现迅速的故障顶替。That is, when any transit node in the device fails, the device can quickly replace the fault.

若当前调度节点发生故障时,装置执行如下过程:If the current scheduling node fails, the device performs the following process:

(1)按照编号顺序选举新的调度节点,例如若编号为1的调度节点故障,则编号为2的节点为新的调度节点,若编号为2的调度节点故障,则编号为3的节点为新的调度节点;(1) Elect a new scheduling node according to the order of numbers. For example, if the scheduling node numbered 1 fails, the node numbered 2 will be the new scheduling node; if the scheduling node numbered 2 fails, the node numbered 3 will be new scheduling node;

(2)重新执行初始化部署过程,即重新部署数据同步装置,采用新的中转节点作为调度节点;(2) Re-execute the initial deployment process, that is, redeploy the data synchronization device, and adopt a new transit node as a scheduling node;

(3)重新执行指标监测过程,即初始化完毕后,系统运行并开始观测,每个处理节点记录μ,为中转节点单位时间处理的数据量,即平均处理率,并且,调度节点记录λ,为所有源服务器单位时间需要同步的数据量,即平均到达率;(3) Re-execute the indicator monitoring process, that is, after the initialization is completed, the system runs and starts to observe, and each processing node records μ, which is the amount of data processed by the transit node per unit time, that is, the average processing rate, and the scheduling node records λ, which is The amount of data that all source servers need to synchronize per unit time, that is, the average arrival rate;

(4)重新执行动态调整过程,即调度节点根据指标监测过程中监测到的指标变化,对分配给每个源服务器的数据进行动态调整。(4) Re-execute the dynamic adjustment process, that is, the scheduling node dynamically adjusts the data allocated to each source server according to the changes in the indicators monitored during the indicator monitoring process.

综上所述,调度节点与统计节点结构完全相同,可以相互替代,二者任一发生故障,都可以进行快速顶替。To sum up, the scheduling node and the statistical node have the same structure and can replace each other. If either of them fails, they can be quickly replaced.

为了快速准确的对中转节点进行故障处理,在本申请实施例提供的数据的同步方法中,还可以通过以下步骤对中转节点进行故障处理:判断多个第一中转节点中是否存在故障节点;若多个第一中转节点中存在故障节点,则从多个第一中转节点中确定除故障节点之外的多个第三中转节点,其中,第三中转节点用于代替第一中转节点对多个目标数据进行处理;获取每个第三中转节点处理数据的效率;依据多个目标数据的数量和每个第三中转节点处理数据的效率,将每个目标数据分配给每个第三中转节点。In order to quickly and accurately troubleshoot the transit node, in the data synchronization method provided in the embodiment of the present application, the transit node can also be troubleshooted through the following steps: judging whether there is a faulty node among the multiple first transit nodes; If there is a faulty node among the multiple first transit nodes, multiple third transit nodes other than the faulty node are determined from the multiple first transit nodes, wherein the third transit node is used to replace the first transit node for multiple The target data is processed; the data processing efficiency of each third transit node is obtained; and each target data is allocated to each third transit node according to the quantity of multiple target data and the data processing efficiency of each third transit node.

例如,若一个或多个处理节点发生故障时,装置执行如下过程:For example, if one or more processing nodes fail, the device performs the following process:

调度节点记录故障的处理节点,继续执行上述的指标监测过程,并将上述的动态调整过程更新如下:The scheduling node records the faulty processing node, continues to execute the above indicator monitoring process, and updates the above dynamic adjustment process as follows:

分配给某一中转节点k(中转节点为非故障节点)的数据量变更为:The amount of data allocated to a transit node k (the transit node is a non-faulty node) is changed to:

Figure BDA0003957658110000141
Figure BDA0003957658110000141

式中b表示故障节点的个数。where b represents the number of faulty nodes.

另外,无论是调度节点发生故障,还是处理节点发生故障,当发生节点故障后,实时排队长度L1和平均排队长度L2将可能增长,此时用户可以据此增加中转节点数量,将新的中转节点加入装置,新加入的装置自动作为处理节点,其加入过程为:In addition, regardless of whether the scheduling node fails or the processing node fails, when the node fails, the real-time queue length L1 and the average queue length L2 may increase. Add a device, and the newly added device will automatically act as a processing node, and the joining process is as follows:

(1)重新执行初始化部署过程,即重新部署数据同步装置,采用新的中转节点作为调度节点或者数据处理中转节点;(1) Re-execute the initial deployment process, that is, re-deploy the data synchronization device, and use a new transfer node as a scheduling node or a data processing transfer node;

(2)重新执行指标监测过程,即初始化完毕后,系统运行并开始观测,每个处理节点记录μ,为中转节点单位时间处理的数据量,即平均处理率,并且,调度节点记录λ,为所有源服务器单位时间需要同步的数据量,即平均到达率;(2) Re-execute the indicator monitoring process, that is, after the initialization is completed, the system runs and starts to observe, and each processing node records μ, which is the amount of data processed by the transit node per unit time, that is, the average processing rate, and the scheduling node records λ, which is The amount of data that all source servers need to synchronize per unit time, that is, the average arrival rate;

(3)重新执行动态调整过程,即调度节点根据指标监测过程中监测到的指标变化,对分配给每个源服务器的数据进行动态调整,且上述公式中的n值将包含新加入的中转节点。(3) Re-execute the dynamic adjustment process, that is, the scheduling node dynamically adjusts the data allocated to each source server according to the changes in the indicators monitored during the indicator monitoring process, and the n value in the above formula will include the newly added transit node .

综上所述,调度节点与统计节点可以相互替代,二者任一发生故障,都可以进行快速顶替。To sum up, the scheduling node and the statistical node can replace each other, and if either of them fails, it can be quickly replaced.

例如,图6是根据本申请实施例提供的可选的数据的同步方法的流程图,如图6所示,可选的数据的同步方法包括如下步骤:For example, FIG. 6 is a flowchart of an optional data synchronization method provided according to an embodiment of the present application. As shown in FIG. 6, the optional data synchronization method includes the following steps:

1.部署装置1. Deploy the device

本申请实施例做作如下部署,其中目的服务器的数量可以为多个,本申请实施例方案不关注目的服务器与各个中转节点的绑定关系,因此将目的服务器视为一个。The embodiment of the present application is assumed to be deployed as follows, where the number of destination servers may be multiple, and the solution of the embodiment of the present application does not pay attention to the binding relationship between the destination server and each transit node, so the destination server is regarded as one.

假定存在m个源服务器,n个中转节点,中转节点从源服务器同步数据,经过处理,并发送给目的服务器。Assume that there are m source servers and n transit nodes, and the transit nodes synchronize data from the source server, process it, and send it to the destination server.

所有中转节点中,将其中一个中转节点视作调度节点,调度节点负责所有中转节点的调度安排,其它节点负责数据处理,也称作数据处理节点。Among all the transit nodes, one of the transit nodes is regarded as a scheduling node, and the scheduling node is responsible for the scheduling of all transit nodes, and the other nodes are responsible for data processing, also known as data processing nodes.

对于任何一个中转节点,其内部结构都由网络模块和多进程的数据处理模块构成,前者负责数据的收发,后者负责数据的处理。调度节点与数据处理节点没有区别,只是在实际运行时被选举出来,用于调度其它节点,如有必要,任何一个中转节点都可以作为调度节点。For any transit node, its internal structure is composed of a network module and a multi-process data processing module. The former is responsible for sending and receiving data, and the latter is responsible for data processing. There is no difference between a scheduling node and a data processing node, but it is elected during actual operation to schedule other nodes. If necessary, any transit node can be used as a scheduling node.

并且,按照加入系统的时间,给中转节点自动编号,将编号为1的中转节点自动选举为调度节点,调度节点负责节点的调度和任务的分配,不负责数据处理。Moreover, according to the time of joining the system, the transfer nodes are automatically numbered, and the transfer node numbered 1 is automatically elected as a scheduling node. The scheduling node is responsible for node scheduling and task assignment, not data processing.

当需要处理的数据占据大量带宽,而调度节点传输能力有限时,调度节点作任务分配时,其过程为:调度节点从源服务器获取任务相关信息,如数据的编号等,不实际同步数据。当需要将数据同步工作分配给其它中转节点时,发送消息告知其它中转节点,任务对应的源服务器、数据的编号、数量等信息,由中转节点自行从源服务器获取数据。When the data to be processed occupies a large amount of bandwidth and the transmission capacity of the scheduling node is limited, when the scheduling node allocates tasks, the process is as follows: the scheduling node obtains task-related information from the source server, such as the serial number of the data, without actually synchronizing the data. When the data synchronization work needs to be assigned to other transit nodes, a message is sent to inform other transit nodes of the source server corresponding to the task, the data number, quantity and other information, and the transit node obtains the data from the source server by itself.

当需要处理的数据无需占据大量带宽,而调度节点传输能力充足时,调度节点作任务分配时,其过程为:调度节点从源服务器获取任务相关信息以及数据本身。当需要将数据同步工作分配给其它中转节点时,发送消息将数据转发给其它中转节点,此时无需其它中转节点与源服务器建立连接。When the data to be processed does not need to occupy a large amount of bandwidth and the transmission capacity of the scheduling node is sufficient, when the scheduling node allocates tasks, the process is as follows: the scheduling node obtains task-related information and the data itself from the source server. When the data synchronization work needs to be assigned to other transit nodes, a message is sent to forward the data to other transit nodes, and there is no need for other transit nodes to establish a connection with the source server at this time.

系统初始运行时,采用相对简单的轮询负载均衡方法,其过程如下:调度节点从各个源服务器获取任务,每次遍历其它中转节点,将固定量的任务分配给各个中转节点。分配前查询目标中转节点是否空闲,若空闲则将任务分配给该中转节点,若不空闲则查询下一个中转节点。When the system is initially running, a relatively simple round-robin load balancing method is adopted. The process is as follows: the scheduling node obtains tasks from each source server, traverses other transit nodes each time, and assigns a fixed amount of tasks to each transit node. Before allocation, query whether the target transit node is free. If it is free, assign the task to the transit node. If it is not free, query the next transit node.

2.指标监测2. Indicator monitoring

(1)空闲时间的计算(1) Calculation of free time

对于任一个中转节点,每间隔一段时间接受调度节点分配任务。For any transit node, it accepts tasks assigned by the scheduling node at intervals.

由中转节点接受调度节点分配的任务,接受任务后进行处理,处理完毕后等待下一次任务的到来,期间调度节点可能会多次询问该节点是否空闲,因为当前任务未处理完,调度节点不会为其分配新的任务。现假定某次接受任务的时间为t1,本次任务处理完毕的时间为t2,下次接受任务的时间为t3。t2介于t1与t3之间,在t1到t3时间内,其空闲时间Tidle=t3-t2。The transfer node accepts the task assigned by the scheduling node, processes it after accepting the task, and waits for the next task to arrive after processing. During this period, the scheduling node may ask whether the node is idle multiple times, because the current task has not been processed, and the scheduling node will not Assign new tasks to it. Now assume that the time to accept a task is t1, the time when this task is completed is t2, and the time to accept the task next time is t3. t2 is between t1 and t3, and during the time from t1 to t3, the idle time Tidle=t3-t2.

(2)平均处理率与平均到达率的计算(2) Calculation of average processing rate and average arrival rate

在第1节初始化完毕后,系统运行并开始观测,每个处理节点记录如下指标:After the initialization in Section 1 is completed, the system runs and starts to observe, and each processing node records the following indicators:

μ:中转节点单位时间处理的数据量,即平均处理率,不同类型的数据通常采用不同的计量单位,例如本申请实施例通过中转节点处理源服务器日志时,可以将日志条数作为计量单位。其计算公式为:μ: the amount of data processed by the transfer node per unit time, that is, the average processing rate. Different types of data usually use different measurement units. For example, when the source server logs are processed by the transfer node in the embodiment of this application, the number of logs can be used as the measurement unit. Its calculation formula is:

Figure BDA0003957658110000161
Figure BDA0003957658110000161

其中,p为统计时间内该中转节点处理的数据量总和,Tidle为统计时间内该中转节点空闲时间总和(即实际不处理数据的时间段),T为统计时间。Among them, p is the total amount of data processed by the transit node within the statistical time, Tidle is the total idle time of the transit node within the statistical time (that is, the time period when the data is not actually processed), and T is the statistical time.

调度节点记录如下指标:The scheduling node records the following indicators:

λ:所有源服务器单位时间需要同步的数据量,即平均到达率,其计量单位与μ相同。λ的计算公式为:λ: The amount of data that all source servers need to synchronize per unit time, that is, the average arrival rate, and its measurement unit is the same as μ. The calculation formula of λ is:

Figure BDA0003957658110000162
Figure BDA0003957658110000162

其中,T为统计时间,q为统计时间内所有源服务器所需要同步的数据量总和。Among them, T is the statistical time, and q is the sum of data volumes that need to be synchronized by all source servers within the statistical time.

3.动态调整3. Dynamic adjustment

根据检测指标进行动态调整的目的在于按照节点负载能力分配任务,减小每个节点的负担,同时减小数据平均处理时间,避免数据滞留。当系统需要处理的数据量过大,各个中转节点不足以负担时,调度节点将给出预警。The purpose of dynamic adjustment based on detection indicators is to allocate tasks according to the load capacity of nodes, reduce the burden of each node, reduce the average data processing time, and avoid data retention. When the amount of data that the system needs to process is too large for each transit node to bear, the scheduling node will give an early warning.

若一直沿用第1节的轮询法,很有可能造成某个节点长时间负载过重的情况。因此需要按照第2节的监测指标进行动态调整。If the polling method in Section 1 is used all the time, it is likely to cause a node to be overloaded for a long time. Therefore, it is necessary to make dynamic adjustments according to the monitoring indicators in Section 2.

调度节点从各个源服务器获取任务,以μ作为权值加权分配任务。假定调度节点一次获取各个源服务器的n条数据,各个处理节点的μ值分别为μ1,μ2,...,μn-1。The scheduling node obtains tasks from each source server, and assigns tasks weighted by μ as a weight. Assume that the scheduling node obtains n pieces of data from each source server at a time, and the μ values of each processing node are μ1, μ2, ..., μn-1.

则分配给中转节点k的数据量为:Then the amount of data allocated to transit node k is:

Figure BDA0003957658110000171
Figure BDA0003957658110000171

中转节点以一定周期统计μ和λ,当μ和λ经过t检验有显著差异时,更新二者的值。The transit node counts μ and λ at a certain period, and when there is a significant difference between μ and λ through the t test, the values of the two are updated.

调度节点关注当前负载情况是否过重,计算相关指标并提供给用户。其计算指标包括实时排队长度L1和平均排队长度L2,实时排队长度L1是调度节点记录的当前未能完成分配的数据量,实时排队长度反映了当前短时间内中转节点负载压力情况。The scheduling node pays attention to whether the current load is too heavy, calculates relevant indicators and provides them to users. Its calculation indicators include the real-time queue length L1 and the average queue length L2. The real-time queue length L1 is the amount of data recorded by the scheduling node that cannot be allocated at present, and the real-time queue length reflects the current load pressure of the transit node in a short period of time.

平均排队长度L2,反映较长时间里的数据堆积情况,反映了中转节点设置是否合理,若该值较大,建议增加中转节点。其计算公式如下:The average queuing length L2 reflects the accumulation of data over a long period of time, and reflects whether the setting of transit nodes is reasonable. If the value is large, it is recommended to add transit nodes. Its calculation formula is as follows:

Figure BDA0003957658110000172
Figure BDA0003957658110000172

式子中,λ:所有源服务器单位时间需要同步的数据量In the formula, λ: the amount of data that all source servers need to synchronize per unit time

μ:中转节点单位时间处理的数据量总和,即

Figure BDA0003957658110000173
μ: the total amount of data processed by the transit node per unit time, that is,
Figure BDA0003957658110000173

4.故障顶替4. Fault replacement

本申请实施例所设计的装置除了根据排队模型实现动态负载均衡之外,还具备故障顶替功能。The device designed in the embodiment of the present application not only realizes dynamic load balancing according to the queuing model, but also has a fault replacement function.

即当装置中的任一中转节点发生故障,该装置能够实现迅速的故障顶替。That is, when any transit node in the device fails, the device can quickly replace the fault.

若当前调度节点发生故障时,装置执行如下过程:If the current scheduling node fails, the device performs the following process:

(1)按照编号顺序选举新的调度节点,例如若编号为1的调度节点故障,则编号为2的节点为新的调度节点,若编号为2的调度节点故障,则编号为3的节点为新的调度节点.(1) Elect a new scheduling node according to the order of numbers. For example, if the scheduling node numbered 1 fails, the node numbered 2 will be the new scheduling node; if the scheduling node numbered 2 fails, the node numbered 3 will be The new scheduling node.

(2)重新执行第1节所述的初始化过程。(2) Re-execute the initialization process described in Section 1.

(3)重新执行第2节所述的指标监测过程。(3) Re-execute the indicator monitoring process described in Section 2.

(4)重新执行第3节所述的动态调整过程。(4) Re-execute the dynamic adjustment process described in Section 3.

若一个或多个处理节点发生故障时,装置执行如下过程:If one or more processing nodes fail, the device performs the following process:

调度节点记录故障的处理节点,继续执行第2节所述的指标监测过程,将第3节所述的动态调整过程更新如下:The scheduling node records the faulty processing node, continues to execute the indicator monitoring process described in Section 2, and updates the dynamic adjustment process described in Section 3 as follows:

分配给某一中转节点k(中转节点为非故障节点)的数据量变更为:The amount of data allocated to a transit node k (the transit node is a non-faulty node) is changed to:

Figure BDA0003957658110000181
Figure BDA0003957658110000181

式中b表示故障节点的个数。where b represents the number of faulty nodes.

无论是调度节点发生故障,还是处理节点发生故障,当发生节点故障后,实时排队长度L1和平均排队长度L2将可能增长,此时用户可以据此增加中转节点数量,将新的中转节点加入装置,新加入的装置自动作为处理节点,其加入过程为:Regardless of whether the scheduling node fails or the processing node fails, when the node fails, the real-time queue length L1 and the average queue length L2 may increase. At this time, the user can increase the number of transit nodes and add new transit nodes to the device , the newly added device automatically acts as a processing node, and its joining process is:

(1)重新执行第1节所述的初始化过程。(1) Re-execute the initialization process described in Section 1.

(2)重新执行第2节所述的指标监测过程。(2) Re-execute the indicator monitoring process described in Section 2.

(3)重新执行第3节所述的动态调整过程,上述公式中的n值将包含新加入的中转节点。(3) Re-execute the dynamic adjustment process described in Section 3, and the value of n in the above formula will include the newly added transit node.

比如,在网络安全的审计和控制中,安全厂商常常通过在内部网络中部署代理软件,从集群部署的认证服务器中同步用户,代理软件将数据转发至网络安全设备,以帮助网络安全设备完成流量的实名审计和控制。在网络安全的审计中,不同网络安全设备的日志通常各不相同,为了将日志汇总到日志平台进行统一管理,可以设置中转节点对日志进行统一处理和格式化。在小型网络中,集群部署的服务器1存储着可供用户访问的资源,服务器2用于反向代理用户请求,为用户提供资源,服务器1和服务器2之间设置中转节点,进行数据解码、分类、格式化等处理操作。For example, in the audit and control of network security, security vendors often deploy proxy software in the internal network to synchronize users from authentication servers deployed in clusters, and the proxy software forwards data to network security devices to help network security devices complete traffic real-name audit and control. In network security auditing, the logs of different network security devices are usually different. In order to aggregate the logs to the log platform for unified management, a transfer node can be set up to process and format the logs uniformly. In a small network, server 1 deployed in a cluster stores resources that can be accessed by users. Server 2 is used to reverse proxy user requests and provide resources for users. A transfer node is set between server 1 and server 2 to decode and classify data. , formatting and other processing operations.

因此,通过本申请实施例提供的方法,可以使用多个中转节点动态对接集群环境中的多个源服务器,将数据处理并转发至目的服务器。且基于中转节点的处理效率和源服务器的数据量动态调整二者的绑定关系,可以提升数据同步的高效性和稳定性。Therefore, through the method provided in the embodiment of the present application, multiple transfer nodes can be used to dynamically connect to multiple source servers in the cluster environment, and data is processed and forwarded to the destination server. And based on the processing efficiency of the transit node and the data volume of the source server, dynamically adjust the binding relationship between the two, which can improve the efficiency and stability of data synchronization.

综上,本申请实施例提供的数据的同步方法,通过第二中转节点获取多个目标数据和多个第一中转节点,其中,每个目标数据为集群环境中多个源服务器待同步至目的服务器的数据;通过第二中转节点确定多个目标数据的数量和每个第一中转节点处理数据的效率;通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器,解决了相关技术中采用集群环境中的源服务器与用于处理数据的中转节点静态绑定的方法,将集群环境中源服务器的数据同步给目的服务器,导致数据同步的效果较差的问题。通过第二中转节点依据确定的多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器,从而提升了数据同步的高效性和稳定性,进而提升了数据同步的效果。To sum up, the data synchronization method provided by the embodiment of the present application obtains multiple target data and multiple first transit nodes through the second transit node, wherein each target data is multiple source servers in the cluster environment to be synchronized to the destination The data of the server; determine the quantity of multiple target data and the efficiency of processing data by each first transit node through the second transit node; process the data according to the quantity of multiple target data and the efficiency of each first transit node through the second transit node Efficiency, assigning each target data to each first transit node, so that each first transit node processes each target data, obtains processed multiple target data, and distributes the processed multiple target data Synchronization to the destination server solves the problem of statically binding the source server in the cluster environment with the transfer node used to process data in the related technology, and synchronizes the data of the source server in the cluster environment to the destination server, resulting in a relatively low effect of data synchronization. bad question. According to the determined number of target data and the data processing efficiency of each first transit node, the second transit node assigns each target data to each first transit node, so that each first transit node The target data is processed to obtain multiple target data after processing, and the multiple target data after processing are synchronized to the destination server, thereby improving the efficiency and stability of data synchronization, and further improving the effect of data synchronization.

需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。It should be noted that the steps shown in the flowcharts of the accompanying drawings may be performed in a computer system, such as a set of computer-executable instructions, and that although a logical order is shown in the flowcharts, in some cases, The steps shown or described may be performed in an order different than here.

实施例2Example 2

本申请实施例还提供了一种数据的同步装置,需要说明的是,本申请实施例的数据的同步装置可以用于执行本申请实施例所提供的用于数据的同步方法。以下对本申请实施例提供的数据的同步装置进行介绍。The embodiment of the present application also provides a data synchronization device. It should be noted that the data synchronization device in the embodiment of the present application can be used to execute the data synchronization method provided in the embodiment of the present application. The device for synchronizing data provided by the embodiment of the present application is introduced below.

图7是根据本申请实施例的数据的同步装置的示意图。如图7所示,该装置应用在数据同步系统中,数据同步系统中至少包括:多个第一中转节点和第二中转节点,第一中转节点用于处理数据,第二中转节点用于调度多个第一中转节点,若多个第一中转节点中存在故障节点,则采用第一中转节点中除故障节点之外的中转节点代替故障节点,若第二中转节点发生故障,则采用多个第一中转节点中的任意一个中转节点代替第二中转节点,且该装置包括:第一获取模块701、第一确定模块702和第一处理模块703。Fig. 7 is a schematic diagram of a data synchronization device according to an embodiment of the present application. As shown in Figure 7, the device is applied in a data synchronization system. The data synchronization system at least includes: a plurality of first transfer nodes and second transfer nodes, the first transfer nodes are used for processing data, and the second transfer nodes are used for scheduling multiple first transit nodes, if there is a faulty node among the multiple first transit nodes, then use a transit node other than the faulty node among the first transit nodes to replace the faulty node; if the second transit node fails, then use multiple Any one of the first transit nodes replaces the second transit node, and the apparatus includes: a first acquiring module 701 , a first determining module 702 and a first processing module 703 .

具体地,第一获取模块701,用于通过第二中转节点获取多个目标数据和多个第一中转节点,其中,每个目标数据为集群环境中多个源服务器待同步至目的服务器的数据;Specifically, the first acquisition module 701 is configured to acquire a plurality of target data and a plurality of first transfer nodes through the second transfer node, wherein each target data is data to be synchronized from a plurality of source servers to a destination server in a cluster environment ;

第一确定模块702,用于通过第二中转节点确定多个目标数据的数量和每个第一中转节点处理数据的效率;The first determining module 702 is configured to determine the quantity of multiple target data and the efficiency of processing data by each first transit node through the second transit node;

第一处理模块703,用于通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器。The first processing module 703 is configured to distribute each target data to each first transit node through the second transit node according to the quantity of multiple target data and the data processing efficiency of each first transit node, so that each The first transfer node processes each target data, obtains multiple processed target data, and synchronizes the processed multiple target data to the destination server.

综上,本申请实施例提供的数据的同步装置,第一获取模块701通过第二中转节点获取多个目标数据和多个第一中转节点,其中,每个目标数据为集群环境中多个源服务器待同步至目的服务器的数据;第一确定模块702通过第二中转节点确定多个目标数据的数量和每个第一中转节点处理数据的效率;第一处理模块703通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器,解决了相关技术中采用集群环境中的源服务器与用于处理数据的中转节点静态绑定的方法,将集群环境中源服务器的数据同步给目的服务器,导致数据同步的效果较差的问题。通过第二中转节点依据确定的多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将处理后的多个目标数据同步至目的服务器,从而提升了数据同步的高效性和稳定性,进而提升了数据同步的效果。To sum up, in the data synchronization device provided by the embodiment of the present application, the first acquisition module 701 acquires multiple target data and multiple first transit nodes through the second transit node, wherein each target data is multiple sources in the cluster environment The server is to be synchronized to the data of the destination server; the first determination module 702 determines the quantity of multiple target data and the efficiency of each first transfer node to process the data through the second transfer node; the first processing module 703 uses the second transfer node according to multiple The number of target data and the efficiency of each first transfer node to process data, each target data is allocated to each first transfer node, so that each first transfer node processes each target data, and after processing multiple target data, and synchronize the processed multiple target data to the destination server, which solves the problem of statically binding the source server in the cluster environment with the transfer node for data processing in the related technology, and the The data of the source server is synchronized to the destination server, resulting in poor data synchronization effect. According to the determined number of target data and the data processing efficiency of each first transit node, the second transit node assigns each target data to each first transit node, so that each first transit node The target data is processed to obtain multiple target data after processing, and the multiple target data after processing are synchronized to the destination server, thereby improving the efficiency and stability of data synchronization, and further improving the effect of data synchronization.

可选地,在本申请实施例提供的数据的同步装置中,第一处理模块包括:第一计算单元,用于依据多个目标数据的数量和每个第一中转节点处理数据的效率,计算得到分配给每个第一中转节点的数据量;第一分配单元,用于基于分配给每个第一中转节点的数据量,将每个目标数据分配给每个第一中转节点。Optionally, in the data synchronization device provided in the embodiment of the present application, the first processing module includes: a first calculation unit, configured to calculate the The amount of data allocated to each first transit node is obtained; the first allocating unit is configured to allocate each target data to each first transit node based on the amount of data allocated to each first transit node.

可选地,在本申请实施例提供的数据的同步装置中,该装置还包括:第二确定模块,用于在通过第二中转节点确定多个目标数据的数量和每个第一中转节点处理数据的效率之前,确定多个目标中转节点,其中,多个目标中转节点中至少包括多个第一中转节点;第三确定模块,用于从多个目标中转节点中确定第二中转节点,以通过第二中转节点确定多个目标数据的数量和每个第一中转节点处理数据的效率,其中,第二中转节点为多个目标中转节点中除多个第一中转节点之外的中转节点。Optionally, in the data synchronization device provided in the embodiment of the present application, the device further includes: a second determination module, configured to determine the quantity of multiple target data through the second transit node and process each first transit node Before the data efficiency, a plurality of target transit nodes are determined, wherein the plurality of target transit nodes at least include a plurality of first transit nodes; a third determination module is configured to determine a second transit node from the plurality of target transit nodes, to The quantity of multiple target data and the data processing efficiency of each first transit node are determined by the second transit node, wherein the second transit node is a transit node among the multiple target transit nodes except the multiple first transit nodes.

可选地,在本申请实施例提供的数据的同步装置中,该装置还包括:第一判断模块,用于在通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点之后,判断多个第一中转节点中是否存在故障节点;第四确定模块,用于若多个第一中转节点中存在故障节点,则从多个第一中转节点中确定除故障节点之外的多个第三中转节点,其中,第三中转节点用于代替第一中转节点对多个目标数据进行处理;第二获取模块,用于获取每个第三中转节点处理数据的效率;第一分配模块,用于依据多个目标数据的数量和每个第三中转节点处理数据的效率,将每个目标数据分配给每个第三中转节点。Optionally, in the data synchronization device provided in the embodiment of the present application, the device further includes: a first judging module, configured to process the target data according to the quantity of multiple target data and each first transit node through the second transit node For data efficiency, after distributing each target data to each first transit node, it is judged whether there is a faulty node among the multiple first transit nodes; the fourth determination module is used for if there is a faulty node among the multiple first transit nodes , then determine a plurality of third transit nodes except the faulty node from the plurality of first transit nodes, wherein the third transit node is used to replace the first transit node to process multiple target data; the second acquisition module, Used to obtain the efficiency of data processing by each third transfer node; the first allocation module is used to allocate each target data to each third transfer node according to the quantity of multiple target data and the efficiency of processing data by each third transfer node Three transit nodes.

可选地,在本申请实施例提供的数据的同步装置中,该装置还包括:第二判断模块,用于在从多个目标中转节点中确定第二中转节点之后,判断第二中转节点是否发生故障;第五确定模块,用于若第二中转节点发生故障,则从多个第一中转节点中确定第四中转节点,其中,第四中转节点用于代替第二中转节点调度多个第一中转节点中除第四中转节点之外的中转节点。Optionally, in the data synchronization device provided in the embodiment of the present application, the device further includes: a second judging module, configured to judge whether the second transit node is A failure occurs; the fifth determination module is configured to determine a fourth transit node from multiple first transit nodes if the second transit node fails, wherein the fourth transit node is used to replace the second transit node to schedule multiple first transit nodes Transit nodes in a transit node other than the fourth transit node.

可选地,在本申请实施例提供的数据的同步装置中,第一处理模块包括:第一判断单元,用于判断多个目标数据的数据量是否大于预设数据量;第二分配单元,用于若多个目标数据的数据量大于预设数据量,则通过第二中转节点依据多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使第一中转节点从多个源服务器中获取多个目标数据,并对多个目标数据进行处理;第一获取单元,用于若多个目标数据的数据量不大于预设数据量,则通过第二中转节点从多个源服务器中获取多个目标数据;第三分配单元,用于依据多个目标数据的数量和每个第一中转节点处理数据的效率,将从多个源服务器中获取的每个目标数据分配给每个第一中转节点。Optionally, in the data synchronization device provided in the embodiment of the present application, the first processing module includes: a first judging unit, configured to judge whether the data volume of multiple target data is greater than a preset data volume; a second distributing unit, If the data volume of the multiple target data is greater than the preset data volume, the second transit node distributes each target data to each The first transfer node, so that the first transfer node obtains a plurality of target data from a plurality of source servers, and processes the plurality of target data; If the amount of data is set, a plurality of target data is obtained from multiple source servers through the second transfer node; the third distribution unit is used to process the data from the Each target data obtained from multiple source servers is assigned to each first transit node.

可选地,在本申请实施例提供的数据的同步装置中,第三确定模块包括:第二获取单元,用于获取每个目标中转节点对应的编号信息;第一确定单元,用于基于每个目标中转节点对应的编号信息,确定多个目标中转节点中编号最小的中转节点;第二确定单元,用于将多个目标中转节点中编号最小的中转节点作为第二中转节点。Optionally, in the data synchronization device provided in the embodiment of the present application, the third determining module includes: a second acquiring unit, configured to acquire number information corresponding to each target transit node; a first determining unit, configured to The number information corresponding to each target transit node is used to determine the transit node with the smallest number among the multiple target transit nodes; the second determination unit is configured to use the transit node with the smallest number among the multiple target transit nodes as the second transit node.

可选地,在本申请实施例提供的数据的同步装置中,该装置还包括:第三获取模块,用于获取每个源服务器在单位时间内待同步至目的服务器的数据量;第一计算模块,用于依据每个源服务器在单位时间内待同步至目的服务器的数据量,计算得到每个第一中转节点的平均排队长度,其中,平均排队长度用于表示在第一时间段内多个目标数据的堆积情况;第六确定模块,用于确定每个第一中转节点的实时排队长度,其中,实时排队长度用于表示在第二时间段内每个第一中转节点的负载压力情况,第二时间段的长度小于第一时间段的长度;第一发送模块,用于基于每个第一中转节点的平均排队长度和实时排队长度,向目标对象发送提醒信息,其中,提醒信息用于提醒目标对象调整将多个目标数据同步至目的服务器的策略。Optionally, in the data synchronization device provided in the embodiment of the present application, the device further includes: a third acquisition module, configured to acquire the amount of data to be synchronized to the destination server by each source server within a unit time; the first calculation The module is used to calculate the average queue length of each first transit node according to the amount of data to be synchronized to the destination server by each source server within a unit time, wherein the average queue length is used to indicate how many accumulation of target data; the sixth determination module is used to determine the real-time queue length of each first transfer node, wherein the real-time queue length is used to represent the load pressure situation of each first transfer node in the second time period , the length of the second time period is less than the length of the first time period; the first sending module is configured to send reminder information to the target object based on the average queue length and real-time queue length of each first transit node, wherein the reminder information is used To remind the target object to adjust the strategy of synchronizing multiple target data to the target server.

可选地,在本申请实施例提供的数据的同步装置中,该装置还包括:第三判断模块,用于在获取多个目标数据和多个第一中转节点之后,判断多个第一中转节点中的第五中转节点是否处于空闲状态;第二分配模块,用于若多个第一中转节点中的第五中转节点处于空闲状态,则将多个目标数据中的第一数据分配给第五中转节点,以使第五中转节点对第一数据进行处理,得到处理后的第一数据,并将处理后的第一数据同步至目的服务器;第四判断模块,用于若多个第一中转节点中的第五中转节点不处于空闲状态,则判断多个第一中转节点中的第六中转节点是否处于空闲状态;第三分配模块,用于若多个第一中转节点中的第六中转节点处于空闲状态,则将多个目标数据中的第一数据分配给第六中转节点,以使第六中转节点对第一数据进行处理,得到处理后的第一数据,并将处理后的第一数据同步至目的服务器。Optionally, in the data synchronization device provided in the embodiment of the present application, the device further includes: a third judging module, configured to judge the multiple first transit nodes after acquiring multiple target data and multiple first transit nodes Whether the fifth transit node among the nodes is in an idle state; the second distribution module is configured to allocate the first data among the plurality of target data to the first transit node if the fifth transit node among the plurality of first transit nodes is in an idle state Five transit nodes, so that the fifth transit node processes the first data, obtains the processed first data, and synchronizes the processed first data to the destination server; the fourth judging module is used for if multiple first If the fifth transit node among the transit nodes is not in an idle state, it is judged whether the sixth transit node among the plurality of first transit nodes is in an idle state; When the transit node is in an idle state, the first data among the plurality of target data is allocated to the sixth transit node, so that the sixth transit node processes the first data, obtains the processed first data, and distributes the processed The first data is synchronized to the destination server.

数据的同步装置包括处理器和存储器,上述第一获取模块701、第一确定模块702和第一处理模块703等均作为程序单元存储在存储器中,由处理器执行存储在存储器中的上述程序单元来实现相应的功能。The data synchronization device includes a processor and a memory. The above-mentioned first acquisition module 701, first determination module 702, and first processing module 703 are all stored in the memory as program units, and the above-mentioned program units stored in the memory are executed by the processor. to realize the corresponding function.

处理器中包含内核,由内核去存储器中调取相应的程序单元。内核可以设置一个或以上,通过调整内核参数来提升数据同步的效果。The processor includes a kernel, and the kernel fetches corresponding program units from the memory. One or more kernels can be set to improve the effect of data synchronization by adjusting kernel parameters.

存储器可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM),存储器包括至少一个存储芯片。Memory may include non-permanent memory in computer-readable media, random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM), memory includes at least one memory chip.

本发明实施例提供了一种计算机可读存储介质,其上存储存有程序,该程序被处理器执行时实现所述数据的同步方法。An embodiment of the present invention provides a computer-readable storage medium on which a program is stored, and when the program is executed by a processor, the data synchronization method is implemented.

本发明实施例提供了一种处理器,所述处理器用于运行程序,其中,所述程序运行时执行所述数据的同步方法。An embodiment of the present invention provides a processor, where the processor is used to run a program, wherein the method for synchronizing data is executed when the program is running.

本发明实施例提供了一种电子设备,设备包括处理器、存储器及存储在存储器上并可在处理器上运行的程序,处理器执行程序时实现以下步骤:通过第二中转节点获取多个目标数据和所述多个第一中转节点,其中,每个目标数据为集群环境中多个源服务器待同步至目的服务器的数据;通过所述第二中转节点确定所述多个目标数据的数量和每个第一中转节点处理数据的效率;通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使每个第一中转节点对每个目标数据进行处理,得到处理后的多个目标数据,并将所述处理后的多个目标数据同步至所述目的服务器。An embodiment of the present invention provides an electronic device. The device includes a processor, a memory, and a program stored on the memory and operable on the processor. When the processor executes the program, the following steps are implemented: Obtain multiple targets through the second transit node data and the plurality of first transfer nodes, wherein each target data is data to be synchronized from multiple source servers to the destination server in a cluster environment; the quantity and the number of the plurality of target data are determined by the second transfer node The data processing efficiency of each first transit node; the second transit node assigns each target data to each first transit node according to the quantity of the plurality of target data and the data processing efficiency of each first transit node A transfer node, so that each first transfer node processes each target data, obtains multiple processed target data, and synchronizes the processed multiple target data to the destination server.

处理器执行程序时还实现以下步骤:通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点包括:依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,计算得到分配给每个第一中转节点的数据量;基于分配给每个第一中转节点的数据量,将每个目标数据分配给每个第一中转节点。When the processor executes the program, the following steps are also implemented: according to the quantity of the plurality of target data and the data processing efficiency of each first transit node through the second transit node, assign each target data to each first transit node The node includes: calculating the amount of data allocated to each first transit node according to the quantity of the plurality of target data and the efficiency of processing data of each first transit node; based on the amount of data allocated to each first transit node , distributing each target data to each first transit node.

处理器执行程序时还实现以下步骤:在通过所述第二中转节点确定所述多个目标数据的数量和每个第一中转节点处理数据的效率之前,所述方法还包括:确定多个目标中转节点,其中,所述多个目标中转节点中至少包括所述多个第一中转节点;从所述多个目标中转节点中确定所述第二中转节点,以通过所述第二中转节点确定所述多个目标数据的数量和每个第一中转节点处理数据的效率,其中,所述第二中转节点为所述多个目标中转节点中除所述多个第一中转节点之外的中转节点。When the processor executes the program, the following steps are also implemented: before the quantity of the multiple target data and the efficiency of processing data by each first transit node are determined by the second transit node, the method further includes: determining multiple target data A transit node, wherein at least the plurality of first transit nodes are included in the plurality of target transit nodes; the second transit node is determined from the plurality of target transit nodes, so as to be determined by the second transit node The quantity of the plurality of target data and the data processing efficiency of each first transfer node, wherein the second transfer node is a transfer of the plurality of target transfer nodes except the plurality of first transfer nodes node.

处理器执行程序时还实现以下步骤:在通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点之后,所述方法还包括:判断所述多个第一中转节点中是否存在故障节点;若所述多个第一中转节点中存在故障节点,则从所述多个第一中转节点中确定除故障节点之外的多个第三中转节点,其中,所述第三中转节点用于代替所述第一中转节点对所述多个目标数据进行处理;获取每个第三中转节点处理数据的效率;依据所述多个目标数据的数量和每个第三中转节点处理数据的效率,将每个目标数据分配给每个第三中转节点。When the processor executes the program, the following steps are also implemented: according to the quantity of the plurality of target data and the data processing efficiency of each first transit node through the second transit node, assign each target data to each first transit node After the transfer node, the method further includes: judging whether there is a fault node among the plurality of first transfer nodes; if there is a fault node among the plurality of first transfer nodes, selecting the Determining a plurality of third transit nodes other than the faulty node, wherein the third transit nodes are used to replace the first transit nodes to process the plurality of target data; acquiring each third transit node to process data efficiency; assigning each target data to each third transfer node according to the quantity of the plurality of target data and the data processing efficiency of each third transfer node.

处理器执行程序时还实现以下步骤:在从所述多个目标中转节点中确定所述第二中转节点之后,所述方法还包括:判断所述第二中转节点是否发生故障;若所述第二中转节点发生故障,则从所述多个第一中转节点中确定第四中转节点,其中,所述第四中转节点用于代替所述第二中转节点调度所述多个第一中转节点中除所述第四中转节点之外的中转节点。When the processor executes the program, the following steps are further implemented: after determining the second transit node from the plurality of target transit nodes, the method further includes: judging whether the second transit node fails; if the second transit node If the second transit node fails, then determine a fourth transit node from the plurality of first transit nodes, where the fourth transit node is used to replace the second transit node to schedule among the plurality of first transit nodes A transit node other than the fourth transit node.

处理器执行程序时还实现以下步骤:通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点包括:判断所述多个目标数据的数据量是否大于预设数据量;若所述多个目标数据的数据量大于所述预设数据量,则通过所述第二中转节点依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将每个目标数据分配给每个第一中转节点,以使所述第一中转节点从所述多个源服务器中获取所述多个目标数据,并对所述多个目标数据进行处理;若所述多个目标数据的数据量不大于所述预设数据量,则通过所述第二中转节点从所述多个源服务器中获取所述多个目标数据;依据所述多个目标数据的数量和每个第一中转节点处理数据的效率,将从所述多个源服务器中获取的每个目标数据分配给每个第一中转节点。When the processor executes the program, the following steps are also implemented: according to the quantity of the plurality of target data and the data processing efficiency of each first transit node through the second transit node, assign each target data to each first transit node The node includes: judging whether the data volume of the plurality of target data is greater than the preset data volume; if the data volume of the multiple target data is greater than the preset data volume, then through the second transit node according to the multiple the number of target data and the data processing efficiency of each first transfer node, assign each target data to each first transfer node, so that the first transfer node obtains the described first transfer node from the plurality of source servers a plurality of target data, and process the plurality of target data; if the data volume of the multiple target data is not greater than the preset data volume, then from the multiple source servers through the second transit node Acquiring the plurality of target data; according to the quantity of the plurality of target data and the data processing efficiency of each first transit node, assign each target data acquired from the plurality of source servers to each first transfer node A transit node.

处理器执行程序时还实现以下步骤:从所述多个目标中转节点中确定所述第二中转节点包括:获取每个目标中转节点对应的编号信息;基于每个目标中转节点对应的编号信息,确定所述多个目标中转节点中编号最小的中转节点;将所述多个目标中转节点中编号最小的中转节点作为所述第二中转节点。When the processor executes the program, the following steps are also implemented: determining the second transit node from the plurality of target transit nodes includes: obtaining number information corresponding to each target transit node; based on the number information corresponding to each target transit node, Determine the transit node with the smallest number among the multiple target transit nodes; use the transit node with the smallest number among the multiple target transit nodes as the second transit node.

处理器执行程序时还实现以下步骤:所述方法还包括:获取每个源服务器在单位时间内待同步至目的服务器的数据量;依据每个源服务器在单位时间内待同步至目的服务器的数据量,计算得到每个第一中转节点的平均排队长度,其中,所述平均排队长度用于表示在第一时间段内所述多个目标数据的堆积情况;确定每个第一中转节点的实时排队长度,其中,所述实时排队长度用于表示在第二时间段内每个第一中转节点的负载压力情况,所述第二时间段的长度小于所述第一时间段的长度;基于每个第一中转节点的平均排队长度和实时排队长度,向目标对象发送提醒信息,其中,所述提醒信息用于提醒所述目标对象调整将所述多个目标数据同步至所述目的服务器的策略。When the processor executes the program, the following steps are also implemented: the method also includes: obtaining the amount of data to be synchronized to the destination server by each source server within unit time; amount, calculate the average queuing length of each first transit node, wherein, the average queuing length is used to represent the accumulation of the plurality of target data in the first time period; determine the real-time queue length, wherein the real-time queue length is used to represent the load pressure situation of each first transit node in a second time period, the length of the second time period is less than the length of the first time period; based on each The average queuing length and real-time queuing length of a first transit node, and send reminder information to the target object, wherein the reminder information is used to remind the target object to adjust the strategy of synchronizing the multiple target data to the destination server. .

处理器执行程序时还实现以下步骤:在获取多个目标数据和多个第一中转节点之后,所述方法还包括:判断所述多个第一中转节点中的第五中转节点是否处于空闲状态;若所述多个第一中转节点中的第五中转节点处于空闲状态,则将多个目标数据中的第一数据分配给所述第五中转节点,以使所述第五中转节点对所述第一数据进行处理,得到处理后的第一数据,并将所述处理后的第一数据同步至所述目的服务器;若所述多个第一中转节点中的第五中转节点不处于空闲状态,则判断所述多个第一中转节点中的第六中转节点是否处于空闲状态;若所述多个第一中转节点中的第六中转节点处于空闲状态,则将多个目标数据中的第一数据分配给所述第六中转节点,以使所述第六中转节点对所述第一数据进行处理,得到处理后的第一数据,并将所述处理后的第一数据同步至所述目的服务器。When the processor executes the program, the following steps are also implemented: after acquiring multiple target data and multiple first transit nodes, the method further includes: judging whether the fifth transit node among the multiple first transit nodes is in an idle state ; If the fifth transit node among the plurality of first transit nodes is in an idle state, assigning the first data among the plurality of target data to the fifth transit node, so that the fifth transit node is process the first data, obtain the processed first data, and synchronize the processed first data to the destination server; if the fifth transit node among the plurality of first transit nodes is not idle state, it is judged whether the sixth transit node among the plurality of first transit nodes is in an idle state; if the sixth transit node among the plurality of first transit nodes is in an idle state, then the The first data is distributed to the sixth transit node, so that the sixth transit node processes the first data, obtains the processed first data, and synchronizes the processed first data to the The destination server.

本文中的设备可以是服务器、PC、PAD、手机等。The devices in this article can be servers, PCs, PADs, mobile phones, etc.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowcharts and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.

在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.

存储器可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。存储器是计算机可读介质的示例。Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read only memory (ROM) or flash RAM. The memory is an example of a computer readable medium.

计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.

还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes Other elements not expressly listed, or elements inherent in the process, method, commodity, or apparatus are also included. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems or computer program products. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

以上仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。The above are only examples of the present application, and are not intended to limit the present application. For those skilled in the art, various modifications and changes may occur in this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims (10)

1. A data synchronization method is applied to a data synchronization system, wherein the data synchronization system at least comprises a plurality of first transit nodes and a second transit node, the first transit nodes are used for processing data, and the second transit nodes are used for scheduling the plurality of first transit nodes; if a fault node exists in the plurality of first transit nodes, adopting transit nodes except the fault node in the first transit nodes to replace the fault node; if the second transit node fails, adopting any one of the plurality of first transit nodes to replace the second transit node; the synchronization method specifically comprises the following steps:
acquiring a plurality of target data and the plurality of first transit nodes through the second transit node, wherein each target data is data to be synchronized to a destination server by a plurality of source servers in a cluster environment;
determining, by the second transit node, the number of the plurality of target data and the efficiency of processing data by each first transit node;
and distributing each target data to each first transfer node through the second transfer node according to the number of the target data and the data processing efficiency of each first transfer node, so that each first transfer node processes each target data to obtain a plurality of processed target data, and synchronizing the plurality of processed target data to the target server.
2. The method of claim 1, wherein assigning, by the second transit node, each target data to each first transit node as a function of the number of the plurality of target data and the efficiency with which each first transit node processes data comprises:
calculating to obtain the data volume distributed to each first transfer node according to the quantity of the target data and the data processing efficiency of each first transfer node;
each target data is assigned to each first transit node based on the amount of data assigned to each first transit node.
3. The method of claim 1, wherein prior to determining, by the second transit node, the quantity of the plurality of target data and the efficiency with which each first transit node processes data, the method further comprises:
determining a plurality of target transit nodes, wherein the plurality of target transit nodes at least include the plurality of first transit nodes;
determining the second transit node from the plurality of target transit nodes to determine the amount of the plurality of target data and the efficiency of processing data by each first transit node through the second transit node, wherein the second transit node is a transit node other than the plurality of first transit nodes from the plurality of target transit nodes.
4. The method of claim 1, wherein after assigning each target data to each first transit node by the second transit node depending on the number of the plurality of target data and the efficiency with which each first transit node processes data, the method further comprises:
judging whether a fault node exists in the plurality of first transfer nodes or not;
if a fault node exists in the first transit nodes, determining a plurality of third transit nodes except the fault node from the first transit nodes, wherein the third transit nodes are used for processing the target data instead of the first transit nodes;
acquiring the data processing efficiency of each third transit node;
and distributing each target data to each third transfer node according to the quantity of the plurality of target data and the data processing efficiency of each third transfer node.
5. The method of claim 3, wherein after determining the second transit node from the plurality of target transit nodes, the method further comprises:
judging whether the second transit node has a fault;
and if the second transit node fails, determining a fourth transit node from the plurality of first transit nodes, wherein the fourth transit node is used for replacing the second transit node to schedule transit nodes except the fourth transit node in the plurality of first transit nodes.
6. The method of claim 1, wherein assigning, by the second transit node, each target data to each first transit node as a function of the number of the plurality of target data and the efficiency with which each first transit node processes data comprises:
judging whether the data volume of the target data is larger than a preset data volume or not;
if the data volume of the target data is larger than the preset data volume, distributing each target data to each first transfer node through the second transfer node according to the number of the target data and the data processing efficiency of each first transfer node, so that the first transfer node obtains the target data from the source servers and processes the target data;
if the data volume of the target data is not larger than the preset data volume, obtaining the target data from the source servers through the second transit node;
and distributing each target data acquired from the plurality of source servers to each first transfer node according to the quantity of the plurality of target data and the efficiency of processing data by each first transfer node.
7. The method of claim 3, wherein determining the second transit node from the plurality of target transit nodes comprises:
acquiring the number information corresponding to each target transfer node;
determining a transfer node with the minimum number in the plurality of target transfer nodes based on the number information corresponding to each target transfer node;
and taking the transfer node with the minimum number in the target transfer nodes as the second transfer node.
8. A data synchronization apparatus, wherein the apparatus is applied in a data synchronization system, and the data synchronization system at least comprises: a plurality of first transit nodes and a second transit node, the first transit nodes being configured to process data, the second transit node being configured to schedule the plurality of first transit nodes, if a failure node exists in the plurality of first transit nodes, replacing the failure node with a transit node other than the failure node in the first transit nodes, and if a failure occurs in the second transit node, replacing the second transit node with any transit node in the plurality of first transit nodes, including:
a first obtaining module, configured to obtain, by the second transit node, a plurality of target data and the plurality of first transit nodes, where each target data is data to be synchronized to a destination server by a plurality of source servers in a cluster environment;
a first determining module, configured to determine, by the second transit node, the number of the plurality of target data and an efficiency of processing data by each first transit node;
and the first processing module is used for distributing each target data to each first transfer node through the second transfer node according to the number of the target data and the data processing efficiency of each first transfer node, so that each first transfer node processes each target data to obtain a plurality of processed target data, and synchronizing the plurality of processed target data to the target server.
9. A computer-readable storage medium characterized in that the storage medium stores a program, wherein the program executes the synchronization method of data according to any one of claims 1 to 7.
10. A processor for a method of synchronizing data, the processor being configured to run a program, wherein the program is configured to perform the method of synchronizing data according to any one of claims 1 to 7 when the program is run.
CN202211466310.3A 2022-11-22 2022-11-22 Data synchronization method and device, storage medium and processor Active CN115834603B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211466310.3A CN115834603B (en) 2022-11-22 2022-11-22 Data synchronization method and device, storage medium and processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211466310.3A CN115834603B (en) 2022-11-22 2022-11-22 Data synchronization method and device, storage medium and processor

Publications (2)

Publication Number Publication Date
CN115834603A true CN115834603A (en) 2023-03-21
CN115834603B CN115834603B (en) 2025-09-23

Family

ID=85530178

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211466310.3A Active CN115834603B (en) 2022-11-22 2022-11-22 Data synchronization method and device, storage medium and processor

Country Status (1)

Country Link
CN (1) CN115834603B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109361777A (en) * 2018-12-18 2019-02-19 广东浪潮大数据研究有限公司 Synchronous method, synchronization system and the relevant apparatus of distributed type assemblies node state
CN111459642A (en) * 2020-04-08 2020-07-28 广州欢聊网络科技有限公司 Fault processing and task processing method and device in distributed system
CN114168280A (en) * 2021-11-25 2022-03-11 天津车之家软件有限公司 Task scheduling method, computing device and storage medium
CN114826892A (en) * 2022-04-28 2022-07-29 济南浪潮数据技术有限公司 Cluster node control method, device, equipment and medium
CN115134373A (en) * 2022-06-28 2022-09-30 中国工商银行股份有限公司 Data synchronization method and device, storage medium and electronic equipment
CN117076196A (en) * 2023-08-14 2023-11-17 京东科技信息技术有限公司 A management and control method and device for database disaster recovery

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109361777A (en) * 2018-12-18 2019-02-19 广东浪潮大数据研究有限公司 Synchronous method, synchronization system and the relevant apparatus of distributed type assemblies node state
CN111459642A (en) * 2020-04-08 2020-07-28 广州欢聊网络科技有限公司 Fault processing and task processing method and device in distributed system
CN114168280A (en) * 2021-11-25 2022-03-11 天津车之家软件有限公司 Task scheduling method, computing device and storage medium
CN114826892A (en) * 2022-04-28 2022-07-29 济南浪潮数据技术有限公司 Cluster node control method, device, equipment and medium
CN115134373A (en) * 2022-06-28 2022-09-30 中国工商银行股份有限公司 Data synchronization method and device, storage medium and electronic equipment
CN117076196A (en) * 2023-08-14 2023-11-17 京东科技信息技术有限公司 A management and control method and device for database disaster recovery

Also Published As

Publication number Publication date
CN115834603B (en) 2025-09-23

Similar Documents

Publication Publication Date Title
US20220329651A1 (en) Apparatus for container orchestration in geographically distributed multi-cloud environment and method using the same
CN108780386B (en) A method, device and system for data storage
US8874811B2 (en) System and method for providing a flexible buffer management interface in a distributed data grid
US20200137151A1 (en) Load balancing engine, client, distributed computing system, and load balancing method
JP4068473B2 (en) Storage device, assignment range determination method and program
TWI755417B (en) Computing task allocation method, execution method of stream computing task, control server, stream computing center server cluster, stream computing system and remote multi-active system
CN107968802B (en) Resource scheduling method and device and filtering type scheduler
EP3813335B1 (en) Service processing methods and systems based on a consortium blockchain network
EP3745678B1 (en) Storage system, and method and apparatus for allocating storage resources
JP6881575B2 (en) Resource allocation systems, management equipment, methods and programs
US20180091588A1 (en) Balancing workload across nodes in a message brokering cluster
US20180091586A1 (en) Self-healing a message brokering cluster
CN102968457B (en) Database method for switching between and system
US12386670B2 (en) On-demand clusters in container computing environment
CN109873714B (en) Cloud computing node configuration updating method and terminal equipment
AU2022457555A1 (en) Resource scheduling method, apparatus and system for elastic-search cluster
US20230089663A1 (en) Maintenance mode for storage nodes
CN120880886A (en) Cluster fault processing method and related equipment
CN113873052B (en) Domain name resolution method, device and equipment of Kubernetes cluster
CN114338670A (en) Edge cloud platform and three-level cloud control platform for internet traffic with same
CN105205160A (en) Data write-in method and device
CN118413536B (en) A resource processing method and device based on edge computing
CN115834603A (en) Data synchronization method and device, storage medium and processor
CN106021026A (en) Backup method and device
CN117880553A (en) Streaming media storage method, system, server, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20260210

Address after: 215163 No. 181 Jingrun Road, Suzhou High-tech Zone, Jiangsu Province

Patentee after: Shanshi Netcom Communication Technology Co.,Ltd.

Country or region after: China

Patentee after: BEIJING HILLSTONE NETWORKS INFORMATION TECHNOLOGY Co.,Ltd.

Address before: 215163 No. 181 Jingrun Road, Suzhou High-tech Zone, Jiangsu Province

Patentee before: Shanshi Netcom Communication Technology Co.,Ltd.

Country or region before: China