Resource synchronization method, apparatus, device, and readable storage medium
By combining microservice technology to monitor resource change events and using regular expression filtering and lock queue mechanisms to generate verification identifiers to synchronize resource change information, the problem of high CPU usage in existing technologies is solved. This enables real-time monitoring and remote synchronization of resource status, improving CPU utilization and data consistency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- E-SURFING DIGITAL LIFE TECH CO LTD
- Filing Date
- 2024-11-15
- Publication Date
- 2026-06-05
AI Technical Summary
In existing resource synchronization technologies, the server's periodic querying of resource node status leads to excessive CPU usage, which affects system performance.
By combining microservice technology to monitor resource change events, and using regular expression filtering and lock queue mechanisms, a verification identifier is generated and resource change information is synchronized, reducing unnecessary network transmission and CPU usage.
This approach achieves reduced CPU utilization while ensuring real-time monitoring of resource status changes and synchronization between remote nodes, thereby improving CPU utilization and data consistency.
Smart Images

Figure CN119449827B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a resource synchronization method, apparatus, device, and readable storage medium. Background Technology
[0002] From a basic operations and security perspective, website data not only needs to be backed up regularly, but also needs to be backed up off-site.
[0003] In existing technologies, a resource synchronization system is deployed on the server for off-site backup. After confirming that the local website data has been updated, the new website data is synchronized to the off-site location. However, in order to identify whether the website data has been updated, the server periodically queries the status of each resource node, which consumes a lot of server CPU resources. Summary of the Invention
[0004] In view of this, this application provides a resource synchronization method, apparatus, device, and readable storage medium to address the drawback of excessive CPU usage in existing resource synchronization technologies.
[0005] To achieve the above objectives, the following solution is proposed:
[0006] A resource synchronization method is applied to a target node in a distributed management system, the resource synchronization method comprising:
[0007] By combining microservice technology, the system monitors resource change events of the corresponding target node, and determines the resource change information of the target node after monitoring the resource change event.
[0008] The resource change information is filtered using regular expressions to assess whether the resource change information needs to be synchronized with remote nodes.
[0009] If so, then generate a verification identifier for the resource change information;
[0010] Write the verification identifier and the resource change information into the lock queue;
[0011] Using the lock queue, the verification identifier and the resource change information are synchronized to the remote node, so that the remote node can perform resource synchronization based on the received resource change information after confirming that the received resource change information is transmitted correctly through the verification identifier.
[0012] Optionally, the step of combining microservice technology to monitor resource change events of the corresponding target node includes:
[0013] In response to a user's resource change operation, and in conjunction with microservice technology, determine the resource change information corresponding to the resource change operation, and write the resource change information into a message queue;
[0014] Monitor the message queue to determine if any resource change events exist.
[0015] Optionally, determining the resource change information of the target node after detecting the resource change event includes:
[0016] After detecting the resource change event, the system uses microservice technology to retrieve the resource change information, which includes object identifiers and path information, from the message queue.
[0017] Optionally, the resource change information is filtered using regular expressions to assess whether the resource change information needs to be synchronized with remote nodes, including:
[0018] Based on the local resources of the target node, construct a regular expression;
[0019] The resource change information is filtered using the regular expression to assess whether the resource change information needs to be synchronized with remote nodes.
[0020] Optionally, the verification identifier for generating the resource change information includes:
[0021] The summary value of the resource change information is used as the verification identifier.
[0022] Optionally, using the lock queue, synchronizing the verification identifier and the resource change information to the remote node includes:
[0023] Send a long-connection heartbeat detection to the remote node and receive confirmation information from the remote node;
[0024] When the received confirmation message indicates that the connection is normal, the verification identifier and the resource change information are sent to the remote node using the lock queue.
[0025] Optionally, after sending a long-connection heartbeat detection to the remote node and receiving confirmation information from the remote node, the method further includes:
[0026] When the received confirmation message indicates a connection error, password verification is performed on the remote node.
[0027] After the remote node verifies the password, a transmission channel is established.
[0028] In conjunction with the transmission channel and based on the lock queue, the verification identifier and the resource change information are sent to the remote node.
[0029] A resource synchronization device, wherein the resource synchronization device is applied to a target node of a distributed management system, the resource synchronization device comprising:
[0030] The monitoring module is used to combine microservice technology to monitor resource change events of the corresponding target node, and determine the resource change information of the target node after monitoring the resource change event.
[0031] The filter is used to perform regular expression filtering on the resource change information and evaluate whether the resource change information needs to be synchronized with remote nodes; if so, the write module and lock queue are invoked.
[0032] The writing module is used to generate a verification identifier for the resource change information and write the verification identifier and the resource change information into the lock queue.
[0033] A lock queue is used to synchronize the verification identifier and the resource change information to the remote node, so that the remote node can perform resource synchronization based on the received resource change information after confirming that the received resource change information is transmitted correctly through the verification identifier.
[0034] A resource synchronization device, comprising a memory and a processor;
[0035] The memory is used to store programs;
[0036] The processor is used to execute the program to implement the various steps of the resource synchronization method described above.
[0037] A readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the various steps of the resource synchronization method described above.
[0038] As can be seen from the above technical solutions, the resource synchronization method provided in this application can be applied to target nodes in a distributed management system. This method, combined with microservice technology, monitors resource change events of the corresponding target node and determines the resource change information of the target node after monitoring the resource change event. Based on this, this application can utilize microservice technology to achieve real-time monitoring of resource status and real-time acquisition of resource change information. Simultaneously, microservice technology can achieve resource isolation, avoiding impact on the normal use of CPU by other processes, improving CPU utilization, and reducing CPU occupancy. Therefore, by combining microservice technology for monitoring resource change events, this application can determine resource status changes while reducing CPU occupancy. Subsequently, this application can perform regular expression filtering on the resource change information to evaluate whether the resource change information needs to be synchronized with remote nodes. Based on this, this application... Regular expression filtering can be used to evaluate whether the resource change information meets the synchronization conditions of remote nodes, avoiding unnecessary resource information synchronization, reducing network transmission and processing burden on remote nodes, and saving CPU usage. Then, if synchronization with remote nodes is required, a verification identifier for the resource change information can be generated. The verification identifier and the resource change information are written into a lock queue. Using the lock queue, the verification identifier and the resource change information are synchronized to the remote node, so that the remote node can perform resource synchronization based on the received resource change information after confirming that the received resource change information is transmitted correctly through the verification identifier. Based on this, this application can use a lock queue to synchronize the verification identifier and resource change information to remote nodes, utilizing the data transmission system coordination capability and data consistency guarantee function of the lock queue to reduce concurrency conflicts, thereby reducing CPU usage. The verification identifier ensures the reliability and integrity of the resource change information. It can be seen that this application can achieve remote resource synchronization with reduced CPU usage. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0040] Figure 1 This is a flowchart of a resource synchronization method disclosed in an embodiment of this application;
[0041] Figure 2 This is a structural block diagram of a resource synchronization device disclosed in an embodiment of this application;
[0042] Figure 3This is a hardware structure block diagram of a resource synchronization device disclosed in an embodiment of this application. Detailed Implementation
[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0044] This application provides a resource synchronization method that can be applied to target nodes in various distributed management systems. The executing entity can be a computer terminal or the processor or server of a smart terminal.
[0045] In this case, any node in the distributed management system can be used as the target node.
[0046] The target node can be deployed on the network side.
[0047] Next, combine Figure 1 The resource synchronization method described in this application is detailed, including the following steps:
[0048] Step S1: Using microservice technology, listen for resource change events of the corresponding target node, and determine the resource change information of the target node after listening for the resource change event.
[0049] Specifically, different tools can be generated based on microservice technology;
[0050] One tool is used to listen for resource change events on the corresponding target node, and another tool is used to determine the resource change information of the target node after listening for the resource change events.
[0051] Resource change events can be static resource addition events, static resource deletion events, static resource modification events, or static resource check events.
[0052] Static resources can contain any one or more of the following: text, images, HTML, CSS, JS, and fonts.
[0053] Resource change information can be used to locate static resources that have undergone changes and the type of change.
[0054] Resource change information may include the object identifier and path information of the corresponding static resource.
[0055] Step S2: Perform regular expression filtering on the resource change information to assess whether the resource change information needs to be synchronized with remote nodes. If so, proceed to step S3.
[0056] Specifically, the path information in the resource change information can be used to perform regular expression filtering on the resource change information to obtain the filtering result;
[0057] Based on the filtering results, assess whether resource change information needs to be synchronized with remote nodes.
[0058] If resource change information needs to be synchronized with remote nodes, then proceed to step S3.
[0059] If resource change information does not need to be synchronized with remote nodes, then stop.
[0060] Among them, remote nodes can be any one or more nodes in the distributed management system other than the target node.
[0061] Step S3: Generate a verification identifier for the resource change information.
[0062] Specifically, verification identifiers for resource change information can be generated in various ways.
[0063] For example, information digest algorithms can be used to generate verification identifiers for resource change information;
[0064] Signature algorithms can also be used to generate verification identifiers for resource change information;
[0065] The Cyclic Redundancy Check (CRC) algorithm can also be used to generate verification identifiers for resource change information.
[0066] Step S4: Write the verification identifier and the resource change information into the lock queue.
[0067] Specifically, the verification identifier and resource change information can be written into the lock queue of the target node.
[0068] Locking information is printed in the logs to lock resource change information such as filename, path, timestamp, and text length.
[0069] Step S5: Using the lock queue, synchronize the verification identifier and the resource change information to the remote node.
[0070] Specifically, a lock queue can be used to transmit the verification identifier and resource change information to remote nodes, so that remote nodes can perform reliability verification on the received resource change information based on the verification identifier. After the resource change information passes the reliability verification, resource synchronization can be performed based on the received resource change information.
[0071] During transmission, a lock queue can be used to monitor the transmission status of the verification identifier and resource change information. If transmission fails, the lock queue's retransmission mechanism can be used to retransmit the verification identifier and resource change information.
[0072] After a retransmission fails, the corresponding verification identifier and resource change information can be recorded and transmitted to the administrator's terminal.
[0073] It can also implement a retry mechanism for transmitting resource change information, which is triggered periodically to scan for failed retransmissions of resource change information.
[0074] This application supports execution on Windows and Linux systems, and can transmit resource change information in real time across systems.
[0075] As can be seen from the above technical solutions, the resource synchronization method provided in this application can be applied to target nodes in a distributed management system. This method, combined with microservice technology, monitors resource change events of the corresponding target node and determines the resource change information of the target node after monitoring the resource change event. Based on this, this application can utilize microservice technology to achieve real-time monitoring of resource status and real-time acquisition of resource change information. Simultaneously, microservice technology can achieve resource isolation, avoiding impact on the normal use of CPU by other processes, improving CPU utilization, and reducing CPU occupancy. Therefore, by combining microservice technology for monitoring resource change events, this application can determine resource status changes while reducing CPU occupancy. Subsequently, this application can perform regular expression filtering on the resource change information to evaluate whether the resource change information needs to be synchronized with remote nodes. Based on this, this application... Regular expression filtering can be used to evaluate whether the resource change information meets the synchronization conditions of remote nodes, avoiding unnecessary resource information synchronization, reducing network transmission and processing burden on remote nodes, and saving CPU usage. Then, if synchronization with remote nodes is required, a verification identifier for the resource change information can be generated. The verification identifier and the resource change information are written into a lock queue. Using the lock queue, the verification identifier and the resource change information are synchronized to the remote node, so that the remote node can perform resource synchronization based on the received resource change information after confirming that the received resource change information is transmitted correctly through the verification identifier. Based on this, this application can use a lock queue to synchronize the verification identifier and resource change information to remote nodes, utilizing the data transmission system coordination capability and data consistency guarantee function of the lock queue to reduce concurrency conflicts, thereby reducing CPU usage. The verification identifier ensures the reliability and integrity of the resource change information. It can be seen that this application can achieve remote resource synchronization with reduced CPU usage.
[0076] In some embodiments of this application, the process of listening to resource change events of the corresponding target node in step S1 using microservice technology is described in detail, and the steps are as follows:
[0077] S10. Respond to the user's resource change operation, and in conjunction with microservice technology, determine the resource change information corresponding to the resource change operation, and write the resource change information into a message queue.
[0078] Specifically, it can respond to users' static resource change operations, obtain the file service system and migration tool created based on microservice technology, and determine the resource change information corresponding to the resource change operation through the file service system.
[0079] Subsequently, resource change information can be written to a message queue through the file service system.
[0080] S11. Listen to the message queue to determine if there is a resource change event.
[0081] Specifically, a drift tool can be used to monitor the message queue and determine whether there are any resource change events based on the data written to the message queue.
[0082] As can be seen from the above technical solution, this embodiment provides an optional method for listening to resource change events of the corresponding target node by combining microservice technology. Through the above method, real-time monitoring and perception of resource change events can be achieved by listening to the message queue, which further improves the real-time performance of resource synchronization in this application.
[0083] In some embodiments of this application, the process of determining the resource change information of the target node after listening to the resource change event in step S1 is described in detail, and the steps are as follows:
[0084] S12. After detecting the resource change event, in conjunction with microservice technology, obtain the resource change information corresponding to the resource change event, which includes object identifier and path information, from the message queue.
[0085] Specifically, migration tools built on microservices technology can be obtained;
[0086] The drift tool can be used to obtain resource change information corresponding to resource change events from the message queue of the target node.
[0087] The resource change information may include the generation timestamp of the corresponding resource change event, object identifier, and path information.
[0088] Object identifiers can be used to identify the static resource subject corresponding to a resource change event;
[0089] Path information can be used to locate static resources corresponding to resource change events.
[0090] As can be seen from the above technical solution, this embodiment provides an optional method for determining the resource change information of the target node after listening to the resource change event. Through this method, this application can obtain resource change information via a message queue, thus better completing the acquisition of resource change information and simplifying the difficulty of obtaining it. Simultaneously, the resource change information obtained by this application includes object identifiers and path information, facilitating the identification and location of modified static resources in the target node, and better achieving resource synchronization.
[0091] In some embodiments of this application, the process of performing regular expression filtering on the resource change information and evaluating whether the resource change information needs to be synchronized with remote nodes is described in detail, and the steps are as follows:
[0092] S20. Construct a regular expression based on the local resources of the target node.
[0093] Specifically, regular expressions for filtering can be generated based on the path information of local static resources in the target node.
[0094] Local static resources are static resources that do not need to be synchronized on the target node.
[0095] S21. Use the regular expression to filter the resource change information and assess whether the resource change information needs to be synchronized with remote nodes.
[0096] Specifically, based on regular expressions and path information in resource change information, it can be assessed whether resource change information belongs to static resources within the target node that do not need to be synchronized with other nodes.
[0097] As can be seen from the above technical solution, this embodiment provides an optional method for performing regular expression filtering on the resource change information and evaluating whether the resource change information needs to be synchronized with remote nodes. By constructing a regular expression and using the regular expression to filter the resource change information, it can be determined whether the resource change information needs to be synchronized with other nodes in the distributed management system other than the target node for resource change events, thereby improving the reliability of resource synchronization.
[0098] In some embodiments of this application, the process of step S3, generating the verification identifier of the resource change information, is described in detail as follows:
[0099] S30. Use the summary value of the resource change information as the verification identifier.
[0100] Specifically, a summary value of resource change information can be generated in various ways, and this summary value can be used as a verification identifier for resource change information.
[0101] The Message-Digest Algorithm 5 can be used to generate the MD5 value of resource change information, and this MD5 value can be used as a verification identifier for resource change information.
[0102] Text summarization algorithms, such as TextRank, can be used to generate text summaries of resource change information, and these summaries can be used as verification identifiers for resource change information.
[0103] As can be seen from the above technical solution, this embodiment provides an optional method for generating the verification identifier of the resource change information. Through the above method, a digest value of the resource change information can be generated by a text digest algorithm or a hash algorithm, and the generated digest value can be used as the verification identifier. Based on this, this application can use different algorithms to generate the verification identifier according to the actual scenario requirements.
[0104] In some embodiments of this application, the process of synchronizing the verification identifier and the resource change information to the remote node using the lock queue is described in detail, and the steps are as follows:
[0105] S50. Send a long-connection heartbeat detection to the remote node and receive confirmation information from the remote node.
[0106] Specifically, a long-connection heartbeat detection can be sent to the remote node, and the remote node's response to the heartbeat detection can be received to determine whether the connection between the target node and the remote node is normal.
[0107] S51. When the received confirmation message indicates that the connection is normal, the verification identifier and the resource change information are sent to the remote node using the lock queue.
[0108] Specifically, after receiving the confirmation message from the remote node, the confirmation information can be parsed, and if the confirmation information indicates that the connection between the target node and the remote node is still normal, a health check can be performed on the remote node's socket.
[0109] After the remote node passes the health check, the verification identifier can be transmitted to the remote node using a lock queue.
[0110] After receiving a reply from the remote node indicating that the verification flag has been received correctly, resource change information can be transmitted to the remote node using a lock queue.
[0111] Meanwhile, to ensure data security, SM2 symmetric encryption can be used to encrypt the transmission of verification identifiers and resource change information.
[0112] It can receive JSON objects returned by nodes in different locations;
[0113] Determine whether the verification identifier and resource change information were successfully transmitted based on the JSON object;
[0114] If successful, record it in the success log and release the corresponding resource change information in the lock queue;
[0115] If it fails, it will be recorded in the failure log and awaited retry by the timed thread.
[0116] The retry thread is triggered every 3 minutes. This thread is responsible for scanning and processing static files that have failed to be transmitted, implementing a file transmission retry mechanism, and if synchronization fails again, the file information will be recorded in a specified text file and notified to the operations and maintenance personnel by triggering an alarm.
[0117] When receiving resource synchronization information from other nodes, the local static resource is located based on the resource object identifier in the resource synchronization information;
[0118] Compare the latest change timestamp of the local static resource with the generation timestamp in the resource synchronization information to determine whether the local static resource is the latest resource.
[0119] If so, then refuse to receive the static resources corresponding to the resource synchronization information sent by other nodes.
[0120] If not, then receive the static resources corresponding to the resource synchronization information sent by other nodes.
[0121] As can be seen from the above technical solution, this embodiment provides an optional method to synchronize the verification identifier and the resource change information to the remote node using the lock queue. Through the above method, the verification identifier and resource change information can be synchronized after the remote node passes the heartbeat detection.
[0122] In some embodiments of this application, considering that the connection between the remote node and the target node may encounter abnormalities, a transmission process can be added in case of connection failure. The transmission process will now be described in detail, with the following steps:
[0123] S52. When the received confirmation message indicates a connection error, perform password verification on the remote node.
[0124] Specifically, a password can be generated and sent to a remote node that is experiencing connection problems.
[0125] S53. After the password verification is completed at the remote node, a transmission channel is established.
[0126] Specifically, after the response information returned by the remote node is verified by the password, the transmission channel between the target node and the remote node can be re-established.
[0127] S54. In conjunction with the transmission channel and based on the lock queue, send the verification identifier and the resource change information to the remote node.
[0128] Specifically, based on the lock queue and transmission, the verification identifier and resource change information can be synchronized to the remote node.
[0129] As can be seen from the above technical solution, this embodiment provides a method for synchronizing resource change information when the target node and the remote node are abnormally connected. The reliability of the remote node can be determined by password verification through the above method, which further ensures the data security of this application.
[0130] Next, we will combine Figure 2 The resource synchronization device provided in this application is described in detail below. The resource synchronization device described below can be compared with the resource synchronization method described above.
[0131] See Figure 2 It can be observed that the resource synchronization device may include:
[0132] The listening module 10 is used to combine microservice technology to listen for resource change events of the corresponding target node, and determine the resource change information of the target node after listening for the resource change event.
[0133] Filter 20 is used to perform regular expression filtering on the resource change information and evaluate whether the resource change information needs to be synchronized with remote nodes; if so, the write module and lock queue are invoked.
[0134] The writing module 30 is used to generate a verification identifier for the resource change information and write the verification identifier and the resource change information into the lock queue.
[0135] Lock queue 40 is used to synchronize the verification identifier and the resource change information to the remote node, so that the remote node can perform resource synchronization based on the received resource change information after confirming that the received resource change information is transmitted correctly through the verification identifier.
[0136] Furthermore, the monitoring module may include:
[0137] The resource change operation response unit is used to respond to the user's resource change operation, and in conjunction with microservice technology, determine the resource change information corresponding to the resource change operation and write the resource change information into a message queue.
[0138] The message queue listening unit is used to listen to the message queue and determine whether there are any resource change events.
[0139] Furthermore, the monitoring module may also include:
[0140] The resource change information acquisition unit is used to, after listening to the resource change event, use microservice technology to obtain the resource change information corresponding to the resource change event, which includes object identifier and path information, from the message queue.
[0141] Furthermore, the filter may include:
[0142] The regular expression construction unit is used to construct regular expressions based on the local resources of the target node;
[0143] The regular expression utilization unit is used to filter the resource change information using the regular expression and to evaluate whether the resource change information needs to be synchronized with remote nodes.
[0144] Furthermore, the writing module may include:
[0145] The summary value generation unit is used to use the summary value of the resource change information as the verification identifier.
[0146] Furthermore, the lock queue can include:
[0147] The heartbeat detection sending unit is used to send a long-connection heartbeat detection to the remote node and receive confirmation information from the remote node.
[0148] The resource change information sending unit is used to send the verification identifier and the resource change information to the remote node when the received confirmation information indicates that the connection is normal.
[0149] Furthermore, the resource change information sending unit may include:
[0150] A password verification component is used to verify the password of the remote node when the received confirmation information indicates a connection error.
[0151] A transmission channel establishment component is used to establish a transmission channel after the remote node passes password verification.
[0152] The transmission channel utilizes a component to send the verification identifier and the resource change information to the remote node in conjunction with the transmission channel.
[0153] The resource synchronization device provided in this application embodiment can be applied to resource synchronization devices, such as PC terminals, cloud platforms, servers, and server clusters. Optionally, Figure 3The hardware structure block diagram of the resource synchronization device is shown below. Figure 3 The hardware structure of the resource synchronization device may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4;
[0154] In this embodiment of the application, the number of processor 1, communication interface 2, memory 3, and communication bus 4 is at least one, and processor 1, communication interface 2, and memory 3 communicate with each other through communication bus 4;
[0155] Processor 1 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.
[0156] Memory 3 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device;
[0157] The memory stores a program, which the processor can call. The program is used for:
[0158] By combining microservice technology, the system monitors resource change events of the corresponding target node, and determines the resource change information of the target node after monitoring the resource change event.
[0159] The resource change information is filtered using regular expressions to assess whether the resource change information needs to be synchronized with remote nodes.
[0160] If so, then generate a verification identifier for the resource change information;
[0161] Write the verification identifier and the resource change information into the lock queue;
[0162] Using the lock queue, the verification identifier and the resource change information are synchronized to the remote node, so that the remote node can perform resource synchronization based on the received resource change information after confirming that the received resource change information is transmitted correctly through the verification identifier.
[0163] Optionally, the refined and extended functions of the program can be referred to the above description.
[0164] This application embodiment also provides a readable storage medium that can store a program suitable for execution by a processor, the program being used for:
[0165] By combining microservice technology, the system monitors resource change events of the corresponding target node, and determines the resource change information of the target node after monitoring the resource change event.
[0166] The resource change information is filtered using regular expressions to assess whether the resource change information needs to be synchronized with remote nodes.
[0167] If so, then generate a verification identifier for the resource change information;
[0168] Write the verification identifier and the resource change information into the lock queue;
[0169] Using the lock queue, the verification identifier and the resource change information are synchronized to the remote node, so that the remote node can perform resource synchronization based on the received resource change information after confirming that the received resource change information is transmitted correctly through the verification identifier.
[0170] Optionally, the refined and extended functions of the program can be referred to the above description.
[0171] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0172] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0173] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. The various embodiments of this application can be combined with each other. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A resource synchronization method, characterized in that, The resource synchronization method, applied to target nodes in a distributed management system, includes: By combining microservice technology, the system monitors resource change events of the corresponding target node, and determines the resource change information of the target node after monitoring the resource change event. Based on the path information of local static resources in the target node, a regular expression for filtering is generated; where local static resources are static resources in the target node that do not need to be synchronized. The resource change information is filtered using the regular expression to assess whether the resource change information needs to be synchronized with remote nodes; If so, then generate a verification identifier for the resource change information; Write the verification identifier and the resource change information into the lock queue; Using the lock queue, the verification identifier and the resource change information are synchronized to the remote node, so that the remote node can perform resource synchronization based on the received resource change information after confirming that the received resource change information is transmitted correctly through the verification identifier.
2. The resource synchronization method according to claim 1, characterized in that, The method of combining microservice technology to monitor resource change events of the corresponding target node includes: In response to a user's resource change operation, and in conjunction with microservice technology, determine the resource change information corresponding to the resource change operation, and write the resource change information into a message queue; Monitor the message queue to determine if any resource change events exist.
3. The resource synchronization method according to claim 2, characterized in that, The step of determining the resource change information of the target node after detecting the resource change event includes: After detecting the resource change event, the system uses microservice technology to retrieve the resource change information, which includes object identifiers and path information, from the message queue.
4. The resource synchronization method according to claim 1, characterized in that, The verification identifier for generating the resource change information includes: The summary value of the resource change information is used as the verification identifier.
5. The resource synchronization method according to claim 1, characterized in that, Using the lock queue, synchronizing the verification identifier and the resource change information to the remote node includes: Send a long-connection heartbeat detection to the remote node and receive confirmation information from the remote node; When the received confirmation message indicates that the connection is normal, the verification identifier and the resource change information are sent to the remote node using the lock queue.
6. The resource synchronization method according to claim 5, characterized in that, After sending a heartbeat detection signal for the long-connection to the remote node and receiving confirmation from the remote node, the process further includes: When the received confirmation message indicates a connection error, password verification is performed on the remote node. After the remote node verifies the password, a transmission channel is established. In conjunction with the transmission channel and based on the lock queue, the verification identifier and the resource change information are sent to the remote node.
7. A resource synchronization device, characterized in that, The resource synchronization device is applied to the target node of the distributed management system, and the resource synchronization device includes: The monitoring module is used to combine microservice technology to monitor resource change events of the corresponding target node, and determine the resource change information of the target node after monitoring the resource change event. A filter is used to generate a regular expression for filtering based on the path information of local static resources in the target node; wherein, local static resources are static resources in the target node that do not need to be synchronized; the regular expression is used to filter the resource change information and evaluate whether the resource change information needs to be synchronized with remote nodes; if so, the write module and lock queue are called. The writing module is used to generate a verification identifier for the resource change information and write the verification identifier and the resource change information into the lock queue. A lock queue is used to synchronize the verification identifier and the resource change information to the remote node, so that the remote node can perform resource synchronization based on the received resource change information after confirming that the received resource change information is transmitted correctly through the verification identifier.
8. A resource synchronization device, characterized in that, Including memory and processor; The memory is used to store programs; The processor is configured to execute the program to implement the various steps of the resource synchronization method as described in any one of claims 1-6.
9. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the resource synchronization method as described in any one of claims 1-6.