CN115391094A - Bitmap metadata storage system and method - Google Patents

Bitmap metadata storage system and method Download PDF

Info

Publication number
CN115391094A
CN115391094A CN202211008974.5A CN202211008974A CN115391094A CN 115391094 A CN115391094 A CN 115391094A CN 202211008974 A CN202211008974 A CN 202211008974A CN 115391094 A CN115391094 A CN 115391094A
Authority
CN
China
Prior art keywords
bitmap
node
data
metadata service
snapshot
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211008974.5A
Other languages
Chinese (zh)
Inventor
文成
黄健
陈伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision System Technology Co Ltd
Original Assignee
Hangzhou Hikvision System Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision System Technology Co Ltd filed Critical Hangzhou Hikvision System Technology Co Ltd
Priority to CN202211008974.5A priority Critical patent/CN115391094A/en
Publication of CN115391094A publication Critical patent/CN115391094A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/065Replication mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Hardware Redundancy (AREA)

Abstract

The embodiment of the application provides a bitmap metadata storage system and a method, wherein the system comprises: the system comprises a storage node, a bitmap metadata service main node and a standby node; the bitmap metadata service master node responds to the received first snapshot bitmap data sent by the storage node and sends the first snapshot bitmap data to the bitmap metadata service standby node under the normal condition; the bitmap metadata service standby node receives first snapshot bitmap data sent by the in-place bitmap data service main node and updates a first bitmap file based on the first snapshot bitmap data; after the updating is finished, sending a first message which represents that the first bitmap file is updated successfully to a bitmap data service main node; the bitmap metadata service master node updates the second bitmap file based on the first snapshot bitmap data after receiving the first message; and after the updating is finished, sending a second message indicating that the second bitmap file is updated successfully to the storage node. Through the system, data synchronization between the main node and the standby node is realized.

Description

