Configuration synchronization method and device of storage system, electronic equipment and storage medium
By registering a listening task when the process starts and utilizing the file system event listening mechanism, event-driven fine-grained configuration synchronization is achieved, solving the problems of service interruption caused by configuration update delays and single points of failure, and improving system response speed and service continuity.
Patent Information
- Application Number
- CN202511247166.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2025-11-21
AI Technical Summary
Existing configuration synchronization methods, such as polling or centralized configuration centers, can lead to configuration update delays, system response lags, or service interruptions due to single points of failure.
When the process starts, it registers a listening task with the monitoring directory, declares the target configuration operation, captures change events based on the file system event listening mechanism, parses the event notification file, and only pulls incremental configuration data and performs dynamic loading when it matches the target configuration operation.
Reduce configuration update latency, improve system response speed, avoid single point of failure risk, and ensure service continuity.
Smart Images

Figure CN120994628A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for configuring and synchronizing storage systems. Background Technology
[0002] File storage systems, as a crucial infrastructure of modern data centers and cloud computing platforms, are widely used in enterprise-level data management, large-scale distributed storage, and high-concurrency access scenarios. Among related technologies, a basic framework for configuration management is constructed through polling mechanisms, centralized configuration centers, and collaborative inter-process communication.
[0003] Existing configuration synchronization methods directly use polling mechanisms or centralized configuration centers for updates, without introducing event-driven models and fine-grained subscription mechanisms. This may lead to configuration update delays, system response lags, or service interruptions due to single points of failure. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, and storage medium for synchronizing the configuration of a storage system, in order to at least solve the problems of configuration update delay, system response lag, or service interruption caused by a single point of failure in the related art.
[0005] This application provides a configuration synchronization method for a storage system, including:
[0006] When the process starts, it registers a listening task with the monitoring directory and declares the target configuration operations it subscribes to.
[0007] In response to database or configuration file updates, an event notification file containing configuration operations and write values is atomically written to the monitoring directory;
[0008] The change events of the monitored directory are captured based on the file system event listening mechanism, and the key configuration operation fields in the event notification file are parsed to determine whether they are the target configuration operations.
[0009] In response to the target configuration operation, the corresponding incremental configuration data is retrieved from the database or configuration file according to the target configuration operation type and dynamically loaded, and the status file is deleted after the event processing is completed.
[0010] Optionally, when the process starts, it registers a listening task with the monitoring directory and declares the target configuration operations it subscribes to, including:
[0011] Create a status file; wherein the status file contains a list of target configuration operations declared by the process and the corresponding priority identifiers.
[0012] Optionally, the atomic writing of an event notification file containing configuration operations and write values to the monitoring directory in response to database or configuration file updates includes:
[0013] The event notification file is encapsulated based on a preset format; wherein, the fields of the configuration operation are of string type, and the write value field is an array that can contain multiple configuration items or a string of a single configuration item;
[0014] The format of the event notification file is verified based on serialization validation.
[0015] Optionally, the step of capturing change events of the monitored directory based on the file system event listening mechanism, parsing key configuration operation fields in the event notification file, and determining whether it is the target configuration operation includes:
[0016] Pattern matching is performed based on a regular expression engine; wherein, the pattern matching includes matching of multi-level configuration operation declarations.
[0017] Optionally, the step of retrieving corresponding incremental configuration data from a database or configuration file and performing dynamic loading in response to the target configuration operation includes:
[0018] When the write value field in the event notification file contains multiple configuration items, obtain the specific identifiers of the multiple configuration items;
[0019] For each configuration item identifier, retrieve the corresponding incremental data from the database or configuration file;
[0020] Upon completion of incremental data loading for each of the aforementioned configuration items, a basic validity check is performed.
[0021] When at least one configuration item fails to be validated, write the loading error log of the failed configuration item to the monitoring directory.
[0022] Optionally, deleting the status file after event processing is completed includes:
[0023] Record the process exit status and write the exit status to the global log file in the monitoring directory;
[0024] The deletion operation is synchronously notified to each process through the file system event notification mechanism, updating the listening status of each process.
[0025] Optionally, the method further includes:
[0026] The event notification file contains a digital signature field, and the registration process uses a preset public key to verify the validity of the signature;
[0027] In response to verification failure, an error log is written to the monitoring directory and an alarm is triggered.
[0028] This application also provides a configuration synchronization device for a storage system, comprising:
[0029] The registration unit is used to register listening tasks with the monitoring directory when a process starts, and declares the target configuration operations it subscribes to.
[0030] The update unit is used to atomically write an event notification file containing configuration operations and write values to the monitoring directory in response to database or configuration file updates;
[0031] The judgment unit is used to capture change events of the monitored directory based on the file system event listening mechanism, parse the key configuration operation fields in the event notification file, and determine whether it is the target configuration operation.
[0032] An execution unit is configured to, in response to the target configuration operation, retrieve the corresponding incremental configuration data from the database or configuration file according to the target configuration operation type and perform dynamic loading, and delete the status file after the event processing is completed.
[0033] Optionally, the registration unit is further configured to:
[0034] Create a status file; wherein the status file contains a list of target configuration operations declared by the process and the corresponding priority identifiers.
[0035] Optionally, the update unit is further configured to:
[0036] The event notification file is encapsulated based on a preset format; wherein, the fields of the configuration operation are of string type, and the write value field is an array that can contain multiple configuration items or a string of a single configuration item;
[0037] The format of the event notification file is verified based on serialization validation.
[0038] Optionally, the determining unit is further configured to:
[0039] Pattern matching is performed based on a regular expression engine; wherein, the pattern matching includes matching of multi-level configuration operation declarations.
[0040] Optionally, the execution unit is further configured to:
[0041] When the write value field in the event notification file contains multiple configuration items, obtain the specific identifiers of the multiple configuration items;
[0042] For each configuration item identifier, retrieve the corresponding incremental data from the database or configuration file;
[0043] Upon completion of incremental data loading for each of the aforementioned configuration items, a basic validity check is performed.
[0044] When at least one configuration item fails to be validated, write the loading error log of the failed configuration item to the monitoring directory.
[0045] Optionally, the execution unit is further configured to:
[0046] Record the process exit status and write the exit status to the global log file in the monitoring directory;
[0047] The deletion operation is synchronously notified to each process through the file system event notification mechanism, updating the listening status of each process.
[0048] Optionally, the device further includes:
[0049] The verification unit is used to verify the validity of the signature by using a preset public key when the event notification file contains a digital signature field.
[0050] The write unit is used to write error logs to the monitoring directory and trigger alarms in response to verification failures.
[0051] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the configuration synchronization method of any of the above-described storage systems when executing the computer program.
[0052] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the configuration synchronization method of any of the above-described storage systems.
[0053] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described storage system configuration synchronization methods.
[0054] This application achieves fine-grained configuration synchronization based on event-driven mechanisms by registering a listening task with the monitoring directory and declaring the target configuration operations to be subscribed to when the process starts. It captures changes in event notification files by leveraging the file system event listening mechanism and pulls incremental configuration data and loads it dynamically only when matching the target configuration operation. This is achieved instead of using polling or a centralized configuration center. Therefore, it can solve the technical problems of configuration update delay, system response lag, and potential service interruption due to single point of failure caused by the use of polling mechanisms or centralized configuration centers without the introduction of event-driven mechanisms and fine-grained subscriptions in the prior art. It achieves the technical effects of reducing configuration update delay, improving system response speed, avoiding single point of failure risks, and ensuring service continuity. Attached Figure Description
[0055] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0056] Figure 1 A schematic flowchart illustrating a configuration synchronization method for a storage system provided in an embodiment of this application;
[0057] Figure 2 A schematic diagram of the structure of a configuration synchronization device for a storage system provided in an embodiment of this application;
[0058] Figure 3 This is a schematic diagram of the configuration synchronization device for another storage system provided in an embodiment of this application. Detailed Implementation
[0059] 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 of ordinary skill in the art without creative effort are within the protection scope of this application.
[0060] It should be noted that, in the description of this application, 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. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0061] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] The embodiments of this application provide a configuration synchronization method for a storage system. The method is described in detail below in conjunction with the execution flow of the configuration synchronization method for a storage system. Figure 1 This is a flowchart illustrating a configuration synchronization method for a storage system provided in an embodiment of this application.
[0063] like Figure 1 As shown, the method includes the following steps:
[0064] Step 101: When the process starts, it registers a listening task with the monitoring directory and declares the target configuration operations it subscribes to;
[0065] When registering a monitoring task, the process must explicitly declare the target configuration operations it is subscribing to. Target configuration operations refer to specific types of configuration changes that the process needs to monitor during runtime, such as adding user permissions, adjusting storage policies, and modifying access control rules—types of configuration operations closely related to the operation of the file storage system. The declaration of these target configuration operations must follow a unified format specification to ensure consistent recognition of configuration operation types among different processes within the system, avoiding missed or incorrect detection of configuration changes due to format differences.
[0066] By registering the monitoring task and declaring the target configuration operation at process startup, the process can precisely focus on the configuration change events it needs to handle during subsequent operation. This avoids indiscriminately processing all changes within the monitored directory, effectively reducing unnecessary resource consumption and improving the process's response efficiency to target configuration changes. This lays a crucial foundation for dynamic synchronization of configuration changes later on. Simultaneously, this advance declaration method allows the system to clearly understand the configuration requirements of each process, facilitating overall coordination of configuration management across the entire file storage system and ensuring the stability and efficiency of the overall system operation.
[0067] Step 102: In response to a database or configuration file update, atomically write an event notification file containing the configuration operation and the write value to the monitoring directory;
[0068] The event notification file must contain two core pieces of information: configuration operations and write values. The configuration operations are used to clarify the specific type of configuration change, such as "user storage quota adjustment" or "file sharing permission addition," to ensure that the subsequent monitoring process can accurately identify the change attributes. The write values are used to record the specific content after the configuration change, which may be the specific parameters of a single configuration item or the collection data of multiple related configuration items, providing a basis for the monitoring process to obtain accurate change information.
[0069] Crucially, the event notification file is written using an atomic operation. Atomicity means that the file creation, data writing, and storage confirmation processes are an inseparable whole, preventing issues such as partial file writing, incomplete data, or file corruption due to write interruptions. This approach effectively avoids configuration information chaos caused by file write anomalies during concurrent configuration updates across multiple processes, ensuring the integrity and validity of the event notification file in the monitoring directory. It provides a reliable data foundation for subsequent listening processes to capture and parse configuration change information, thereby ensuring the accuracy and stability of configuration synchronization throughout the entire file storage system.
[0070] Step 103: Capture change events of the monitored directory based on the file system event listening mechanism, parse the key configuration operation fields in the event notification file, and determine whether it is the target configuration operation;
[0071] After capturing a change event, the process needs to parse the event notification file that triggered the event, focusing on extracting key configuration operation fields. These key configuration operation fields are a core component of the event notification file, clearly identifying the specific operation type corresponding to the configuration change. Examples include file storage path adjustments, user access permission updates, and system caching policy modifications—operation categories closely related to the operation of the file storage system. The field content follows a pre-defined, unified format specification to ensure the accuracy and efficiency of the parsing process.
[0072] After parsing the key configuration operation fields, the process compares the operation type corresponding to that field with the target configuration operation declared at startup. This comparison strictly adheres to preset matching rules, verifying that each key configuration operation is completely consistent with the target configuration operation in its operation type definition, or falls within the scope of the target configuration operation. Through this process, the process can accurately identify whether the current change event is a configuration update it needs to process, effectively filtering out configuration changes irrelevant to its operation, avoiding wasted system resources from invalid data processing, and ensuring that the process only performs subsequent dynamic loading work for the target configuration operation, thus guaranteeing the accuracy and efficiency of file storage system configuration synchronization.
[0073] Step 104: In response to the target configuration operation, retrieve the corresponding incremental configuration data from the database or configuration file according to the target configuration operation type and perform dynamic loading, and delete the status file after the event processing is completed.
[0074] Once the system confirms through preliminary analysis that the captured configuration operation is the target configuration operation subscribed to by the process, it will initiate the corresponding incremental configuration data retrieval process based on the specific type of the target configuration operation. The type of the target configuration operation determines the source and scope of the data retrieval. If the target configuration operation involves changes to user basic information or other content closely related to the database, the incremental configuration data corresponding to that operation will be retrieved from the database. If the target configuration operation involves changes based on configuration files, such as adjustments to local system operating parameters, the incremental data will be extracted from the corresponding configuration file. Incremental configuration data refers to data that only includes the portion of the data involved in this configuration change, rather than the complete configuration dataset. This retrieval method can significantly reduce data transmission volume, lower system resource consumption, and improve data acquisition efficiency.
[0075] After successfully retrieving incremental configuration data, the system will immediately perform a dynamic loading operation. Dynamic loading refers to integrating incremental configuration data into the process's current runtime environment without interrupting normal process operation. This updates the process's internal runtime parameters and logical rules related to the configuration, ensuring that the process can carry out subsequent business processing based on the latest configuration information. This achieves hot updates of configuration changes, avoids service interruptions caused by configuration updates, and ensures the continuous and stable operation of the file storage system.
[0076] Once the dynamic loading of incremental configuration data is complete and the configuration changes have been successfully implemented, the system will delete the status file. The status file is generated when a process starts its registration and monitoring task; it identifies the process's monitoring status and subscription information. Deleting this file after event processing promptly releases the disk space and system resources occupied by the status file, preventing the accumulation of invalid files from impacting monitoring directory management and overall system efficiency. It also clearly reflects the completion status of the current event processing, providing a clean environment for subsequent configuration change events and further ensuring the orderly and efficient dynamic configuration synchronization process of the entire file storage system.
[0077] In some embodiments, the process registers a listening task with the monitoring directory upon startup, and declares the target configuration operations it subscribes to, including:
[0078] Create a status file; wherein the status file contains a list of target configuration operations declared by the process and the corresponding priority identifiers.
[0079] As an important identifier linking processes and monitoring directories, status files must be created in accordance with the atomic operation specifications of the file system. This ensures that in scenarios where multiple processes start concurrently, each process's status file can be generated independently, preventing file overwriting or data conflicts and guaranteeing the accuracy of subsequent configuration change monitoring and response.
[0080] The core content of the status file includes a list of target configuration operations declared by the process and priority indicators for each operation. The list of target configuration operations clearly outlines all configuration change types that the process needs to pay attention to during its operation. These types are closely related to the core functions of the file storage system, such as changes in user access permissions, configuration adjustments for storage node expansion, and updates to file backup strategies, ensuring that the process can accurately identify the configuration events that need to be responded to.
[0081] Priority identifiers provide a clear basis for the processing order when multiple target configuration operations are triggered simultaneously. Different target configuration operations have varying degrees of impact on the operation of the file storage system. For example, adjusting core parameters of storage nodes has a more critical impact on system stability and service continuity than minor adjustments to ordinary user permissions, and therefore will be assigned a higher priority identifier. When change events corresponding to multiple target configuration operations occur simultaneously, the process will process the higher-priority configuration operations first, and then process the lower-priority operations in sequence, based on the priority identifiers. This avoids imbalances in system resource allocation or delays in critical configuration updates caused by disordered processing order, further improving the orderliness and reliability of dynamic configuration synchronization in the file storage system.
[0082] Optionally, the atomic writing of an event notification file containing configuration operations and write values to the monitoring directory in response to database or configuration file updates includes:
[0083] The event notification file is encapsulated based on a preset format; wherein, the fields of the configuration operation are of string type, and the write value field is an array that can contain multiple configuration items or a string of a single configuration item;
[0084] The format of the event notification file is verified based on serialization validation.
[0085] Encapsulating event notification files using a preset format is fundamental to ensuring consistent file content and accurate identification by monitoring processes. The preset format is a system-defined, structured format suitable for transmitting configuration change information. Under this format specification, configuration operation fields are set to string type. String-type configuration operation fields clearly and explicitly describe the specific type of configuration change, such as identifying user permission configuration updates or storage policy parameter adjustments. Their concise and unambiguous expression facilitates quick reading and identification of the core attributes of configuration operations by different monitoring processes.
[0086] The write value field flexibly supports two data formats based on the actual needs of configuration changes: it can be an array containing multiple configuration items or a string representing a single configuration item. When a configuration update involves multiple related configuration items, the array-based write value field can orderly integrate these configuration items and completely transmit multiple sets of configuration change information; when the configuration update involves only a single configuration item, the string format of the single configuration item can simplify the data structure, reduce unnecessary redundancy, and improve data transmission and parsing efficiency.
[0087] After encapsulating the event notification file in the preset format, the file format must be validated based on serialization verification. Serialization verification is a process that uses specific algorithms and rules to check the data structure and format compliance of the encapsulated event notification file. This process verifies one by one whether the string format of the configuration operation fields conforms to the preset specifications, whether the data format (array or string) of the written value fields matches the type of configuration operation, and whether the overall structure of the file is complete, without missing or disordered elements. Through serialization verification, event notification files that do not meet the format requirements can be promptly identified and excluded, preventing such files from entering the monitoring directory and causing the listening process to fail to parse them, thereby affecting the normal progress of the configuration synchronization process. This ensures the smooth capture and processing of subsequent configuration changes from the data source.
[0088] Optionally, the step of capturing change events of the monitored directory based on the file system event listening mechanism, parsing key configuration operation fields in the event notification file, and determining whether it is the target configuration operation includes:
[0089] Pattern matching is performed based on a regular expression engine; wherein, the pattern matching includes matching of multi-level configuration operation declarations.
[0090] A regular expression engine is a tool with pattern recognition and string matching capabilities. It can quickly scan and compare character sequences in key configuration operation fields based on predefined regular expression rules. In practical applications, technicians will formulate corresponding regular expression patterns for various configuration operation types that may occur in file storage systems. For example, for configuration operations related to user permissions, regular expression rules covering operations such as "add user permissions," "modify user permissions," and "delete user permissions" can be constructed. After parsing the key configuration operation fields, the regular expression engine will automatically call these rules to perform matching operations, quickly determining whether the operation corresponding to the field conforms to the pattern characteristics of the target configuration operation.
[0091] Crucially, this pattern matching supports matching multi-level configuration operation declarations. Multi-level configuration operation declarations refer to configuration operation types with hierarchical divisions. For example, in a hierarchical structure of "storage node-partition-file permissions," there might be multi-level configuration operation declarations such as "storage node A-partition 1-file read permission enabled" and "storage node B-partition 2-file write permission restricted." The regular expression engine, through flexible rule design, can identify configuration operation fields containing multi-level information. For instance, by constructing regular expressions containing hierarchical delimiters and keywords, it can accurately match configuration operations under different hierarchical combinations. This multi-level matching capability allows the system to accurately locate target configuration operations in complex configuration systems, avoiding misjudgments caused by missing or confused hierarchical information. It ensures efficient and accurate identification of target configuration operations even in scenarios with numerous configuration operation types and complex hierarchical relationships, providing reliable support for the orderly advancement of subsequent configuration synchronization processes.
[0092] Optionally, the step of retrieving corresponding incremental configuration data from a database or configuration file and performing dynamic loading in response to the target configuration operation includes:
[0093] When the write value field in the event notification file contains multiple configuration items, obtain the specific identifiers of the multiple configuration items;
[0094] For each configuration item identifier, retrieve the corresponding incremental data from the database or configuration file;
[0095] Upon completion of incremental data loading for each of the aforementioned configuration items, a basic validity check is performed.
[0096] When at least one configuration item fails to be validated, write the loading error log of the failed configuration item to the monitoring directory.
[0097] The different situations of the written value fields in the event notification file need to be handled in a refined manner. In particular, when the written value field contains multiple configuration items, a multi-step operation is required to ensure the accuracy of configuration synchronization and the traceability of problems.
[0098] When the write value field in the event notification file contains multiple configuration items, the system first retrieves the specific identifiers of each configuration item. These identifiers uniquely distinguish each item; for example, in a user configuration scenario, the identifier might be a unique user number; in a storage partition configuration scenario, it might be the partition name or number. These specific identifiers accurately locate the storage location of each configuration item in the database or configuration file, providing a basis for subsequent targeted retrieval of incremental data and preventing data retrieval confusion or omissions.
[0099] After obtaining the specific identifiers of all configuration items, the system will retrieve the incremental data corresponding to each configuration item from the corresponding data source (database or configuration file). Incremental data refers to data containing only the updated content of the configuration item affected by this configuration change, not the complete data of the configuration item. This method of retrieving incremental data by identifier effectively reduces data transmission volume, lowers system resource consumption, and avoids processing delays caused by retrieving large amounts of data at once, ensuring that incremental data for each configuration item can be obtained quickly and accurately.
[0100] Once all incremental data for each configuration item has been retrieved and dynamic loading has begun, the system will automatically perform basic validity checks after all incremental data has been loaded. Basic validity checks primarily focus on the format compliance, content completeness, and compatibility with existing system configurations of the incremental data. For example, it checks whether the data format conforms to preset specifications, whether key fields are missing, whether data values are within a reasonable range, and whether the incremental data conflicts with other currently running system configurations. Through validity checks, potential problems in the incremental data can be identified in a timely manner, preventing invalid or erroneous configuration data from entering the system's operational flow and affecting the stability of the file storage system.
[0101] If at least one configuration item fails verification during the validity check process, the system will immediately write a loading error log containing information about the failed configuration item to the monitoring directory. The error log will record detailed information such as the specific identifier of the failed configuration item, the failed verification item, the reason for the failure, and the time the verification occurred. This information provides clear guidance for technical personnel to troubleshoot subsequent issues, helping to quickly locate the root cause of the fault and fix it. It also provides data support for system operation and maintenance management, ensuring the traceability of the configuration synchronization process even when problems occur, and reducing the impact of faults on the overall system operation.
[0102] Optionally, deleting the status file after event processing is completed includes:
[0103] Record the process exit status and write the exit status to the global log file in the monitoring directory;
[0104] The deletion operation is synchronously notified to each process through the file system event notification mechanism, updating the listening status of each process.
[0105] After an event is processed, the system first records the process's exit status. The process exit status is crucial information reflecting the outcome of the event processing, encompassing various scenarios such as successful event processing, partial configuration item loading errors that do not affect the overall process, and core configuration loading failure leading to event termination. This status information clearly presents the final running status of the process within the event processing cycle. After recording, the system writes the exit status to a global log file in the monitoring directory. The global log file is used to centrally store event processing records related to configuration synchronization across the entire file storage system. Writing the process exit status to this file provides complete data for subsequent system maintenance and troubleshooting. By reviewing the global log, technical personnel can quickly trace the processing and results of specific events and promptly locate potential problems.
[0106] After completing process exit status recording and log writing, the system executes the deletion operation of the status file. This deletion operation is synchronously notified to all processes in the system through the file system event notification mechanism. The file system event notification mechanism can transmit the status file deletion change as an event signal to all processes that have registered listening tasks in the monitoring directory in real time. Upon receiving the notification, each process immediately updates its own listening status, such as clearing the process listening record corresponding to the deleted status file, and adjusting the listening priority or scope for subsequent configuration change events. Through this cross-process synchronous notification, it is ensured that all processes are promptly aware of the status file deletion, avoiding missed or misheard configuration changes due to some processes not updating their listening status, or continued reliance on outdated status information. This ensures the consistency of the listening status of all processes in the entire file storage system and maintains the orderliness and stability of the configuration synchronization process.
[0107] Optionally, the method further includes:
[0108] The event notification file contains a digital signature field, and the registration process uses a preset public key to verify the validity of the signature;
[0109] In response to verification failure, an error log is written to the monitoring directory and an alarm is triggered.
[0110] The digital signature field is a unique piece of data generated based on an asymmetric encryption algorithm. Its generation process requires combining the original content of the event notification file with a dedicated private key. When generating the event notification file, the system first performs a hash operation on the core content, such as configuration operations and written values, to obtain a fixed-length hash value. This hash value is then encrypted using the private key, and the resulting encrypted data is the digital signature field, which is embedded in the file. This field acts like a "digital seal" for the event notification file, effectively proving the legitimacy of the file's origin and the integrity of its content, preventing unauthorized tampering during transmission or storage.
[0111] Upon capturing the event notification file, the registration process does not directly parse the configuration content. Instead, it first uses a pre-set public key to verify the validity of the digital signature field in the file. The public key is paired with the private key used to generate the signature and has the ability to decrypt data encrypted with the private key. During verification, the registration process first extracts the digital signature field from the file, decrypts it using the public key to obtain the original hash value, and simultaneously re-hashes the current content of the event notification file to obtain a new hash value. The two hash values are then compared. If they match, it indicates that the file source is legitimate and the content has not been tampered with, and the signature verification passes; if they do not match, the signature verification fails.
[0112] When digital signature verification fails, the registration process immediately writes an error log to the monitoring directory. The error log records detailed information about the verification failure, including the event notification file's identifier, the specific time of failure, public key information, and hash value comparison results. This information provides clear data support for subsequent technical personnel to troubleshoot the problem, facilitating quick identification of whether the verification failure was caused by file tampering, public key mismatch, or other reasons. Simultaneously, the system triggers an alarm mechanism. The alarm format can be configured according to actual needs, such as sending alarm information to the operations and maintenance management platform, triggering audible and visual alarms, or sending notification messages to designated operations and maintenance personnel. Timely alarms ensure that relevant personnel are aware of security risks immediately, enabling rapid intervention and preventing unauthorized or erroneous configuration information from entering the subsequent synchronization process, thus ensuring the security and stability of the file storage system's dynamic configuration synchronization.
[0113] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0114] Embodiments of this application also provide a configuration synchronization device for a storage system. Figure 2 This is a schematic diagram of the structure of a configuration synchronization device for a storage system provided in an embodiment of this application, as shown below. Figure 2 As shown, it includes:
[0115] Registration unit 21 is used to register a listening task with the monitoring directory when the process starts, and declare the target configuration operation it subscribes to.
[0116] Update unit 22 is used to atomically write an event notification file containing configuration operations and write values to the monitoring directory in response to database or configuration file updates;
[0117] Judgment unit 23 is used to capture change events of the monitored directory based on the file system event listening mechanism, parse the key configuration operation fields in the event notification file, and determine whether it is the target configuration operation;
[0118] Execution unit 24 is configured to, in response to the target configuration operation, retrieve the corresponding incremental configuration data from the database or configuration file according to the target configuration operation type and perform dynamic loading, and delete the status file after the event processing is completed.
[0119] Furthermore, in one possible implementation of this application embodiment, the registration unit 21 is further configured to:
[0120] Create a status file; wherein the status file contains a list of target configuration operations declared by the process and the corresponding priority identifiers.
[0121] Furthermore, in one possible implementation of this application embodiment, the updating unit 22 is further configured to:
[0122] The event notification file is encapsulated based on a preset format; wherein, the fields of the configuration operation are of string type, and the write value field is an array that can contain multiple configuration items or a string of a single configuration item;
[0123] The format of the event notification file is verified based on serialization validation.
[0124] Furthermore, in one possible implementation of this application embodiment, the determining unit 23 is further configured to:
[0125] Pattern matching is performed based on a regular expression engine; wherein, the pattern matching includes matching of multi-level configuration operation declarations.
[0126] Furthermore, in one possible implementation of this application embodiment, the execution unit 24 is further configured to:
[0127] When the write value field in the event notification file contains multiple configuration items, obtain the specific identifiers of the multiple configuration items;
[0128] For each configuration item identifier, retrieve the corresponding incremental data from the database or configuration file;
[0129] Upon completion of incremental data loading for each of the aforementioned configuration items, a basic validity check is performed.
[0130] When at least one configuration item fails to be validated, write the loading error log of the failed configuration item to the monitoring directory.
[0131] Furthermore, in one possible implementation of this application embodiment, the execution unit 24 is further configured to:
[0132] Record the process exit status and write the exit status to the global log file in the monitoring directory;
[0133] The deletion operation is synchronously notified to each process through the file system event notification mechanism, updating the listening status of each process.
[0134] Furthermore, in one possible implementation of the embodiments of this application, such as Figure 3 As shown, the device further includes:
[0135] Verification unit 25 is used to verify the validity of the signature by using a preset public key when the event notification file contains a digital signature field.
[0136] Write unit 26 is used to write an error log to the monitoring directory and trigger an alarm in response to verification failure.
[0137] For a description of the features in the embodiment corresponding to the configuration synchronization device of the storage system, please refer to the relevant description of the embodiment corresponding to the configuration synchronization method of the storage system, which will not be repeated here.
[0138] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above-described embodiments of the configuration synchronization method for a storage system.
[0139] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described storage system configuration synchronization method embodiments when it runs.
[0140] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0141] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described storage system configuration synchronization method embodiments.
[0142] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described storage system configuration synchronization method embodiments.
[0143] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can 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.
[0144] The foregoing has provided a detailed description of a configuration synchronization method, apparatus, electronic device, and storage medium for a storage system provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A configuration synchronization method for a storage system, characterized in that, include: When the process starts, it registers a listening task with the monitoring directory and declares the target configuration operations it subscribes to. In response to database or configuration file updates, an event notification file containing configuration operations and write values is atomically written to the monitoring directory; The change events of the monitored directory are captured based on the file system event listening mechanism, and the key configuration operation fields in the event notification file are parsed to determine whether they are the target configuration operations. In response to the target configuration operation, the corresponding incremental configuration data is retrieved from the database or configuration file according to the target configuration operation type and dynamically loaded, and the status file is deleted after the event processing is completed.
2. The method according to claim 1, characterized in that, When the process starts, it registers a listening task with the monitoring directory and declares the target configuration operations it subscribes to, including: Create a status file; wherein the status file contains a list of target configuration operations declared by the process and the corresponding priority identifiers.
3. The method according to claim 1, characterized in that, The atomic writing of an event notification file containing configuration operations and write values to the monitoring directory in response to database or configuration file updates includes: The event notification file is encapsulated based on a preset format; wherein, the fields of the configuration operation are of string type, and the write value field is an array that can contain multiple configuration items or a string of a single configuration item; The format of the event notification file is verified based on serialization validation.
4. The method according to claim 1, characterized in that, The method of capturing change events in the monitored directory based on the file system event listening mechanism, parsing key configuration operation fields in the event notification file, and determining whether it is the target configuration operation includes: Pattern matching is performed based on a regular expression engine; wherein, the pattern matching includes matching of multi-level configuration operation declarations.
5. The method according to claim 1, characterized in that, The step of retrieving corresponding incremental configuration data from the database or configuration file and performing dynamic loading in response to the target configuration operation type includes: When the write value field in the event notification file contains multiple configuration items, obtain the specific identifiers of the multiple configuration items; For each configuration item identifier, retrieve the corresponding incremental data from the database or configuration file; Upon completion of incremental data loading for each of the aforementioned configuration items, a basic validity check is performed. When at least one configuration item fails to be validated, write the loading error log of the failed configuration item to the monitoring directory.
6. The method according to claim 1, characterized in that, The deletion of the status file after event handling is completed includes: Record the process exit status and write the exit status to the global log file in the monitoring directory; The deletion operation is synchronously notified to each process through the file system event notification mechanism, updating the listening status of each process.
7. The method according to claim 1, characterized in that, The method further includes: The event notification file contains a digital signature field, and the registration process uses a preset public key to verify the validity of the signature; In response to verification failure, an error log is written to the monitoring directory and an alarm is triggered.
8. A configuration synchronization device for a storage system, characterized in that, include: The registration unit is used to register listening tasks with the monitoring directory when a process starts, and declares the target configuration operations it subscribes to. The update unit is used to atomically write an event notification file containing configuration operations and write values to the monitoring directory in response to database or configuration file updates; The judgment unit is used to capture change events of the monitored directory based on the file system event listening mechanism, parse the key configuration operation fields in the event notification file, and determine whether it is the target configuration operation. An execution unit is configured to, in response to the target configuration operation, retrieve the corresponding incremental configuration data from the database or configuration file according to the target configuration operation type and perform dynamic loading, and delete the status file after the event processing is completed.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the configuration synchronization method for the storage system as described in 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, it implements the steps of the configuration synchronization method for the storage system as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method for notifying configuration change of embedded equipment
CN111857798A
Method, system and equipment for monitoring landing of Linux specific directory file and storage medium
CN116150109A
Listener event consistency points
US9418097B1