Multi-controller data synchronization method, device and equipment and storage medium
By introducing data management services and D-BUS communication, the service unit in the decoupled controller is synchronized with data, which solves the problem of low FRU data synchronization efficiency and improves data management efficiency and system stability.
Patent Information
- Application Number
- CN202410703467.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, the data synchronization efficiency of the FRU is low, resulting in complex service unit services and high coding coupling, which affects system stability and debugging convenience.
Introduce data management services, decouple the service units in the controller and synchronize data, actively obtain and centrally synchronize data through data management services, other service units only need to focus on their own business, reduce the coupling between service units, and use D-BUS Communication and Boost Asio event-driven system improve data synchronization efficiency.
It improves data management efficiency and debugging convenience, reduces the coupling between service units, realizes complete decoupling of data management and service units, and improves the stability and flexibility of the system.
Smart Images

Figure CN118535099A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data management, and in particular to a multi-controller data synchronization method, device, equipment and storage medium. Background Art
[0002] The multi-controller redundancy design of the storage server is intended to improve the reliability and redundancy of the storage system. The main goal of this architecture is to ensure that the system can continue to operate normally without interrupting service when a controller fails. Data synchronization ensures that the data in the storage system, especially the synchronized data, remains consistent between multiple controllers, thereby preventing data loss or damage.
[0003] The Baseboard Management Controller (BMC) is a core component of the server management system defined by the IPMI (Intelligent Platform Management Interface) protocol, i.e., the Intelligent Platform Management Interface. It is a hardware manager integrated into servers, network devices, and other computer systems. Its function is to monitor the hardware status of the device, perform remote management operations, and provide monitoring and control functions for the device. BMC monitors the health status of each hardware device and obtains the field replaceable unit (FRU) data of each hardware device, which helps operation and maintenance personnel to understand the operating status of the server in a timely manner and ensure the normal operation of the server. In the related technology, the data of the FRU is managed by each service unit (also called the service management unit), and decides whether it needs to be synchronized to other controllers, and performs data synchronization through the interface provided by the data synchronization function. The service unit's business is complex and the data synchronization efficiency is low. Summary of the invention
[0004] In view of this, the present invention provides a multi-controller data synchronization method, device, equipment and storage medium to solve the problem of low data synchronization efficiency of FRU.
[0005] In a first aspect, the present invention provides a multi-controller data synchronization method, which is applied to a data management service on a first controller, each controller includes a plurality of service units, and the service units are used to store and manage data of corresponding field replaceable units, and the method includes:
[0006] Get synchronization data configuration information;
[0007] Determine data to be synchronized according to the synchronization data configuration information, wherein the data to be synchronized includes data of the field replaceable unit;
[0008] Collect the data that needs to be synchronized;
[0009] According to the field replaceable unit to which the data to be synchronized belongs, storing the data to be synchronized into a corresponding data partition;
[0010] Determine the data of the target field replaceable unit that currently needs to be synchronized;
[0011] Synchronize data in a target data partition corresponding to the target field replaceable unit to data management services of other controllers other than the first controller.
[0012] In an optional implementation, in the controller, the data partition corresponding to each of the field replaceable units includes a primary data partition and a secondary data partition;
[0013] According to the field replaceable unit to which the data to be synchronized belongs, storing the data to be synchronized into a corresponding data partition includes:
[0014] storing the newly collected data of the field replaceable unit into the primary data partition and the secondary data partition of the field replaceable unit respectively;
[0015] The step of synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller includes:
[0016] Synchronize the data in the secondary data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller;
[0017] After the data in the secondary data partition is successfully synchronized to the data management service of other controllers other than the first controller, the data in the secondary data partition is cleared.
[0018] In an optional implementation, storing the newly collected data of the field replaceable unit into the primary data partition and the secondary data partition of the field replaceable unit respectively includes:
[0019] storing the newly collected data of the field replaceable unit into the secondary data partition;
[0020] Determine whether the read-write process lock and the read-write thread lock of the primary data partition are occupied according to a preset period;
[0021] If the read-write process lock and the read-write thread lock of the primary data partition are not occupied, then the read-write process lock and the read-write thread lock of the primary data partition are acquired;
[0022] writing the data of the field replaceable unit newly collected in the secondary data partition into the primary data partition;
[0023] After writing is completed, the read-write process lock and the read-write thread lock of the primary data partition are released.
[0024] In an optional implementation, after storing the data to be synchronized into a corresponding data partition according to the field replaceable unit to which the data to be synchronized belongs, the method further includes:
[0025] marking the newly collected data of the field replaceable unit;
[0026] The step of synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller includes:
[0027] Acquire the marked data in the target data partition;
[0028] Synchronizing the marked data to a data management service of another controller other than the first controller;
[0029] After the marked data is successfully synchronized to the data management service of other controllers other than the first controller, the mark of the data is removed.
[0030] In an optional implementation, the multi-controller data synchronization method further includes:
[0031] Receive data query requests;
[0032] Obtaining target data corresponding to the query request;
[0033] The target data is sent to the sender of the data query request.
[0034] In an optional implementation, the data management service uses D-BUS communication;
[0035] The method further comprises:
[0036] Receive D-BUS interface modification request;
[0037] The corresponding D-BUS interface is modified based on the D-BUS interface modification request.
[0038] In an optional implementation manner, the collecting the data to be synchronized includes:
[0039] If a trigger condition for obtaining data of the first service unit is met, obtaining the data of the first service unit;
[0040] and / or,
[0041] The data of the second service unit is obtained through routine testing.
[0042] In an optional implementation, synchronizing the data in the target data partition corresponding to the target field replaceable unit to a data management service of another controller other than the first controller includes:
[0043] Synchronizing the data to other controllers other than the first controller at a regular interval;
[0044] and / or,
[0045] If the data synchronization trigger condition is met, the data is synchronized to other controllers other than the first controller.
[0046] In an optional implementation, if the data synchronization trigger condition is met, synchronizing the data to other controllers other than the first controller includes:
[0047] receiving state change data for a target field replaceable unit input by a user, and determining that the data synchronization trigger condition is satisfied;
[0048] Determining a second controller to which the target field replaceable unit belongs;
[0049] If the first controller and the second controller are slave controllers, the status change data of the target field replaceable unit is synchronized to the data management service of the master controller, so that the data management service of the master controller synchronizes the status change data of the target field replaceable unit to the data management service of the second controller.
[0050] In an optional specific implementation, synchronizing the data in the target data partition corresponding to the target field replaceable unit to a data management service of another controller other than the first controller includes:
[0051] Acquire at least part of the data and store it in a cache;
[0052] Initialize the connection with D-BUS;
[0053] Register a unique first name on D-BUS;
[0054] Reading first data in the cache;
[0055] Encapsulating the first data into a protocol format of a web page access interface to obtain a first data packet;
[0056] Sending the first data packet to the peer server via the D-BUS using the first name and a second name registered by the peer controller on the D-BUS;
[0057] Receiving first feedback information for the first data packet returned by the opposite end controller;
[0058] Determining whether the first data packet has been correctly sent to the opposite end controller according to the first feedback information;
[0059] If it is determined that the first data packet has been correctly sent to the opposite end controller, determining whether there is any data in the cache that has not been sent;
[0060] If there is data in the cache that has not been sent, obtaining second data in the data that has not been sent;
[0061] Encapsulating the second data into a protocol format of a web page access interface to obtain a second data packet;
[0062] Sending the second data packet to the peer server by using the first name and the second name via D-BUS;
[0063] receiving second feedback information for the second data packet returned by the opposite end controller;
[0064] determining, according to the second feedback information, whether the second data packet has been correctly sent to the opposite end controller;
[0065] If it is determined that the second data packet has been correctly sent to the opposite end controller, determining whether there is any data in the cache that has not been sent;
[0066] If there is no unsent data in the buffer, the connection with the D-BUS is disconnected.
[0067] In a second aspect, the present invention provides a multi-controller data synchronization device, which is applied to a data management service on a first controller, each controller includes a plurality of service units, and the service units are used to store and manage data of corresponding field replaceable units, and the device includes:
[0068] Configuration information acquisition module, used to obtain synchronization data configuration information;
[0069] A determination module, configured to determine data to be synchronized according to the synchronization data configuration information, wherein the data to be synchronized includes data of the field replaceable unit;
[0070] A collection module, used for collecting the data that needs to be synchronized;
[0071] A saving module, used for storing the data to be synchronized into a corresponding data partition according to the field replaceable unit to which the data to be synchronized belongs;
[0072] A determination module, used to determine the data of the target field replaceable unit that currently needs to be synchronized;
[0073] A synchronization module is used to synchronize the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller.
[0074] In some optional implementations, in the controller, the data partition corresponding to each of the field replaceable units includes a primary data partition and a secondary data partition;
[0075] The saving module is specifically used to store the newly collected data of the field replaceable unit into the primary data partition and the secondary data partition of the field replaceable unit respectively;
[0076] A synchronization module is specifically used to synchronize the data in the secondary data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller; after the data in the secondary data partition is successfully synchronized to the data management service of other controllers other than the first controller, the data in the secondary data partition is cleared.
[0077] In some optional embodiments, the above device further includes:
[0078] a marking module, configured to mark the newly collected data of the field replaceable unit;
[0079] The synchronization module is specifically used to obtain the marked data in the target data partition; synchronize the marked data to the data management service of other controllers other than the first controller; and remove the mark of the data after the marked data is successfully synchronized to the data management service of other controllers other than the first controller.
[0080] In some optional implementations, the multi-controller data synchronization device further includes:
[0081] A first request receiving module, used for receiving a data query request;
[0082] A target data acquisition module, used to acquire the target data corresponding to the query request;
[0083] A sending module is used to send the target data to the sender of the data query request.
[0084] In some optional embodiments, the synchronization module is specifically used to receive status change data for a target field replaceable unit input by a user, determine whether the data synchronization trigger condition is satisfied; determine the second controller to which the target field replaceable unit belongs; if the first controller and the second controller are slave controllers, synchronize the status change data of the target field replaceable unit to the data management service of the main controller, so that the data management service of the main controller synchronizes the status change data of the target field replaceable unit to the data management service of the second controller.
[0085] In some optional implementations, the data management service uses D-BUS communication;
[0086] The multi-controller data synchronization device also includes:
[0087] A second request receiving module, used for receiving a D-BUS interface modification request;
[0088] The interface modification module is used to modify the corresponding D-BUS interface based on the D-BUS interface modification request.
[0089] In some optional embodiments, the collection module includes:
[0090] A first collecting unit, configured to obtain the data of the first service unit when a triggering condition for obtaining the data of the first service unit is met;
[0091] and / or,
[0092] The second collection unit is used to obtain data of the second service unit through routine testing.
[0093] In some optional implementations, the synchronization module includes:
[0094] A first synchronization unit, used for periodically synchronizing the data to other controllers other than the first controller;
[0095] and / or,
[0096] The second synchronization unit is used to synchronize the data to other controllers other than the first controller when a data synchronization trigger condition is met.
[0097] In some optional implementations, the synchronization module includes:
[0098] A selection unit, used for acquiring at least part of the data and storing it in a cache;
[0099] Initialization unit, used to initialize the connection with D-BUS;
[0100] A registration unit, used to register a unique first name on the D-BUS;
[0101] A reading unit, configured to read the first data in the cache;
[0102] an encapsulation unit, configured to encapsulate the first data into a protocol format of a web page access interface to obtain a first data packet;
[0103] A data packet sending unit, configured to send the first data packet to a peer server via a D-BUS using the first name and a second name registered by the peer controller on the D-BUS;
[0104] A feedback information receiving unit, configured to receive first feedback information for the first data packet returned by the opposite end controller;
[0105] A first judging unit, configured to judge whether the first data packet has been correctly sent to the opposite end controller according to the first feedback information;
[0106] A second judgment unit, configured to judge whether there is any unsent data in the cache when it is determined that the first data packet has been correctly sent to the opposite end controller;
[0107] The reading unit is further configured to obtain second data from the data that has not been sent if there is data that has not been sent in the cache;
[0108] The encapsulation unit is further used to encapsulate the second data into a protocol format of a web page access interface to obtain a second data packet;
[0109] The data packet sending unit is further used to send the second data packet to the opposite server via D-BUS using the first name and the second name;
[0110] The feedback information receiving unit is further configured to receive second feedback information for the second data packet returned by the opposite end controller;
[0111] The first judging unit is further configured to judge whether the second data packet has been correctly sent to the opposite end controller according to the second feedback information;
[0112] The second judgment unit is further configured to judge whether there is any unsent data in the cache when it is determined that the second data packet has been correctly sent to the opposite end controller;
[0113] The disconnection unit is used to disconnect the connection with the D-BUS if there is no unsent data in the buffer.
[0114] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the multi-controller data synchronization method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0115] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the multi-controller data synchronization method of the first aspect or any corresponding embodiment thereof.
[0116] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the multi-controller data synchronization method of the first aspect or any corresponding embodiment thereof.
[0117] The multi-controller data synchronization method, device, equipment and storage medium provided by the embodiment of the present invention introduces a data management service. On the premise of ensuring that the synchronized data on multiple controllers remain consistent, each service unit (also referred to as a service management unit) in the controller is decoupled from data synchronization. Specifically, the data management service actively obtains data that needs to be synchronized from other services, and centralizes the synchronized data to the data management service. Other service units (such as FRU service units) only need to pay attention to their own services and data, and do not need to pay attention to the data of other controllers, making the business more unified, the coding simpler, and reducing the coupling between service units. Centralizing the synchronized data to the data management service also improves data management efficiency and debugging convenience. BRIEF DESCRIPTION OF THE DRAWINGS
[0118] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0119] Figure 1 is a schematic flow chart of a multi-controller data synchronization method according to an embodiment of the present invention;
[0120] Figure 2 is a schematic diagram of a logical architecture of multi-controller data synchronization according to an embodiment of the present invention;
[0121] Figure 3 is a flow chart of another multi-controller data synchronization method according to an embodiment of the present invention;
[0122] Figure 4is a functional schematic diagram of a data management service according to an embodiment of the present invention;
[0123] Figure 5 is a structural block diagram of a multi-controller data synchronization device according to an embodiment of the present invention;
[0124] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0125] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0126] The embodiment of the present invention provides a multi-controller data synchronization method, which introduces a data management service, decouples each service unit (also referred to as a service management unit) in the controller from data synchronization, and ensures that the synchronization data on multiple controllers remain consistent. Specifically, the data management service actively obtains data that needs to be synchronized from other services, and centralizes the synchronization data to the data management service. Other service units (such as FRU service units) only need to pay attention to their own services and data, and do not need to pay attention to the data of other controllers, making the business more unified, the coding simpler, and reducing the coupling between service units. Centralizing the synchronization data to the data management service also improves data management efficiency and debugging convenience.
[0127] According to an embodiment of the present invention, an embodiment of a multi-controller data synchronization method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of executable computer instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0128] In this embodiment, a multi-controller data synchronization method is provided, which can be used for a data management service applied to a first controller, each controller includes a plurality of service units, and the service units are used to store and manage data of corresponding field replaceable units. Figure 1 is a flowchart of a multi-controller data synchronization method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0129] Step S101, obtaining synchronization data configuration information.
[0130] In the embodiment of the present invention, the data to be synchronized is configured in the form of a configuration file, which can be flexibly configured according to actual needs, conveniently managing and expanding the synchronized data, and adapting to different application scenarios. The configuration file can be a JSON configuration file, and JSON (JavaScript Object Notation, JS object notation) is a lightweight data exchange format.
[0131] Step S102: determining data to be synchronized according to synchronization data configuration information, where the data to be synchronized includes data of field replaceable units.
[0132] The data that needs to be synchronized includes the service unit corresponding to the FRU, the attribute information and status information of the FRU, etc. The attribute information includes the manufacturer, version number, model and serial number, etc. The status information includes temperature and speed (fan). The types of status information of different FRUs may be different.
[0133] Step S103: collecting data that needs to be synchronized.
[0134] The data to be synchronized are collected here, including the data of the controller (ie, the first controller) and the data of other controllers. Specifically, the data of other controllers can be collected through the communication link between the controllers.
[0135] In addition, data management services will organize and categorize the collected data.
[0136] Step S104, storing the data to be synchronized into the corresponding data partition according to the field replaceable unit to which the data to be synchronized belongs;
[0137] Step S105, determining the data of the target field replaceable unit that currently needs to be synchronized;
[0138] Step S106: Synchronize the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller.
[0139] Specifically, see Figure 2 A logical architecture of multi-controller data synchronization is shown, in which the data management service is responsible for data collection, data synchronization and peer controller data management of the controller, and the link management service is responsible for data sending and link management (creation, destruction and switching of primary and standby links).
[0140] The multi-controller data synchronization method provided in this embodiment introduces a data management service. On the premise of ensuring that the synchronized data on multiple controllers remain consistent, it decouples the service units (also referred to as service management units) in the controller from data synchronization. Specifically, the data management service actively obtains the data that needs to be synchronized from other services, and centralizes the synchronized data to the data management service. Other service units (such as FRU service units) only need to pay attention to their own services and data, and do not need to pay attention to the data of other controllers, making the business more unified, the coding simpler, and reducing the coupling between service units. Centralizing the synchronized data to the data management service also improves data management efficiency and debugging convenience. In an embodiment of the present invention, when synchronizing data to the opposite controller, the synchronized data only needs to be sent to the data management service of the opposite controller, and is not sent to the service unit of the opposite controller, thereby achieving complete decoupling of data management and service units, and concentrating data management services on the data management service.
[0141] In addition, since the data of each service unit in the multi-controller (specifically including the data of the field replaceable unit managed by each service unit) is all saved and managed by the data management service, the data volume is large. Therefore, for the convenience of subsequent reading, the embodiment of the present invention stores the data of different field replaceable units in partitions. Subsequently, the field replaceable unit to which the data to be read belongs can be determined first, and then the corresponding data can be read from the data partition corresponding to the field replaceable unit.
[0142] In this embodiment, a multi-controller data synchronization method is provided, which can be used for a data management service applied to a first controller, each controller includes a plurality of service units, and the service units are used to store and manage data of corresponding field replaceable units. Figure 3 is a flowchart of a multi-controller data synchronization method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0143] Step S301, obtaining synchronization data configuration information.
[0144] In the embodiment of the present invention, the data to be synchronized is configured in the form of a configuration file, which can be flexibly configured according to actual needs, conveniently managing and expanding the synchronized data, and adapting to different application scenarios. The configuration file can be a JSON configuration file, and JSON (JavaScript Object Notation, JS object notation) is a lightweight data exchange format.
[0145] Step S302: determining data to be synchronized according to synchronization data configuration information, where the data to be synchronized includes data of field replaceable units.
[0146] The data that needs to be synchronized includes the service unit corresponding to the FRU, the attribute information and status information of the FRU, etc.
[0147] Step S303: collecting data that needs to be synchronized.
[0148] The data to be synchronized are collected here, including the data of the controller (ie, the first controller) and the data of other controllers. Specifically, the data of other controllers can be collected through the communication link between the controllers.
[0149] After the data management service collects the data, it can be stored in the memory of the first controller.
[0150] In some optional specific implementations, step S303, i.e., collecting data to be synchronized, includes:
[0151] Step S3031, if the trigger condition for obtaining the data of the first service unit is met, then obtaining the data of the first service unit;
[0152] and / or,
[0153] Step S3032: Acquire data of the second service unit through routine testing.
[0154] In the embodiment of the present invention, the data of each service unit (except the data management service) on this controller can be obtained through example testing, and specifically, the data to be synchronized is obtained by example testing the attribute data exposed by each service unit (except the data management service) on D-BUS, thereby realizing the decoupling of data management and each service unit (except the data management service). The data of each service unit on other controllers can be sent by the data management service of other controllers.
[0155] In addition, if the service unit, such as the attribute data of some service units, needs to be synchronized, the data is not updated frequently and there is no need for routine testing, then the data of the service unit can be acquired in a triggered manner. The specific triggering form can be determined according to actual needs, for example, it can be triggered by a broadcast signal of D-BUS. The specific triggering condition can be an event trigger. The triggered collection of data that needs to be synchronized can be applicable to the data collection of the service unit on this controller, and also to the data collection of the service unit on other controllers.
[0156] See also Figure 2 and Figure 4In the embodiment of the present invention, the data management service adopts D-BUS communication. Specifically, the data management service and the service unit (FRU service unit) of this controller adopt D-BUS communication, and the data management service and other controllers also adopt D-BUS communication. D-BUS, as a typical local inter-process communication (IPC), is similar to a pipe and relies on path names to identify the sender and the receiver. That is, when sending data, the path name bound to the receiver is specified. The operating system can directly find the corresponding receiver according to the path name, and copy the original data directly to the kernel buffer of the receiver, and report it to the receiver process for processing. Similarly, the receiver can obtain the path name of the sender from the received data packet and send data to it through this path name. It reduces the requirements for system resources and bandwidth and has an efficient transmission rate.
[0157] Step S304, storing the data to be synchronized into the corresponding data partition according to the field replaceable unit to which the data to be synchronized belongs;
[0158] Step S305, determining the data of the target field replaceable unit that currently needs to be synchronized;
[0159] Step S306: Synchronize the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller through the communication link between the controllers.
[0160] In some optional specific implementations, in the controller, the data partition corresponding to each field replaceable unit includes a primary data partition and a secondary data partition;
[0161] Step S304, i.e. storing the data to be synchronized into the corresponding data partition according to the field replaceable unit to which the data to be synchronized belongs, comprises:
[0162] storing the newly collected data of the field replaceable unit into the primary data partition and the secondary data partition of the field replaceable unit respectively;
[0163] Step S306, synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller, includes:
[0164] Synchronize the data in the secondary data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller;
[0165] After the data in the secondary data partition is successfully synchronized to the data management services of other controllers other than the first controller, the data in the secondary data partition is cleared.
[0166] In an embodiment of the present invention, for newly acquired data that has not yet been synchronized to other servers, a backup copy can be made separately in the secondary data partition. During subsequent synchronization, there is no need to go to the primary data partition, only to go to the secondary data partition to read, and there is no need to spend a lot of time searching when reading data.
[0167] In an optional implementation, storing the newly collected data of the field replaceable unit into the primary data partition and the secondary data partition of the field replaceable unit respectively includes:
[0168] storing the newly collected data of the field replaceable unit into the secondary data partition;
[0169] Determine whether the read-write process lock and the read-write thread lock of the main data partition are occupied according to a preset period; once the read-write process lock and the read-write thread lock are occupied, other processes or threads cannot read and write the main data partition;
[0170] If the read-write process lock and the read-write thread lock of the primary data partition are not occupied, then the read-write process lock and the read-write thread lock of the primary data partition are acquired;
[0171] writing the data of the field replaceable unit newly collected in the secondary data partition into the primary data partition;
[0172] After writing is completed, the read-write process lock and the read-write thread lock of the primary data partition are released.
[0173] In an embodiment of the present invention, the data management service not only needs to complete data synchronization but also needs to complete the data collection process. Therefore, in order to prevent data conflicts, during the data collection process, the collected data is first stored in the secondary data partition, and when there is no data reading and writing in the primary data partition (if there is data reading and writing, the read-write process lock and the read-write thread lock need to be occupied), the collected data is written into the primary data area.
[0174] In some optional specific implementations, step S304, i.e. after the field replaceable unit to which the data to be synchronized belongs stores the data to be synchronized into the corresponding data partition, further includes:
[0175] Tagging newly collected field replaceable unit data;
[0176] Step S305, synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller, including:
[0177] Obtain the marked data in the target data partition;
[0178] synchronizing the marked data to data management services of other controllers other than the first controller;
[0179] After the marked data is successfully synchronized to the data management services of other controllers other than the first controller, the mark of the data is removed.
[0180] In some optional specific implementations, step S306, i.e., synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller through the communication link between the controllers, includes:
[0181] receiving state change data for a target field replaceable unit input by a user, and determining that the data synchronization trigger condition is satisfied;
[0182] Determining a second controller to which the target field replaceable unit belongs;
[0183] If the first controller and the second controller are slave controllers, the status change data of the target field replaceable unit is synchronized to the data management service of the master controller, so that the data management service of the master controller synchronizes the status change data of the target field replaceable unit to the data management service of the second controller.
[0184] In some optional specific implementations, step S306, i.e., synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller through the communication link between the controllers, includes:
[0185] Synchronizing data to other controllers other than the first controller at a regular interval;
[0186] and / or,
[0187] If the data synchronization trigger condition is met, the data is synchronized to other controllers except the first controller.
[0188] In the embodiment of the present invention, there are two ways of data synchronization, one is timed synchronization, and the other is triggered synchronization. Triggered synchronization is mainly applicable to scenarios where the data of a service unit or some service units is updated and the data of this service unit or these service units needs to be synchronized first and separately. For example, if the data required by the slave controller is modified in the master controller, then the modified data can be triggered to be synchronized to the data management service of the slave controller. The trigger condition here can be an event trigger or other trigger conditions.
[0189] The data collection trigger and data synchronization trigger in the embodiment of the present invention can both use Boost Asio event trigger. Boost.Asio, the design inspiration comes from the Reactor pattern, which separates operation and event processing, drives asynchronous operations through event loops, and thus achieves high-performance network communication. Its task scheduling mechanism is to implement two different queues to handle general operations and IO operations. General operations can be placed in the default operation queue provided by Boost Asio, while operations directly related to IO can be placed in the thread private queue. During scheduling, it will first check whether the operation queue is empty. If it is not empty, the operations in the queue will be processed. If the operation in the queue is an operation directly related to IO, it will be copied to the thread private queue, and then the run function of Reactor will be executed, and the thread private queue will be passed in as the operation queue.
[0190] About Boost Asio event triggering:
[0191] 1. Asynchronous I / O and event triggering
[0192] Asynchronous I / O: Unlike traditional synchronous I / O, asynchronous I / O allows applications to perform other tasks while waiting for I / O operations (such as reading, writing, connecting, etc.) to complete. This is achieved in a non-blocking manner, that is, the I / O operation does not return the result immediately, but triggers a callback function or processing function when the operation is completed.
[0193] Event triggering: In Boost Asio, when an asynchronous I / O operation is completed, one or more events are triggered. These events are usually represented by callback functions or processing functions after the operation is completed. When an event is triggered, the corresponding function will be called to process the results of the operation.
[0194] 2. Key components triggered by events
[0195] I / O Services: One of the core components of Boost Asio, it abstracts the I / O interface of the operating system and provides asynchronous data processing capabilities. Applications use I / O services to perform asynchronous I / O operations and receive event notifications when the operations are completed.
[0196] I / O Objects: Used to initiate specific asynchronous I / O operations. For example, boost::asio::ip::tcp::socket objects are used for TCP socket operations, and boost::asio::deadline_timer objects are used for timer operations.
[0197] 3. Event triggering process
[0198] Create I / O services and I / O objects: First, the application needs to create an I / O service object (such as boost::asio::io_service) and one or more I / O objects (such as sockets, timers, etc.).
[0199] Define callback functions or processing functions: Define callback functions or processing functions for asynchronous I / O operations. These functions will be called when the operation is completed to process the results of the operation.
[0200] Start asynchronous I / O operations: Use I / O objects to start asynchronous I / O operations. For example, use socket objects to start asynchronous read, write, or connect operations, or use timer objects to start asynchronous wait operations.
[0201] Run I / O service: Call the run() or run_one() method of the I / O service to start the event loop. In the event loop, the I / O service will wait for the asynchronous I / O operation to complete and trigger the corresponding event when it is completed.
[0202] Handling events: When an asynchronous I / O operation is completed, the corresponding callback function or processing function will be called. In these functions, you can check the result of the operation (such as through the boost::system::error_code object) and perform corresponding processing logic.
[0203] In the related art, the data synchronization function provides two interfaces, an asynchronous sending interface and a synchronous sending interface. The asynchronous interface stores messages in a queue, the data sending thread reads messages from the message queue for sending, and the receiving thread receives and parses the processed data; the synchronous interface directly allows the data sending thread to compete for resources to send data. The depth of the message queue needs to be carefully managed to ensure that the requirements of all modules sending data at the same time are met. This may require continuous adjustment and optimization. In high concurrency situations, if the message queue depth is not enough or the processing speed cannot keep up with the sending speed, messages may be lost or delayed. In the synchronous sending interface, due to the direct competition for resources by threads, data transmission may be delayed, especially under high load conditions. If not controlled, it may cause deadlock or performance problems.
[0204] In the embodiment of the present invention, an efficient event-driven system is established by combining the use of D-BUS and Boost Asio, and the communication is more efficient and reliable, which solves the problem of message loss or delay caused by insufficient message queue depth in the related technical implementation, and also solves the deadlock or performance problems caused by thread competition for resources under high load.
[0205] Taking the first controller as the main controller as an example, the data synchronization process is as follows:
[0206] Step 1: The main controller collects the data to be synchronized through the data management service, which may be the data of each shared FRU service unit;
[0207] Step 2: The main controller records the latest collected data into the memory;
[0208] Step 3: The master controller broadcasts the latest collected data to the data management service of each slave controller;
[0209] Step 4: The slave controller records the latest data sent by the master controller into the memory.
[0210] In addition, the multi-controller data synchronization method provided by the embodiment of the present invention also includes:
[0211] Step 1: receiving a data query request;
[0212] Step 2: Obtain target data corresponding to the query request; the target data is part or all of the collected synchronization data;
[0213] Step 3: Send the target data to the sender of the data query request.
[0214] The embodiment of the present invention provides a data query function to facilitate the acquisition of controller data, for example, it facilitates redfish, web, IPMI, and service units to acquire information of peer controllers.
[0215] In some other optional specific implementations, the multi-controller data synchronization method provided by the embodiment of the present invention further includes:
[0216] Receive D-BUS interface modification request;
[0217] Modify the corresponding D-BUS interface based on the D-BUS interface modification request.
[0218] The embodiment of the present invention also provides a D-BUS interface modification function, which facilitates debugging of the data synchronization function with the help of a D-BUS interface tool, that is, improves debugging convenience. Debugging can specifically include viewing data stored by the data management service, modifying the status of the FRU, and the like.
[0219] The embodiment of the present invention effectively solves the problem of data synchronization of multi-controller BMC shared devices through an innovative data synchronization mechanism, improves the stability, flexibility and reliability of the system, and has high practical value and market prospects.
[0220] In other optional specific implementations, modifying the corresponding D-BUS interface based on the D-BUS interface modification request includes:
[0221] Get the permission profile;
[0222] Determining whether the interface modification requested by the interface modification request is permitted according to the permission control file;
[0223] If it is determined that the interface modification requested by the interface modification request is allowed, the interface modification is performed.
[0224] In the embodiment of the present invention, the modification of the D-BUS interface is restricted by authority control to prevent the interface modification from affecting normal data synchronization.
[0225] In some specific implementations, synchronizing data to other controllers other than the first controller through the communication link between the controllers includes:
[0226] Obtaining at least part of the data and storing it in a cache;
[0227] Initialize the connection with D-BUS;
[0228] Register a unique first name on D-BUS;
[0229] Reading the first data in the cache;
[0230] Encapsulating the first data into a protocol format of a web page access interface to obtain a first data packet;
[0231] Sending a first data packet to a peer server via the D-BUS using the first name and a second name registered by the peer controller on the D-BUS;
[0232] Receiving first feedback information for the first data packet returned by the opposite end controller;
[0233] Determining whether the first data packet has been correctly sent to the opposite end controller according to the first feedback information;
[0234] If it is determined that the first data packet has been correctly sent to the opposite end controller, then determining whether there is any data in the cache that has not been sent;
[0235] If there is data in the cache that has not been sent, obtain second data in the data that has not been sent;
[0236] Encapsulating the second data into a protocol format of a web page access interface to obtain a second data packet;
[0237] Sending a second data packet to the peer server via D-BUS using the first name and the second name;
[0238] receiving second feedback information for the second data packet returned by the opposite end controller;
[0239] Determining whether the second data packet has been correctly sent to the opposite end controller according to the second feedback information;
[0240] If it is determined that the second data packet has been correctly sent to the opposite end controller, determining whether there is any data in the cache that has not been sent;
[0241] If there is no unsent data in the buffer, disconnect from the D-BUS.
[0242] In addition, if it is determined based on the feedback information that the data packet is not correctly sent to the peer controller, the data packet is resent until feedback information for the data packet is received from the peer controller (specifically, the data management service in the peer controller) indicating that the data packet has been correctly received by the peer controller.
[0243] The detailed process of using D-BUS to communicate between the two ends can be divided into the following steps, which are summarized based on the characteristics and working principle of D-BUS:
[0244] Initialization and connection: First, the two processes (the two ends refer to the data management service of this controller and the data management service of the other controller, and the two processes refer to process A and process B) need to initialize the connection with D-BUS. This is usually done by calling functions such as dbus_bus_get(), specifying whether the connection is to the system bus (System bus) or the user bus (Session bus).
[0245] Registration and naming: Both process A and process B need to register a unique name (busname) on D-BUS so that other processes can identify and communicate with it. This is done by calling functions such as dbus_bus_request_name().
[0246] After successful registration, the process can publish or receive messages on D-BUS using this name.
[0247] Message publishing and receiving: D-BUS supports multiple message types, including method call, signal, property, etc.
[0248] Process A can send a method call message or publish a signal to process B via D-BUS. Process B can register to receive specific signals or method calls.
[0249] When process B receives a message from process A, it processes the message accordingly, such as executing a function or updating a property.
[0250] Message forwarding and routing: The background process (dbus-daemon) of D-BUS plays the role of message forwarding and routing. When process A sends a message to process B, the message is first sent to dbus-daemon, and then dbus-daemon forwards the message to process B according to the name and path of the target process.
[0251] This mechanism allows D-BUS to support many-to-many communication mode, that is, one message can be received and processed by multiple processes.
[0252] Error handling and feedback: If an error occurs during the communication process (such as connection failure, name conflict, etc.), D-BUS will provide the corresponding error code and description information so that the process can perform error handling.
[0253] For method call messages, process B can send a method return message to feedback the execution result or error information to process A.
[0254] Disconnection and cleanup: When the process has completed the communication and needs to disconnect from the D-BUS, the corresponding function should be called to release resources and disconnect. This helps to avoid resource leaks and potential security issues.
[0255] In summary, the process of using D-BUS to communicate between two ends involves multiple steps, including initializing the connection, registering names, publishing and receiving messages, forwarding and routing messages, error handling and feedback, and disconnection and cleanup. These steps together form the basis of D-BUS as an efficient, flexible, and secure inter-process communication mechanism.
[0256] In addition, the first data packet obtained after encapsulating the first data into the protocol format of the webpage access interface includes:
[0257] The second name is split into multiple parts, and the multiple parts of the second name are inserted into the first data according to a prior agreement. The first data with the first and second names inserted is then encapsulated into the protocol format of the web page access interface to obtain a first data packet, so that the data management service of the controller on the other end parses the first data packet after receiving the first data packet. After the parsing is completed, the data at the data position where the second name is located is extracted from the parsed data according to the prior agreement, and the extracted data is compared with the second name. If they are consistent, it is determined that the first data packet has been correctly received, and feedback information is sent to this controller to indicate that the first data packet has been correctly received (for the controller on this end, that is, the first data packet has been correctly sent to the controller on the other end).
[0258] The embodiment of the present invention provides a method for verifying whether a data packet is sent correctly, which does not require the introduction of additional verification information, nor does it require the calculation of data in the data packet to obtain the verification information, thereby reducing the amount of data processing.
[0259] In this embodiment, a multi-controller data synchronization device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0260] This embodiment provides a multi-controller data synchronization device, which is applied to a data management service on a first controller. Each controller includes a plurality of service units, and the service units are used to store and manage data of corresponding field replaceable units, such as Figure 5 As shown, the device comprises:
[0261] Configuration information acquisition module 501, used to acquire synchronization data configuration information;
[0262] A determination module 502, configured to determine data to be synchronized according to synchronization data configuration information, wherein the data to be synchronized includes data of field replaceable units;
[0263] A collection module 503 is used to collect data that needs to be synchronized;
[0264] A saving module 504 is used to store the data to be synchronized into the corresponding data partition according to the field replaceable unit to which the data to be synchronized belongs;
[0265] A determination module 505, used to determine the data of the target field replaceable unit that currently needs to be synchronized;
[0266] The synchronization module 506 is used to synchronize the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller.
[0267] The multi-controller data synchronization device provided in this embodiment introduces a data management service. On the premise of ensuring that the synchronized data on multiple controllers remain consistent, it decouples the service units (also called service management units) in the controller from data synchronization. Specifically, the data management service actively obtains the data that needs to be synchronized from other services, and centralizes the synchronized data to the data management service. Other service units (such as FRU service units) only need to pay attention to their own services and data, and do not need to pay attention to the data of other controllers, making the business more unified, the coding simpler, and reducing the coupling between service units. Centralizing the synchronized data to the data management service also improves data management efficiency and debugging convenience.
[0268] In some optional implementations, in the controller, the data partition corresponding to each field replaceable unit includes a primary data partition and a secondary data partition;
[0269] A storage module, specifically used to store the newly collected data of the field replaceable unit into the primary data partition and the secondary data partition of the field replaceable unit respectively;
[0270] The synchronization module is specifically used to synchronize the data in the secondary data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller; after the data in the secondary data partition is successfully synchronized to the data management service of other controllers other than the first controller, the data in the secondary data partition is cleared.
[0271] In some optional embodiments, the saving module is specifically used to store the newly collected data of the field replaceable unit into the secondary data partition; determine whether the read-write process lock and read-write thread lock of the main data partition are occupied according to a preset period; if the read-write process lock and read-write thread lock of the main data partition are not occupied, obtain the read-write process lock and read-write thread lock of the main data partition; write the newly collected data of the field replaceable unit in the secondary data partition into the main data partition; after the writing is completed, release the read-write process lock and read-write thread lock of the main data partition.
[0272] In some optional embodiments, the above device further includes:
[0273] a marking module, used for marking newly collected data of the field replaceable unit;
[0274] The synchronization module is specifically used to obtain the marked data in the target data partition; synchronize the marked data to the data management service of other controllers other than the first controller; after the marked data is successfully synchronized to the data management service of other controllers other than the first controller, remove the data mark.
[0275] In some optional implementations, the multi-controller data synchronization device further includes:
[0276] A first request receiving module, used for receiving a data query request;
[0277] A target data acquisition module is used to acquire target data corresponding to the query request;
[0278] The sending module is used to send the target data to the sender of the data query request.
[0279] In some optional embodiments, the synchronization module is specifically used to receive status change data for a target field replaceable unit input by a user, determine whether the data synchronization trigger condition is satisfied; determine the second controller to which the target field replaceable unit belongs; if the first controller and the second controller are slave controllers, synchronize the status change data of the target field replaceable unit to the data management service of the main controller, so that the data management service of the main controller synchronizes the status change data of the target field replaceable unit to the data management service of the second controller.
[0280] In some optional embodiments, the data management service uses D-BUS communication;
[0281] The multi-controller data synchronization device also includes:
[0282] A second request receiving module, used for receiving a D-BUS interface modification request;
[0283] The interface modification module is used to modify the corresponding D-BUS interface based on the D-BUS interface modification request.
[0284] In some optional embodiments, the collection module includes:
[0285] A first collecting unit, configured to obtain data of the first service unit when a triggering condition for obtaining data of the first service unit is met;
[0286] and / or,
[0287] The second collection unit is used to obtain data of the second service unit through routine testing.
[0288] In some optional implementations, the synchronization module includes:
[0289] A first synchronization unit, used for periodically synchronizing data to other controllers other than the first controller;
[0290] and / or,
[0291] The second synchronization unit is used to synchronize data to other controllers other than the first controller when a data synchronization trigger condition is met.
[0292] In some optional implementations, the synchronization module 504 includes:
[0293] A selection unit, used for acquiring at least part of the data and storing it in a cache;
[0294] Initialization unit, used to initialize the connection with D-BUS;
[0295] A registration unit, used to register a unique first name on the D-BUS;
[0296] A reading unit, configured to read the first data in the cache;
[0297] An encapsulation unit, configured to encapsulate the first data into a protocol format of a web page access interface to obtain a first data packet;
[0298] A data packet sending unit, configured to send a first data packet to a peer server via a D-BUS using a first name and a second name registered by a peer controller on the D-BUS;
[0299] A feedback information receiving unit, configured to receive first feedback information for a first data packet returned by a peer controller;
[0300] A first judging unit, configured to judge whether the first data packet has been correctly sent to the opposite end controller according to the first feedback information;
[0301] A second judgment unit is used to judge whether there is any unsent data in the cache when it is determined that the first data packet has been correctly sent to the opposite end controller;
[0302] The reading unit is further used to obtain second data from the data that has not been sent when there is data that has not been sent in the cache;
[0303] The encapsulation unit is further used to encapsulate the second data into a protocol format of the webpage access interface to obtain a second data packet;
[0304] The data packet sending unit is further used to send a second data packet to the opposite end server via D-BUS using the first name and the second name;
[0305] The feedback information receiving unit is further used to receive second feedback information for the second data packet returned by the opposite end controller;
[0306] The first judgment unit is further used to judge whether the second data packet has been correctly sent to the opposite end controller according to the second feedback information;
[0307] The second judgment unit is further used to judge whether there is any unsent data in the cache when it is determined that the second data packet has been correctly sent to the opposite end controller;
[0308] The disconnection unit is used to disconnect the connection with the D-BUS if there is no unsent data in the buffer.
[0309] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0310] The multi-controller data synchronization device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0311] The embodiment of the present invention also provides a computer device having the above Figure 5 A multi-controller data synchronization device is shown.
[0312] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0313] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0314] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0315] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0316] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0317] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0318] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0319] The computer device also includes a communication interface, which is used for the computer device to communicate with other devices or a communication network.
[0320] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0321] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0322] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A multi-controller data synchronization method, characterized in that: A data management service applied to a first controller, each controller comprising a plurality of service units, the service units being used to store and manage data of a corresponding field replaceable unit, the method comprising: Get synchronization data configuration information; Determine data to be synchronized according to the synchronization data configuration information, wherein the data to be synchronized includes data of the field replaceable unit; Collect the data that needs to be synchronized; According to the field replaceable unit to which the data to be synchronized belongs, storing the data to be synchronized into a corresponding data partition; Determine the data of the target field replaceable unit that currently needs to be synchronized; Synchronize data in a target data partition corresponding to the target field replaceable unit to data management services of other controllers other than the first controller.
2. The method according to claim 1, characterized in that In the controller, the data partition corresponding to each of the field replaceable units includes a primary data partition and a secondary data partition; According to the field replaceable unit to which the data to be synchronized belongs, storing the data to be synchronized into a corresponding data partition includes: storing the newly collected data of the field replaceable unit into the primary data partition and the secondary data partition of the field replaceable unit respectively; The step of synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller includes: Synchronize the data in the secondary data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller; After the data in the secondary data partition is successfully synchronized to the data management service of other controllers other than the first controller, the data in the secondary data partition is cleared.
3. The method according to claim 2, characterized in that The storing the newly collected data of the field replaceable unit into the primary data partition and the secondary data partition of the field replaceable unit respectively comprises: storing the newly collected data of the field replaceable unit into the secondary data partition; Determine whether the read-write process lock and the read-write thread lock of the primary data partition are occupied according to a preset period; If the read-write process lock and the read-write thread lock of the primary data partition are not occupied, then the read-write process lock and the read-write thread lock of the primary data partition are acquired; writing the data of the field replaceable unit newly collected in the secondary data partition into the primary data partition; After writing is completed, the read-write process lock and the read-write thread lock of the primary data partition are released.
4. The method according to claim 1, characterized in that: After storing the data to be synchronized into the corresponding data partition according to the field replaceable unit to which the data to be synchronized belongs, the method further includes: marking the newly collected data of the field replaceable unit; The step of synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller includes: Acquire the marked data in the target data partition; Synchronizing the marked data to a data management service of another controller other than the first controller; After the marked data is successfully synchronized to the data management service of other controllers other than the first controller, the mark of the data is removed.
5. The method according to claim 1, characterized in that The collecting of the data that needs to be synchronized includes: If a trigger condition for obtaining data of the first service unit is met, obtaining the data of the first service unit; and / or, Acquire data of the second service unit through routine testing; The step of synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller includes: Synchronizing the data to other controllers other than the first controller at a regular interval; and / or, If the data synchronization trigger condition is met, the data is synchronized to other controllers other than the first controller.
6. The method according to claim 5, characterized in that If the data synchronization trigger condition is met, synchronizing the data to other controllers other than the first controller includes: receiving state change data for a target field replaceable unit input by a user, and determining that the data synchronization trigger condition is satisfied; Determining a second controller to which the target field replaceable unit belongs; If the first controller and the second controller are slave controllers, the status change data of the target field replaceable unit is synchronized to the data management service of the master controller, so that the data management service of the master controller synchronizes the status change data of the target field replaceable unit to the data management service of the second controller.
7. The method according to claim 1, characterized in that The synchronizing the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller comprises: Acquire at least part of the data and store it in a cache; Initialize the connection with D-BUS; Register a unique first name on D-BUS; Reading first data in the cache; Encapsulating the first data into a protocol format of a web page access interface to obtain a first data packet; Sending the first data packet to the peer server via the D-BUS using the first name and a second name registered by the peer controller on the D-BUS; Receiving first feedback information for the first data packet returned by the opposite end controller; Determining whether the first data packet has been correctly sent to the opposite end controller according to the first feedback information; If it is determined that the first data packet has been correctly sent to the opposite end controller, determining whether there is any data in the cache that has not been sent; If there is data in the cache that has not been sent, obtaining second data in the data that has not been sent; Encapsulating the second data into a protocol format of a web page access interface to obtain a second data packet; Sending the second data packet to the peer server by using the first name and the second name via D-BUS; receiving second feedback information for the second data packet returned by the opposite end controller; determining, according to the second feedback information, whether the second data packet has been correctly sent to the opposite end controller; If it is determined that the second data packet has been correctly sent to the opposite end controller, determining whether there is any data in the cache that has not been sent; If there is no unsent data in the buffer, the connection with the D-BUS is disconnected.
8. A multi-controller data synchronization device, characterized in that: A data management service applied to a first controller, each controller comprising a plurality of service units, the service units being used to store and manage data of a corresponding field replaceable unit, the device comprising: Configuration information acquisition module, used to obtain synchronization data configuration information; A determination module, configured to determine data to be synchronized according to the synchronization data configuration information, wherein the data to be synchronized includes data of the field replaceable unit; A collection module, used for collecting the data that needs to be synchronized; A saving module, configured to store the data to be synchronized into a corresponding data partition according to the field replaceable unit to which the data to be synchronized belongs; A determination module, used to determine the data of the target field replaceable unit that currently needs to be synchronized; A synchronization module is used to synchronize the data in the target data partition corresponding to the target field replaceable unit to the data management service of other controllers other than the first controller.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the multi-controller data synchronization method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the multi-controller data synchronization method according to any one of claims 1 to 7.