Bitmap metadata storage system and method
Technical Field
The present application relates to the field of computer software technologies, and in particular, to a bitmap metadata storage system and method.
Background
An SAN (Storage Area Network) cluster realizes a high-performance and high-availability distributed system in a Network Storage manner. SAN clusters provide a block device storage means for ISCSI (Internet Small Computer System Interface) protocol. The ISCSI client accesses the block device appointed by the SAN cluster through an ISCSI protocol, a virtual block device can be generated in a local operating system, and the client completes the access of the block device through a network.
In order to improve the availability of the SAN cluster, a dual-computer cluster system is adopted in the related art, and continuous and reliable service can be provided for a single node failure scene through a high availability implementation mode of a main node and a standby node. However, how to implement data synchronization between the main node and the standby node becomes a technical problem to be solved urgently aiming at the implementation manner of the main node and the standby node.
Disclosure of Invention
Embodiments of the present application provide a bitmap metadata storage system and method, so as to implement data synchronization between a primary node and a secondary node. The specific technical scheme is as follows:
according to a first aspect of embodiments of the present application, there is provided a storage system including:
the bitmap metadata service nodes comprise a bitmap metadata service main node and a bitmap metadata service standby node;
the storage node is used for sending first snapshot bitmap data representing the data state of the storage block to the bitmap metadata service main node under the condition that the data state of the storage block is changed;
the bitmap metadata service master node is used for responding to the received first snapshot bitmap data and sending the first snapshot bitmap data to the bitmap metadata service standby node under the condition that the bitmap metadata service standby node is normal;
the bitmap metadata service standby node is used for updating a first bitmap file based on first snapshot bitmap data after receiving the first snapshot bitmap data sent by the bitmap metadata service main node, wherein the first bitmap file comprises the data state of each storage block; after the first bitmap file is updated, sending a first message indicating that the first bitmap file is updated successfully to the bitmap metadata service master node;
the bitmap metadata service master node is further configured to update a second bitmap file based on the first snapshot bitmap data after receiving the first message, where the second bitmap file includes data states of the storage blocks; and after the second bitmap file is updated, sending a second message indicating that the second bitmap file is updated successfully to the storage node.
Optionally, the bitmap metadata service master node is further configured to: in response to receiving the first snapshot bitmap data, in the case that the bitmap metadata service standby node is abnormal, updating the second bitmap file based on the first snapshot bitmap data; storing the first snapshot bitmap data into a second log file; and sending a second message indicating that the second bitmap file is updated successfully to the storage node.
Optionally, the bitmap metadata service master node is further configured to, after the bitmap metadata service backup node recovers from an exception, obtain current snapshot bitmap data to be synchronized according to the second log file, and send the current snapshot bitmap data to be synchronized to the bitmap metadata service backup node;
the bitmap metadata service standby node is further used for updating the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized; after the updating of the first bitmap file is completed, sending a third message indicating that the updating of the first bitmap file is successful to the bitmap metadata service main node;
and the bitmap metadata service master node is further configured to update the synchronization record of the second log file after receiving the third message, select the next snapshot bitmap data to be synchronized in the second log file, and continue to send the snapshot bitmap data to the bitmap metadata service backup node for synchronization until all snapshot bitmap data in the second log file are synchronized.
Optionally, the storage node is specifically configured to: when the data state of a storage block is changed, snapshot bitmap data of the corresponding storage block is generated, wherein the snapshot bitmap data comprises the data state of the corresponding storage block; for any memory block, when the memory block does not store data, the data state record of the memory block is a first identifier, and when the memory block stores data, the data state record of the memory block is a second identifier.
Optionally, the bitmap metadata service master node is further configured to: in the process of synchronizing the snapshot bitmap data in the second log file to the bitmap metadata service standby node, if receiving second snapshot bitmap data sent by the storage node, sending the second snapshot bitmap data to the bitmap metadata service standby node;
the bitmap metadata service standby node is further configured to update the first bitmap file based on the second snapshot bitmap data.
Optionally, the bitmap metadata service standby node is specifically configured to: and sequentially updating the first bitmap file according to the sequence of the received current snapshot bitmap data to be synchronized and the second snapshot bitmap data.
Optionally, the bitmap metadata service master node is further configured to trigger an opposite end disconnection event when detecting that the bitmap metadata service backup node changes from normal to abnormal, and switch from all normal states to a local normal state;
the bitmap metadata service master node is specifically configured to send the first snapshot bitmap data to the bitmap metadata service standby node in response to receiving the first snapshot bitmap data and in a case that a state of the master node is a full normal state; under the condition that the self state is the normal state of the machine, updating the second bitmap file based on the first snapshot bitmap data; and storing the first snapshot bitmap data into a second log file.
Optionally, the bitmap metadata service standby node is further configured to: entering an initial state after starting; in the initial state, after receiving the heartbeat message of the primitive data service main node, triggering an opposite end heartbeat event, and switching the initial state into a local waiting state;
the bitmap metadata service master node is specifically configured to: in the normal state of the local machine, after receiving the heartbeat message of the bitmap metadata service standby node, triggering an opposite end heartbeat event, and switching the normal state of the local machine to the working state of the local machine; under the condition of the working state of the machine, acquiring snapshot bitmap data to be synchronized currently according to the second log file, and sending the snapshot bitmap data to be synchronized currently to the bit primitive data service standby node;
the bitmap metadata service standby node is specifically configured to: in a waiting state of the machine, after receiving the snapshot bitmap data to be synchronized currently, updating the first bitmap file based on the snapshot bitmap data to be synchronized currently; after the first bitmap file is updated, sending a third message indicating that the first bitmap file is updated successfully to the bitmap metadata service master node;
the bitmap metadata service master node is further configured to: under the condition that all snapshot bitmap data in the second log file are synchronously completed, sending a fourth message indicating the completion of the synchronization to the bitmap metadata service standby node, triggering a synchronization completion event, and switching the working state of the local machine to all normal states;
the bitmap metadata service standby node is further configured to: responding to the fourth message, triggering a receiving completion event, and switching a local waiting state into a local working state; and under the condition that the bitmap metadata service master node does not have the first log file, sending a fourth message indicating synchronization completion to the bitmap metadata service master node, triggering a synchronization completion event, and switching the working state of the local machine to be in a full normal state.
According to a second aspect of the embodiments of the present application, there is provided a bitmap metadata storage method, applied to a bitmap metadata service master node in a storage system, where the storage system further includes a bitmap metadata service backup node and a storage node, and the method includes:
receiving first snapshot bitmap data, wherein the first snapshot bitmap data is sent to the bit primitive data service master node by the storage node under the condition that the data state of a storage block is changed, and the first snapshot bitmap data represents the data state of the storage block;
under the condition that a bit map data service standby node is normal, sending the first snapshot bitmap data to the bitmap metadata service standby node so that the bitmap metadata service standby node updates a first bitmap file based on the first snapshot bitmap data, and sending a first message indicating that the first bitmap file is successfully updated to a bitmap metadata service main node after the first bitmap file is completely updated; wherein, the first bitmap file comprises the data state of each storage block;
after receiving the first message, updating a second bitmap file based on the first snapshot bitmap data; wherein, the second bitmap file comprises the data state of each storage block;
and after the second bitmap file is updated, sending a second message indicating that the second bitmap file is updated successfully to the storage node.
Optionally, the method further includes:
updating the second bitmap file based on the first snapshot bitmap data under the condition that the bitmap metadata service standby node is abnormal;
storing the first snapshot bitmap data into a second log file;
and sending a second message indicating that the second bitmap file is updated successfully to the storage node.
Optionally, the method further includes:
after the bitmap metadata service standby node recovers from an abnormality, acquiring current snapshot bitmap data to be synchronized according to the second log file, sending the current snapshot bitmap data to be synchronized to the bitmap metadata service standby node so that the bitmap metadata service standby node updates the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized, and sends a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service main node after the first bitmap file is completely updated;
and after receiving the third message, updating the synchronization record of the second log file, selecting next snapshot bitmap data to be synchronized in the second log file, and continuously sending the next snapshot bitmap data to the bit primitive data service standby node for synchronization until all the snapshot bitmap data in the second log file are synchronized.
Optionally, the snapshot bitmap data includes a data state of the corresponding storage block; for any memory block, when the memory block does not store data, the data state record of the memory block is a first identifier, and when the memory block stores data, the data state record of the memory block is a second identifier.
Optionally, the method further includes:
in the process of synchronizing the snapshot bitmap data in the second log file to the bitmap metadata service standby node, if second snapshot bitmap data sent by the storage node is received, the second snapshot bitmap data is sent to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates the first bitmap file based on the second snapshot bitmap data, and the first bitmap file is sequentially updated according to the received current snapshot bitmap data to be synchronized and the sequence of the second snapshot bitmap data.
Optionally, when the bitmap metadata service standby node is abnormal, the second bitmap file is updated based on the first snapshot bitmap data; storing the first snapshot bitmap data into a second log file, including:
when detecting that the bitmap metadata service backup node is changed from normal to abnormal, triggering an opposite terminal disconnection event, and switching all normal states to a local normal state;
in response to receiving the first snapshot bitmap data, under the condition that the state of the first snapshot bitmap data is a local normal state, updating the second bitmap file based on the first snapshot bitmap data; storing the first snapshot bitmap data in a second log file; the bitmap metadata service standby node enters an initial state after being started, and in the initial state, after receiving a heartbeat message of the bitmap metadata service main node, an opposite end heartbeat event is triggered and switched from the initial state to a local waiting state;
under the condition that the on-site primitive data service standby node is normal, the sending the first snapshot bitmap data to the bitmap primitive data service standby node comprises the following steps:
and responding to the received first snapshot bitmap data, and sending the first snapshot bitmap data to the bitmap metadata service standby node under the condition that the state of the first snapshot bitmap data is all normal states.
Optionally, after the bitmap metadata service standby node recovers from an exception, acquiring snapshot bitmap data to be synchronized currently according to the second log file, and sending the snapshot bitmap data to be synchronized currently to the bitmap metadata service standby node, where the method includes:
in the normal state of the local machine, after receiving the heartbeat message of the bitmap metadata service backup node, triggering an opposite end heartbeat event, and switching the normal state of the local machine to the working state of the local machine;
under the working state of the machine, acquiring current snapshot bitmap data to be synchronized according to the second log file, and sending the current snapshot bitmap data to be synchronized to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized in the waiting state of the machine, and sends a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is completely updated;
and under the condition that all snapshot bitmap data in the second log file are synchronously completed, sending a fourth message indicating the completion of synchronization to the bitmap metadata service backup node, triggering a synchronization completion event, switching the local working state to a full normal state, so that the bitmap metadata service backup node responds to the received fourth message, triggering the reception completion event, switching the local waiting state to the local working state, under the condition that the bitmap metadata service backup node has no first log file, sending the fourth message indicating the completion of synchronization to the bitmap metadata service main node, triggering the synchronization completion event, and switching the local working state to the full normal state.
According to a third aspect of the embodiments of the present application, there is provided a bitmap metadata storage method, applied to a bitmap metadata service backup node in a storage system, where the storage system further includes a bitmap metadata service master node and a storage node, and the method includes:
after receiving first snapshot bitmap data, updating a first bitmap file based on the first snapshot bitmap data; the first snapshot bitmap data is forwarded to the bitmap metadata service standby node after the primitive data service master node receives the first snapshot bitmap data sent by the storage node, and the first bitmap file comprises the data state of each storage block;
after the first bitmap file is updated, sending a first message indicating that the first bitmap file is updated successfully to the bitmap metadata service main node, so that the bitmap metadata service main node updates a second bitmap file based on the first snapshot bitmap data after receiving the first message, and sends a second message indicating that the second bitmap file is updated successfully to the storage node after the second bitmap file is updated.
Optionally, the method further includes:
after the bitmap metadata service standby node recovers from the abnormality and receives the current snapshot bitmap data to be synchronized, updating the first bitmap file based on the current snapshot bitmap data to be synchronized; the current snapshot bitmap data to be synchronized is obtained and sent to the bitmap metadata service standby node according to a second log file after the bitmap metadata service standby node recovers from an abnormality, and the second log file is used for storing the first snapshot bitmap data received by the bitmap metadata service standby node under the condition that the bitmap metadata service standby node is abnormal;
after the first bitmap file is updated, sending a third message indicating that the first bitmap file is updated successfully to the bitmap metadata service master node, so that the bitmap metadata service master node updates the synchronization record of the second log file after receiving the third message, selects next snapshot bitmap data to be synchronized from the second log file, and continuously sends the next snapshot bitmap data to be synchronized to the bitmap metadata service backup node for synchronization until all snapshot bitmap data in the second log file are synchronized.
Optionally, the snapshot bitmap data includes a data state of a corresponding storage block; for any memory block, under the condition that no data is stored in the memory block, the data state record of the memory block is a first identifier, and under the condition that the data is stored in the memory block, the data state record of the memory block is a second identifier;
the method further comprises the following steps:
according to the received sequence of the current snapshot bitmap data to be synchronized and the second snapshot bitmap data, updating the first bitmap file in sequence; wherein the second snapshot bitmap data is: and in the process that the bitmap metadata service main node synchronizes the snapshot bitmap data in the second log file to the bitmap metadata service standby node, the storage node sends the snapshot bitmap data to the bitmap metadata service main node.
Optionally, the method further includes: entering an initial state after the bitmap metadata service standby node is started; in the initial state, after receiving the heartbeat message of the bitmap metadata service main node, triggering an opposite end heartbeat event, and switching from the initial state to a local waiting state; when detecting that the bitmap metadata service standby node is changed from normal to abnormal, the bitmap metadata service master node triggers an opposite terminal offline event, switches all normal states to a local normal state, receives the first snapshot bitmap data under the condition that the bitmap metadata service master node is in all normal states, sends the first snapshot bitmap data to the bitmap metadata service standby node, updates the second bitmap file based on the first snapshot bitmap data under the condition that the bitmap metadata service master node is in the local normal state, and stores the first snapshot bitmap data into the second log file;
after the bitmap metadata service standby node recovers from the exception and receives the current snapshot bitmap data to be synchronized, updating the first bitmap file based on the current snapshot bitmap data to be synchronized, including: in a waiting state of the machine, after receiving snapshot bitmap data to be synchronized currently, updating the first bitmap file based on the snapshot bitmap data to be synchronized currently; the current snapshot bitmap data to be synchronized is obtained according to the second log file and sent to the bitmap metadata service standby node under the condition that the bitmap metadata service main node is in the working state of the local machine, and the working state of the local machine is a state that the bitmap metadata service main node triggers an opposite-end heartbeat event after receiving a heartbeat message of the bitmap metadata service standby node and is switched from the normal state of the local machine;
after the first bitmap file is updated, sending a third message indicating that the first bitmap file is updated successfully to the bitmap metadata service master node;
the method further comprises the following steps: responding to the received fourth message which is sent by the bitmap metadata service main node and represents synchronous completion, triggering a receiving completion event, and switching a local waiting state into a local working state; under the condition that the bitmap metadata service standby node does not have the first log file, a fourth message indicating synchronization completion is sent to the bitmap metadata service main node, a synchronization completion event is triggered, and the working state of the local machine is switched to all normal states; the fourth message is sent to the bitmap metadata service master node when all snapshot bitmap data in the second log file are synchronously completed, and the bitmap metadata service master node triggers a synchronous completion event when sending the fourth message, and switches from a local working state to a full normal state.
According to a fourth aspect of the embodiments of the present application, there is provided a bitmap metadata storage apparatus, which is applied to a bitmap metadata service master node in a storage system, where the storage system further includes a bitmap metadata service backup node and a storage node, and the apparatus includes:
the receiving module is used for receiving first snapshot bitmap data, wherein the first snapshot bitmap data is sent to the bit primitive data service master node by the storage node under the condition that the data state of a storage block is changed, and the first snapshot bitmap data represents the data state of the storage block;
a first sending module, configured to send the first snapshot bitmap data to the bitmap metadata service standby node under a condition that the bitmap metadata service standby node is normal, so that the bitmap metadata service standby node updates a first bitmap file based on the first snapshot bitmap data, and sends a first message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is completely updated; wherein, the first bitmap file comprises the data state of each storage block;
a first updating module, configured to update a second bitmap file based on the first snapshot bitmap data after receiving the first message; wherein, the second bitmap file comprises the data state of each storage block;
and the second sending module is used for sending a second message indicating that the second bitmap file is successfully updated to the storage node after the second bitmap file is updated.
Optionally, the apparatus further comprises:
the second updating module is used for updating the second bitmap file based on the first snapshot bitmap data under the condition that the bitmap metadata service standby node is abnormal;
the first storage module is used for storing the first snapshot bitmap data into a second log file;
and a third sending module, configured to send a second message indicating that the second bitmap file is successfully updated to the storage node.
Optionally, the apparatus further comprises:
a fourth sending module, configured to, after the bitmap metadata service backup node recovers from an exception, obtain current snapshot bitmap data to be synchronized according to the second log file, and send the current snapshot bitmap data to be synchronized to the bitmap metadata service backup node, so that the bitmap metadata service backup node updates the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized, and sends a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is completely updated;
the third updating module is used for updating the synchronous record of the second log file after receiving the third message;
and the fifth sending module is used for selecting the next snapshot bitmap data to be synchronized from the second log file and continuously sending the next snapshot bitmap data to the bit primitive data service standby node for synchronization until all the snapshot bitmap data in the second log file are synchronized.
Optionally, the snapshot bitmap data includes a data state of the corresponding storage block; for any memory block, when the memory block does not store data, the data state record of the memory block is a first identifier, and when the memory block stores data, the data state record of the memory block is a second identifier.
Optionally, the apparatus further comprises:
a sixth sending module, configured to, in the process of synchronizing the snapshot bitmap data in the second log file to the bitmap metadata service standby node, send, if the second snapshot bitmap data sent by the storage node is received, the second snapshot bitmap data to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates the first bitmap file based on the second snapshot bitmap data, and sequentially updates the first bitmap file according to the received snapshot bitmap data to be currently synchronized and the precedence order of the second snapshot bitmap data.
Optionally, the second updating module and the first storage module are specifically configured to:
when detecting that the bitmap metadata service backup node is changed from normal to abnormal, triggering an opposite terminal disconnection event, and switching all normal states to a local normal state;
in response to receiving the first snapshot bitmap data, under the condition that the state of the first snapshot bitmap data is a local normal state, updating the second bitmap file based on the first snapshot bitmap data; storing the first snapshot bitmap data in a second log file; the bitmap metadata service standby node enters an initial state after being started, and in the initial state, after receiving a heartbeat message of the bitmap metadata service main node, a heartbeat event of an opposite terminal is triggered, and the initial state is switched into a local waiting state;
the first sending module is specifically configured to:
and responding to the received first snapshot bitmap data, and sending the first snapshot bitmap data to the bitmap metadata service standby node under the condition that the state of the first snapshot bitmap data is all normal.
Optionally, the fourth sending module is specifically configured to:
in the normal state of the local machine, after receiving the heartbeat message of the bitmap metadata service standby node, triggering an opposite end heartbeat event, and switching the normal state of the local machine to the working state of the local machine;
under the working state of the local machine, acquiring current snapshot bitmap data to be synchronized according to the second log file, and sending the current snapshot bitmap data to be synchronized to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized in the waiting state of the local machine, and sends a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is completely updated;
and under the condition that all snapshot bitmap data in the second log file are synchronously completed, sending a fourth message indicating the completion of synchronization to the bitmap metadata service backup node, triggering a synchronization completion event, switching the local working state to a full normal state, so that the bitmap metadata service backup node responds to the received fourth message, triggering the reception completion event, switching the local waiting state to the local working state, under the condition that the bitmap metadata service backup node has no first log file, sending the fourth message indicating the completion of synchronization to the bitmap metadata service main node, triggering the synchronization completion event, and switching the local working state to the full normal state.
According to a fifth aspect of the embodiments of the present application, there is provided a bitmap metadata storage apparatus, which is applied to a bitmap metadata service backup node in a storage system, where the storage system further includes a bitmap metadata service master node and a storage node, and the apparatus includes:
the first updating module is used for updating the first bitmap file based on the first snapshot bitmap data after the first snapshot bitmap data is received; the first snapshot bitmap data is forwarded to the bitmap metadata service standby node after the primitive data service master node receives the first snapshot bitmap data sent by the storage node, and the first bitmap file comprises the data state of each storage block;
a first sending module, configured to send a first message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is updated, so that the bitmap metadata service master node updates a second bitmap file based on the first snapshot bitmap data after receiving the first message, and sends a second message indicating that the second bitmap file is successfully updated to the storage node after the second bitmap file is updated.
Optionally, the apparatus further comprises:
the second updating module is used for updating the first bitmap file based on the current snapshot bitmap data to be synchronized after the bitmap metadata service standby node recovers from the abnormality and receives the current snapshot bitmap data to be synchronized; the current snapshot bitmap data to be synchronized is obtained and sent to the bitmap metadata service standby node according to a second log file after the bitmap metadata service standby node recovers from an abnormality, and the second log file is used for storing the first snapshot bitmap data received by the bitmap metadata service standby node under the condition that the bitmap metadata service standby node is abnormal;
and the second sending module is used for sending a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service main node after the first bitmap file is updated, so that the bitmap metadata service main node updates the synchronous record of the second log file after receiving the third message, selects the next snapshot bitmap data to be synchronized in the second log file, and continuously sends the next snapshot bitmap data to be synchronized to the bitmap metadata service standby node for synchronization until all the snapshot bitmap data in the second log file are synchronized.
Optionally, the snapshot bitmap data includes a data state of the corresponding storage block; for any memory block, under the condition that no data is stored in the memory block, the data state record of the memory block is a first identifier, and under the condition that the data is stored in the memory block, the data state record of the memory block is a second identifier;
the device further comprises:
the third updating module is used for sequentially updating the first bitmap file according to the received sequence of the current snapshot bitmap data to be synchronized and the second snapshot bitmap data; wherein the second snapshot bitmap data is: and in the process that the bitmap metadata service main node synchronizes the snapshot bitmap data in the second log file to the bitmap metadata service standby node, the storage node sends the snapshot bitmap data to the bitmap metadata service main node.
Optionally, the bitmap metadata service standby node enters an initial state after being started; in the initial state, after receiving the heartbeat message of the bitmap metadata service main node, triggering an opposite end heartbeat event, and switching from the initial state to a local waiting state; when detecting that the bitmap metadata service standby node is changed from normal to abnormal, the bitmap metadata service master node triggers an opposite terminal offline event, switches all normal states to a local normal state, receives the first snapshot bitmap data under the condition that the bitmap metadata service master node is in all normal states, sends the first snapshot bitmap data to the bitmap metadata service standby node, updates the second bitmap file based on the first snapshot bitmap data under the condition that the bitmap metadata service master node is in all normal states, and stores the first snapshot bitmap data into the second log file;
the second update module is specifically configured to: in a waiting state of the machine, after receiving snapshot bitmap data to be synchronized currently, updating the first bitmap file based on the snapshot bitmap data to be synchronized currently; the current snapshot bitmap data to be synchronized is obtained according to the second log file and sent to the bitmap metadata service standby node under the condition that the bitmap metadata service main node is in the working state of the machine, and the working state of the machine is a state after the bitmap metadata service main node receives heartbeat messages of the bitmap metadata service standby node, triggers an opposite-end heartbeat event and is switched from the normal state of the machine;
after the updating of the first bitmap file is completed, sending a third message indicating that the updating of the first bitmap file is successful to the bitmap metadata service main node;
responding to the received fourth message which is sent by the bitmap metadata service main node and represents synchronous completion, triggering a receiving completion event, and switching a local waiting state into a local working state; under the condition that the bitmap metadata service master node does not have the first log file, sending a fourth message indicating synchronization completion to the bitmap metadata service master node, triggering a synchronization completion event, and switching the working state of the local machine to a full normal state; the fourth message is sent to the bitmap metadata service master node when all snapshot bitmap data in the second log file are synchronously completed, and the bitmap metadata service master node triggers a synchronous completion event when sending the fourth message, and switches from a local working state to a full normal state.
According to a sixth aspect of embodiments herein, there is provided an electronic device comprising a processor and a memory;
a memory for storing a computer program;
a processor for implementing the method steps of the second or third aspect when executing the program stored in the memory.
According to a seventh aspect of embodiments herein, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs any of the method steps described above.
The embodiment of the application has the following beneficial effects:
an embodiment of the present application provides a bitmap metadata storage system and method, including: the bitmap metadata service nodes comprise a bitmap metadata service main node and a bitmap metadata service standby node; the storage node is used for sending first snapshot bitmap data representing the data state of the storage block to the bitmap metadata service main node under the condition that the data state of the storage block is changed; the bitmap metadata service master node is used for responding to the received first snapshot bitmap data and sending the first snapshot bitmap data to the bitmap metadata service backup node under the condition that the bitmap metadata service backup node is normal; the bitmap metadata service standby node is used for updating a first bitmap file based on first snapshot bitmap data after receiving the first snapshot bitmap data sent by the bitmap metadata service main node, wherein the first bitmap file comprises the data state of each storage block; after the updating of the first bitmap file is completed, sending a first message indicating that the updating of the first bitmap file is successful to the bitmap metadata service main node; the bitmap metadata service master node is further configured to update a second bitmap file based on the first snapshot bitmap data after receiving the first message, where the second bitmap file includes data states of the storage blocks; and after the second bitmap file is updated, sending a second message indicating that the second bitmap file is updated successfully to the storage node. By the method, the bitmap metadata service main node synchronizes the snapshot bitmap data to the bitmap metadata service standby node, the bitmap metadata service standby node returns a message that the first bitmap file is successfully updated to the bitmap metadata service main node after receiving the snapshot bitmap data, and the bitmap metadata service main node updates the second bitmap file and returns a message that the second bitmap file is successfully updated to the storage node after receiving the message. In the application, the snapshot bitmap data must be synchronized to the bitmap data service standby node, that is, only if the bitmap metadata service master node and the bitmap metadata service standby node normally update the bitmap file, the bitmap metadata service master node returns the result to the storage node, thereby realizing the bitmap metadata synchronization between the master node and the standby node; after the first bitmap file in the bitmap metadata service standby node is successfully updated, the bitmap metadata service main node updates the second bitmap file, and the consistency of the first bitmap file and the second bitmap file can be improved.
Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the description below are only some embodiments of the present application, and other embodiments can be obtained by those skilled in the art according to the drawings.
FIG. 1 is a schematic node structure diagram of a bitmap metadata storage system according to an embodiment of the present application;
fig. 2 is a schematic diagram of a node operation when the bitmap metadata storage system provided in the embodiment of the present application normally provides a service;
fig. 3 is a schematic node working diagram when a bit primitive data serving standby node in the bitmap metadata storage system provided in the embodiment of the present application is abnormal;
fig. 4 is a schematic node working diagram when a bit primitive data serving standby node in the bitmap metadata storage system recovers abnormally according to the embodiment of the present application;
FIG. 5 is a schematic flow chart illustrating node status management in a bitmap metadata storage system according to an embodiment of the present application;
FIG. 6 is a block diagram of a bitmap metadata storage system in accordance with an embodiment of the present application;
fig. 7 is a schematic flowchart of a first bitmap metadata storage method applied to a bitmap metadata service master node according to an embodiment of the present application;
fig. 8 is a schematic flowchart of a second bitmap metadata storage method applied to a bitmap metadata service master node according to an embodiment of the present application;
fig. 9 is a schematic flowchart of a third bitmap metadata storage method applied to a bitmap metadata service master node according to an embodiment of the present application;
fig. 10 is a schematic flowchart of a bitmap metadata storage method applied to a bitmap metadata service standby node according to an embodiment of the present application;
fig. 11 is a schematic flowchart of a second bitmap metadata storage method applied to a bitmap metadata service standby node according to an embodiment of the present application;
FIG. 12 is a schematic structural diagram of a bitmap metadata storage device applied to a bitmap metadata service master node according to an embodiment of the present application;
FIG. 13 is a schematic structural diagram of a bitmap metadata storage device applied to a bitmap metadata service backup node according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of a bitmap metadata service node according to an embodiment of the present application;
fig. 15 is a schematic structural diagram of another bitmap metadata service node according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the description herein are intended to be within the scope of the present disclosure.
In order to achieve data synchronization between a primary node and a standby node, embodiments of the present application provide a bitmap metadata storage system and method.
First, a structure of a bitmap metadata storage system provided in an embodiment of the present application is described, as shown in fig. 1, including the following nodes:
the storage node 110 and the bitmap metadata service node 120, where the bitmap metadata service node 120 includes a bitmap metadata service master node 1210 and a bitmap metadata service backup node 1220;
the storage node 110 is configured to send, to the bitmap metadata service master node 1210, first snapshot bitmap data indicating a data state of a storage block when the data state of the storage block is changed;
the bitmap metadata service master node 1210 is configured to send, in response to the received first snapshot bitmap data, the first snapshot bitmap data to the bitmap metadata service standby node 1220 when the bitmap metadata service standby node 1220 is normal;
the bitmap metadata service backup node 1220 is configured to update a first bitmap file based on first snapshot bitmap data sent by the bitmap metadata service master node 1210 after receiving the first snapshot bitmap data, where the first bitmap file includes data states of storage blocks; after the updating of the first bitmap file is completed, sending a first message indicating that the updating of the first bitmap file is successful to the bitmap metadata service master node 1210;
the bitmap metadata service master node 1210 is further configured to update a second bitmap file based on the first snapshot bitmap data after receiving the first message, where the second bitmap file includes a data state of each storage block; after the second bitmap file is updated, a second message indicating that the second bitmap file is updated successfully is sent to the storage node 110.
The storage nodes are used as an entrance for user access and provide an ISCSI storage block access function for the SAN client, and can send snapshot bitmap data to the primitive data service master node according to the read-write operation of the SAN client on a certain storage block and store the data of the storage block into cloud storage.
The bitmap metadata service master node and the bitmap metadata service backup node provide functions of storing and accessing bitmap metadata and the like, and provide strong-consistency bitmap metadata service. The strong consistency is: the distributed system needs to satisfy the principle of consistency, that is, data is updated consistently, the change of all data is synchronous, and for the relational database in the dual-computer cluster system, the updated data is required to be seen by subsequent access, which is strong consistency. The roles of the bitmap metadata service master node and the bitmap metadata service standby node can be interchanged, and when the bitmap metadata service standby node detects that the bitmap metadata service master node is abnormal, the bitmap metadata service standby node can switch itself to the bitmap metadata service master node.
Referring to fig. 2, after receiving the first snapshot bitmap data sent by the storage node 110, the bitmap metadata service master node 1210 sends the first snapshot bitmap data to the bitmap metadata service standby node 1220, and the bitmap metadata service standby node 1220 updates the first bitmap file based on the first snapshot bitmap data; after the first bitmap file is updated, sending a first message indicating that the first bitmap file is updated successfully to the bitmap metadata service main node 1210, and after the bitmap metadata service main node 1210 receives the first message, updating a second bitmap file based on first snapshot bitmap data; after the bitmap files of the primary bitmap data service node 1210 and the bitmap metadata service backup node 1220 are updated, the primary bitmap data service node 1210 will return a second message indicating that the second bitmap file is updated successfully to the storage node 110, so that the strong consistency of the bitmap files of the primary and backup bitmap metadata service nodes can be ensured.
In the above embodiment, when the bitmap metadata service master node and the bitmap metadata service standby node are both normal, the snapshot bitmap data must be synchronized to the bitmap metadata service standby node, that is, only when the bitmap metadata service master node and the bitmap metadata service standby node normally update the bitmap file, the result is returned to the storage node, thereby realizing data synchronization between the master node and the standby node; after the first bitmap file in the bitmap metadata service standby node is successfully updated, the bitmap metadata service main node updates the second bitmap file, and the consistency of the first bitmap file and the second bitmap file can be improved.
Under the condition that the bit primitive data service standby node is abnormal and the bit primitive data service main node is normal, the normal operation of the system still needs to be ensured. For example, as shown in fig. 3, when a bit primitive data serving standby node 1220 in the bit primitive data storage system is abnormal, in a possible implementation manner, the bitmap metadata serving master node 1210 in the bitmap metadata storage system of the present application is further configured to: in response to receiving the first snapshot bitmap data, updating the second bitmap file based on the first snapshot bitmap data in the event that the bitmap metadata service standby node 1220 is abnormal; storing the first snapshot bitmap data in a second log file; sending a second message indicating that the second bitmap file is successfully updated to the storage node 110.
The second log file is used to sequentially store snapshot bitmap data sent by the storage node 110 to the bitmap metadata service master node 1210 during an exception of the bitmap metadata service backup node 1220.
In the above embodiment, when the bitmap metadata service standby node is abnormal, the snapshot bitmap data cannot be synchronized to the bitmap metadata service standby node, and the bitmap metadata service master node records each newly added snapshot bitmap data in a log form, so as to prepare for execution work after the subsequent bitmap metadata service standby node is abnormally recovered, so as to implement data synchronization between the master node and the standby node.
As shown in fig. 4, when a bit primitive data service standby node in the bit primitive data storage system recovers abnormally, in a possible implementation manner, the bitmap metadata service master node 1210 in the bitmap metadata storage system of the present application is further configured to, after the bitmap metadata service standby node 1220 recovers from the abnormality, obtain snapshot bitmap data to be currently synchronized according to the second log file, and send the snapshot bitmap data to be currently synchronized to the bit primitive data service standby node 1220;
the bitmap metadata service standby node 1220 is further configured to update the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized; after the updating of the first bitmap file is completed, sending a third message indicating that the updating of the first bitmap file is successful to the bitmap metadata service master node 1210;
the bitmap metadata service master node 1210 is further configured to update the synchronization record of the second log file after receiving the third message, and select a next snapshot bitmap data to be synchronized in the second log file to continue to be sent to the bitmap metadata service slave node 1220 for synchronization until all snapshot bitmap data in the second log file are synchronized.
In this embodiment, when all snapshot bitmap data in the second log file are completed synchronously, the bitmap metadata service master node deletes the second log file, and the bitmap metadata service backup node returns to normal.
After the bit map metadata service backup node recovers abnormally, the working schematic diagram of each node in the bit map metadata storage system is as shown in fig. 2, and therefore details are not repeated in this embodiment, and a storage node is not shown in the working schematic diagram of each node in fig. 4.
In this embodiment, when the on-bit primitive data service standby node recovers abnormally, the storage node is specifically configured to: when the data state of a storage block is changed, snapshot bitmap data of the corresponding storage block is generated, wherein the snapshot bitmap data comprises the data state of the corresponding storage block; for any memory block, when the memory block does not store data, the data state record of the memory block is a first identifier, and when the memory block stores data, the data state record of the memory block is a second identifier.
Specifically, the snapshot is an important function of the distributed storage block, the function of the snapshot needs to divide the space of the storage block into some logical units, record whether data exists in each logical unit, and may be simplified into metadata of a bitmap, that is, snapshot bitmap data. Bitmap metadata of a storage block directly records whether data are written in corresponding logic units or not, and the correctness and the safety of a bitmap are key factors of the consistency of the data of the storage block, so that the bitmap metadata needs to keep strong consistency.
Optionally, in this embodiment, when the bitmap metadata service backup node recovers abnormally, the bitmap metadata service master node is further configured to: in the process of synchronizing the snapshot bitmap data in the second log file to the bitmap metadata service standby node, if receiving second snapshot bitmap data sent by the storage node, sending the second snapshot bitmap data to the bitmap metadata service standby node;
the bitmap metadata service standby node is further configured to update the first bitmap file based on the second snapshot bitmap data.
When the bitmap data service master node does not update the snapshot bitmap data to be synchronized currently in the second log file, the bitmap metadata service master node also sends the received second snapshot bitmap data sent by the storage node to the bitmap metadata service backup node, and the bitmap metadata service backup node does not need to distinguish the snapshot bitmap data from the storage node and only needs to sequentially update the first bitmap file.
Optionally, the bitmap metadata service standby node is specifically configured to: and sequentially updating the first bitmap file according to the sequence of the received current snapshot bitmap data to be synchronized and the received second snapshot bitmap data.
Specifically, the bitmap metadata service standby node can also bear second snapshot bitmap data sent by the bitmap metadata service master node in the exception recovery process. This is determined by the characteristics of the snapshot bitmap data, and some bit (binary bit) of the bitmap may be set from 0 to 1, but there is no need to set from 1 to 0, for example, for a storage scene of a surveillance video, the surveillance video may be stored to an empty disk, or the surveillance video may overwrite a hard disk whose data has expired, but there is no need to delete the surveillance video. Therefore, the bitmap metadata service standby node receives two types of messages, namely the current snapshot bitmap data to be synchronized and the second snapshot bitmap data, when the bitmap metadata service standby node is abnormally recovered, even if the two types of messages are processed in a disordered way, the effect is not caused, and compared with a mode that after the current snapshot bitmap data to be synchronized in the second log file is completely updated, the updating of the second snapshot bitmap data is carried out, in the embodiment, the updating sequence is not limited, and even if the updating of all the snapshot bitmap data in the log file is not completed, the bitmap metadata service standby node can firstly update the first bitmap file according to the second snapshot bitmap data, so that the waiting time of the storage node can be reduced, the data writing speed of the storage node can be accelerated, and the bitmap metadata service standby node can be recovered to be normal quickly after the bitmap metadata service standby node is abnormal.
In the above embodiment, when the bit primitive data service standby node recovers abnormally, the bitmap metadata service master node obtains snapshot bitmap data to be synchronized from the second log file and sends the snapshot bitmap data to the bit primitive data service standby node for synchronization until all snapshot bitmap data in the second log file are synchronized, thereby implementing synchronization and consistency of bitmap metadata. And when the abnormal recovery occurs, the bitmap metadata service standby node can also bear second snapshot bitmap data sent by the bitmap metadata service main node. This is determined by the nature of the snapshot bitmap data, and some bit (binary bit) of the bitmap can be set from 0 to 1, but there is no requirement to set from 1 to 0. Therefore, the bitmap metadata service standby node can receive two types of messages, namely the current snapshot bitmap data to be synchronized and the second snapshot bitmap data, when the exception recovery is carried out, even if the two types of messages are processed in a disordered way, the data writing speed of the storage node can be accelerated, the bitmap metadata service standby node can be quickly recovered to be normal after the exception, and the data synchronization between the main node and the standby node is realized.
Referring to fig. 5, a schematic flowchart of node state management in a bitmap metadata storage system according to an embodiment of the present application is provided. A state machine is maintained in the bitmap metadata service master node and used for determining whether the bitmap metadata service master node can normally respond to the storage nodes or not and information interaction between the bitmap metadata service master node and the bitmap metadata service backup node.
The current state of partitioning includes: one _ start: an initial state; wait _ sync: a local machine waiting state; working _ sync: the working state of the machine; book _ ok: all normal states; keep _ ok: the machine is in a normal state.
And the bitmap metadata service main node can normally respond to the storage node only when the work _ sync, the book _ ok and the keep _ ok are in the states.
The events that are currently divided include: heart _ msg _ event: triggering an opposite end heartbeat event; recv _ sync _ over _ msg _ event: receiving a completion event; send _ sync _ over _ msg _ event: a synchronization completion event; close _ connect _ event: and (5) the opposite terminal is disconnected.
As shown in fig. 5, after the bitmap metadata service standby node is started, because it does not know whether the bitmap metadata is installed for the first time or recovered abnormally, it does not know whether the local bitmap data is up-to-date, and it needs to negotiate with the bitmap metadata service primary node to determine whether it can provide services.
The state switching process after the abnormal standby node of the bitmap metadata service is as follows:
the bitmap metadata service master node is also used for triggering an opposite terminal disconnection event when detecting that the bitmap metadata service backup node is changed from normal to abnormal, and switching all normal states to the normal state of the host;
the bitmap metadata service master node is specifically configured to send the first snapshot bitmap data to the bitmap metadata service standby node in response to receiving the first snapshot bitmap data and in a case that a state of the master node is a full normal state; under the condition that the self state is the normal state of the machine, updating the second bitmap file based on the first snapshot bitmap data; and storing the first snapshot bitmap data into a second log file.
The state switching process from the starting to the normal service providing of the bitmap metadata service standby node is as follows:
the bitmap metadata service standby node is further configured to: entering an initial state after starting; in the initial state, after receiving the heartbeat message of the primitive data service main node, triggering an opposite end heartbeat event, and switching from the initial state to a local waiting state;
the bitmap metadata service master node is specifically configured to: in the normal state of the local machine, after receiving the heartbeat message of the bitmap metadata service standby node, triggering an opposite end heartbeat event, and switching the normal state of the local machine to the working state of the local machine; under the condition of the working state of the machine, acquiring snapshot bitmap data to be synchronized currently according to the second log file, and sending the snapshot bitmap data to be synchronized currently to the bit primitive data service standby node;
the bitmap metadata service standby node is specifically configured to: in a waiting state of the machine, after receiving the snapshot bitmap data to be synchronized currently, updating the first bitmap file based on the snapshot bitmap data to be synchronized currently; after the updating of the first bitmap file is completed, sending a third message indicating that the updating of the first bitmap file is successful to the bitmap metadata service main node;
the bitmap metadata service master node, further configured to: under the condition that all snapshot bitmap data in the second log file are synchronously completed, sending a fourth message indicating the completion of synchronization to the bitmap metadata service standby node, triggering a synchronization completion event, and switching the working state of the computer to a full normal state;
the bitmap metadata service standby node is further configured to: responding to the received fourth message, triggering a receiving completion event, and switching from a local waiting state to a local working state; and under the condition that the bitmap metadata service master node does not have the first log file, sending a fourth message indicating synchronization completion to the bitmap metadata service master node, triggering a synchronization completion event, and switching the working state of the local machine to a full normal state.
The state of the bitmap metadata service node and the event executed by the bitmap metadata service node correspond to each other, each state in the state machine shown in fig. 5 is processed strictly according to the event shown in the figure, and when the event which can not convert the state is triggered, the processing is not needed. For example, in fig. 5, there is no case of directly transitioning from all normal states to the native operating state, and after receiving the fourth message, the bitmap metadata service node in all normal states discards the fourth message without processing, and does not transition to the native operating state.
In the above embodiment, a mechanism of a state machine is used to control the service of the bit primitive data service node. The mode of the state machine is unique, and the state can be quickly switched according to the up-down line behaviors of both nodes, so that the log file can be generated and the log file can be synchronized. Based on more negotiation flows between the two nodes, the state machine mechanism can maintain the conversion of the node states and complete the recovery of data so as to realize the data synchronization between the main node and the standby node.
Referring to fig. 6, a schematic diagram of a framework of a bitmap metadata storage system according to an embodiment of the present application is shown.
As shown in fig. 6, the storage lan client interacts with the storage node through the ISCSI protocol to perform operations such as reading and writing of the storage block.
And the storage node acquires or modifies bitmap information corresponding to the specified logic unit from the bit primitive data service node according to the read-write operation of the storage local area network client to a certain storage block, and stores the data of the storage block into the cloud storage.
And the management child node manages the storage blocks, maintains the on-line and off-line states of the storage nodes and stores the data related to configuration into the maridb database management system.
The mariardb database management system is a dual-computer cluster building mode, and data is asynchronous and synchronous. Because the data related to the whole cluster configuration is stored, the data volume is small, the real-time synchronization requirement on the data is not high, and the configuration file can be stored in an asynchronous and synchronous mode.
The bitmap metadata service node is a construction mode of a dual-computer cluster, and data are synchronized in real time. And under the condition that the two nodes are normal, the result is returned to the storage node only if the two bitmap metadata service nodes both normally update the bitmap file.
The dual-computer cluster system provides a high-availability implementation mode of two nodes, and can provide continuous and reliable service for the scene of single node failure.
In this embodiment, when the bitmap metadata service backup node detects that the bit primitive data service master node is abnormal, the master node and the slave node are switched, the previous bit primitive data service master node becomes a new bitmap metadata service backup node, the previous bit primitive data service backup node becomes a new bitmap metadata service master node, and the bitmap metadata service is taken over and provided in response to the storage node. The two management nodes realize the high availability of the cluster through the exchange mechanism software, and the exchange mechanism software maintains the virtual IP address of one cluster. The storage node accesses the management node through the virtual IP address. That is, when both management nodes operate normally, only one node bears the virtual IP, and only one management node can provide service currently. When the current service node is abnormal, the virtual IP is switched to another normal node, and the other node provides service.
The actually written block device data of the storage nodes are stored in the underlying cloud storage, and the cloud storage provides an object storage mode.
In the above embodiment, when both the bitmap metadata service master node and the bitmap metadata service standby node are normal, the snapshot bitmap data must be synchronized to the bitmap metadata service standby node, that is, only when both the bitmap metadata service master node and the bitmap metadata service standby node update the bitmap file normally, the result is returned to the storage node, thereby implementing data synchronization between the master node and the standby node. In addition, when both management nodes operate normally, only one node bears the virtual IP, and only one management node can provide service currently. When the current service node is abnormal, the virtual IP is switched to another normal node, the other node provides service to realize the main-standby switching, if the bitmap metadata service main node is abnormal, the bitmap metadata service main node becomes a new bitmap metadata service main node, and the bitmap metadata service main node is taken over and provided by responding to the storage node.
When the bitmap metadata storage system normally provides a service, referring to fig. 7, a first flowchart of the bitmap metadata storage method applied to the bitmap metadata service master node provided in the embodiment of the present application is shown, including the following steps:
step S701, receiving first snapshot bitmap data, wherein the first snapshot bitmap data is sent to the bit primitive data service master node by the storage node under the condition that the data state of a storage block is changed, and the first snapshot bitmap data represents the data state of the storage block;
step S702, sending the first snapshot bitmap data to the bitmap metadata service standby node under the condition that the bitmap metadata service standby node is normal, so that the bitmap metadata service standby node updates a first bitmap file based on the first snapshot bitmap data, and sending a first message indicating that the first bitmap file is successfully updated to the bitmap metadata service main node after the first bitmap file is completely updated; wherein, the first bitmap file comprises the data state of each storage block;
step S703 of updating a second bitmap file based on the first snapshot bitmap data after receiving the first message; wherein, the second bitmap file comprises the data state of each storage block;
step S704, after the second bitmap file is updated, sending a second message indicating that the second bitmap file is updated successfully to the storage node.
In the above embodiment, when both the bitmap metadata service master node and the bitmap metadata service standby node are normal, the snapshot bitmap data must be synchronized to the bitmap metadata service standby node, that is, only when both the bitmap metadata service master node and the bitmap metadata service standby node update the bitmap file normally, the result is returned to the storage node, thereby implementing data synchronization between the master node and the standby node.
Under the condition that the bit primitive data service standby node is abnormal and the bit primitive data service main node is normal, the normal operation of the system still needs to be ensured. For example, as shown in fig. 8, a second flowchart of a bitmap metadata storage method applied to a bitmap metadata service master node according to an embodiment of the present application is shown, where the second flowchart includes the following steps:
step S801, under the condition that the bitmap metadata service standby node is abnormal, updating the second bitmap file based on the first snapshot bitmap data;
step S802, storing the first snapshot bitmap data into a second log file;
step S803, sending a second message indicating that the second bitmap file is successfully updated to the storage node.
Optionally, when the bitmap metadata service standby node is abnormal, the second bitmap file is updated based on the first snapshot bitmap data; storing the first snapshot bitmap data into a second log file, including:
when detecting that the bitmap metadata service backup node is changed from normal to abnormal, triggering an opposite terminal disconnection event, and switching all normal states to a local normal state;
in response to receiving the first snapshot bitmap data, under the condition that the state of the first snapshot bitmap data is a local normal state, updating the second bitmap file based on the first snapshot bitmap data; storing the first snapshot bitmap data into a second log file; the bitmap metadata service standby node enters an initial state after being started, and in the initial state, after receiving a heartbeat message of the bitmap metadata service main node, a heartbeat event of an opposite terminal is triggered, and the initial state is switched into a local waiting state;
under the condition that the on-site primitive data service standby node is normal, sending the first snapshot bitmap data to the bitmap primitive data service standby node, wherein the sending of the first snapshot bitmap data to the bitmap primitive data service standby node comprises the following steps:
and responding to the received first snapshot bitmap data, and sending the first snapshot bitmap data to the bitmap metadata service standby node under the condition that the state of the first snapshot bitmap data is all normal.
In the above embodiment, when the bitmap metadata service standby node is abnormal, the snapshot bitmap data cannot be synchronized to the bitmap metadata service standby node, and the bitmap metadata service master node records each newly added snapshot bitmap data in the form of a log, so as to prepare for execution after the subsequent bitmap metadata service standby node recovers from the abnormality, thereby implementing data synchronization between the master node and the standby node.
When the bitmap metadata service backup node recovers abnormally, referring to fig. 9, a third flowchart of the bitmap metadata storage method applied to the bitmap metadata service master node provided in the embodiment of the present application is shown, including the following steps:
step S901, after the bitmap metadata service standby node recovers from the exception, acquiring the current snapshot bitmap data to be synchronized according to the second log file, and sending the current snapshot bitmap data to be synchronized to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized, and sends a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is completely updated;
step S902, after receiving the third message, updating the synchronization record of the second log file, and selecting the next snapshot bitmap data to be synchronized in the second log file and continuously sending the next snapshot bitmap data to the bit primitive data service standby node for synchronization until all the snapshot bitmap data in the second log file are synchronized.
After the backup node of the bitmap metadata service recovers abnormally, the flow diagram of the bitmap metadata storage method is as shown in fig. 7, and therefore details are not repeated in this embodiment.
Optionally, the snapshot bitmap data includes a data state of the corresponding storage block; for any memory block, when the memory block does not store data, the data state record of the memory block is a first identifier, and when the memory block stores data, the data state record of the memory block is a second identifier.
Optionally, the method further includes: in the process of synchronizing the snapshot bitmap data in the second log file to the bitmap metadata service standby node, if second snapshot bitmap data sent by the storage node is received, the second snapshot bitmap data is sent to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates the first bitmap file based on the second snapshot bitmap data, and the first bitmap file is sequentially updated according to the received current snapshot bitmap data to be synchronized and the sequence of the second snapshot bitmap data.
Optionally, after the bitmap metadata service standby node recovers from an exception, acquiring snapshot bitmap data to be synchronized currently according to the second log file, and sending the snapshot bitmap data to be synchronized currently to the bitmap metadata service standby node, where the method includes:
in the normal state of the local machine, after receiving the heartbeat message of the bitmap metadata service standby node, triggering an opposite end heartbeat event, and switching the normal state of the local machine to the working state of the local machine;
under the working state of the local machine, acquiring current snapshot bitmap data to be synchronized according to the second log file, and sending the current snapshot bitmap data to be synchronized to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized in the waiting state of the local machine, and sends a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is completely updated;
and under the condition that all snapshot bitmap data in the second log file are synchronously completed, sending a fourth message indicating the completion of synchronization to the bitmap metadata service backup node, triggering a synchronization completion event, switching the local working state to a full normal state, so that the bitmap metadata service backup node responds to the received fourth message, triggering the reception completion event, switching the local waiting state to the local working state, under the condition that the bitmap metadata service backup node has no first log file, sending the fourth message indicating the completion of synchronization to the bitmap metadata service main node, triggering the synchronization completion event, and switching the local working state to the full normal state.
In the above embodiment, when the bit primitive data service standby node recovers abnormally, the bitmap metadata service master node acquires snapshot bitmap data to be synchronized from the second log file and sends the snapshot bitmap data to the bit primitive data service standby node for synchronization until all snapshot bitmap data in the second log file are synchronized, so as to achieve data synchronization between the master node and the standby node and strong consistency of the bitmap metadata.
When the bitmap metadata storage system normally provides services, referring to fig. 10, a first flowchart of a bitmap metadata storage method applied to a bitmap metadata service backup node provided in an embodiment of the present application is schematically shown, and the method includes the following steps:
step S1001, after receiving first snapshot bitmap data, updating a first bitmap file based on the first snapshot bitmap data; the first snapshot bitmap data is forwarded to the bitmap metadata service standby node after the primitive data service master node receives the first snapshot bitmap data sent by the storage node, and the first bitmap file comprises the data state of each storage block;
step S1002, after the update of the first bitmap file is completed, send a first message indicating that the update of the first bitmap file is successful to the bitmap metadata service master node, so that the bitmap metadata service master node updates a second bitmap file based on the first snapshot bitmap data after receiving the first message, and after the update of the second bitmap file is completed, send a second message indicating that the update of the second bitmap file is successful to the storage node.
In the above embodiment, when the primary bitmap metadata service node and the backup bitmap metadata service node are both normal, the snapshot bitmap data must be synchronized to the backup bitmap metadata service node, so that data synchronization between the primary node and the backup node is realized.
When the bitmap metadata service standby node is abnormally recovered, referring to fig. 11, a second flow diagram of the bitmap metadata storage method applied to the bitmap metadata service standby node provided in the embodiment of the present application is shown, including the following steps:
step S1101, after the bitmap metadata service standby node recovers from the exception and receives the current snapshot bitmap data to be synchronized, updating the first bitmap file based on the current snapshot bitmap data to be synchronized; the current snapshot bitmap data to be synchronized is obtained and sent to the bitmap metadata service standby node according to a second log file after the bitmap metadata service standby node recovers from an abnormality, and the second log file is used for storing the first snapshot bitmap data received by the bitmap metadata service standby node under the condition that the bitmap metadata service standby node is abnormal;
step S1102, after the first bitmap file is updated, sending a third message indicating that the first bitmap file is updated successfully to the bitmap metadata service master node, so that the bitmap metadata service master node updates the synchronization record of the second log file after receiving the third message, and selects the next snapshot bitmap data to be synchronized in the second log file to continue sending the snapshot bitmap data to the bitmap metadata service backup node for synchronization until all the snapshot bitmap data in the second log file are synchronized.
Optionally, the snapshot bitmap data includes a data state of the corresponding storage block; for any memory block, under the condition that no data is stored in the memory block, the data state record of the memory block is a first identifier, and under the condition that the data is stored in the memory block, the data state record of the memory block is a second identifier;
the method further comprises the following steps:
according to the received sequence of the current snapshot bitmap data to be synchronized and the second snapshot bitmap data, updating the first bitmap file in sequence; wherein the second snapshot bitmap data is: and in the process that the bitmap metadata service main node synchronizes the snapshot bitmap data in the second log file to the bitmap metadata service standby node, the storage node sends the snapshot bitmap data to the bitmap metadata service main node.
Optionally, the method further includes: after the bitmap metadata service standby node is started, the bitmap metadata service standby node enters an initial state; in the initial state, after receiving the heartbeat message of the bitmap metadata service main node, triggering an opposite end heartbeat event, and switching from the initial state to a local waiting state; when detecting that the bitmap metadata service standby node is changed from normal to abnormal, the bitmap metadata service master node triggers an opposite terminal offline event, switches all normal states to a local normal state, receives the first snapshot bitmap data under the condition that the bitmap metadata service master node is in all normal states, sends the first snapshot bitmap data to the bitmap metadata service standby node, updates the second bitmap file based on the first snapshot bitmap data under the condition that the bitmap metadata service master node is in all normal states, and stores the first snapshot bitmap data into the second log file;
after the bitmap metadata service standby node recovers from the abnormality and receives the current snapshot bitmap data to be synchronized, updating the first bitmap file based on the current snapshot bitmap data to be synchronized, including: in a waiting state of the machine, after receiving the snapshot bitmap data to be synchronized currently, updating the first bitmap file based on the snapshot bitmap data to be synchronized currently; the current snapshot bitmap data to be synchronized is obtained according to the second log file and sent to the bitmap metadata service standby node under the condition that the bitmap metadata service main node is in the working state of the local machine, and the working state of the local machine is a state that the bitmap metadata service main node triggers an opposite-end heartbeat event after receiving a heartbeat message of the bitmap metadata service standby node and is switched from the normal state of the local machine;
after the updating of the first bitmap file is completed, sending a third message indicating that the updating of the first bitmap file is successful to the bitmap metadata service main node;
the method further comprises the following steps: in response to receiving a fourth message which is sent by the bitmap metadata service main node and indicates that synchronization is completed, triggering a receiving completion event, and switching from a local waiting state to a local working state; under the condition that the bitmap metadata service master node does not have the first log file, sending a fourth message indicating synchronization completion to the bitmap metadata service master node, triggering a synchronization completion event, and switching the working state of the local machine to a full normal state; the fourth message is sent to the bitmap metadata service master node when all snapshot bitmap data in the second log file are synchronously completed, and the bitmap metadata service master node triggers a synchronous completion event when sending the fourth message, and switches from a local working state to a full normal state.
In the above embodiment, when the standby node of the in-place primitive data service recovers abnormally, after receiving the current snapshot bitmap data to be synchronized sent by the in-place primitive data service master node, the first bitmap file is updated based on the current snapshot bitmap data to be synchronized, so that synchronization and consistency of the bit primitive data are realized. And when the abnormal recovery occurs, the bitmap metadata service standby node can also bear second snapshot bitmap data sent by the bitmap metadata service main node. This is determined by the nature of the snapshot bitmap data, and some bit (binary bit) of the bitmap can be set from 0 to 1, but there is no requirement to set from 1 to 0. Therefore, the bitmap metadata service standby node can receive two types of messages, namely the current snapshot bitmap data to be synchronized and the second snapshot bitmap data, when the abnormal recovery occurs, even if the two types of messages are processed in a disordered sequence, the method has no influence.
Referring to fig. 12, a schematic structural diagram of a bitmap metadata storage apparatus applied to a bitmap metadata service master node according to an embodiment of the present application is provided, where the apparatus includes:
a receiving module 1210, configured to receive first snapshot bitmap data, where the first snapshot bitmap data is sent from a storage node to a bit primitive data service master node when a data state of a storage block is changed, and the first snapshot bitmap data represents a data state of the storage block;
a first sending module 1220, configured to send the first snapshot bitmap data to the bitmap metadata service standby node under a condition that the bitmap metadata service standby node is normal, so that the bitmap metadata service standby node updates a first bitmap file based on the first snapshot bitmap data, and sends a first message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is completely updated; wherein, the first bitmap file comprises the data state of each storage block;
a first updating module 1230, configured to update a second bitmap file based on the first snapshot bitmap data after receiving the first message; wherein, the second bitmap file comprises the data state of each storage block;
a second sending module 1240, configured to send, to the storage node, a second message indicating that the update of the second bitmap file is successful after the update of the second bitmap file is completed.
In the above embodiment, when both the bitmap metadata service master node and the bitmap metadata service standby node are normal, the snapshot bitmap data must be synchronized to the bitmap metadata service standby node, that is, only when both the bitmap metadata service master node and the bitmap metadata service standby node update the bitmap file normally, the result is returned to the storage node, thereby implementing data synchronization between the master node and the standby node.
Optionally, the apparatus further comprises:
the second updating module is used for updating the second bitmap file based on the first snapshot bitmap data under the condition that the bitmap metadata service standby node is abnormal;
the first storage module is used for storing the first snapshot bitmap data into a second log file;
and a third sending module, configured to send a second message indicating that the second bitmap file is successfully updated to the storage node.
Optionally, the apparatus further comprises:
a fourth sending module, configured to, after the bitmap metadata service backup node recovers from an exception, obtain snapshot bitmap data to be synchronized currently according to the second log file, and send the snapshot bitmap data to be synchronized currently to the bitmap metadata service backup node, so that the bitmap metadata service backup node updates the first bitmap file based on the snapshot bitmap data to be synchronized currently after receiving the snapshot bitmap data to be synchronized currently, and sends a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is updated;
the third updating module is used for updating the synchronous record of the second log file after receiving the third message;
and the fifth sending module is used for selecting the next snapshot bitmap data to be synchronized from the second log file and continuously sending the next snapshot bitmap data to the bit primitive data service standby node for synchronization until all the snapshot bitmap data in the second log file are synchronized.
Optionally, the snapshot bitmap data includes a data state of the corresponding storage block; for any memory block, when the memory block does not store data, the data state record of the memory block is a first identifier, and when the memory block stores data, the data state record of the memory block is a second identifier.
Optionally, the apparatus further comprises: a sixth sending module, configured to, in a process of synchronizing the snapshot bitmap data in the second log file to the bitmap metadata service standby node, send, if receiving second snapshot bitmap data sent by the storage node, the second snapshot bitmap data to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates the first bitmap file based on the second snapshot bitmap data, and sequentially updates the first bitmap file according to the received snapshot bitmap data to be currently synchronized and the sequence of the second snapshot bitmap data.
Optionally, the second updating module and the first storage module are specifically configured to: when detecting that the bitmap metadata service backup node is changed from normal to abnormal, triggering an opposite terminal disconnection event, and switching all normal states to a local normal state; in response to receiving the first snapshot bitmap data, under the condition that the state of the first snapshot bitmap data is a local normal state, updating the second bitmap file based on the first snapshot bitmap data; storing the first snapshot bitmap data in a second log file; the bitmap metadata service standby node enters an initial state after being started, and in the initial state, after receiving a heartbeat message of the bitmap metadata service main node, a heartbeat event of an opposite terminal is triggered, and the initial state is switched into a local waiting state;
the first sending module is specifically configured to: and responding to the received first snapshot bitmap data, and sending the first snapshot bitmap data to the bitmap metadata service standby node under the condition that the state of the first snapshot bitmap data is all normal.
In the above embodiment, when the bitmap metadata service standby node is abnormal, the snapshot bitmap data cannot be synchronized to the bitmap metadata service standby node, and the bitmap metadata service master node records each newly added snapshot bitmap data in a log form, so as to prepare for execution work after the subsequent bitmap metadata service standby node is abnormally recovered, so as to implement data synchronization between the master node and the standby node.
Optionally, the fourth sending module is specifically configured to: in the normal state of the local machine, after receiving the heartbeat message of the bitmap metadata service backup node, triggering an opposite end heartbeat event, and switching the normal state of the local machine to the working state of the local machine; under the working state of the machine, acquiring current snapshot bitmap data to be synchronized according to the second log file, and sending the current snapshot bitmap data to be synchronized to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized in the waiting state of the machine, and sends a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is completely updated; and under the condition that all snapshot bitmap data in the second log file are synchronously completed, sending a fourth message indicating the completion of synchronization to the bitmap metadata service backup node, triggering a synchronization completion event, switching the working state of the local computer to a full normal state, so that the bitmap metadata service backup node responds to the received fourth message, triggering the reception completion event, switching the waiting state of the local computer to the working state of the local computer, under the condition that the bitmap metadata service backup node has no first log file, sending the fourth message indicating the completion of synchronization to the bitmap metadata service master node, triggering the synchronization completion event, and switching the working state of the local computer to the full normal state.
In the above embodiment, when the bit primitive data service standby node recovers abnormally, the bitmap metadata service master node acquires snapshot bitmap data to be synchronized from the second log file and sends the snapshot bitmap data to the bit primitive data service standby node for synchronization until all snapshot bitmap data in the second log file are synchronized, so as to achieve data synchronization between the master node and the standby node and strong consistency of the bitmap metadata.
Referring to fig. 13, a schematic structural diagram of a bitmap metadata storage apparatus applied to a bitmap metadata service standby node according to an embodiment of the present application is provided, where the apparatus includes:
a first updating module 1310, configured to update a first bitmap file based on first snapshot bitmap data after receiving the first snapshot bitmap data; the first snapshot bitmap data is forwarded to the bitmap metadata service standby node after the primitive data service master node receives the first snapshot bitmap data sent by the storage node, and the first bitmap file comprises the data state of each storage block;
a sending module 1320, configured to send a first message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is updated, so that the bitmap metadata service master node updates a second bitmap file based on the first snapshot bitmap data after receiving the first message, and sends a second message indicating that the second bitmap file is successfully updated to the storage node after the second bitmap file is updated.
In the above embodiment, when the primary bitmap metadata service node and the backup bitmap metadata service node are both normal, the snapshot bitmap data must be synchronized to the backup bitmap metadata service node, so that data synchronization between the primary node and the backup node is realized.
Optionally, the apparatus further comprises:
the second updating module is used for updating the first bitmap file based on the current snapshot bitmap data to be synchronized after the bitmap metadata service standby node recovers from the abnormality and receives the current snapshot bitmap data to be synchronized; the current snapshot bitmap data to be synchronized is obtained and sent to the bitmap metadata service standby node according to a second log file after the bitmap metadata service standby node recovers from an abnormality, and the second log file is used for storing the first snapshot bitmap data received by the bitmap metadata service standby node under the condition that the bitmap metadata service standby node is abnormal;
and the second sending module is used for sending a third message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is updated, so that the bitmap metadata service master node updates the synchronization record of the second log file after receiving the third message, selects the next snapshot bitmap data to be synchronized from the second log file and continuously sends the next snapshot bitmap data to the bitmap metadata service backup node for synchronization until all the snapshot bitmap data in the second log file are synchronized.
Optionally, the snapshot bitmap data includes a data state of a corresponding storage block; for any memory block, under the condition that no data is stored in the memory block, the data state record of the memory block is a first identifier, and under the condition that the data is stored in the memory block, the data state record of the memory block is a second identifier;
the device further comprises:
the third updating module is used for sequentially updating the first bitmap file according to the sequence of the received current snapshot bitmap data to be synchronized and the second snapshot bitmap data; wherein the second snapshot bitmap data is: and in the process that the bitmap metadata service main node synchronizes the snapshot bitmap data in the second log file to the bitmap metadata service standby node, the storage node sends the snapshot bitmap data to the bitmap metadata service main node.
Optionally, the bitmap metadata service node enters an initial state after being started; in the initial state, after receiving the heartbeat message of the bitmap metadata service main node, triggering an opposite end heartbeat event, and switching the initial state into a local waiting state; when detecting that the bitmap metadata service standby node is changed from normal to abnormal, the bitmap metadata service master node triggers an opposite terminal offline event, switches all normal states to a local normal state, receives the first snapshot bitmap data under the condition that the bitmap metadata service master node is in all normal states, sends the first snapshot bitmap data to the bitmap metadata service standby node, updates the second bitmap file based on the first snapshot bitmap data under the condition that the bitmap metadata service master node is in all normal states, and stores the first snapshot bitmap data into the second log file;
the second update module is specifically configured to: in a waiting state of the machine, after receiving snapshot bitmap data to be synchronized currently, updating the first bitmap file based on the snapshot bitmap data to be synchronized currently; the current snapshot bitmap data to be synchronized is obtained according to the second log file and sent to the bitmap metadata service standby node under the condition that the bitmap metadata service main node is in the working state of the local machine, and the working state of the local machine is a state that the bitmap metadata service main node triggers an opposite-end heartbeat event after receiving a heartbeat message of the bitmap metadata service standby node and is switched from the normal state of the local machine;
after the updating of the first bitmap file is completed, sending a third message indicating that the updating of the first bitmap file is successful to the bitmap metadata service main node;
in response to receiving a fourth message which is sent by the bitmap metadata service main node and indicates that synchronization is completed, triggering a receiving completion event, and switching from a local waiting state to a local working state; under the condition that the bitmap metadata service master node does not have the first log file, sending a fourth message indicating synchronization completion to the bitmap metadata service master node, triggering a synchronization completion event, and switching the working state of the local machine to a full normal state; the fourth message is sent to the bitmap metadata service master node when all snapshot bitmap data in the second log file are synchronously completed, and when the bitmap metadata service master node sends the fourth message, a synchronization completion event is triggered, and the working state of the bitmap metadata service master node is switched to a full normal state.
In the above embodiment, when the standby node of the in-place primitive data service recovers abnormally, after receiving the current snapshot bitmap data to be synchronized sent by the in-place primitive data service master node, the first bitmap file is updated based on the current snapshot bitmap data to be synchronized, so that synchronization and consistency of the bit primitive data are realized. And when the abnormal recovery occurs, the bitmap metadata service standby node can also bear second snapshot bitmap data sent by the bitmap metadata service main node. This is determined by the nature of the snapshot bitmap data, and some bit (binary bit) of the bitmap can be set from 0 to 1, but there is no requirement to set from 1 to 0. Therefore, the bitmap metadata service standby node can receive two types of messages, namely current snapshot bitmap data to be synchronized and second snapshot bitmap data, when abnormal recovery occurs, even if the two types of messages are processed in a disordered manner, and compared with a mode that the second snapshot bitmap data is updated after the current snapshot bitmap data to be synchronized in the second log file is completely updated, the bitmap metadata service standby node has no limitation on the updating sequence when the two types of messages are processed, in the embodiment, the data writing speed of the storage node can be increased, the bitmap metadata service standby node can be quickly recovered to be normal after the abnormal condition, and data synchronization between the main node and the standby node is achieved.
The embodiment of the present application further provides a bitmap metadata service node, as shown in fig. 14, including a processor 1401 and a memory 1402;
a memory 1402 for storing a computer program;
the processor 1401 is configured to implement the following steps when executing the program stored in the memory 1402:
receiving first snapshot bitmap data sent by a storage node;
under the condition that the bit primitive data service standby node is normal, the first snapshot bitmap data is sent to the bitmap primitive data service standby node;
after receiving a first message indicating that a first bitmap file of the bitmap metadata service standby node is updated successfully, updating a second bitmap file based on the first snapshot bitmap data;
and after the second bitmap file is updated, sending a second message indicating that the second bitmap file is updated successfully to the storage node.
Optionally, the processor 1401 is configured to, when executing the program stored in the memory 1402, further implement the bitmap metadata storage method described in any of the foregoing embodiments.
The embodiment of the present application further provides a bitmap metadata service node, as shown in fig. 15, including a processor 1501 and a memory 1502;
a memory 1502 for storing computer programs;
the processor 1501, when executing the program stored in the memory 1502, implements the following steps:
after receiving first snapshot bitmap data sent by the bitmap metadata service master node, updating a first bitmap file based on the first snapshot bitmap data;
and after the first bitmap file is updated, sending a first message indicating that the first bitmap file is updated successfully to the bitmap metadata service master node.
Optionally, the processor 1501, when being configured to execute the program stored in the memory 1502, may further implement the bitmap metadata storage method described in any of the above embodiments.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In another embodiment provided by the present application, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements any one of the above-mentioned bit primitive data storage methods.
In yet another embodiment provided by the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any one of the bit primitive data storage methods of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It should be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on differences from other embodiments. In particular, as for the system embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The above description is only for the preferred embodiment of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (14)

