Storage node synchronization method and device, storage medium and electronic equipment
By storing configuration data in key-value pairs in a distributed storage system and updating it in real time using a listening mechanism, the problem of untimely synchronization of storage nodes is solved, achieving real-time synchronization of node configurations and system stability.
Patent Information
- Application Number
- CN202510925911.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-10-21
AI Technical Summary
In a distributed storage system, storage nodes fail to synchronize configurations in a timely manner, resulting in inconsistent system states and affecting system performance and reliability.
The configuration data of the storage nodes is saved to the database in a key-value pair structure, and the update information is immediately pushed to the listening node when the configuration data is updated through a listening mechanism to achieve real-time synchronization.
This ensures real-time synchronization of configuration data across nodes in a distributed storage system, reducing the risk of system failures and improving system reliability and consistency.
Smart Images

Figure CN120821776A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed storage technology, and in particular to a method and device for synchronizing storage nodes, a storage medium, and an electronic device. Background Art
[0002] In a distributed storage system, the configuration consistency of each storage node is a key factor in ensuring the reliability and stability of the entire system. With the rapid development of cloud computing and microservices architecture, distributed storage environments are becoming increasingly complex, and the number of storage nodes is constantly increasing, making it significantly more difficult to synchronize and manage the configuration of storage nodes.
[0003] Traditional configuration synchronization mechanisms often face latency and inconsistency issues, which in turn impact system performance and reliability. When using polling mode for configuration synchronization, storage nodes periodically request configuration information from a central server. Because configuration queries are performed at fixed intervals, when a configuration change occurs, the storage node may need to wait for the next query cycle to obtain the updated configuration. If a storage node experiences a configuration update during this waiting period, this can lead to inconsistent states across storage nodes, potentially causing system failures. These issues make it more difficult to ensure high availability and consistency in distributed storage systems.
[0004] It can be seen that the distributed storage system in the related art has the problem of untimely synchronization of storage nodes when configuration updates occur. Summary of the Invention
[0005] The present application provides a storage node synchronization method and device, a storage medium, and an electronic device to at least solve the problem in the related art that system anomalies are prone to occur during concurrent upgrades of distributed storage systems.
[0006] The present application provides a storage node synchronization method, which is applied to a distributed storage system, wherein the distributed storage system includes at least one storage node, and the method includes: saving the configuration data of the storage node to a database in a key-value pair structure, wherein the key part of the key-value pair structure is the configuration item of the configuration data, and the value part of the key-value pair structure is the configuration value of the configuration item; determining a target storage node from the storage nodes that needs to be synchronized with the storage node corresponding to the first key-value pair, and determining the target storage node as a listening node for the first key-value pair; when the listening node detects that the first configuration data saved in the first key-value pair in the database is updated, obtaining an updated second key-value pair, wherein the second configuration data saved in the second key-value pair represents the updated first configuration data; and synchronizing the configuration data of the target storage node according to the second configuration data.
[0007] The present application also provides a synchronization device for a storage node, comprising: a saving module, used to save the configuration data of the storage node to a database in a key-value pair structure, wherein the key part of the key-value pair structure is the configuration item of the configuration data, and the value part of the key-value pair structure is the configuration value of the configuration item; a determination module, used to determine, from the storage node, a target storage node that needs to be synchronized with the storage node corresponding to the first key-value pair, and determine the target storage node as a listening node for the first key-value pair; an obtaining module, used to obtain an updated second key-value pair when the listening node detects that the first configuration data saved in the first key-value pair in the database is updated, wherein the second configuration data saved in the second key-value pair represents the updated first configuration data; a synchronization module, used to synchronize the configuration data of the target storage node according to the second configuration data.
[0008] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned storage node synchronization methods when executing the computer program.
[0009] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned storage node synchronization methods are implemented.
[0010] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned storage node synchronization methods when executed by a processor.
[0011] Through this application, the configuration data of the storage nodes is stored in the database in the form of key-value pairs. When the data of the key-value pairs is updated, the update information is immediately pushed to the storage nodes that monitor the key-value pairs, so that the storage nodes that monitor the key-value pairs can immediately synchronize their configurations according to the updated information. Therefore, the technical problem of storage nodes in a distributed storage system not being able to synchronize in a timely manner when configuration updates occur can be solved, achieving the technical effect of ensuring real-time synchronization of the configurations of each node in the distributed storage system. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0013] Figure 1 This is a schematic diagram of an application scenario of a storage node synchronization method according to an embodiment of the present application;
[0014] Figure 2 This is a flow chart of an optional method for synchronizing a storage node according to an embodiment of the present application;
[0015] Figure 3 is a schematic diagram of an optional storage node synchronization method according to an embodiment of the present application;
[0016] Figure 4 is a flowchart of an optional storage node synchronization method according to an embodiment of the present application;
[0017] Figure 5 This is a structural block diagram of an optional storage node synchronization device according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0019] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0020] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0021] According to one aspect of an embodiment of the present application, a method for synchronizing a storage node is provided. Optionally, in this embodiment, the method for synchronizing a storage node may be applied to, but is not limited to, Figure 1 The hardware environment shown includes a terminal device 102 and a server 104. The server 104 can be connected to the terminal device 102 via a network and can be used to provide services (e.g., application services, etc.) for the terminal device 102 or a client installed on the terminal device 102. A database can be set on the server 104 or independently of the server 104 to provide data storage services for the server 104.
[0022] The aforementioned network may include, but is not limited to, at least one of the following: a wired network and a wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: a wide area network, a metropolitan area network, or a local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity) and Bluetooth. The terminal device 102 may be, but is not limited to, a PC (Personal Computer), a mobile phone, a tablet computer, etc. The server 104 may be, but is not limited to, a cloud server, a server cluster, or other server types.
[0023] The storage node synchronization method of the embodiment of the present application can be executed by the server 104, or by the terminal device 102, or jointly by the server 104 and the terminal device 102. The storage node synchronization method of the embodiment of the present application can also be executed by the client installed on the terminal device 102.
[0024] Taking the example of the storage node synchronization method in this embodiment being executed by the terminal device 102, here, the terminal device 102 can be a physical host, and the storage node synchronization method in this embodiment is applied to the physical host. The memory that can be called by the physical host is divided into multiple memory levels, and one memory level of the multiple memory levels contains at least one type of memory, and the multiple memory levels include a first memory level corresponding to the physical memory of the physical host. Here, the physical host can be enterprise-level servers, cluster servers, office computers, embedded devices, and other physical devices that can serve as the underlying hardware support in a virtualized environment. Physical memory refers to the physical memory module that is directly and closely connected to the host hardware and is the core and foundation of the memory architecture. Physical memory is typically composed of dynamic random access memory (DRAM), which has extremely fast read and write speeds and can respond to processor memory access requests with nanosecond response times. This makes physical memory suitable for hosting the core code of the virtual machine operating system, frequently called system function libraries, and critical process data running at high speeds. For example, during the initial startup of a virtual machine, the operating system kernel needs to quickly load and initialize various hardware drivers and establish a basic system operating environment. At this time, physical memory can complete data read and write operations with extremely high efficiency, ensuring that the virtual machine can start quickly and stably. During the operation of the virtual machine, application components with extremely demanding memory read and write performance, such as the transaction processing module of the database management system and the real-time rendering engine, also rely on physical memory to ensure their efficient operation, thereby maintaining the smoothness and responsiveness of the entire virtual machine system.
[0025] Figure 2 FIG. 1 is a flow chart of an optional method for synchronizing storage nodes according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:
[0026] Step S202: Save the configuration data of the storage node to the database in a key-value pair structure, wherein the key portion of the key-value pair structure is the configuration item of the configuration data, and the value portion of the key-value pair structure is the configuration value of the configuration item;
[0027] Optionally, in the above step S202, key-value pairs can be stored in, for example, an etcd database. The etcd database is a distributed key-value storage database. In etcd, data is stored in the form of key-value pairs, and users can easily read, write and monitor data changes.
[0028] Step S204: determining a target storage node that needs to be synchronized with the storage node corresponding to the first key-value pair from the storage nodes, and determining the target storage node as a listening node for the first key-value pair;
[0029] Optionally, in the above step S204, there may be multiple configuration items in the target storage node, and the target storage node may monitor multiple key-value pairs to determine synchronized configuration data for different configuration items.
[0030] Step S206: When the monitoring node detects that the first configuration data stored in the first key-value pair in the database is updated, an updated second key-value pair is obtained, wherein the second configuration data stored in the second key-value pair represents the updated first configuration data;
[0031] Step S208: Synchronize the configuration data of the target storage node according to the second configuration data.
[0032] Through the embodiments provided by this application, the configuration data of the storage nodes is stored in the database in the form of key-value pairs. When the data of the key-value pairs is updated, the updated information is immediately pushed to the storage nodes that monitor the key-value pairs, so that the storage nodes that monitor the key-value pairs can immediately synchronize their configurations according to the updated information. Therefore, the technical problem of storage nodes in a distributed storage system not being able to synchronize in a timely manner when configuration updates occur can be solved, achieving the technical effect of ensuring real-time synchronization of the configurations of each node in the distributed storage system.
[0033] In an exemplary embodiment, the configuration data of the storage node is saved to the database in a key-value pair structure, including: determining the node identifier of each storage node, wherein the node identifier is unique; grouping each storage node and determining the group identifier corresponding to each storage node, wherein the group identifier is unique; determining the name of the configuration item included in each storage node; determining the key of the key-value pair based on the group identifier, the node identifier and the configuration item name, and determining the value of the key-value pair based on the configuration value of the configuration item.
[0034] Optionally, in the above embodiment, for example, the distributed storage system includes node 1 and node 2, node 1 and node 2 belong to the same group, the group identifier is config, the node identifier of node 1 is node1, the node identifier of node 2 is node2, node 1 includes configuration item A, the configuration item name of configuration item A is settingA, and the configuration value is value1, node 2 includes configuration item B, the configuration item name of configuration item B is settingB, and the configuration value is value2, then the key-value pair structure corresponding to configuration item A is [config / node1 / settingA, value1], and the key-value pair structure corresponding to configuration item B is [config / node1 / settingB, value2].
[0035] Through the above embodiment, the configuration information of each node can be centrally stored in the etcd database. These configuration information are saved in the form of key-value pairs to ensure that they can be quickly read and modified, and facilitate unified management and access.
[0036] In an exemplary embodiment, determining the target storage node as a listening node for the first key-value pair includes: registering a listening component for the target storage node, wherein the listening component is used to listen to the key-value pairs of the database; determining the listening data and listening events of the listening component, wherein the listening data includes the group identifier of the listening, the storage node of the listening, and the configuration items of the listening, and the listening events include the creation of the key-value pair, the update of the key-value pair, and the deletion of the key-value pair.
[0037] Optionally, in the above embodiment, through the monitoring mechanism of the monitoring component, it is possible to monitor key-value pairs in a specific range, and specific monitoring events can also be set. When the monitored configuration item changes, the etcd database will automatically push the change information of the configuration item to all storage nodes that subscribe to the configuration item, ensuring that the relevant storage nodes can synchronize the configuration data in a timely manner.
[0038] Through the above embodiment, a key-value pair to be monitored can be set separately for each storage node, and multiple key-value pairs can be monitored. The granularity of monitoring can be further refined, thereby realizing the synchronization process of complex configuration relationships between different storage nodes, and the timeliness of synchronization can be guaranteed through the monitoring mechanism.
[0039] In an exemplary embodiment, synchronizing the configuration data of the target storage node according to the second configuration data includes: verifying the second configuration data according to a preset verification rule to obtain a verification result; and when it is determined that the verification result indicates that the verification has passed, synchronizing the configuration of the target storage node according to the second configuration data.
[0040] Optionally, in the above embodiment, the storage node will first perform configuration verification before applying the new configuration to ensure that the configuration will not cause system instability or failure. Only after the verification is passed will the new configuration be officially applied.
[0041] Through the above embodiments, the rationality of the configuration data can be guaranteed, and the situation in which system failures or errors due to incorrect configuration data are avoided.
[0042] In an exemplary embodiment, after synchronizing the configuration data of the target storage node according to the second configuration data, the method further includes: determining a synchronization result of synchronizing the configuration data of the target storage node according to the second configuration data; when it is determined that the synchronization result indicates that the configuration data of the target storage node is successfully synchronized, updating the key-value pairs corresponding to the configuration data of the target storage node that is successfully synchronized in the database; when it is determined that the synchronization result indicates that the configuration data of the target storage node fails to synchronize, taking the target storage node offline.
[0043] Optionally, in the above embodiment, after a storage node successfully applies a new configuration, it will provide feedback to the etcd database. Upon receiving the feedback, the etcd database will update the key-value pairs corresponding to the storage node's configuration items in the database, ensuring that the data recorded in the database is real-time and accurate.
[0044] In an optional embodiment, after successfully applying the new configuration, the storage node can further record health data of the storage node, such as application status, error information, etc. The health data is then fed back to the etcd database, which can monitor the overall health of the system through the health data to ensure that all nodes are operating normally.
[0045] In an exemplary embodiment, the method also includes: determining a first state of the target storage node before synchronization and a second state of the target storage node after synchronization; determining an updated configuration item of the target storage node and an update time corresponding to the updated configuration item, determining a first configuration value of the updated configuration item before the update and a second configuration value of the updated configuration item after the update; and saving the updated configuration item, update time, first state, first configuration, second state and second configuration to a log file of the target storage node.
[0046] Optionally, in the above embodiment, all configuration changes and node status data are recorded in a log file. The information recorded in the log file includes the timestamp of the configuration change, the configuration item, and the values before and after the change.
[0047] Recording log data facilitates data tracing and auditing when problems arise. Regular log audits can also help identify potential issues and optimize configuration management processes.
[0048] In an exemplary embodiment, after the target storage node is taken offline, the method further includes: repairing the target storage node, and when it is determined that the target storage node has been repaired, obtaining newly updated data from the target log file, wherein the target log file represents the log file corresponding to the storage node corresponding to the first key-value pair, and the newly updated data represents the updated data newly recorded after the target storage node is taken offline for the key-value pair monitored by the monitoring component; and synchronizing the configuration data of the target storage node according to the newly updated data.
[0049] Optionally, in the above embodiment, the offline storage node needs to ensure that the configuration of the node is consistent with other online nodes when it comes back online. For example, node A monitors multiple configuration items of node B. During the period when node A is offline, node B has multiple configuration updates. Then, when node A comes online, it can find all new update records of node B during the offline period by querying the log file of node B. Then, the update records of the configuration items monitored by node A can be determined to determine the current configuration data of node A. After synchronizing the configuration data of node A, it can go back online.
[0050] Through the above embodiments, configuration data can be centrally managed, changes in configuration data can be monitored, and automatic synchronization can be performed to ensure configuration consistency of each node, thereby reducing potential risks of the distributed storage system caused by untimely synchronization of node configurations.
[0051] The following describes an optional method for synchronizing storage nodes according to an embodiment of the present application in conjunction with an optional embodiment. In an optional embodiment, Figure 3 As shown, the synchronization method of the storage node can be implemented by cooperating with the following module structure:
[0052] The data storage module is used to configure the data format and store the configuration information of each storage node in the etcd database in the form of key-value pairs.
[0053] The change monitoring module uses the monitoring subscription mechanism to monitor configuration items stored in etcd. Register a monitoring key through etcd's monitoring subscription mechanism.
[0054] When the etcd database changes and the change monitoring module detects a change in a configuration item, the etcd database automatically pushes the relevant information to all storage nodes that subscribe to the configuration item, ensuring that each storage node can respond to the configuration change in a timely manner.
[0055] The synchronization update module, upon receiving configuration change signals pushed by the etcd database, parses the received change information and retrieves the updated configuration data. It then automatically updates the local configuration of the relevant storage nodes based on the latest configuration data. Before applying the new configuration, the storage nodes can perform a series of validation operations to ensure that the new configuration works properly without introducing errors.
[0056] After each storage node successfully applies a new configuration, it sends feedback to the etcd database through the status feedback module. Upon receiving this feedback, the etcd database updates the key-value pairs corresponding to the storage node's configuration item in the database, ensuring that the data recorded in the database is real-time and accurate. Furthermore, this feedback data can also include health data about the storage node, such as application status and error messages. The etcd database uses this health data to monitor the overall health of the system and ensure that all nodes are operating normally.
[0057] The logging module records all configuration changes and node status data in log files. Information recorded in the log files includes the timestamp of the configuration change, the configuration item, and the values before and after the change. Logging this data facilitates subsequent data tracing and auditing when issues arise. Regular log audits can also help identify potential issues and optimize configuration management processes.
[0058] In an optional embodiment, the flowchart of the storage node synchronization method of the embodiment of the present application is as follows: Figure 4 As shown, the specific steps include:
[0059] Step S401: The storage node starts.
[0060] Step S402: Load the initial configuration of the node from the etcd database.
[0061] Step S403: Register a monitoring component for the storage node and configure monitoring data and monitoring events. The monitoring data includes the monitored group identifier, the monitored storage node, and the monitored configuration items. The monitoring events include the creation, update, and deletion of key-value pairs.
[0062] Step S404: monitoring a configuration change.
[0063] Step S405: the etcd database pushes the change information to the storage node that has subscribed to the configuration item.
[0064] Step S406: After receiving the change information, the configuration node parses the new configuration.
[0065] Step S407: Verify the validity of the new configuration to ensure that the new configuration can work normally without introducing errors.
[0066] Step S408: Update the local configuration of the storage node and feed back the update result to the etcd database.
[0067] Step S409: Obtain the node status data and feed it back to the etcd database.
[0068] Step S410: After receiving the update result, the etcd database updates the key-value pair data corresponding to the configuration items updated by the storage node, and monitors the overall health status of the system based on the node status data to ensure that all storage nodes are operating normally.
[0069] Step S411: The etcd database records all configuration change information and node status data in a log file.
[0070] Through the above examples, the etcd database's monitoring and subscription mechanism is utilized to achieve efficient, real-time synchronization of configurations across storage nodes. By centrally storing configuration data, monitoring changes in real time, automatically updating configurations, and providing verification and feedback, the efficiency of configuration management in distributed storage environments is significantly improved, addressing the latency issues inherent in traditional configuration synchronization methods.
[0071] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (for example, read-only memory (ROM) / random access memory (RAM), a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0072] According to another aspect of the embodiments of the present application, a synchronization device for a storage node is also provided, which can be used to implement the synchronization method for the storage node provided in the above embodiments, and will not be repeated hereafter. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation by hardware, or a combination of software and hardware, is also possible and contemplated.
[0073] Figure 5This is a structural block diagram of an optional storage node synchronization device according to an embodiment of the present application, such as Figure 5 As shown in , the synchronization device of the storage node includes:
[0074] A saving module 52 is configured to save the configuration data of the storage node to a database in a key-value pair structure, wherein the key portion of the key-value pair structure is a configuration item of the configuration data, and the value portion of the key-value pair structure is a configuration value of the configuration item;
[0075] A determination module 54 is configured to determine, from the storage nodes, a target storage node that needs to be synchronized with the storage node corresponding to the first key-value pair, and determine the target storage node as a listening node for the first key-value pair;
[0076] an obtaining module 56 for obtaining an updated second key-value pair when the monitoring node detects that the first configuration data stored in the first key-value pair in the database is updated, wherein the second configuration data stored in the second key-value pair represents the updated first configuration data;
[0077] The synchronization module 58 is configured to synchronize the configuration data of the target storage node according to the second configuration data.
[0078] Through the embodiments provided by this application, the configuration data of the storage nodes is stored in the database in the form of key-value pairs. When the data of the key-value pairs is updated, the updated information is immediately pushed to the storage nodes that monitor the key-value pairs, so that the storage nodes that monitor the key-value pairs can immediately synchronize their configurations according to the updated information. Therefore, the technical problem of storage nodes in a distributed storage system not being able to synchronize in a timely manner when configuration updates occur can be solved, achieving the technical effect of ensuring real-time synchronization of the configurations of each node in the distributed storage system.
[0079] In an exemplary embodiment, the above-mentioned saving module 52 is also used to determine the node identifier of each storage node, wherein the node identifier is unique; group each storage node to determine the group identifier corresponding to each storage node, wherein the group identifier is unique; determine the name of the configuration item included in each storage node; determine the key of the key-value pair based on the group identifier, the node identifier and the configuration item name, and determine the value of the key-value pair based on the configuration value of the configuration item.
[0080] In an exemplary embodiment, the above-mentioned determination module 54 is also used to register a monitoring component for the target storage node, wherein the monitoring component is used to monitor the key-value pairs of the database; determine the monitoring data and monitoring events of the monitoring component, the monitoring data includes the monitored group identifier, the monitored storage node, and the monitored configuration items, and the monitoring events include the creation of key-value pairs, the update of key-value pairs, and the deletion of key-value pairs.
[0081] In an exemplary embodiment, the synchronization module 58 is further configured to verify the second configuration data according to a preset verification rule to obtain a verification result; if the verification result indicates that the verification has passed, the target storage node is configured and synchronized according to the second configuration data.
[0082] In an exemplary embodiment, the above-mentioned synchronization module 58 is also used to determine the synchronization result of synchronizing the configuration data of the target storage node according to the second configuration data; when it is determined that the synchronization result indicates that the configuration data of the target storage node is successfully synchronized, the corresponding key-value pairs of the configuration data successfully synchronized with the target storage node in the database are updated; when it is determined that the synchronization result indicates that the configuration data synchronization of the target storage node fails, the target storage node is taken offline.
[0083] In an exemplary embodiment, the above-mentioned synchronization module 58 is also used to determine the first state of the target storage node before synchronization and the second state of the target storage node after synchronization; determine the updated configuration items of the target storage node and the update time corresponding to the updated configuration items, determine the first configuration value of the updated configuration items before the update and the second configuration value of the updated configuration items after the update; save the updated configuration items, update time, first state, first configuration, second state and second configuration to the log file of the target storage node.
[0084] In an exemplary embodiment, the above-mentioned synchronization module 58 is also used to repair the target storage node. When it is determined that the target storage node has been repaired, the newly updated data is obtained from the target log file, wherein the target log file represents the log file corresponding to the storage node corresponding to the first key-value pair, and the newly updated data represents the key-value pair monitored by the monitoring component. The newly recorded update data after the target storage node goes offline; the configuration data of the target storage node is synchronized according to the newly updated data.
[0085] For the description of the features in the embodiment corresponding to the synchronization device of the storage node, please refer to the relevant description of the embodiment corresponding to the synchronization method of the storage node, which will not be repeated here.
[0086] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned storage node synchronization method embodiments.
[0087] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned storage node synchronization method embodiments when running.
[0088] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0089] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned storage node synchronization method embodiments are implemented.
[0090] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, implementing the steps of any of the above-mentioned storage node synchronization method embodiments.
[0091] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0092] The above is a detailed introduction to the method and device, storage medium and electronic device of a distributed storage system provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A storage node synchronization method, applied to a distributed storage system, characterized in that: The distributed storage system includes at least one storage node, including: Saving the configuration data of the storage node to the database in a key-value pair structure, wherein the key portion of the key-value pair structure is the configuration item of the configuration data, and the value portion of the key-value pair structure is the configuration value of the configuration item; Determine a target storage node from the storage nodes that needs to be synchronized with the storage node corresponding to the first key-value pair, and determine the target storage node as a listening node for the first key-value pair; When the listening node detects that the first configuration data stored in the first key-value pair in the database is updated, obtaining an updated second key-value pair, wherein the second configuration data stored in the second key-value pair represents the updated first configuration data; The configuration data of the target storage node is synchronized according to the second configuration data.
2. The method for synchronizing a storage node according to claim 1, wherein: Save the configuration data of the storage node to the database in a key-value pair structure, including: Determine a node identifier for each storage node, wherein the node identifier is unique; Grouping each storage node and determining a group identifier corresponding to each storage node, wherein the group identifier is unique; Determining the configuration item names included in each storage node; The key of the key-value pair is determined according to the group identifier, the node identifier, and the configuration item name, and the value of the key-value pair is determined according to the configuration value of the configuration item.
3. The method for synchronizing a storage node according to claim 1, wherein: Determining the target storage node as a listening node for the first key-value pair includes: registering a monitoring component for the target storage node, wherein the monitoring component is used to monitor the key-value pairs of the database; Determine the monitoring data and monitoring events of the monitoring component, wherein the monitoring data includes the monitored group identifier, the monitored storage node, and the monitored configuration item, and the monitoring events include the creation of a key-value pair, the update of a key-value pair, and the deletion of a key-value pair.
4. The method for synchronizing a storage node according to claim 1, wherein: Synchronizing the configuration data of the target storage node according to the second configuration data includes: Verifying the second configuration data according to a preset verification rule to obtain a verification result; If it is determined that the verification result indicates that the verification is passed, configuration synchronization is performed on the target storage node according to the second configuration data.
5. The method for synchronizing a storage node according to claim 1, wherein: After synchronizing the configuration data of the target storage node according to the second configuration data, The method further comprises: determining a synchronization result of synchronizing the configuration data of the target storage node according to the second configuration data; In a case where it is determined that the synchronization result indicates that the configuration data of the target storage node is successfully synchronized, updating the key-value pair corresponding to the configuration data of the target storage node that is successfully synchronized in the database; If it is determined that the synchronization result indicates that the configuration data synchronization of the target storage node has failed, the target storage node is taken offline.
6. The method for synchronizing a storage node according to claim 5, wherein: The method further comprises: Determining a first state of the target storage node before synchronization and a second state of the target storage node after synchronization; Determining an updated configuration item of the target storage node and an update time corresponding to the updated configuration item, and determining a first configuration value of the updated configuration item before the update and a second configuration value of the updated configuration item after the update; The updated configuration item, the update time, the first state, the first configuration, the second state, and the second configuration are saved to a log file of the target storage node.
7. The method for synchronizing a storage node according to claim 5, wherein: After taking the target storage node offline, the method further includes: Repairing the target storage node, and when it is determined that the target storage node has been repaired, obtaining new update data from a target log file, wherein the target log file represents a log file corresponding to the storage node corresponding to the first key-value pair, and the new update data represents update data newly recorded for the key-value pair monitored by the monitoring component after the target storage node goes offline; The configuration data of the target storage node is synchronized according to the newly added updated data.
8. A synchronization device for a storage node, characterized in that: include: A saving module, configured to save the configuration data of the storage node to a database in a key-value pair structure, wherein the key portion of the key-value pair structure is a configuration item of the configuration data, and the value portion of the key-value pair structure is a configuration value of the configuration item; a determination module, configured to determine, from the storage nodes, a target storage node that needs to be synchronized with the storage node corresponding to the first key-value pair, and determine the target storage node as a listening node for the first key-value pair; an obtaining module, configured to obtain an updated second key-value pair when the monitoring node detects that the first configuration data stored in the first key-value pair in the database is updated, wherein the second configuration data stored in the second key-value pair represents the updated first configuration data; A synchronization module is configured to synchronize the configuration data of the target storage node according to the second configuration data.
9. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the storage node synchronization method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the storage node synchronization method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Data synchronization method of distributed storage nodes and related device
CN110515907A
Inter-node data synchronization method, data synchronization device and data synchronization equipment
CN110941665A
File processing method, device and system
CN115842803A
Hyper-converged system distributed storage cluster management method and device and medium
CN118277488A
Event-driven identity data synchronization method
CN119089071A