Data synchronization method, device and equipment

By creating a target mount point in the BMC system and mounting the partition of the backup storage device, combining the block device interface and priority policy, efficient and secure data synchronization between the main and backup FLASH is achieved, and the system complexity in the existing technology is solved Sex and risk issues.

CN119149293APending Publication Date: 2024-12-17NINGCHANG INFORMATION TECH (HANGZHOU) CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411139658.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

The prior art adds memory structure in BMC systems, resulting in system complexity and potential risks, making it difficult to achieve efficient and secure data synchronization between main and standby FLASH.

Method used

By creating a target mount point in the file system of the main storage device, mount the second file partition of the backup storage device to this point, and data synchronization is performed using the block device interface, and the priority policy and encryption algorithm are used to ensure data synchronization safety and efficiency.

Benefits of technology

There is no need to increase hardware, reduce system complexity and cost, improve data synchronization efficiency, reduce management workload, enhance data security, and ensure timely updates and integrity of configuration files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149293A_ABST
    Figure CN119149293A_ABST
Patent Text Reader

Abstract

The invention relates to a data synchronization method, device and equipment, and the method comprises the steps: determining partition information of a first file partition where configuration data is located when the configuration data of main storage equipment of a BMC (Baseboard Management Controller) is detected to be modified, determining a second file partition from a standby storage device of the BMC based on the partition information; the main storage device and the standby storage device have the same data structure; creating a target mounting point in a file system of the main storage device, and mounting a second file partition of the standby storage device to the target mounting point; and through the target mounting point, the modified configuration data is synchronized to the second file partition, so that the data synchronization efficiency and security are improved while newly added hardware or complex software configuration does not need to be introduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data management technology, and in particular to a data synchronization method, device and equipment. Background Art

[0002] BMC (Baseboard Management Controller) is responsible for providing hardware management and remote control functions independent of the operating system during server operation, ensuring that the server can be monitored and managed in any state, and plays an important role in server management. The dual BMC FLASH (Flash Memory) system, that is, configuring a main FLASH and a backup FLASH in the server, can further ensure the reliability and availability of the system. In this configuration, the main FLASH is responsible for daily management tasks, while the backup FLASH serves as a redundant backup to deal with the failure or maintenance of the main FLASH.

[0003] As the complexity and availability requirements of server systems increase, the consistency of configuration data between the main FLASH and the backup FLASH is very important for the normal operation of the server.

[0004] In the related art, a memory connected to the main FLASH and the backup FLASH is added to the BMC system, and the data is synchronized to the memory for storage after the configuration data is modified. When the main and backup switching occurs, the configuration data in the memory is restored to the backup FLASH to achieve synchronization of configuration data. However, since this method adds a new memory structure to the BMC system, it also increases the complexity and potential risks of the system. Summary of the invention

[0005] The present invention provides a data synchronization method, apparatus and device for improving data synchronization efficiency and security without introducing new hardware or complex software configuration.

[0006] In a first aspect, the present application provides a data synchronization method, which is applied to a baseboard management controller BMC, and the method includes:

[0007] When it is detected that the configuration data of the primary storage device of the BMC is modified, the partition information of the first file partition where the configuration data is located is determined, and based on the partition information, a second file partition is determined from the backup storage device of the BMC; the primary storage device and the backup storage device have the same data structure;

[0008] Creating a target mount point in the file system of the primary storage device, and mounting the second file partition of the backup storage device to the target mount point;

[0009] The modified configuration data is synchronized to the second file partition through the target mount point.

[0010] The above method, by creating a target mount point under the file system of the primary storage device and mounting the second file partition of the backup storage device to the target mount point, realizes that the primary storage device can manage the second file partition of the backup storage device through the mount point, and then synchronize the modified configuration data to the second file partition. Since the method does not require the addition of new hardware devices, it avoids increasing the complexity of the system and reduces the overall cost; through the close cooperation between the primary storage device and the backup storage device, the manual operation and monitoring workload of the management personnel is reduced, thereby significantly improving the data synchronization efficiency; at the same time, since the data is only transmitted within the system, the risk of data leakage is reduced and the security of data synchronization is provided.

[0011] In a possible implementation, before mounting the second file partition of the backup storage device to the target mount point, the method further includes:

[0012] Mapping the second file partition to a block device through a block device interface;

[0013] The step of mounting the second file partition of the backup storage device to the target mount point includes:

[0014] The block device obtained after the second file partition mapping is mounted to the target mount point.

[0015] The above method maps the second file partition to a block device through a block device interface, and then mounts the mapped block device to a target mount point, thereby mounting the configuration data partition of the backup storage device to the file system of the primary storage device.

[0016] In a possible implementation manner, before synchronizing the modified configuration data to the second file partition, the method further includes:

[0017] Obtaining a target configuration file to which the modified configuration data belongs;

[0018] Determine a target priority corresponding to the target configuration file, and add the target configuration file to a storage area corresponding to the target priority;

[0019] The step of synchronizing the modified configuration data to the second file partition includes:

[0020] Based on a synchronization policy corresponding to the target priority, the modified configuration data in the storage area is synchronized to the second file partition.