1. A storage system, the system comprising:
the bitmap metadata service nodes comprise a bitmap metadata service main node and a bitmap metadata service standby node;
the storage node is used for sending first snapshot bitmap data representing the data state of the storage block to the bitmap metadata service main node under the condition that the data state of the storage block is changed;
the bitmap metadata service master node is used for responding to the received first snapshot bitmap data and sending the first snapshot bitmap data to the bitmap metadata service backup node under the condition that the bitmap metadata service backup node is normal;
the bitmap metadata service standby node is used for updating a first bitmap file based on first snapshot bitmap data after receiving the first snapshot bitmap data sent by the bitmap metadata service main node, wherein the first bitmap file comprises the data state of each storage block; after the updating of the first bitmap file is completed, sending a first message indicating that the updating of the first bitmap file is successful to the bitmap metadata service main node;
the bitmap metadata service master node is further configured to update a second bitmap file based on the first snapshot bitmap data after receiving the first message, where the second bitmap file includes data states of the storage blocks; and after the second bitmap file is updated, sending a second message indicating that the second bitmap file is updated successfully to the storage node.
2. The storage system of claim 1, wherein the bitmap metadata service master node is further configured to: in response to receiving the first snapshot bitmap data, in the case that the bitmap metadata service standby node is abnormal, updating the second bitmap file based on the first snapshot bitmap data; storing the first snapshot bitmap data in a second log file; and sending a second message indicating that the second bitmap file is updated successfully to the storage node.
3. The storage system according to claim 2, wherein the bitmap metadata service master node is further configured to, after the bitmap metadata service backup node recovers from an exception, obtain snapshot bitmap data to be currently synchronized according to the second log file, and send the snapshot bitmap data to be currently synchronized to the bitmap metadata service backup node;
the bitmap metadata service standby node is also used for updating the first bitmap file based on the current snapshot bitmap data to be synchronized after receiving the current snapshot bitmap data to be synchronized; after the updating of the first bitmap file is completed, sending a third message indicating that the updating of the first bitmap file is successful to the bitmap metadata service main node;
and the bitmap metadata service master node is further configured to update the synchronization record of the second log file after receiving the third message, select the next snapshot bitmap data to be synchronized in the second log file, and continue to send the snapshot bitmap data to the bitmap metadata service backup node for synchronization until all snapshot bitmap data in the second log file are synchronized.
4. The storage system of claim 3, wherein the storage node is specifically configured to: when the data state of a storage block is changed, generating snapshot bitmap data of the corresponding storage block, wherein the snapshot bitmap data comprises the data state of the corresponding storage block; for any memory block, when the memory block does not store data, the data state record of the memory block is a first identifier, and when the memory block stores data, the data state record of the memory block is a second identifier.
5. The storage system of claim 4, wherein the bitmap metadata service master node is further configured to: in the process of synchronizing the snapshot bitmap data in the second log file to the bitmap metadata service standby node, if second snapshot bitmap data sent by the storage node is received, the second snapshot bitmap data is sent to the bitmap metadata service standby node;
the bitmap metadata service standby node is further configured to update the first bitmap file based on the second snapshot bitmap data.
6. The storage system of claim 5, wherein the bitmap metadata service standby node is specifically configured to: and sequentially updating the first bitmap file according to the sequence of the received current snapshot bitmap data to be synchronized and the second snapshot bitmap data.
7. The storage system according to claim 2, wherein the primary bitmap metadata service node is further configured to trigger an opposite end disconnection event when detecting that the backup bitmap metadata service node changes from normal to abnormal, and switch from a full normal state to a local normal state;
the bitmap metadata service master node is specifically configured to send the first snapshot bitmap data to the bitmap metadata service standby node in response to receiving the first snapshot bitmap data and in a case that a state of the master node is a full normal state; under the condition that the self state is the normal state of the machine, updating the second bitmap file based on the first snapshot bitmap data; and storing the first snapshot bitmap data into a second log file.
8. The storage system of claim 3, wherein the bitmap metadata service standby node is further configured to: entering an initial state after starting; in the initial state, after receiving the heartbeat message of the primitive data service main node, triggering an opposite end heartbeat event, and switching the initial state into a local waiting state;
the bitmap metadata service master node is specifically configured to: in the normal state of the local machine, after receiving the heartbeat message of the bitmap metadata service standby node, triggering an opposite end heartbeat event, and switching the normal state of the local machine to the working state of the local machine; under the condition of the working state of the machine, acquiring current snapshot bitmap data to be synchronized according to the second log file, and sending the current snapshot bitmap data to be synchronized to the bit primitive data service standby node;
the bitmap metadata service standby node is specifically configured to: in a waiting state of the machine, after receiving the snapshot bitmap data to be synchronized currently, updating the first bitmap file based on the snapshot bitmap data to be synchronized currently; after the first bitmap file is updated, sending a third message indicating that the first bitmap file is updated successfully to the bitmap metadata service master node;
the bitmap metadata service master node is further configured to: under the condition that all snapshot bitmap data in the second log file are synchronously completed, sending a fourth message indicating the completion of the synchronization to the bitmap metadata service standby node, triggering a synchronization completion event, and switching the working state of the local machine to all normal states;
the bitmap metadata service standby node is further configured to: responding to the received fourth message, triggering a receiving completion event, and switching from a local waiting state to a local working state; and under the condition that the bitmap metadata service master node does not have the first log file, sending a fourth message indicating synchronization completion to the bitmap metadata service master node, triggering a synchronization completion event, and switching the working state of the local machine to a full normal state.
9. A bitmap metadata storage method is characterized in that the method is applied to a bitmap metadata service main node in a storage system, the storage system further comprises a bitmap metadata service standby node and a storage node, and the method comprises the following steps:
receiving first snapshot bitmap data, wherein the first snapshot bitmap data is sent to the bit primitive data service master node by the storage node under the condition that the data state of a storage block is changed, and the first snapshot bitmap data represents the data state of the storage block;
under the condition that a bit map metadata service standby node is normal, the first snapshot bitmap data is sent to the bitmap metadata service standby node, so that the bitmap metadata service standby node updates a first bitmap file based on the first snapshot bitmap data, and after the first bitmap file is updated, a first message indicating that the first bitmap file is updated successfully is sent to a bitmap metadata service main node; wherein, the first bitmap file comprises the data state of each storage block;
updating a second bitmap file based on the first snapshot bitmap data after receiving the first message; wherein, the second bitmap file comprises the data state of each storage block;
and after the second bitmap file is updated, sending a second message indicating that the second bitmap file is updated successfully to the storage node.
10. A bitmap metadata storage method is applied to a bitmap metadata service standby node in a storage system, the storage system further comprises a bitmap metadata service main node and a storage node, and the method comprises the following steps:
after receiving first snapshot bitmap data, updating a first bitmap file based on the first snapshot bitmap data; the first snapshot bitmap data is forwarded to the bitmap metadata service standby node by the primary node of the primitive data service after receiving the first snapshot bitmap data sent by the storage node, and the first bitmap file comprises the data state of each storage block;
after the first bitmap file is updated, sending a first message indicating that the first bitmap file is updated successfully to the bitmap metadata service main node, so that the bitmap metadata service main node updates a second bitmap file based on the first snapshot bitmap data after receiving the first message, and sends a second message indicating that the second bitmap file is updated successfully to the storage node after the second bitmap file is updated.
11. A bitmap metadata storage device is applied to a bitmap metadata service main node in a storage system, the storage system further comprises a bitmap metadata service standby node and a storage node, and the device comprises:
a receiving module, configured to receive first snapshot bitmap data, where the first snapshot bitmap data is sent to the bit primitive data service master node by a storage node when a data state of a storage block is changed, and the first snapshot bitmap data represents the data state of the storage block;
a first sending module, configured to send the first snapshot bitmap data to the bitmap metadata service standby node under a condition that the bitmap metadata service standby node is normal, so that the bitmap metadata service standby node updates a first bitmap file based on the first snapshot bitmap data, and sends a first message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is completely updated; wherein, the first bitmap file comprises the data state of each storage block;
a first updating module, configured to update a second bitmap file based on the first snapshot bitmap data after receiving the first message; wherein, the second bitmap file comprises the data state of each storage block;
and the second sending module is used for sending a second message indicating that the second bitmap file is successfully updated to the storage node after the second bitmap file is updated.
12. A bitmap metadata storage device, which is applied to a bitmap metadata service standby node in a storage system, wherein the storage system further comprises a bitmap metadata service primary node and a storage node, and the device comprises:
the first updating module is used for updating the first bitmap file based on the first snapshot bitmap data after the first snapshot bitmap data are received; the first snapshot bitmap data is forwarded to the bitmap metadata service standby node after the primitive data service master node receives the first snapshot bitmap data sent by the storage node, and the first bitmap file comprises the data state of each storage block;
a sending module, configured to send a first message indicating that the first bitmap file is successfully updated to the bitmap metadata service master node after the first bitmap file is updated, so that the bitmap metadata service master node updates a second bitmap file based on the first snapshot bitmap data after receiving the first message, and sends a second message indicating that the second bitmap file is successfully updated to the storage node after the second bitmap file is updated.
13. An electronic device comprising a processor and a memory;
a memory for storing a computer program;
a processor for implementing the method steps as claimed in claim 9 or 10 when executing a program stored in the memory.
14. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any of the claims 9-10.
CN202211008974.5A 2022-08-22 2022-08-22 Bitmap metadata storage system and method Pending CN115391094A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211008974.5A CN115391094A (en) 2022-08-22 2022-08-22 Bitmap metadata storage system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211008974.5A CN115391094A (en) 2022-08-22 2022-08-22 Bitmap metadata storage system and method

