File synchronization method, device, storage medium and electronic device
By determining multi-dimensional resource utilization and weight values in a distributed storage system, calculating reasonable synchronization timing, caching files, and synchronizing them at appropriate times, the problem of mismatch between file synchronization timing and system state is solved, thereby improving system performance and user experience.
Patent Information
- Application Number
- CN202410297699.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-14
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-03-14
AI Technical Summary
In existing technologies, the timing of file synchronization in distributed storage systems does not match the system state, resulting in high resource consumption and poor user experience during peak business periods.
By determining multi-dimensional resource utilization in the target cluster, adjusting resource weight values, calculating reasonable synchronization timing, and synchronizing files to backup nodes at that timing, caching is used to reduce frequent synchronization, and weight allocation is adjusted according to business scenarios.
It achieves matching of file synchronization timing with system status, avoiding resource consumption during peak business periods, and improving system performance and user experience.
Smart Images

Figure CN118214755B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the cluster field, and in particular, to a file synchronization method and device, a storage medium, and an electronic device. BACKGROUND
[0002] With the advent of the big data era, storage systems play an important role in accessing massive amounts of data, and distributed storage is an important part of the storage system. A distributed storage system is composed of several nodes that collectively form a cluster to provide storage services externally, thus ensuring system reliability when one or more nodes fail without affecting service status.
[0003] In current distributed storage systems, the synchronization of configuration files between nodes, whether synchronous or asynchronous, directly synchronizes the files to other nodes when the files are changed.
[0004] Therefore, the related art has the problem that the timing of synchronizing files does not match the state of the system.
[0005] To address the above problems in the related art, no effective solutions have been proposed so far. SUMMARY
[0006] Embodiments of the present application provide a file synchronization method and device, a storage medium, and an electronic device to at least solve the problem that the timing of synchronizing files does not match the state of the system in the related art.
[0007] According to an embodiment of the present application, a file synchronization method is provided, including: in the case where a master node included in a target cluster changes, determining a first resource utilization rate of a target resource in multiple different dimensions of the target cluster; determining a first resource weight value of each target resource based on the first resource utilization rate; determining a target service currently executed by the master node, and a target sub-resource corresponding to the target service, wherein the target sub-resource is a resource included in the target resource, and the utilization rate of the target sub-resource is greater than that of other sub-resources when the master node executes the target service, the other sub-resources being resources included in the target resource other than the target sub-resource; correcting a first sub-resource weight value of the target sub-resource included in the first resource weight value to obtain a target resource weight value; determining a first synchronization time of synchronizing a target file of the master node based on the target resource weight value and a second sub-resource weight value of the other sub-resources included in the first resource weight value; and in the case where the first synchronization time is reached, synchronizing the target file to a backup node included in the target cluster, wherein the master node is connected to the backup node.
[0008] According to another embodiment of the present application, a file synchronization apparatus is provided, comprising: a first determining module configured to determine first resource utilization rates of target resources in different dimensions in a target cluster in a case where a master node included in the target cluster changes; a second determining module configured to determine a first resource weight value of each of the target resources based on the first resource utilization rates; a third determining module configured to determine a target service currently executed by the master node, and a target sub-resource corresponding to the target service, wherein the target sub-resource is a resource included in the target resources, and the utilization rate of the target sub-resource is greater than that of other sub-resources when the master node executes the target service, the other sub-resources being resources included in the target resources other than the target sub-resource; a correcting module configured to correct a first sub-resource weight value of the target sub-resource included in the first resource weight value to obtain a target resource weight value; a fourth determining module configured to determine a first synchronization time of synchronizing a target file of the master node based on the target resource weight value and a second sub-resource weight value of the other sub-resources included in the first resource weight value; and a synchronizing module configured to synchronize the target file to a backup node included in the target cluster in a case where the first synchronization time is reached, wherein the master node is connected to the backup node.
[0009] According to still another embodiment of the present application, a computer readable storage medium is further provided, and the computer readable storage medium stores a computer program, wherein the computer program is configured to execute the steps in any of the method embodiments when running.
[0010] According to still another embodiment of the present application, an electronic device is further provided, comprising a memory and a processor, the memory stores a computer program, and the processor is configured to execute the computer program to execute the steps in any of the method embodiments.
[0011] According to the application, in the case that the master node included in the target cluster changes, the first resource utilization rate of the target cluster in multiple different dimensions of target resources is determined; the first resource weight value of each target resource is determined based on the first resource utilization rate; the target service currently executed by the master node is determined, and the target sub-resource corresponding to the target service, the utilization rate of the target sub-resource is greater than the utilization rate of other sub-resources included in the target resource, the first sub-resource weight value of the target sub-resource is corrected to obtain the target resource weight value, the first synchronization time of the target file of the synchronization master node is determined based on the target resource weight value and the second sub-resource weight value of the other sub-resources; in the case that the first synchronization time is reached, the target file is synchronized to the backup node included in the target cluster, wherein the master node is connected with the backup node. Since the target file is synchronized to the target cluster, the first resource weight value can be determined according to the first resource utilization rate of each target resource, the target sub-resource is determined according to the target service executed by the master node, the first sub-resource weight value of the target sub-resource is corrected to obtain the target resource weight value, and the first synchronization time is determined according to the target resource weight value and the second sub-resource weight value of the other sub-resources, and the synchronization is performed when the first synchronization time is reached. When the first synchronization time is determined, the first resource utilization rate of each target resource is fully considered, so that the determined first synchronization time matches the running state of the target system, and the first sub-resource utilization rate of the target sub-resource corresponding to the target service is corrected according to the target service executed by the master node, so that the first synchronization time matches the scene demand of executing the target service. Therefore, the problem that the synchronization file time does not match the system state in the related art can be solved, and the effect that the synchronization file time matches the system state is achieved. BRIEF DESCRIPTION OF DRAWINGS
[0012] Figure 1 is a hardware structure block diagram of a server device of a file synchronization method according to an embodiment of the application;
[0013] Figure 2 is a flowchart of a file synchronization method according to an embodiment of the application;
[0014] Figure 3 is a structure schematic diagram of a target cluster according to an embodiment of the application;
[0015] Figure 4 is a flowchart of determining a first resource weight value according to a specific embodiment of the application;
[0016] Figure 5 is a flowchart of synchronizing a target file to a backup node included in a target cluster according to a specific embodiment of the application;
[0017] Figure 6 is a flowchart of caching a target file according to a specific embodiment of the application;
[0018] Figure 7 This is a schematic diagram of the cache area structure according to an embodiment of this application;
[0019] Figure 8 This is a structural block diagram of a document synchronization device according to an embodiment of this application. Detailed Implementation
[0020] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.
[0021] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0022] The methods and embodiments provided in this application can be executed on a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure block diagram of a server device for a file synchronization method according to an embodiment of this application. For example... Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The server device may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the server equipment described above. For example, the server equipment may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0023] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the file synchronization method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thus implementing the aforementioned method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to server devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0024] The transmission device 106 is configured to receive or send data via a network. The network can include a wireless network provided by a communication service provider of the server device. In an example, the transmission device 106 includes a network interface controller (NIC) configured to connect to other network devices via a base station to communicate with the Internet. In an example, the transmission device 106 can be a radio frequency (RF) module configured to communicate with the Internet via a wireless manner.
[0025] A file synchronization method is provided in the embodiment, Figure 2 A flowchart of the file synchronization method according to the embodiment is shown in FIG. 2, which includes the following steps: Figure 2
[0026] In step S202, when the master node included in the target cluster changes, the first resource utilization of the target cluster in multiple different dimensions of target resources is determined.
[0027] In step S204, the first resource weight value of each target resource is determined based on the first resource utilization.
[0028] In step S206, the target service currently executed by the master node is determined, and a target sub-resource corresponding to the target service is determined, wherein the target sub-resource is a resource included in the target resource, and the utilization rate of the target sub-resource is greater than that of other sub-resources when the master node executes the target service, and the other sub-resources are resources included in the target resource except the target sub-resource.
[0029] In step S208, the first sub-resource weight value of the target sub-resource included in the first resource weight value is corrected to obtain a target resource weight value.
[0030] In step S210, the first synchronization time of the target file of the master node is determined based on the target resource weight value and a second sub-resource weight value of the other sub-resources included in the first resource weight value.
[0031] In step S212, when the first synchronization time is reached, the target file is synchronized to a backup node included in the target cluster, wherein the master node is connected to the backup node.
[0032] In the above embodiment, the target cluster can be a cluster in a master-backup mode, such as a distributed cluster in a master-backup mode, and a structural diagram of the target cluster can be referred to FIG. 1. Figure 3 Figure 3 As shown, the target cluster can include one master node and multiple standby nodes. The master node can be the monitor node of the distributed cluster, responsible for maintaining the cluster state, i.e., the master node can be the Mon node. The target cluster can run in a target system, such as a Linux system, a Windows system, etc.
[0033] In the above embodiment, the master node can include node information, which can be classified by multiple node information to obtain target resources of multiple dimensions. The target resources can include IOPS (Input / Output Operations Per Second) data, CPU data, memory data, and network card transceiving packet data. The first resource utilization rate can include hard disk IOPS utilization rate, CUP utilization rate, MEM utilization rate, and bandwidth utilization rate, etc.
[0034] In the above embodiment, for the master-standby mode cluster, when the MON node file changes, synchronization is no longer performed immediately, but through multi-dimensional analysis, a reasonable first synchronization opportunity is calculated and then synchronization is performed. These dimensions include but are not limited to IOPS / CPU occupancy rate / MEM occupancy rate / network bandwidth. In this way, the peak period of high consumption of bottleneck resources of the device can be avoided, and the system performance can be effectively optimized. The multi-dimensional weight can be changed according to different scenes to meet multiple scenes. In order to realize intelligent analysis, a caching method is used. When the file changes, the file is cached first, and then the synchronization is performed at the right opportunity after the analysis is completed. This method also effectively reduces the response time of the operation and improves the customer experience.
[0035] In the above embodiment, the first resource weight value of each dimension can be a non-fixed weight value. The first resource weight value can change with the state of the master node, and the resources and usage of each dimension of the MON node can be analyzed to give a more reasonable weight ratio. At the same time, the first resource weight value can also be manually configured for users to manually change the weight value according to the actual situation.
[0036] In the above embodiment, the weight of each dimension is different, which can effectively adapt to different device conditions and business scenarios. For example, high IOPS weight: the data in the node is frequently accessed, and the hard disk performance is not high. At this time, the hard disk performance becomes the bottleneck of the service, and the weight of IOPS can be increased. CPU occupancy rate / MEM occupancy rate: the node CPU and MEM are less or frequently calculated. At this time, the CPU and MEM performance become the bottleneck of the service, and the weight of CPU / MEM occupancy rate can be increased. Network bandwidth: the node is in a complex network environment, or the message transceiving is frequent, and network congestion often occurs. At this time, the network bandwidth becomes the bottleneck of the service, and the weight of the network bandwidth can be increased.
[0037] In the above embodiments, the target service can include a database read-write operation service, a service data access service, and the like. Different target services can correspond to different application scenarios, for example, a server scenario, in which a customer pays great attention to the computing capability of a device, and most service scenarios are highly dependent on the computing capability of a CPU. Therefore, when presetting the weight of each index, the weight value of the CPU is high. For a storage scenario, the customer pays more attention to the hard disk and bandwidth capability of the device, so that data can be accessed faster. Therefore, in the weight of each index, the weight value of the hard disk IOPS and bandwidth is high. That is, the target service to be executed by the master node can be determined. If the service has a higher requirement for computing capability, the corresponding target sub-resource is the CPU, the first sub-resource weight value of the CPU is corrected to obtain the target resource weight value. When the target service to be executed by the master node has a higher requirement for storage capability, the corresponding target sub-resource is the hard disk IOPS and bandwidth, and the first sub-resource weight value of the hard disk IOPS and bandwidth is corrected to obtain the target resource weight value. For different target services, different first synchronization times can be calculated to better adapt to multiple scenarios.
[0038] In the above embodiments, the first synchronization opportunity can be determined according to the target resource weight value and the second sub-resource weight value. The first synchronization opportunity can be a time length, that is, the synchronization operation is performed after a time length.
[0039] According to the application, in the case that the master node included in the target cluster changes, the first resource utilization of the target cluster in multiple different dimensions of target resources is determined; the first resource weight value of each target resource is determined based on the first resource utilization; the target service currently executed by the master node is determined, and the target sub-resource corresponding to the target service, the utilization rate of the target sub-resource being greater than that of other sub-resources included in the target resources when the master node executes the target service, the first sub-resource weight value of the target sub-resource is corrected to obtain the target resource weight value, the first synchronization time of the target file of the synchronization master node is determined based on the target resource weight value and the second sub-resource weight value of the other sub-resources; in the case that the first synchronization time is reached, the target file is synchronized to the backup node included in the target cluster, wherein the master node is connected with the backup node. Since the target file is synchronized to the target cluster, the first resource weight value can be determined according to the first resource utilization of each target resource, the target sub-resource is determined according to the target service executed by the master node, the first sub-resource weight value of the target sub-resource is corrected to obtain the target resource weight value, and the first synchronization time is determined according to the target resource weight value and the second sub-resource weight value of the other sub-resources, and the synchronization is performed when the first synchronization time is reached. In the determination of the first synchronization time, the first resource utilization of each target resource is fully considered, so that the determined first synchronization time matches the running state of the target system, and the first sub-resource utilization of the target sub-resource corresponding to the target service is corrected according to the target service executed by the master node, so that the first synchronization time matches the scene demand of executing the target service. Therefore, the problem that the synchronization time of the file does not match the state of the system in the related art can be solved, and the effect that the synchronization time of the file matches the state of the system is achieved.
[0040] The execution subject of the above steps can be a master node, but is not limited thereto.
[0041] In an example embodiment, determining the first resource utilization of the target cluster in multiple different dimensions of target resources includes: for each target resource, performing the following operations to determine the first resource utilization of the target resource: determining the target used resource number of the target resource and the total resource number; and determining the first resource utilization based on the first ratio of the used resource number to the total resource number. In this embodiment, the resource utilization of the target resource in each dimension can be represented as the used resource number / the total resource number. When the first resource utilization includes IOPS utilization, CPU utilization, MEM utilization, and bandwidth utilization, it can be represented as
[0042] Rate iops =Used iops / Total iops
[0043] Rate cpu =Used cpu / Total cpu
[0044] Rate mem =Used mem / Total mem
[0045] Rate bandwidth =Used bandwdth / Total bandwidth .
[0046] In the above embodiment, each resource utilization rate takes a ratio value, and the use of the resource is more fully reflected in this process.
[0047] In an example embodiment, the determining the target used resource number of the target resource comprises: collecting used resource numbers of the target resource at different time points in a predetermined time period to obtain a plurality of used resource numbers; and determining an average value of the plurality of used resource numbers as the target used resource number. In this embodiment, when the target resource includes IOPS data, CPU data, memory data, and network card transceiving packet data, the hard disk IOPS data in a period of time can be collected, the sampling points are not less than 10 times, and the average value is taken, the CPU utilization rate and the MEM utilization rate in a period of time are collected, the sampling points are not less than 10 times, and the average value is taken, the network card transceiving packet data in a period of time is collected, the sampling points are not less than 10 times, and the average value is taken, all the above data are summarized and analyzed, the business scenarios are analyzed according to the data, the resource proportion used by different business scenarios is different, in addition, the actual situation of the node also needs to be considered, which analyzes which dimension of resource is closer to exhaustion under the current business scenario. The first resource weight value of each dimension of the target resource is calculated according to the formula. The average value can include an arithmetic average value and a weighted average value. When the average value is the arithmetic average value, the sum value of the plurality of used resource numbers and the number of used resource numbers can be determined, and the ratio of the sum value to the number is determined as the target used resource number. When the average value is the weighted average value, the collection time point of each used resource number can be determined, the time difference between the collection time period and the current time point is determined, and the weight of the used resource number is allocated according to the time difference. The time difference and the weight are negatively correlated. That is, the smaller the time difference, the greater the weight. The target used resource number is determined by performing weighted average on each collected used resource number and the corresponding weight.
[0048] In the above embodiment, the used resource data is sampled in a period of time, and the average value of the sampling is determined as the target used resource number, which takes into account the system performance in the predetermined time period and improves the accuracy of determining the target used resource number.
[0049] In one example embodiment, the determining the first resource utilization based on the first ratio of the used resource number to the total resource number comprises: determining a target difference of the first ratio and a predetermined utilization threshold; in a case that the target difference is greater than a predetermined threshold, amplifying the first ratio to obtain a second ratio; determining the second ratio as the first resource utilization; in a case that the target difference is less than or equal to the predetermined threshold, determining the first ratio as the first resource utilization. In this embodiment, in order to more fully reflect the resource usage, the first ratio is appropriately offset according to the recommended specifications of the distributed storage device, i.e. the predetermined utilization threshold: if the first ratio of a target resource is significantly lower than the predetermined utilization threshold, the first ratio of the target resource is increased to obtain a second ratio. The second ratio thus obtained can more reflect the actual status of the resource of the current node.
[0050] In the above embodiment, the amplifying the first ratio to obtain a second ratio can comprise multiplying the first ratio by a first coefficient greater than 1 to obtain the second ratio. It can also comprise increasing the first ratio by a fixed value to obtain the second ratio. It can also comprise increasing the first ratio by a dynamic value to obtain the second ratio. The dynamic value can be determined according to the size of the target difference, and the dynamic value is positively correlated with the target difference, i.e. the greater the target difference, the greater the dynamic value.
[0051] In the above embodiment, by setting the predetermined utilization threshold, the target resource that is significantly lower than the predetermined utilization threshold can be appropriately offset, and the actual status of the resource of the current node can be more fully reflected.
[0052] In one example embodiment, the determining the first resource utilization based on the first resource utilization comprises: determining a first sum value of all the first resource utilizations; determining the first resource weight value of each target resource as a ratio of the first resource utilization of the target resource to the first sum value. In this embodiment, when the target resource comprises IOPS data, CPU data, memory data, and network card transceiving packet data, the first resource weight value can be represented as
[0053] In the above embodiment, the weight distribution recommendation value of each dimension resource can be obtained according to the offset utilization rate ratio value of the target resource of each dimension divided by the sum of all utilization rates. After determining the first resource weight value, the first resource weight value can be displayed on the front-end interface, and a modification page for modifying the first resource weight value can be displayed on the front-end interface. The first resource weight value can be modified through the modification page. When the user does not modify the first resource weight value for more than a predetermined time, the determined first resource weight value can be determined as the final weight value. That is, the customer can adjust the weight distribution according to the actual business scenario to better meet the actual scenario.
[0054] Figure 4 is a flowchart for determining the first resource weight value according to an embodiment of the application, as shown in Figure 4 The multi-dimensional intelligent analysis can obtain the weight value of each dimension through the collection and analysis of node information (hard disk IOPS data, CPU utilization rate, MEM utilization rate, and network card transceiving packet data), based on the focus of the business and the performance bottleneck of the current node. The weight value is recommended to the customer as a recommendation value. The resource weight value can also be expanded or reduced according to different business types as follows:
[0055] (1) Collect the hard disk IOPS data for a period of time, and the sampling point is not less than 10 times, and take the average value.
[0056] (2) Collect the CPU utilization rate and MEM utilization rate for a period of time, and the sampling point is not less than 10 times, and take the average value.
[0057] (3) Collect the network card transceiving packet data for a period of time, and the sampling point is not less than 10 times, and take the average value.
[0058] (4) Summarize all the above data and analyze them. According to the focus of the data, analyze the business scenario. Different business scenarios use different resource proportions. In addition, the actual situation of the node needs to be analyzed. Under the current business scenario, which dimension of resource is closer to exhaustion.
[0059] (5) Calculate the weight value of each dimension according to the formula, and provide it to the customer as a recommendation value.
[0060] In the above embodiment, the resource consumption evaluation can be analyzed from multiple dimensions, including IOPS, CPU utilization rate, MEM utilization rate, and bandwidth. The weight distribution can be intelligently analyzed from the actual business scenario or manually configured, which can better meet the needs of the actual scenario.
[0061] In an example embodiment, determining the first synchronization timing of synchronizing the target file of the master node based on the target resource weight value and the second sub-resource weight values of the other sub-resources included in the first resource weight value comprises: determining a first product of the first resource utilization of the target sub-resource and the target resource weight value; determining a product of the other sub-resources and the second sub-resource weight values of the other sub-resources, obtaining a plurality of second products; determining a second sum value of the first product and the plurality of second products; and determining the first synchronization timing based on a third product of the second sum value and a weighting coefficient. In this embodiment, when the file needs to be synchronized due to changes, the current resource utilization of the environment is first obtained, multiplied by the respective weight ratio, which can reflect the weight of each dimension, and then summed, which represents the overall situation of the resources. The first synchronization timing can be represented as
[0062] Interval = (Rate iops* Weight iops + Rate cpu * Weight cpu + Rate em * Weight mem + Rate bandwidth * Weight bandwidth ) * π, wherein π is a weighting coefficient.
[0063] In the above embodiment, the product of the sum of the first resource utilization and the resource weight of each first resource utilization and the weighting coefficient is determined as the first synchronization timing, which can obtain a first synchronization timing that matches the state of the master node, i.e., the first synchronization timing is intelligently selected according to the actual resource consumption, effectively avoiding the peak period of business.
[0064] In an example embodiment, the determining the first synchronization timing based on the third product of the second sum value and the weighting coefficient comprises: determining the first synchronization timing as the first synchronization threshold value when the third product is less than the first synchronization threshold value; determining the first synchronization timing as the second synchronization threshold value when the third product is greater than the second synchronization threshold value, wherein the first synchronization threshold value is less than the second synchronization threshold value; determining the first synchronization timing as the third product when the third product is greater than or equal to the first synchronization threshold value and less than or equal to the second synchronization threshold value. In this embodiment, the first synchronization timing can be fixed in a reasonable range. When the Interval is lower than the minimum threshold value, i.e., the first synchronization threshold value, it can be considered that the current resource consumption is very low, and there is no need to find another timing. In this case, direct synchronization is selected. The first synchronization threshold value can be 0. When the Interval is higher than the maximum threshold value, i.e., the second synchronization threshold value, it can be considered that the current resource consumption is very high, but a too long Interval can cause synchronization abnormalities. In this case, the Interval_max is selected for direct synchronization, i.e., the second synchronization threshold value is determined as the first synchronization timing. When the third product is between the first synchronization threshold value and the second synchronization threshold value, the second product can be directly determined as the first synchronization timing.
[0065] In the above embodiment, when the resource consumption is very low, there is no need to find another timing, and direct synchronization is selected, which improves the user experience. When the current resource consumption is very high, direct synchronization is selected after the second synchronization threshold value, which effectively prevents the occurrence of synchronization abnormalities.
[0066] In an example embodiment, before determining the first resource utilization rate of the target resource in multiple different dimensions of the target cluster, the method further comprises: determining that the master node changes when it is determined that the file of the master node changes; determining that the master node changes when it is determined that the master node fails. In this embodiment, the file change of the master node can include the file change of the master node and the failure of the master node. When the file of the master node changes, it is determined that the master node changes, and the file is backed up to the standby node, thereby ensuring the reliability of the system. When the master node fails, the file of the master node is backed up to the standby node, thereby realizing that the service state is not affected when the master node fails.
[0067] In an example embodiment, the synchronizing the target file into the standby node included in the target cluster comprises: determining a second resource utilization of the master node at a time when the first synchronization timing is reached; in a case where the second resource utilization indicates that synchronization is allowed, synchronizing the target file into the standby node; in a case where the second resource utilization indicates that synchronization is prohibited, determining a second resource weight value of each target resource based on the second resource utilization, determining a second synchronization timing of synchronizing the target file based on the second resource weight value; determining a waiting time length of the target file waiting for synchronization at a time when the second synchronization timing is reached; in a case where the waiting time length is greater than a predetermined time length, synchronizing the target file into the standby node; in a case where the waiting time length is less than or equal to the predetermined time length, updating the second resource utilization to a resource utilization of the target resource at a time when the second synchronization timing is reached. In this embodiment, when the weight distribution of each resource dimension is determined, it can be actually used for file synchronization operation. When the MON node file changes and needs to be synchronized to other nodes, the actual execution synchronization time is calculated according to the current resource consumption and the configured weight distribution. The synchronization is performed after a specified time interval. In the case of reaching the first synchronization timing, the second resource utilization of the master node at the time when the first synchronization timing is reached can be determined again. In a case where the second resource utilization is greater than a set threshold, it is determined that synchronization is not allowed. In a case where the second resource utilization is less than the set threshold, it is determined that synchronization is allowed. The second resource utilization can include IPOS utilization, CPU utilization, MEN utilization and bandwidth utilization. In the case of determining that synchronization is not allowed, the second resource weight value of each second resource utilization can be determined according to the second resource utilization, and the second synchronization timing can be determined according to the second resource weight value. In the case of reaching the second synchronization timing, the waiting time length of the target file waiting for synchronization is determined. If the waiting time length is greater than the predetermined time length, forced synchronization can be performed. If the waiting time length is less than the predetermined time length, the resource utilization of the master node can be determined again, and the second resource utilization is updated to the resource utilization at the time when the second synchronization timing is reached. The second resource weight value of each second resource utilization is determined according to the second resource utilization, and the second synchronization timing is determined according to the second resource weight value.
[0068] In the above embodiment, when a large number of database read and write operations occur instantaneously on the master node, the CPU consumption increases sharply, that is, in the case of high CPU occupation, when the configuration file synchronization logic is encountered, the first synchronization opportunity n can be calculated, that is, synchronization needs to be performed after n seconds, sleep for n seconds, and wait for the opportunity. During the waiting process, if the file synchronization logic occurs again, that is, the master node changes again, the latest file can be used to overwrite the original file, saving the resource consumption of one synchronization. After n seconds, the resource utilization of each dimension is calculated again. If the CPU occupation peak has ended, the obtained value will be within the safe range, and then the file synchronization can be directly performed. If it is found that the CPU occupation is still high, the synchronization is performed again after m seconds, and the waiting for m seconds is continued. The waiting is not infinite, and a threshold max seconds is preset. When the waiting time (m+n+... seconds) exceeds max seconds, it is considered that long-time waiting may cause the risk of file desynchronization, and then a file synchronization is forcibly performed.
[0069] In the above embodiment, when a large number of database read and write operations occur instantaneously on the master node, the CPU consumption increases sharply, that is, in the case of high CPU occupation, when the configuration file synchronization logic is encountered, the first synchronization opportunity n can be calculated, that is, synchronization needs to be performed after n seconds, sleep for n seconds, and wait for the opportunity. During the waiting process, if the file synchronization logic occurs again, that is, the master node changes again, the latest file can be used to overwrite the original file, saving the resource consumption of one synchronization. After n seconds, the resource utilization of each dimension is calculated again. If the CPU occupation peak has ended, the obtained value will be within the safe range, and then the file synchronization can be directly performed. If it is found that the CPU occupation is still high, the synchronization is performed again after m seconds, and the waiting for m seconds is continued. The waiting is not infinite, and a threshold max seconds is preset. When the waiting time (m+n+... seconds) exceeds max seconds, it is considered that long-time waiting may cause the risk of file desynchronization, and then a file synchronization is forcibly performed.
[0070] In the above embodiment, when a large number of database read and write operations occur instantaneously on the master node, the CPU consumption increases sharply, that is, in the case of high CPU occupation, when the configuration file synchronization logic is encountered, the first synchronization opportunity n can be calculated, that is, synchronization needs to be performed after n seconds, sleep for n seconds, and wait for the opportunity. During the waiting process, if the file synchronization logic occurs again, that is, the master node changes again, the latest file can be used to overwrite the original file, saving the resource consumption of one synchronization. After n seconds, the resource utilization of each dimension is calculated again. If the CPU occupation peak has ended, the obtained value will be within the safe range, and then the file synchronization can be directly performed. If it is found that the CPU occupation is still high, the synchronization is performed again after m seconds, and the waiting for m seconds is continued. The waiting is not infinite, and a threshold max seconds is preset. When the waiting time (m+n+... seconds) exceeds max seconds, it is considered that long-time waiting may cause the risk of file desynchronization, and then a file synchronization is forcibly performed.
[0071] In the above embodiment, Figure 5 is a flowchart of synchronizing a target file to a standby node included in a target cluster according to an embodiment of the present application, as shown in Figure 5 , the flow includes:
[0072] (1) The MON node file changes and needs to be synchronized to other nodes.
[0073] (2) The file is placed in the cache area for subsequent synchronization.
[0074] (3) Collect the current usage of each resource of the node, calculate the synchronization opportunity according to the configured weight of each dimension, i.e. analyze the current resource utilization, if in the peak period, delay the file synchronization, the specific delay time is calculated according to the current resource usage, the higher the resource occupation, the longer the delay; if the current resource is idle, the file synchronization is performed immediately.
[0075] (4) Wait for the synchronization opportunity to arrive, when the delay time expires, collect the current resource utilization again, calculate the synchronization opportunity again, if still in the peak period, continue to delay the file synchronization; if the resource is idle, perform the file synchronization.
[0076] (5) When the resource occupation is still high after waiting for a certain period of time, in order to avoid data loss caused by long-time file asynchronization, no longer care about the high resource utilization, forcibly synchronize the file once.
[0077] In an example embodiment, the method further comprises: in the case that the master node comprises a cache area, determining whether there is a cached file identical to the target file in the cache area; in the case that there is the cached file, storing the target file in the cache area to replace the cached file in the cache area; in the case that there is no cached file, storing the target file in the cache area; in the case that the master node does not comprise the cache area, creating the cache area in the master node and storing the target file in the cache area. In this embodiment, the target file can be cached in the cache area, and when the synchronization opportunity is reached, the file is synchronized from the cache area to the backup node. In the case that the master node is determined to change, it can be determined whether the cache area is included in the master node, in the case that it is not, the cache area is created and the target file is stored in the cache area. In the case that the cache area exists, it can be determined whether there is a cached file identical to the target file in the cache area, in the case that there is, the cached file in the cache area is replaced by the target file, and in the case that there is no cached file, the target file is stored in the cache area. In the case that the synchronization opportunity is reached, the target file is synchronized from the cache area to the backup node, and the target file in the cache area is deleted.
[0078] In the above embodiments, Figure 6 is a process diagram of caching a target file according to an example embodiment of the present application, as Figure 6As shown, the process includes: when a file changes, preparing to put the file into the cache area; determining if the cache area already exists; if not, creating the cache area and putting the modified file into it; starting intelligent analysis to determine the synchronization time point based on current multi-dimensional resource consumption; if the cache area already exists, determining if the current file is already cached; if the file is already cached, overwriting the original file and stopping the original synchronization timer; restarting intelligent analysis to reconfirm the synchronization time point; if the file is not cached, putting the modified file into it; starting intelligent analysis to confirm the synchronization time point. In the above embodiment, the method of first putting the file to be synchronized into the cache area and then performing synchronization at an opportune time is beneficial for implementing the results of multi-dimensional analysis. It also helps reduce the number of file synchronizations. After a file changes and is put into the cache area, if the file changes again during the waiting period for synchronization, the latest file can overwrite the original file, and only the most recently modified file needs to be synchronized. This method is particularly effective in reducing the number of synchronizations when files are frequently modified.
[0079] In an exemplary embodiment, storing the target file in the cache includes: storing the hash value of the target file in the memory of the cache; and storing the file data of the target file in the hard disk of the cache. In this embodiment, a schematic diagram of the cache structure can be found in the appendix. Figure 7 ,like Figure 7 As shown, the cache can include memory (MEM) and disk (DISK). Memory only stores the file's hash value (SHA), such as the MD5 hash. This is used to check file consistency; the actual files are written to disk as cached files to avoid consuming excessive memory. The disk cache stores files to be synchronized; it does not use memory for storage to ensure no data loss upon node restart. Only the latest copy of the same file is kept in the cache, and the cache is cleared after each synchronization to ensure minimal space consumption.
[0080] In the above embodiment, when the interval time of file synchronization, the waiting process, the file to be synchronized cannot be temporarily put into the memory, so the occupation of the memory is too high. Then at the same time in order to record the file to be synchronized, a unique identifier is needed to mark the file and the current state of the file. At the same time, in order to be scalable, a file cache area is established, all files that need to be synchronized can be put into the cache area, and after each file synchronization is completed, the file is removed from the cache area. In addition, when the cache area file changes, the SHA value recorded in the memory does not match the corresponding file in the cache area, so it is not suitable for synchronization, because the SHA value is different, which means that the file has been changed. At this time, synchronization to other nodes will still cause the file to be out of synchronization. At this time, what to do is to take the latest file and update the cache area and the memory SHA value. On the premise of reducing the memory occupation, the legitimacy of the file is guaranteed, and the scalability is also increased.
[0081] In an example embodiment, the correcting the first sub-resource weight value of the target sub-resource included in the first resource weight value to obtain a target resource weight value includes: determining a correction ratio; and determining a sum value of the product of the correction ratio and the first sub-resource weight value and the first sub-resource weight value as the target resource weight value. In this embodiment, the correction ratio can be a predetermined ratio, and can also be determined according to the first resource utilization. For example, the target resource can include A, B, and C. Among them, A is a target sub-resource, and the first resource utilization of A, B, and C is D, E, and F respectively. The proportion of D can be determined as D / (D+E+F), and the interval in which the proportion is located can be determined. Different intervals correspond to different ratios Y, and the ratio Y is determined as the correction ratio. If the first sub-resource weight value is X, then the target resource weight value is X+X*Y.
[0082] In the above embodiment, by increasing the weight of the target sub-resource relied on by the target business scenario, the first synchronization time calculated can meet the current page business scenario.
[0083] In an example embodiment, in the case that the master node included in the target cluster changes, the change type of the master node changing can be determined; in the case that the change type indicates that the master node fails, the files of the master node are synchronized to the backup nodes in the target cluster to prevent the case that the service is abnormal due to the files not being synchronized in time when the master node fails. In the case that the change type indicates that the files of the master node change, the first resource utilization of the target resources in multiple different dimensions of the target cluster is determined, the first resource weight value of each target resource is determined according to the first resource utilization, and the first synchronization time of synchronizing the target files of the master node is determined according to the first resource weight value; in the case that the first synchronization time is reached, the target files are synchronized to the backup nodes included in the target cluster. That is, when the master node fails, the file synchronization is performed in time to ensure the normal operation of the service. When the files of the master node change, the file synchronization is performed when the synchronization time is reached, and in the process of frequent operations, the synchronization frequency can be effectively reduced, and unnecessary resource consumption can be reduced.
[0084] In the foregoing embodiment, the synchronization time is intelligently selected according to the actual resource consumption, and the business peak period is effectively avoided; the resource consumption evaluation can be analyzed from multiple dimensions, including IOPS, CPU utilization, MEM utilization, and bandwidth, and the weight ratio can be intelligently analyzed from the actual business scenario or manually configured; the files are synchronized in the cache mode, and in the process of frequent operations, the synchronization frequency can be effectively reduced, and unnecessary resource consumption can be reduced. The weight ratio of each dimension resource is calculated according to the actual situation, the synchronization time of the files is calculated according to the weight ratio of each dimension, the files are synchronized in the cache mode, the synchronization frequency is effectively reduced, and the problem that the current file synchronization method in the related art is too simple and cannot intelligently change the strategy according to the actual business volume, so that the resource consumption is already high at the business peak period, and the file synchronization operation is still needed at this time, and the resource consumption is obviously high in the case of frequent operations, and the user experience is poor.
[0085] Through the description of the foregoing embodiments, those skilled in the art can clearly understand that the method according to the foregoing embodiments can be realized by means of software and a general hardware platform as required, and of course can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device) to execute the method described in each embodiment of the present application.
[0086] A file synchronization apparatus is also provided in the embodiments, which is configured to implement the above-described embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
[0087] Figure 8 is a structural block diagram of a file synchronization apparatus according to an embodiment of the present application, as shown in Figure 8 The apparatus comprises:
[0088] A first determining module 802 is configured to determine a first resource utilization rate of a target resource in multiple different dimensions of a target cluster in a case where a master node included in the target cluster changes.
[0089] A second determining module 804 is configured to determine a first resource weight value of each target resource based on the first resource utilization rate.
[0090] A third determining module 806 is configured to determine a target service currently executed by the master node, and a target sub-resource corresponding to the target service, wherein the target sub-resource is a resource included in the target resource, and the utilization rate of the target sub-resource is greater than that of other sub-resources when the master node executes the target service, the other sub-resources being resources included in the target resource except the target sub-resource.
[0091] A correction module 808 is configured to correct a first sub-resource weight value of the target sub-resource included in the first resource weight value, to obtain a target resource weight value.
[0092] A fourth determining module 810 is configured to determine a first synchronization time of synchronizing a target file of the master node based on the target resource weight value and a second sub-resource weight value of the other sub-resources included in the first resource weight value.
[0093] A synchronization module 812 is configured to synchronize the target file to a backup node included in the target cluster in a case where the first synchronization time is reached, wherein the master node is connected to the backup node.
[0094] In an example embodiment, the first determining module 802 can determine the first resource utilization of the target resource in multiple different dimensions of the target cluster by determining, for each target resource, a target used resource number and a total resource number of the target resource, and determining the first resource utilization based on a first ratio of the used resource number to the total resource number.
[0095] In an example embodiment, the first determining module 802 can determine the target used resource number of the target resource by collecting used resource numbers of the target resource at different time points in a predetermined time period to obtain multiple used resource numbers, and determining an average of the multiple used resource numbers as the target used resource number.
[0096] In an example embodiment, the first determining module 802 can determine the first resource utilization based on the first ratio of the used resource number to the total resource number by determining a target difference between the first ratio and a predetermined utilization threshold, amplifying the first ratio to obtain a second ratio when the target difference is greater than a predetermined threshold, determining the second ratio as the first resource utilization, and determining the first ratio as the first resource utilization when the target difference is less than or equal to the predetermined threshold.
[0097] In an example embodiment, the second determining module 804 can determine the first resource weight value of each target resource based on the resource utilization by determining a first sum value of all the first resource utilizations, and determining the first resource weight value of each target resource as a ratio of the first resource utilization of the target resource to the first sum value.
[0098] In an example embodiment, the fourth determining module 810 can determine the first synchronization time of the target file of the master node based on the target resource weight value and a second sub-resource weight value of the other sub-resource included in the first resource weight value by determining a first product of the first resource utilization of the target sub-resource and the target resource weight, determining a product of the other sub-resource and the second sub-resource weight value of the other sub-resource to obtain multiple second products, determining a second sum value of the first product and the multiple second products, and determining the first synchronization time based on a third product of the second sum value and a weighting coefficient.
[0099] In an example embodiment, the fourth determining module 810 can determine the first synchronization timing based on the third product of the second sum value and the weighting coefficient in the following manner: in a case where the third product is less than a first synchronization threshold, determining the first synchronization timing as the first synchronization threshold; in a case where the third product is greater than a second synchronization threshold, determining the first synchronization timing as the second synchronization threshold, wherein the first synchronization threshold is less than the second synchronization threshold; in a case where the third product is greater than or equal to the first synchronization threshold and less than or equal to the second synchronization threshold, determining the first synchronization timing as the third product.
[0100] In an example embodiment, the apparatus can be configured to determine that the master node changes in a case where it is determined that the file of the master node changes, and determine that the master node changes in a case where it is determined that the master node fails.
[0101] In an example embodiment, the synchronization module 812 can synchronize the target file to the backup node included in the target cluster in the following manner: determining a second resource utilization rate of the master node at the time when the first synchronization timing is reached; in a case where the second resource utilization rate indicates that synchronization is allowed, synchronizing the target file to the backup node; in a case where the second resource utilization rate indicates that synchronization is prohibited, determining a second resource weight value of each target resource based on the second resource utilization rate, determining a second synchronization timing of synchronizing the target file based on the second resource weight value; determining a waiting time length of the target file waiting for synchronization at the time when the second synchronization timing is reached; in a case where the waiting time length is greater than a predetermined time length, synchronizing the target file to the backup node; in a case where the waiting time length is less than or equal to the predetermined time length, updating the second resource utilization rate as the resource utilization rate of the target resource at the time when the second synchronization timing is reached.
[0102] In an example embodiment, the apparatus can be further configured to, in a case where the master node includes a cache area, determine whether there is a cached file identical to the target file in the cache area; in a case where the cached file exists, store the target file in the cache area to overwrite the cached file in the cache area; in a case where the cached file does not exist, store the target file in the cache area; in a case where the master node does not include the cache area, create the cache area in the master node and store the target file in the cache area.
[0103] In an example embodiment, the apparatus can store the target file into the cache area by storing a hash value of the target file into memory in the cache area and storing file data of the target file into a hard disk in the cache area.
[0104] In an example embodiment, the correction module 808 can correct the first sub-resource weight value of the target sub-resource included in the first resource weight value to obtain a target resource weight value by determining a correction ratio, and determining a sum value of the correction ratio and the first sub-resource weight value as the target resource weight value.
[0105] It should be noted that each of the above modules can be implemented by software or hardware, and for the latter, the following implementation manners can be used, but are not limited thereto: all of the above modules are located in the same processor; or each of the above modules is located in a different processor in any combination.
[0106] Embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the computer program is configured to execute the steps in any of the above method embodiments when running.
[0107] In an example embodiment, the above computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.
[0108] Embodiments of the present application also provide an electronic device, which includes a memory storing a computer program and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
[0109] In an example embodiment, the above electronic device can further include a transmission device connected to the processor and an input / output device connected to the processor.
[0110] The specific examples in the present embodiment can refer to the examples described in the above embodiments and example implementations, and the present embodiment will not be described here again.
[0111] It should be apparent to those skilled in the art that the modules or steps of the application described above can be implemented with general computing devices, which can be centralized on a single computing device or distributed on a network of multiple computing devices, and which can be implemented with program codes executable by the computing devices, so that they can be stored in storage devices and executed by the computing devices, and in some cases, the steps shown or described can be executed in different orders than shown, or made into individual integrated circuit modules, or made into a single integrated circuit module. Thus, the present application is not limited to any particular combination of hardware and software.
[0112] The preferred embodiments of the present application described above are only used to explain the principles of the present application and not limit the present application. Any modification, equivalent replacement, improvement, etc. within the principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for synchronizing files, comprising: determining first resource utilization of target resources in different dimensions in a target cluster in a case where a master node included in the target cluster changes; determining a first resource weight value of each of the target resources based on the first resource utilization; determining a target service currently executed by the master node and a target sub-resource corresponding to the target service, wherein the target sub-resource is a resource included in the target resource, and a utilization rate of the target sub-resource is greater than utilization rates of other sub-resources in a case where the master node executes the target service, the other sub-resources being resources included in the target resource except the target sub-resource; correcting a first sub-resource weight value of the target sub-resource included in the first resource weight value to obtain a target resource weight value; determining a first synchronization time for synchronizing a target file of the master node based on the target resource weight value and a second sub-resource weight value of the other sub-resources included in the first resource weight value; and synchronizing the target file to a backup node included in the target cluster in a case where the first synchronization time is reached, wherein the master node is connected to the backup node.
2. The method of claim 1, wherein determining the first resource utilization of the target resources in different dimensions in the target cluster comprises: for each of the target resources, performing the following operations to determine the first resource utilization of the target resource: determining a target used resource number of the target resource and a total resource number; and determining the first resource utilization based on a first ratio of the used resource number to the total resource number.
3. The method of claim 2, wherein the determining the target used resource number of the target resource comprises: collecting used resource numbers of the target resource at different time points in a predetermined time period to obtain a plurality of the used resource numbers; and determining an average value of the plurality of the used resource numbers as the target used resource number.
4. The method of claim 2, wherein the determining the first resource utilization based on the first ratio of the used resource number to the total resource number comprises: determining a target difference value of the first ratio and a predetermined utilization threshold value; in a case where the target difference value is greater than a predetermined threshold value, amplifying the first ratio to obtain a second ratio; and determining the second ratio as the first resource utilization. in a case where the target difference value is less than or equal to the predetermined threshold value, determining the first ratio as the first resource utilization.
5. The method of claim 1, wherein the determining the first resource weight value of each of the target resources based on the resource utilization comprises: determining a first sum value of all the first resource utilizations; and determining the first resource weight value of each of the target resources as a ratio of the first resource utilization of the target resource to the first sum value.
6. The method of claim 1, wherein determining a first synchronization time of synchronizing the target file of the master node based on the target resource weight value and the second sub-resource weight values of the other sub-resources included in the first resource weight value, comprises: determining a first product of the first resource utilization rate of the target sub-resource and the target resource weight; determining a second product of the other sub-resources and the second sub-resource weight values of the other sub-resources; determining a second sum value of the first product and a plurality of the second products; determining the first synchronization time based on a third product of the second sum value and a weighting coefficient.
7. The method of claim 6, wherein determining the first synchronization time based on the third product of the second sum value and a weighting coefficient, comprises: in a case that the third product is less than a first synchronization threshold, determining the first synchronization threshold as the first synchronization time; in a case that the third product is greater than a second synchronization threshold, determining the second synchronization threshold as the first synchronization time, wherein the first synchronization threshold is less than the second synchronization threshold; in a case that the third product is greater than or equal to the first synchronization threshold and less than or equal to the second synchronization threshold, determining the third product as the first synchronization time.
8. The method of claim 1, wherein before determining the first resource utilization rate of the target resource in a plurality of different dimensions of the target cluster, the method further comprises: in a case that a file of the master node is determined to be changed, determining that the master node is changed; in a case that the master node is determined to be failed, determining that the master node is changed.
9. The method of claim 1, wherein synchronizing the target file into a backup node included in the target cluster, comprises: determining a second resource utilization rate of the master node at a time when the first synchronization time is reached; in a case that the second resource utilization rate indicates that synchronization is allowed, synchronizing the target file into the backup node; in a case that the second resource utilization rate indicates that synchronization is prohibited, determining a second resource weight value of each of the target resources based on the second resource utilization rate, and determining a second synchronization time of synchronizing the target file based on the second resource weight value; determining a waiting time length of the target file waiting for synchronization at a time when the second synchronization time is reached; in a case that the waiting time length is greater than a predetermined time length, synchronizing the target file into the backup node; in a case that the waiting time length is less than or equal to the predetermined time length, updating the second resource utilization rate to a resource utilization rate of the target resource at a time when the second synchronization time is reached.
10. The method of claim 1, wherein the method further comprises: in a case that a cache area is included in the master node, determining whether there is a cached file identical to the target file in the cache area; in a case that the cached file exists, storing the target file into the cache area to overwrite the cached file in the cache area; storing the target file into the cache area in the absence of the cached file; in the absence of the cache area in the master node, creating the cache area in the master node and storing the target file into the cache area.
11. The method of claim 10, wherein storing the target file into the cache area comprises: storing a hash value of the target file into a memory in the cache area; storing file data of the target file into a hard disk in the cache area.
12. The method of claim 1, wherein the correcting the first sub-resource weight value of the target sub-resource included in the first resource weight value to obtain a target resource weight value comprises: determining a correction ratio; determining a sum value of the correction ratio and the first sub-resource weight value as the target resource weight value.
13. An apparatus for synchronizing files, comprising: a first determining module configured to determine first resource utilization rates of target resources in different dimensions in a target cluster in the case that a master node included in the target cluster changes; a second determining module configured to determine first resource weight values of each of the target resources based on the first resource utilization rates; a third determining module configured to determine a target service currently executed by the master node and a target sub-resource corresponding to the target service, wherein the target sub-resource is a resource included in the target resources, and a utilization rate of the target sub-resource is greater than utilization rates of other sub-resources in the case that the master node executes the target service, the other sub-resources being resources included in the target resources other than the target sub-resource; a correcting module configured to correct a first sub-resource weight value of the target sub-resource included in the first resource weight value to obtain a target resource weight value; a fourth determining module configured to determine a first synchronization time of synchronizing a target file of the master node based on the target resource weight value and second sub-resource weight values of the other sub-resources included in the first resource weight value; a synchronizing module configured to synchronize the target file into a backup node included in the target cluster in the case that the first synchronization time is reached, wherein the master node is connected with the backup node.
14. A computer readable storage medium, comprising: a computer program stored in the computer readable storage medium, wherein the computer program, when executed by a processor, implements the steps of the method in any one of claims 1 to 12.
15. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: the processor, when executing the computer program, implements the steps of the method in any one of claims 1 to 12.
Citation Information
Patent Citations
Data backup method and device
CN110362431A
File backup method and device and computing equipment
CN113535483A