[0021] The above method increases the flexibility of the data synchronization process by setting different file priorities and adopting different synchronization strategies to synchronize configuration data for files with different file priorities.

[0022] In a possible implementation, the priority of the configuration file in the primary storage device includes a first priority and a second priority, the second priority is lower than the first priority, and synchronizing the modified configuration data in the storage area to the second file partition based on the synchronization policy corresponding to the target priority includes:

[0023] If the target priority is the first priority, when an operation of adding a target configuration file in the storage area is detected, a synchronization component is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition;

[0024] If the target priority is the second priority, then when the preset conditions are met, the synchronization component is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition; the preset conditions are: reaching a preset period or the amount of data in the storage area reaches a preset threshold.

[0025] The above method directly synchronizes high-priority files to the second file partition when they are added to the storage area, and synchronizes low-priority files to the second file partition as a whole after they are added to the storage area when a preset period is reached or the amount of data in the storage area reaches a threshold. This method ensures that high-priority configuration data changes are processed in a timely manner, while low-priority configuration data changes are synchronized in batches, thereby reducing device load and resource consumption.

[0026] In a possible implementation manner, if the target priority is the second priority, adding the target configuration file to a storage area corresponding to the target priority includes:

[0027] Based on the file identifier of the target configuration file, searching the storage area for a configuration file corresponding to the file identifier;

[0028] If a configuration file corresponding to the file identifier is found, the found configuration file is updated based on the currently acquired target configuration file.

[0029] In the above method, since the data in the storage area corresponding to the second priority is synchronized in batches, each time data is stored, when it is determined that a configuration file with the same identifier already exists in the storage area, it is updated, thereby ensuring that each configuration file in the storage area is kept in the latest state.

[0030] In a possible implementation manner, the storage area further includes: a reference encryption value generated by encrypting the target configuration file based on an encryption algorithm; and the method further includes:

[0031] Acquire the reference encryption value from the storage area, and synchronize it to the second file partition;

[0032] After synchronizing the modified configuration data in the storage area to the second file partition, the method further includes:

[0033] When the backup storage device is switched to the active state, determining the real-time encryption value of each configuration file in the backup storage device;

[0034] Based on the real-time encryption value and reference encryption value corresponding to each configuration file, the integrity of the corresponding configuration file is checked.

[0035] The above method, when synchronizing configuration data, synchronizes the encryption reference value corresponding to the target configuration file to the backup storage device at the same time. When the backup storage device switches to the primary state, the real-time encryption value of each configuration file is determined and compared with the corresponding reference encryption value to verify its integrity, thereby further enhancing the reliability, security and integrity of the configuration file.

[0036] In a possible implementation manner, after synchronizing the modified configuration data to the second file partition, the method further includes:

[0037] After it is determined that the configuration data synchronization is complete, the target mount point is unmounted from the file system of the primary storage device.

[0038] The above method, after determining that the configuration data synchronization is complete, unmounts the mount point, which can ensure that temporary resources are released and avoid affecting subsequent operations such as access to the file system of the primary storage device.

[0039] In a second aspect, an embodiment of the present application provides a data synchronization device, which is applied to a baseboard management controller BMC, and the device includes:

[0040] a detection module, configured to, when detecting that configuration data of a primary storage device of the BMC is modified, determine partition information of a first file partition where the configuration data is located, and determine a second file partition from a backup storage device of the BMC based on the partition information; the primary storage device and the backup storage device have the same data structure;

[0041] A creation module, used to create a target mount point in the file system of the primary storage device, and mount the second file partition of the backup storage device to the target mount point;

[0042] A synchronization module is used to synchronize the modified configuration data to the second file partition through the target mount point.

[0043] In a possible implementation manner, before mounting the second file partition of the backup storage device to the target mount point, the creation module is further configured to:

[0044] Mapping the second file partition to a block device through a block device interface;

[0045] The above creation module is specifically used for:

[0046] The block device obtained after the second file partition mapping is mounted to the target mount point.

[0047] In a possible implementation manner, the synchronization module is specifically used to:

[0048] Obtaining a target configuration file to which the modified configuration data belongs;

[0049] Determine a target priority corresponding to the target configuration file, and add the target configuration file to a storage area corresponding to the target priority;

[0050] Based on a synchronization policy corresponding to the target priority, the modified configuration data in the storage area is synchronized to the second file partition.

[0051] In a possible implementation manner, the priority of the configuration file in the primary storage device includes a first priority and a second priority, the second priority is lower than the first priority, and the synchronization module is specifically configured to:

[0052] If the target priority is the first priority, when an operation of adding a target configuration file in the storage area is detected, a synchronization component is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition;

[0053] If the target priority is the second priority, then when the preset conditions are met, the synchronization component is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition; the preset conditions are: reaching a preset period or the amount of data in the storage area reaches a preset threshold.

[0054] In a possible implementation, if the target priority is the second priority, the synchronization module is specifically configured to:

[0055] Based on the file identifier of the target configuration file, searching the storage area for a configuration file corresponding to the file identifier;

[0056] If a configuration file corresponding to the file identifier is found, the found configuration file is updated based on the currently acquired target configuration file.

[0057] In a possible implementation manner, the storage area further includes: a reference encryption value generated by encrypting the target configuration file based on an encryption algorithm; and the device further includes a verification module, which is used to:

[0058] Acquire the reference encryption value from the storage area, and synchronize it to the second file partition;

[0059] After synchronizing the modified configuration data in the storage area to the second file partition, when the backup storage device switches to the active state, determining the real-time encryption value of each configuration file in the backup storage device;

[0060] Based on the real-time encryption value and the reference encryption value corresponding to each configuration file, the integrity of the corresponding configuration file is checked.

[0061] In a possible implementation manner, after synchronizing the modified configuration data to the second file partition, the synchronization module is further used to:

[0062] After it is determined that the configuration data synchronization is complete, the target mount point is unmounted from the file system of the primary storage device.

[0063] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the data synchronization method when executing the computer program.

[0064] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps in the above-mentioned data synchronization method of the present application are implemented.

[0065] In the fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which is stored in a computer-readable storage medium; when the processor of the memory access device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the memory access device executes the steps in the above-mentioned data synchronization method of the present application.

[0066] For each of the above-mentioned second to fifth aspects and the technical effects that may be achieved by each of the above-mentioned aspects, please refer to the above-mentioned description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0068] Figure 1 A flowchart of a data synchronization method provided in an embodiment of the present application;

[0069] Figure 2 A schematic diagram of a mounting process provided in an embodiment of the present application;

[0070] Figure 3 A schematic diagram of a cache synchronization mechanism provided in an embodiment of the present application;

[0071] Figure 4 A schematic diagram of a data synchronization process provided in an embodiment of the present application;

[0072] Figure 5 A schematic diagram of a data synchronization device provided in an embodiment of the present application;

[0073] Figure 6 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0074] In order to make the purpose, technical solution and advantages of the present application more clear, the present application will be further described in detail below in conjunction with the accompanying drawings. The specific operation method in the method embodiment can also be applied to the device embodiment or the system embodiment.

[0075] In the description of this application, "multiple" is understood to be "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. A is connected to B, which can represent two situations: A is directly connected to B and A is connected to B through C. In addition, in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

[0076] In order to facilitate those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, the following is a brief description of the professional terms involved:

[0077] (1) BMC (Baseboard Management Controller): An independent management microcontroller dedicated to servers. It provides a set of standard interfaces and management tools for system monitoring, management, and maintenance. BMC monitors the hardware status of devices and performs remote management operations through the hardware manager integrated in servers, network devices, and other computer systems.

[0078] (2) FLASH (Flash Memory): A non-volatile storage medium.

[0079] (3) MTD (Memory Technology Device): A Linux kernel subsystem that is specifically used to manage and operate non-volatile storage devices. MTD provides a unified interface and management mechanism for devices.

[0080] (4) DTS (Device Tree Source): A text file format used to describe hardware device configuration. DTS files use specific syntax to define system nodes and their properties. They are compiled to generate DTB files (Device Tree Blob), which are read by the operating system kernel and used to configure hardware devices.

[0081] (5) Inotify ("inode notify"): A Linux kernel subsystem and API (Application Programming Interface) used to monitor file system events. It allows applications to monitor changes in files and directories, such as file creation, modification, and deletion, so that they can respond to file system changes in real time.

[0082] (6)mtdblock: It is a block device interface in the Linux kernel that can map MTD devices to block devices, allowing these non-volatile storage devices to be accessed through the standard block device interface.

[0083] (7) rsync (remote sync): an open source file synchronization and transfer tool used to synchronize the contents of files and directories to keep the source and destination consistent. It supports local and remote synchronization operations, and only transmits the updated parts during the transmission process, greatly improving data transmission efficiency.

[0084] (8) MD5: A widely used cryptographic hash function used for data integrity verification and digital signatures.

[0085] (9) Mounting: Connecting a file system (usually a hard disk partition, disk, network share, etc.) to a specific directory of the file system so that the contents of the file system can be accessed under this directory. A mount point is a directory that serves as the entry point of the file system and is used to access and manage the contents of the file system. When a file system is mounted on a directory, all files and subdirectories under the directory become part of the file system. The significance of a mount point is that it provides a standard interface that allows users to access and manage the contents of the file system through the mount point without understanding the specific structure and location of the file system.

[0086] BMC (Baseboard Management Controller) is responsible for providing hardware management and remote control functions independent of the operating system during server operation, ensuring that the server can be monitored and managed in any state, and plays an important role in server management. The dual BMC FLASH (Flash Memory) system, that is, configuring a main FLASH and a backup FLASH in the server, can further ensure the reliability and availability of the system. In this configuration, the main FLASH is responsible for daily management tasks, while the backup FLASH serves as a redundant backup to deal with the failure or maintenance of the main FLASH.

[0087] With the increasing complexity and availability requirements of server systems, how to ensure the consistency of configuration data between the main FLASH and the backup FLASH has become one of the key issues and is crucial to the normal operation of the server. Therefore, data synchronization between the main FLASH and the backup FLASH can ensure that the backup FLASH can quickly take over related tasks when the main FLASH fails, ensure high system availability, and reduce server downtime; it can achieve reliable remote management and monitoring of the server, and ensure the daily operation and maintenance of the data center and rapid response to failures; at the same time, it can also ensure the configuration consistency of the main FLASH and the backup FLASH, avoiding management confusion and erroneous operations caused by inconsistent configuration. Therefore, achieving real-time and effective synchronization of configuration files of the main and backup FLASH has important technical significance and application value.

[0088] In the related art, a memory connected to the main FLASH and the backup FLASH is added to the BMC system, and the data is synchronized to the memory for storage after the configuration data is modified. When the main and backup switching occurs, the configuration data in the memory is restored to the backup FLASH to achieve synchronization of configuration data. Although this method solves the problem of configuration synchronization to a certain extent, since this method adds a memory structure to the BMC system, it also increases the complexity and potential risks of the system, which may lead to single point failure of the memory, data consistency and timeliness, security risks, configuration conflicts and overwriting risks, performance bottlenecks, system architecture complexity, robustness and reliability of the synchronization mechanism, and data consistency check costs.

[0089] In this regard, an embodiment of the present application provides a data synchronization method applied to this scenario, which improves data synchronization efficiency and security without introducing new hardware or complex software configuration.

[0090] The present application is further described in detail below in conjunction with the accompanying drawings. Figure 1 FIG. 1 is a flow chart of a data synchronization method provided in an embodiment of the present application. The specific implementation process of the method is as follows:

[0091] Step S101, when it is detected that the configuration data of the primary storage device of the BMC is modified, the partition information of the first file partition where the configuration data is located is determined, and based on the partition information, a second file partition is determined from the backup storage device of the BMC;

[0092] Wherein, the primary storage device and the backup storage device have the same data structure;

[0093] In a possible implementation, the primary storage device and the backup storage device are respectively the primary FLASH and the backup FLASH in the BMC. Each FLASH has multiple independent MTD partitions for storing BMC configuration files and other related data to ensure data isolation and security. Figure 2 As shown, the MTD partitions corresponding to the main FLASH may include: uboot, conf, backconf, extlog, root, www, etc., and the MTD partitions corresponding to the backup FLASH may include: conf, backconf, extlog, root, www, etc., wherein the conf partition is used to store configuration data in the FLASH.

[0094] In some embodiments, the present application also configures a BMC file system, which is used to manage and store configuration files of the primary storage device in the BMC. The file system allows direct access to the primary storage device, but does not allow access to the backup storage device. Figure 2As shown, the configuration file may include but is not limited to: user information, network configuration, power configuration, fan configuration, etc.

[0095] In some embodiments, the BMC can call external tools, such as Inotify, to monitor changes in configuration files in real time. In specific implementations, taking Inotify as an example, the Inotify instance is initialized, and corresponding monitoring items are added to monitor the configuration files of the specified primary storage device. When data is modified in the configuration file of the primary device, such as modifying the configuration to specified parameters under certain conditions, Inotify will capture the modification and generate an event. The listener (i.e., BMC) reads and parses the event, and notifies the primary storage device, triggering subsequent data synchronization operations. This mechanism ensures that modifications to the configuration file can be captured and processed in real time, thereby maintaining the consistency and timeliness of the system configuration.

[0096] When the primary storage device receives the notification sent by Inotify, it retrieves the partition information of each file partition (i.e., the MTD partition) to determine the partition information of the relevant partition (i.e., the first file partition) of the configuration file where the modified configuration data is located, such as the partition identifier, etc. This operation can ensure that the primary storage device can accurately locate the location of the configuration file where the configuration data modification occurs, so as to facilitate the subsequent extraction of the configuration file from this location.

[0097] In some embodiments, since the primary storage device and the backup storage device have the same data structure, after the primary storage device determines the partition information of the first file partition, the second file partition of the backup storage device used to store the configuration file should have the same partition information (such as an identifier) ​​as the first file partition. Therefore, the second file partition of the backup storage device can be determined based on the partition information of the first file partition to facilitate subsequent mounting operations.

[0098] Step S102, creating a target mount point in the file system of the primary storage device, and mounting the second file partition of the backup storage device to the target mount point;

[0099] In some embodiments, before mounting the second file partition of the backup storage device to the target mount point, the second file partition needs to be mapped to a block device through a block device interface; the mounting of the backup storage device is achieved by mounting the block device obtained after mapping the second file partition to the target mount point.

[0100] Specifically, since the BMC file system is used to access and manage the file partitions of the primary storage device, but cannot manage the file partitions of the backup storage device, the file partitions of the backup storage device are mounted to the file system in the embodiment of the present application to implement the file system's management function of the configuration files of the backup storage device. Figure 2As shown, the file partition of the backup storage device can be mapped to a block device through a block device interface, such as mtdblock, such as mapping conf to mtdblock1 and mapping root to mtdblock4. In specific implementation, it is realized by configuring the DTS file in the kernel. After mapping the file partition of the backup storage device to a block device, subsequent mounting operations can be performed.

[0101] In some embodiments, after the file partition of the backup storage device is mapped to the block device, a temporary mount point (i.e., a target mount point, which is essentially a target) is created under the target of the file system (such as the / var directory). The temporary mount point can be named / var / conf / . After the creation is completed, the block device corresponding to the second file partition can be Figure 2 The mtdblock1 shown is mounted to the / var / conf / mount point of the file system through the mount command to complete the mounting process.

[0102] Through this operation, after the block device is mounted to the file system, the configuration file in the mounted partition (i.e., the second file partition) can be managed through the file system, that is, the primary storage device can operate the second file partition of the backup storage device, so as to synchronize the modified configuration file to the backup storage device later, and realize data synchronization and sharing.

[0103] In some embodiments, the primary storage device may also mount its own file partitions under the file system.

[0104] Step S103: Synchronize the modified configuration data to the second file partition through the target mount point.

[0105] In some embodiments, after the configuration file partition is mounted, the primary storage device can directly access and operate the configuration file of the backup storage device. In order to ensure the consistency of the configuration files between the primary and backup storage devices and improve synchronization efficiency and security, the present application adopts an incremental synchronization mechanism, that is, when performing data synchronization, only the modified configuration data in the configuration file is synchronized.

[0106] In specific implementation, incremental synchronization can be achieved through the rsync tool, such as Figure 3 As shown, rsync is used to compare the configuration data between the source file (i.e., the configuration file in the primary storage device) and the target file (i.e., the configuration file in the mounted partition of the backup storage device), and synchronize the difference in the configuration data, thereby reducing synchronization time and resource consumption.

[0107] In some embodiments, after synchronizing the modified configuration data to the second file partition, after determining that the configuration data synchronization is complete, the target mount point is unmounted from the file system of the primary storage device.

[0108] During implementation, after the second file partition is mounted to the target mount point, the original content under the target is unavailable, and the target also affects the subsequent business of the BMC. Therefore, in an embodiment of the present application, the target mount point is uninstalled after data synchronization is completed. This process can be completed by uninstalling the target (such as / var / conf / ) to ensure that temporary resources are released.

[0109] In some embodiments, the present application may pre-set to trigger a message notification and send it to the primary storage device after the configuration data synchronization is completed, so that the primary storage device determines that the configuration data synchronization is completed and unmounts the target mount point after receiving each message notification.

[0110] In order to further improve synchronization efficiency and optimize system resource usage, the embodiment of the present application introduces a priority-based cache mechanism. Optionally, the present application pre-sets multiple priorities for the configuration file, and creates storage areas (i.e., caches) corresponding to different priorities in the file system, and different priorities correspond to different synchronization strategies.

[0111] In some embodiments, before synchronizing the modified configuration data to the second file partition, obtain the target configuration file to which the modified configuration data belongs; determine the target priority corresponding to the target configuration file, and add the target configuration file to the storage area corresponding to the target priority; when performing data synchronization, synchronize the modified configuration data in the storage area to the second file partition based on the synchronization policy corresponding to the target priority.

[0112] It should be noted that the number and level of priorities corresponding to the above configuration files can be set based on demand, and the corresponding synchronization strategies can also be set based on demand.

[0113] In some embodiments, the priority of the configuration file in the primary storage device includes a first priority and a second priority, and the second priority is lower than the first priority, that is, the first priority is a high priority and the second priority is a low priority.

[0114] In the specific implementation, each configuration file is classified in priority in advance. For example, the priority can be set according to the importance of the configuration file in the BMC system. If the modification of the configuration file may cause a BMC system failure, it is set to a high priority; if the configuration file has little or no impact on the BMC, it is set to a low priority.

[0115] This application configures a data table in the BMC for storing the identifiers of each configuration file and the corresponding priority, so as to store the priority of each configuration file, such as Figure 3 As shown, in this example, the configuration files identified as user.ini and net.conf have high priorities, and the configuration files identified as sdr.dat and fan.conf have low priorities. When monitoring the modification of configuration files based on the Inotify monitoring mechanism, if a file modification is detected, an event processing flow is triggered. Based on the above configured data table, the priority of the modified configuration file is queried to obtain the priority of each configuration file, and the priority is stored in the storage area corresponding to the priority.

[0116] The mechanism includes two storage parts, namely, an active cache (ActiveCache) corresponding to a first priority, and a pending cache (Pending Cache) corresponding to a second priority.

[0117] Specifically, the Active Cache is used to store high-priority file data that needs to be synchronized immediately. When a change in a high-priority configuration file is detected, the event handler will store the configuration file in the Active Cache; when information changes in the Active Cache, the rsync synchronization operation will be triggered immediately to synchronize the modified configuration data to the second file partition of the mount point.

[0118] The pending cache is used to store low-priority file data for batch synchronization. When changes to low-priority configuration files are detected, the event handler stores these configuration files in the pending cache; when the configuration data in the pending cache meets the preset conditions, the rsync synchronization operation is triggered, and the configuration data in the pending cache is synchronized in batches to the second file partition under the mount point through rsync.

[0119] In some embodiments, if the target priority is the first priority, the synchronization process is:

[0120] When an operation of adding a target configuration file in the storage area is detected, a synchronization component (i.e., rsync) is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition;

[0121] In specific implementation, Figure 3As shown, if the priority of the target configuration file is the first priority, the event handler will store the relevant information of the target configuration file in the active cache, and the relevant information includes but is not limited to: the path, identification (such as name) and metadata of the configuration file. The metadata may include the size, modification time and hash value of the configuration file. After the information is added, the active cache will immediately trigger the rsync synchronization mechanism to compare the configuration data between the source file (i.e., the configuration file in the primary storage device) and the target file (i.e., the configuration file in the mounted partition of the backup storage device), and synchronize the difference in the configuration data to the second file partition.

[0122] In some embodiments, if the target priority is the second priority, the synchronization process is:

[0123] When a preset condition is met, the synchronization component (rsync) is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition; the preset condition is: reaching a preset period or the amount of data in the storage area reaches a preset threshold.

[0124] It should be noted that in the embodiment of the present application, there is no restriction on the values ​​of the preset period and the preset threshold, and they can be set based on demand.

[0125] In specific implementation, Figure 3 As shown, if the priority of the target configuration file is the second priority, the event handler will store the relevant information of the target configuration file in the pending cache, and the relevant information includes but is not limited to: the path, identification (such as name) and metadata of the configuration file. When the pending cache meets the preset conditions, such as reaching the specified period, the rsync synchronization mechanism is triggered to compare the configuration data between the source file (i.e., the configuration file in the primary storage device) and the target file (i.e., the configuration file in the mounted partition of the backup storage device), and synchronize the difference in the configuration data to the second file partition.

[0126] Since the configuration data in the pending cache is synchronized in batches, if the same configuration file is detected to have changed again within a short period of time, the relevant information of the configuration file will be stored in the pending cache again. At this time, it is necessary to search for the configuration file in the pending cache and replace the data of the found configuration file based on the current configuration file to ensure that each configuration file in the pending cache is kept up to date.

[0127] In some embodiments, if the target priority is the second priority, when the target configuration file is added to the storage area corresponding to the target priority, based on the file identifier of the target configuration file, the configuration file corresponding to the file identifier is queried from the storage area; if the configuration file corresponding to the file identifier is queried, the queried configuration file is updated based on the currently acquired target configuration file; if the corresponding configuration file is not queried, the currently acquired target configuration file is directly stored in the storage area.

[0128] In a specific implementation, the pending cache stores the path, identifier, and metadata (size, modification time, and hash value, etc.) of the configuration file. Therefore, when the second priority configuration file is modified, the corresponding configuration file is searched from the pending cache based on the path and identifier of the configuration file, and the relevant data of the found configuration file is updated.

[0129] In some embodiments, the present application can also perform secondary division on the low priority (i.e., the second priority), and divide the low priority into multiple different levels, such as level one, level two, and level three, where different levels correspond to different values ​​of the preset conditions, to further reduce the device load and resource consumption. At the same time, the storage area corresponding to the second priority is divided again to obtain multiple sub-storage areas of different levels.

[0130] For example, when the preset condition is to reach the preset period, different preset period values ​​can be set for the above-mentioned first level, second level and third level respectively, and the configuration files of different levels are stored in the sub-storage areas corresponding to the levels respectively. When performing data synchronization, each level is synchronized according to the corresponding preset period value.

[0131] The data format in the storage area is not limited in the embodiments of the present application. In some embodiments, a key-value data structure may be used in the storage area to cache the configuration file.

[0132] In some embodiments, the key value (Key) can be a unique identifier of the file, which can be composed of at least one of the file path, file name and file encryption value (i.e., the reference encryption value hereinafter), and the value (Value) can be metadata information of the file, which can be composed of at least one of the size, modification time and hash value of the configuration file. By storing in this way, it can be ensured that the corresponding configuration file can be quickly queried from the storage area and updated in time.

[0133] In some embodiments, the storage area of ​​the present application also includes: a reference encrypted value generated after encrypting the target configuration file based on an encryption algorithm; that is, in the present application, the target configuration file is encrypted based on an encryption algorithm to generate a corresponding reference encrypted value, and the reference encrypted value is added to the storage area while the modified configuration data is added to the storage area.

[0134] In specific implementation, Figure 3 As shown, when the rsync synchronization mechanism is triggered, the modified configuration data is synchronized to the second file partition, and a reference encryption value is obtained from the storage area and synchronized to the second file partition; the reference encryption value is used for integrity verification when switching between primary and backup storage devices.

[0135] It should be noted that the above encryption algorithm is not limited in the embodiment of the present application and can be set based on demand, for example, set to MD5.

[0136] In some embodiments, the present application configures a storage area for storing encrypted values ​​under the second file partition of the backup storage device, such as Figure 3 The MD5.conf shown in the figure can store the file names and encryption values ​​(such as MD5 values) of each synchronized configuration file. When the primary storage device fails and the backup storage device switches to the primary state, when the backup storage device starts and reads the configuration file of the second file partition, it calculates the real-time encryption value of each configuration file and compares it with the corresponding stored reference encryption value to perform integrity verification on the corresponding configuration file. This method further ensures the reliability, security and integrity of the configuration file.

[0137] The above method can effectively solve the high concurrency and CPU load problems of rsync caused by frequent modification of configuration files through a priority-based caching mechanism; high-priority configuration file modifications are synchronized instantly to ensure that important configuration files are updated in a timely manner; and low-priority configuration file modifications are synchronized in batches to reduce system resource consumption. In terms of real-time performance, security, reliability, cost and resource utilization, ease of operation, and system architecture complexity, the data synchronization method of the present application has obvious advantages and is suitable for systems with high reliability and high availability requirements.

[0138] The following combination Figure 4 The above data synchronization process is described in detail with a specific example. The process specifically includes the following steps:

[0139] Step S401, real-time detection of the modification of the configuration data of the main device through Inotify;

[0140] Step S402, when it is determined that the configuration data of the primary device is modified, the / proc / mtd file is checked to obtain the mapping information of the backup storage device;

[0141] Specifically, obtain the block device to which each MTD partition of the backup storage device is mapped;

[0142] Step S403, creating a target mount point under the file system of the primary storage device;

[0143] Step S404, mounting the block device corresponding to the file partition (conf partition) of the backup storage device to the target mount point;

[0144] Step S405, determining the target priority of the target configuration file to which the configuration data belongs, and adding the target configuration file to the corresponding storage area according to the target priority;

[0145] Step S406, based on the synchronization policy corresponding to the target configuration file, synchronizing the configuration data to the file partition of the backup storage device through the rsync mechanism;

[0146] Step S407, determine that data synchronization is complete, and unmount the target mount point.

[0147] Based on the same inventive concept, the present application also provides a data synchronization device, see Figure 5 , the device comprises:

[0148] The detection module 501 is used to determine the partition information of the first file partition where the configuration data is located when it is detected that the configuration data of the primary storage device of the BMC is modified, and determine the second file partition from the backup storage device of the BMC based on the partition information; the primary storage device and the backup storage device have the same data structure;

[0149] A creation module 502, configured to create a target mount point in the file system of the primary storage device, and mount the second file partition of the backup storage device to the target mount point;

[0150] The synchronization module 503 is used to synchronize the modified configuration data to the second file partition through the target mount point.

[0151] In a possible implementation manner, before mounting the second file partition of the backup storage device to the target mount point, the creation module 502 is further configured to:

[0152] Mapping the second file partition to a block device through a block device interface;

[0153] The creation module 502 is specifically used for:

[0154] The block device obtained after the second file partition mapping is mounted to the target mount point.

[0155] In a possible implementation manner, the synchronization module 503 is specifically configured to:

[0156] Obtaining a target configuration file to which the modified configuration data belongs;

[0157] Determine a target priority corresponding to the target configuration file, and add the target configuration file to a storage area corresponding to the target priority;

[0158] Based on a synchronization policy corresponding to the target priority, the modified configuration data in the storage area is synchronized to the second file partition.

[0159] In a possible implementation manner, the priority of the configuration file in the primary storage device includes a first priority and a second priority, the second priority is lower than the first priority, and the synchronization module 503 is specifically used to:

[0160] If the target priority is the first priority, when an operation of adding a target configuration file in the storage area is detected, a synchronization component is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition;

[0161] If the target priority is the second priority, then when the preset conditions are met, the synchronization component is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition; the preset conditions are: reaching a preset period or the amount of data in the storage area reaches a preset threshold.

[0162] In a possible implementation, if the target priority is the second priority, the synchronization module 503 is specifically configured to:

[0163] Based on the file identifier of the target configuration file, searching the storage area for a configuration file corresponding to the file identifier;

[0164] If a configuration file corresponding to the file identifier is found, the found configuration file is updated based on the currently acquired target configuration file.

[0165] In a possible implementation manner, the storage area further includes: a reference encryption value generated by encrypting the target configuration file based on an encryption algorithm; and the device further includes a verification module, which is used to:

[0166] Acquire the reference encryption value from the storage area, and synchronize it to the second file partition;

[0167] After synchronizing the modified configuration data in the storage area to the second file partition, when the backup storage device switches to the active state, determining the real-time encryption value of each configuration file in the backup storage device;

[0168] Based on the real-time encryption value and the reference encryption value corresponding to each configuration file, the integrity of the corresponding configuration file is checked.

[0169] In a possible implementation manner, after synchronizing the modified configuration data to the second file partition, the synchronization module 503 is further configured to:

[0170] After it is determined that the configuration data synchronization is complete, the target mount point is unmounted from the file system of the primary storage device.

[0171] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the electronic device can realize the function of the aforementioned data synchronization device, referring to Figure 6 , the electronic device comprises:

[0172] At least one processor 601, and a memory 602 connected to the at least one processor 601. The specific connection medium between the processor 601 and the memory 602 is not limited in the embodiment of the present application. Figure 6 In the example, the processor 601 and the memory 602 are connected via a bus 600. Figure 6 The connection between other components is shown by bold lines, and is not intended to be limiting. The bus 600 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 601 can also be called a controller, and there is no limitation on the name.

[0173] In the embodiment of the present application, the memory 602 stores instructions that can be executed by at least one processor 601. The at least one processor 601 can execute the data synchronization method discussed above by executing the instructions stored in the memory 602. The processor 601 can implement Figure 5 The functions of each module in the device shown.

[0174] Among them, the processor 601 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 602 and calling the data stored in the memory 602, the various functions of the device and processing data, the device can be monitored as a whole.

[0175] In one possible design, the processor 601 may include one or more processing units, and the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.

[0176] Processor 601 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the data synchronization method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0177] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 602 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 602 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 602 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0178] By designing and programming the processor 601, the code corresponding to the application anomaly detection method described in the above embodiment can be fixed into the chip, so that the chip can execute the code when running. Figure 1The steps of the data synchronization method of the embodiment shown are as follows: How to design and program the processor 601 is a technology well known to those skilled in the art and will not be described in detail here.

[0179] An embodiment of the present application also provides a computer-readable storage medium that stores computer-executable instructions required to execute the above-mentioned processor, which includes a program required to execute the above-mentioned processor.

[0180] In some possible implementations, various aspects of the data synchronization method provided by the present application may also be implemented in the form of a program product, which includes a program code. When the above-mentioned program product is run on an electronic device, the above-mentioned program code is used to enable the above-mentioned electronic device to execute the steps of the data synchronization method according to various exemplary implementations of the present application described above in this specification.

[0181] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0182] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (apparatus), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0183] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0184] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0185] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0186] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A data synchronization method, characterized in that: Applied to a baseboard management controller BMC, the method comprises: When it is detected that the configuration data of the primary storage device of the BMC is modified, the partition information of the first file partition where the configuration data is located is determined, and based on the partition information, a second file partition is determined from the backup storage device of the BMC; the primary storage device and the backup storage device have the same data structure; Creating a target mount point in the file system of the primary storage device, and mounting the second file partition of the backup storage device to the target mount point; The modified configuration data is synchronized to the second file partition through the target mount point.

2. The method according to claim 1, characterized in that Before mounting the second file partition of the backup storage device to the target mount point, the method further includes: Mapping the second file partition to a block device through a block device interface; The step of mounting the second file partition of the backup storage device to the target mount point includes: The block device obtained after the second file partition mapping is mounted to the target mount point.

3. The method according to claim 1, characterized in that: Before synchronizing the modified configuration data to the second file partition, the method further includes: Obtaining a target configuration file to which the modified configuration data belongs; Determine a target priority corresponding to the target configuration file, and add the target configuration file to a storage area corresponding to the target priority; The step of synchronizing the modified configuration data to the second file partition includes: Based on a synchronization policy corresponding to the target priority, the modified configuration data in the storage area is synchronized to the second file partition.

4. The method according to claim 3, characterized in that The priority of the configuration file in the primary storage device includes a first priority and a second priority, the second priority is lower than the first priority, and synchronizing the modified configuration data in the storage area to the second file partition based on the synchronization strategy corresponding to the target priority includes: If the target priority is the first priority, when an operation of adding a target configuration file in the storage area is detected, a synchronization component is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition; If the target priority is the second priority, then when the preset conditions are met, the synchronization component is called to obtain the modified configuration data from the storage area and synchronize it to the second file partition; the preset conditions are: reaching a preset period or the amount of data in the storage area reaches a preset threshold.

5. The method according to claim 4, characterized in that If the target priority is the second priority, adding the target configuration file to a storage area corresponding to the target priority includes: Based on the file identifier of the target configuration file, searching the storage area for a configuration file corresponding to the file identifier; If a configuration file corresponding to the file identifier is found, the found configuration file is updated based on the currently acquired target configuration file.

6. The method according to claim 3, characterized in that The storage area also includes: a reference encryption value generated by encrypting the target configuration file based on an encryption algorithm; the method also includes: Acquire the reference encryption value from the storage area, and synchronize it to the second file partition; After synchronizing the modified configuration data in the storage area to the second file partition, the method further includes: When the backup storage device is switched to the active state, determining the real-time encryption value of each configuration file in the backup storage device; Based on the real-time encryption value and the reference encryption value corresponding to each configuration file, the integrity of the corresponding configuration file is checked.

7. The method according to any one of claims 1 to 6, characterized in that: After synchronizing the modified configuration data to the second file partition, the method further includes: After it is determined that the configuration data synchronization is complete, the target mount point is unmounted from the file system of the primary storage device.

8. A data synchronization device, characterized in that: Applied to BMC, the device comprises: a detection module, configured to, when detecting that configuration data of a primary storage device of the BMC is modified, determine partition information of a first file partition where the configuration data is located, and determine a second file partition from a backup storage device of the BMC based on the partition information; the primary storage device and the backup storage device have the same data structure; A creation module, used to create a target mount point in the file system of the primary storage device, and mount the second file partition of the backup storage device to the target mount point; A synchronization module is used to synchronize the modified configuration data to the second file partition through the target mount point.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to implement the method according to any one of claims 1 to 7 when executing a computer program stored in the memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.