Publications (1)

Publication Number Publication Date
CN115391094A true CN115391094A (en) 2022-11-25

Family

ID=84119911

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211008974.5A Pending CN115391094A (en) 2022-08-22 2022-08-22 Bitmap metadata storage system and method

Country Status (1)

Country Link
CN (1) CN115391094A (en)

Similar Documents

Publication Publication Date Title
EP3062226B1 (en) Data replication method and storage system
US9934242B2 (en) Replication of data between mirrored data sites
WO2016070375A1 (en) Distributed storage replication system and method
US20150213100A1 (en) Data synchronization method and system
CN105814544B (en) System and method for supporting persistent partition recovery in a distributed data grid
CN111078667B (en) Data migration method and related device
JP5548829B2 (en) Computer system, data management method, and data management program
US20230305936A1 (en) Methods and systems for a non-disruptive automatic unplanned failover from a primary copy of data at a primary storage system to a mirror copy of the data at a cross-site secondary storage system
JP2008171387A (en) Backup system with continuous data protection
JP5686034B2 (en) Cluster system, synchronization control method, server device, and synchronization control program
JP5292351B2 (en) Message queue management system, lock server, message queue management method, and message queue management program
US10452680B1 (en) Catch-up replication with log peer
CN111865632A (en) Switching method of distributed data storage cluster and switching instruction sending method and device
CN113010496A (en) Data migration method, device, equipment and storage medium
CN111752488A (en) Management method and device of storage cluster, management node and storage medium
WO2018157605A1 (en) Message transmission method and device in cluster file system
CN109726211B (en) Distributed time sequence database
WO2021212493A1 (en) Data synchronization method and device, data storage system and computer-readable medium
CN116389233B (en) Container cloud management platform active-standby switching system, method and device and computer equipment
WO2023240995A1 (en) Data recovery method and apparatus for dual-machine hot standby system, and medium
CN115391094A (en) Bitmap metadata storage system and method
JP6697101B2 (en) Information processing system
CN113297134B (en) Data processing system, data processing method and device, and electronic device
CN113515574A (en) Data synchronization method and device
CN113076298A (en) Distributed small file storage system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination