Data storage method and data storage apparatus
By identifying the data type to be stored in the distributed log storage system and selecting the target master node for storage, the storage performance degradation caused by broker down is solved, and data storage effects of high availability and resource saving are achieved.
Patent Information
- Application Number
- PCT/IB2025/050050
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-30
- Filing Date
- 2025-01-03
- Publication Date
- 2025-08-07
AI Technical Summary
In the existing distributed log storage system, the re-election and synchronization tasks caused by broker downtime lead to degradation of storage performance, affecting the normal sending and receiving of messages and the continuity and integrity of data.
Provide a data storage method and device, by obtaining the data to be stored in the first master node, performing type identification in the case of failure, filtering out the target master node from other storage nodes for data storage according to the data type, realizing a high-availability storage solution, and allowing multiple brokers to coexist, having a multi-role and global leader allocation mechanism.
It realizes a high-availability storage solution suitable for a variety of scenarios, improves storage performance, avoids the idle state of the machine as a backup node, saves resources, and ensures data continuity and integrity.
Smart Images

Figure IB2025050050_07082025_PF_FP_ABST
Abstract
Description
[0001]TECHNICAL FIELD: Embodiments of this specification relate to the field of computer technology, and in particular to data storage methods and data storage devices. Background: With the development of computer technology, a large number of distributed log storage systems (log-based storage systems) have been used in industrial software to record and analyze information. A log storage system refers to a software system that records and stores large amounts of information in the form of logs. Currently, distributed stream processing platforms based on partitioned backup can process high-throughput real-time data streams. However, with a large number of topics and partitions, a message delivery hub (broker) downtime involves a large number of re-election and synchronization tasks. This puts significant pressure on all components in the distributed stream processing platform, affecting the normal sending and receiving of messages and resulting in poor storage performance. Therefore, a data storage solution with high storage performance is urgently needed. SUMMARY OF THE INVENTION: In view of this, embodiments of this specification provide a data storage method. One or more embodiments of this specification also relate to a data storage device, a computing device, a computer-readable storage medium, and a computer program product to address technical deficiencies in the prior art. According to a first aspect of an embodiment of the present specification, a data storage method is provided, which is applied to a data storage system. The data storage system includes multiple storage nodes, and the storage nodes include a master node and a backup node. The method includes: obtaining data to be stored from a first master node, where the first master node is any one of the multiple master nodes; in the event of a failure of the first master node, performing type identification on the data to be stored to determine the data type of the data to be stored; based on the data type, selecting a target master node corresponding to the data to be stored from storage nodes other than the first master node; and storing the data to be stored in the target master node.According to a second aspect of an embodiment of this specification, a data storage device is provided, applied to a data storage system. The data storage system includes multiple storage nodes, including master nodes and backup nodes. The device includes: an acquisition component configured to acquire data to be stored from a first master node, where the first master node is any one of the multiple master nodes; an identification component configured to, in the event of a failure of the first master node, identify the type of the data to be stored and determine the data type of the data to be stored; a screening component configured to screen, based on the data type, a target master node corresponding to the data to be stored from storage nodes other than the first master node; and a first storage component configured to store the data to be stored in the target master node. According to a third aspect of an embodiment of this specification, a computing device is provided, including: a memory and a processor; the memory is configured to store computer-executable instructions; the processor is configured to execute the computer-executable instructions, wherein the computer-executable instructions, when executed by the processor, implement the steps of the aforementioned data storage method. According to a fourth aspect of an embodiment of this specification, a computer-readable storage medium is provided, storing computer-executable instructions, wherein the instructions, when executed by the processor, implement the steps of the aforementioned data storage method. According to a fifth aspect of the embodiments of this specification, a computer program product is provided, comprising a computer program / instructions. When executed by a processor, the computer program / instructions implement the steps of the aforementioned data storage method. The data storage method provided in one embodiment of this specification is applied to a data storage system comprising multiple storage nodes, including master nodes and backup nodes. The method comprises: obtaining data to be stored from a first master node, where the first master node is any one of the multiple master nodes; in the event of a failure of the first master node, identifying the type of the data to be stored to determine the data type of the data to be stored; selecting a target master node corresponding to the data to be stored from storage nodes other than the first master node based on the data type; and storing the data to be stored in the target master node.Because the target master node is selected from storage nodes other than the first master node based on the data type of the data to be stored, this solution is compatible with multiple data types and provides a high-availability storage solution suitable for various scenarios. In addition, each storage node includes a master node and a backup node, allowing a single machine to simultaneously play the roles of master and backup node. This prevents some machines from being idle as backup nodes, saves resources, and improves storage performance. BRIEF DESCRIPTION OF THE DRAWINGS FIG1 is an architectural diagram of a data storage system provided in one embodiment of this specification; FIG2 is a flow chart of a data storage method provided in one embodiment of this specification; FIG3 is a schematic diagram of the structure of a storage unit in a data storage system provided in one embodiment of this specification; FIG4 is a flow chart of the processing process of a data storage method provided in one embodiment of this specification; FIG5 is a schematic diagram of the processing flow of an adaptation unit in a data storage method provided in one embodiment of this specification; FIG6 is a flow chart of node election in a data storage method provided in one embodiment of this specification; FIG7 is a flow chart of the processing process of another data storage method provided in one embodiment of this specification; FIG8 is a schematic diagram of the processing flow of a merging unit in a data storage method provided in one embodiment of this specification; FIG9 is an architectural diagram of another data storage system provided in one embodiment of this specification; FIG10 is a schematic diagram of the performance test results of a data storage method provided in one embodiment of this specification; FIG11 is a schematic diagram of the performance test results of another data storage method provided in one embodiment of this specification; FIG12 is a schematic diagram of the structure of a data storage device provided in one embodiment of this specification; FIG13 is a block diagram of the structure of a computing device provided in one embodiment of this specification. DETAILED DESCRIPTION The following description sets forth numerous specific details to facilitate a thorough understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art may make similar generalizations without violating the scope of this specification. Therefore, this specification is not limited to the specific implementations disclosed below. The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification.As used in one or more embodiments of this specification and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and encompasses any and all possible combinations of one or more of the associated listed items. It should be understood that while the terms "first," "second," and so on may be employed in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from one another. For example, the first could be referred to as the second, and similarly, the second could be referred to as the first, without departing from the scope of one or more embodiments of this specification. Depending on the context, the term "if," as used herein, could be interpreted as meaning "when," "when," or "in response to determining." Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, storage, and display) referred to in one or more embodiments of this specification are all authorized by the user or fully authorized by all parties. The collection, use, and processing of the relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or reject. First, the terms used in one or more embodiments of this specification are explained. High Availability: High availability refers to the system's ability to maintain continuous availability in the face of failures. Broker: A broker is the central hub responsible for message delivery in a distributed log storage system, responsible for receiving, processing, and forwarding messages to ensure efficient and reliable message delivery. In the embodiments of this specification, a broker can be understood as a storage node. In industrial software, there are two key scenarios: messaging and streaming. These scenarios have different requirements for log storage. Messaging is a high-speed, asynchronous, program-to-program communication technology. Messages are typically stored in a distributed manner across different machines.Messaging allows different components or systems to communicate in the form of messages, achieving loose coupling and efficient data transfer. In messaging scenarios, message reliability is crucial. Messages must be accurately recorded and delivered to ensure data integrity and consistency. Therefore, messaging requires a highly available storage solution to ensure secure message storage and delivery. Stream processing is a technology that processes continuous data streams. It ensures the consistency and integrity of data over time to support real-time analysis and decision-making. In stream processing scenarios, the continuity and integrity of log storage are crucial. Discontinuous or incomplete stored logs can severely impact subsequent data processing and analysis. Therefore, stream processing requires a highly available storage paradigm to ensure data continuity and integrity. Currently, data storage can be achieved through distributed stream processing platforms or distributed publish-subscribe messaging systems. Distributed stream processing platforms are designed to process high-throughput real-time data streams. Their high availability solution is based on a cluster of brokers. High availability is achieved through partitioned replication and an election mechanism based on the distributed application coordination service (ZooKeeper). When a broker fails, a distributed stream processing platform can re-elect a new leader from the backup brokers and restore data replication. The high availability solutions of distributed stream processing platforms perform well in stream processing scenarios. However, in messaging scenarios involving a large number of topics and partitions, inter-broker elections and data synchronization can lead to performance degradation and increased costs. A topic refers to a category of data. Distributed publish-subscribe messaging systems are designed to handle large-scale, real-time message streams. Their high availability is built on a cluster of independent brokers operating in a master-slave model. Distributed publish-subscribe messaging systems use partition replication and election mechanisms similar to those used in distributed stream processing platforms to achieve high availability and data replication. While their high availability solutions perform well in both stream processing and messaging scenarios, they can still present performance and cost issues when dealing with a large number of topics and partitions.Because messaging and stream processing scenarios have different log storage requirements, embodiments of this specification propose a high-availability storage paradigm compatible with both scenarios. This approach provides efficient and reliable messaging and stream processing capabilities, ensures data continuity and integrity, and meets the requirements of industrial software. Specifically, embodiments of this specification propose a data storage method, applied to a data storage system comprising multiple storage nodes, including master and backup nodes. The method comprises: obtaining data to be stored from a first master node, where the first master node is any one of the multiple master nodes; in the event of a failure of the first master node, identifying the type of the data to be stored and determining the data type of the data to be stored; based on the data type, selecting a target master node corresponding to the data to be stored from storage nodes other than the first master node; and storing the data to be stored in the target master node. Because the data storage solution proposed in embodiments of this specification allows for the coexistence of multiple brokers, provides brokers with multiple roles, global leader allocation, data synchronization, node management, and timely notification mechanisms, it achieves a high-availability storage solution applicable to all scenarios. This specification provides a data storage method, which also relates to a data storage device, a computing device, and a computer-readable storage medium. Each of these methods is described in detail in the following embodiments. Referring to FIG1 , FIG1 illustrates an architecture diagram of a data storage system according to one embodiment of this specification. The data storage system may include a client 100 and a server 200. The server 200 includes multiple storage nodes, including a primary node and a backup node. The client 100 is configured to send data to be stored for a first primary node to the server 200, where the first primary node is any one of the multiple primary nodes. The server 200 is configured to, in the event of a failure of the first primary node, identify the data type to be stored and determine the data type to be stored. Based on the data type, the server 200 selects a target primary node corresponding to the data to be stored from storage nodes other than the first primary node. The server 200 then stores the data to be stored at the target primary node.In the embodiments of this specification, since the target master node is selected from storage nodes other than the first master node based on the data type of the data to be stored, this solution is compatible with storage tasks for data of various data types (such as non-continuous and continuous data types). Furthermore, since the data types to be stored vary in different scenarios, the embodiments of this specification can provide a high-availability storage solution applicable to various scenarios. Furthermore, each storage node includes a master node and a backup node, allowing a single machine to simultaneously serve as both a master and a backup node. This prevents some machines from being idle as backup nodes, conserving resources, and improving storage performance. In practical applications, the data storage system may include multiple clients 100 and a server 200. The clients 100 may include end-side devices, and the server 200 may include cloud-side devices. Communication connections can be established between the multiple clients 100 via the server 200. In data storage scenarios, the server 200 provides data storage services between the multiple clients 100. The multiple clients 100 can act as either senders or receivers, communicating via the server 200. Users can interact with the server 200 through the client 100 to receive data sent by other clients 100 or send data to other clients 100. In data storage scenarios, users can publish data streams to the server 200 through the client 100. The server 200 then stores the data based on the data stream and pushes the stored data to other clients with which the communication is established. The connection between the client 100 and the server 200 is established via a network. The network provides the medium for the communication link between the client 100 and the server 200. The network can include various connection types, such as wired or wireless communication links or fiber optic cables. Data transmitted by the client 100 may need to undergo encoding, transcoding, compression, and other processing before being published to the server 200.The client 100 can be a browser, an APP (Application), a web application such as an H5 (HyperText Markup Languages, version 5) application, a light application (also known as a mini-program, a lightweight application), or a cloud application. The client 100 can be developed based on a software development kit (SDK) for the corresponding service provided by the server 200, such as a real-time communication (RTC) SDK. The client 100 can be deployed in an electronic device and rely on the device or certain APPs in the device to run. For example, the electronic device can have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, tablet computer, or personal computer. Various other types of applications can also be configured in the electronic device, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc. The server 200 may include servers that provide various services, such as servers that provide communication services to multiple clients, servers that support backend training for models used on clients, and servers that process data sent by clients. It should be noted that the server 200 can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. The server can also be a server in a distributed system or a server integrated with blockchain. The server can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.It is worth noting that the data storage methods provided in the embodiments of this specification are generally executed by the server. However, in other embodiments of this specification, the client may also have similar functions to the server and thereby execute the data storage methods provided in the embodiments of this specification. In other embodiments, the data storage methods provided in the embodiments of this specification may also be jointly executed by the client and the server. Referring to Figure 2, Figure 2 shows a flow chart of a data storage method provided in one embodiment of this specification. This method is applied to a data storage system comprising multiple storage nodes, including master nodes and backup nodes. The method specifically includes the following steps: Step 202: Obtain data to be stored from a first master node, where the first master node is any one of the multiple master nodes. In one or more embodiments of this specification, the data to be stored from the first master node may be obtained and stored. Specifically, the first master node is any one of the multiple master nodes. A master node is responsible for managing data read and write operations, maintaining system status information, and performing necessary data management and scheduling tasks. In practical applications, a master node may be referred to as a "control node" or "coordinating node." When a client needs to read or store data, it typically first interacts with the master node. A slave node provides backup and failover capabilities for the master node. In practical applications, a slave node can be referred to as a "slave node." It is designed to take over the responsibilities of the master node if the master node fails or becomes unavailable, ensuring system continuity and data integrity. The slave node typically synchronizes data and status information from the master node in real time or periodically to ensure rapid failover and service when needed. By configuring master and slave nodes, a data storage system can achieve high availability and fault tolerance, mitigating the risk of system outages caused by single points of failure. Data to be stored refers to data to be stored on the primary master node, which is the target storage location for the data to be stored. Data to be stored can be logs, messages, and more. This data can be used in various industrial logging scenarios, such as those involving large-scale message transmission without requiring message ordering, or stream processing scenarios where strict message ordering is required.Message transmission scenarios include, but are not limited to, IoT scenarios, and stream processing scenarios include, but are not limited to, financial, order, and banking scenarios. It should be noted that in a traditional master-slave architecture, master and backup nodes are assigned to different machines, resulting in low machine utilization. Therefore, to improve machine utilization, in a high-availability cluster, embodiments of this specification provide a container within the data storage system. The container supports the coexistence of multiple brokers on the same machine. Each broker includes leader and follower partitions, allowing a single machine to simultaneously function as both a master and a backup node. This prevents some machines from being idle as backup nodes, thereby conserving resources and avoiding waste. See Figure 3 , which shows a schematic diagram of the structure of a container in a data storage system provided by one embodiment of this specification. As shown in Figure 3 , the leader and follower nodes in the container are configured at the broker granularity. The container includes a master node A and a backup node B. The data topics stored in master node A include Topic A and Topic B, and the data topics stored in backup node B include Topic C and Topic D. This allows for selective node election based on data type when a master node is down. For example, if strict data order is not required and the first master node is down, node election is not performed. However, if strict data order is required and the first master node is down, node election is performed. This allows for flexible determination of data storage nodes based on different data types, improving data storage flexibility. In practical applications, there are multiple methods for obtaining the data to be stored on the first master node, and the method selected depends on the specific circumstances. This embodiment of the present specification does not impose any limitations on this method. In one possible implementation of this specification, the data to be stored on the first master node can be received from a user via a client. In another possible implementation of this specification, the data to be stored on the first master node can be read from other data acquisition devices or databases.In an optional embodiment of the present specification, after obtaining the data to be stored from the first master node, it may be determined whether the first master node is faulty. If the first master node is faulty, it indicates that the first master node cannot store the data to be stored; if the first master node is not faulty, it indicates that the first master node can store the data to be stored. That is, after obtaining the data to be stored from the first master node, the method may further include the following steps: if the first master node is not faulty, storing the data to be stored in the first master node; obtaining storage confirmation information from the first master node, and sending the storage confirmation information to the client. The storage confirmation information is sent to the first master node after the first backup node stores the data to be stored synchronized by the first master node. The first backup node is a backup node corresponding to the first master node. It should be noted that, if the first master node is not faulty, the data to be stored may be stored in the first master node. Furthermore, the first master node may synchronize the data to be stored to a first backup node corresponding to the first master node to back up the data to be stored. After synchronization is complete, the first standby node can send a storage confirmation message (act) to the first master node. At this point, the storage process for the data to be stored is complete. The storage confirmation message can be obtained from the first master node and sent to the client, allowing the user to understand the data storage status. In practical applications, there are multiple ways to determine whether the first master node has failed, and the method used depends on the specific situation. This embodiment of the specification does not limit this method. In one possible implementation of this specification, whether the first master node has failed can be determined based on whether the data to be stored has been successfully stored. In another possible implementation of this specification, whether the first master node has failed can be determined through heartbeat detection. Using the solution of this embodiment of the specification, if the first master node is not failed, the data to be stored is stored in the first master node; the storage confirmation message is obtained from the first master node, and the storage confirmation message is sent to the client. If the first master node is not failed, the data to be stored is stored in the first master node, ensuring the success rate of data storage.In an optional embodiment of the present specification, after obtaining the data to be stored on the first master node, the following steps may also be included: if the first master node fails to store the data to be stored, determining that the first master node has failed; and / or if the first heartbeat sent by the first master node has expired, determining that the first master node has failed. It should be noted that a heartbeat is a periodic, brief signal or message used to indicate that a node is online and operating normally. Nodes in a data storage system typically periodically send heartbeats to other nodes or a management server to indicate that they are still operating normally. If a node stops sending heartbeats or the heartbeat expires (the interval exceeds a preset threshold), it indicates that the node has failed. In practical applications, in message transmission scenarios, it is typically possible to determine whether the first master node has failed to store the data to be stored, thereby determining whether the first master node has failed. In message transmission scenarios, it is typically possible to determine whether the first heartbeat sent by the first master node has expired, or whether the first master node has sent the first heartbeat, thereby determining whether the first master node has failed. Using the solutions of the embodiments of this specification, if the first master node fails to store the data to be stored, the first master node is determined to be faulty; and / or if the first heartbeat sent by the first master node is overdue, the first master node is determined to be faulty. Determining whether the first master node is faulty in different ways increases the flexibility of the fault determination method. Step 204: In the event of a first master node failure, the type of the data to be stored is identified to determine the data type of the data to be stored. In one or more embodiments of this specification, after obtaining the data to be stored from the first master node, in the event of a first master node failure, the type of the data to be stored can be further identified to determine the data type of the data to be stored. Specifically, data types include, but are not limited to, non-continuous data types and continuous data types. For example, data in a message transmission scenario is of non-continuous data type, while data in a stream processing scenario is of continuous data type. In actual applications, there are various ways to identify the type of data to be stored and determine the data type of the data to be stored, and the method selected depends on the actual situation. The embodiments of this specification do not impose any limitations on this method.In one possible implementation of this specification, a data analysis tool can be used to extract timestamps from the data to be stored and determine the data type of the data to be stored based on the timestamps. In another possible implementation of this specification, a pre-trained type recognition model can be used to perform type recognition on the data to be stored and determine the data type of the data to be stored. Step 206: Based on the data type, a target master node corresponding to the data to be stored is selected from storage nodes other than the first master node. In one or more embodiments of this specification, data to be stored is obtained from the first master node. In the event of a failure of the first master node, type recognition is performed on the data to be stored to determine the data type of the data to be stored. Furthermore, based on the data type, a target master node corresponding to the data to be stored can be selected from storage nodes other than the first master node. It should be noted that since the first master node has failed, when selecting a target storage node for the data to be stored, storage nodes other than the first master node can be selected to avoid selecting the first master node as the target master node, which could result in data storage failure. In practical applications, the target master node can be selected based on the synchronization status set, or it can be a second master node located in the same storage unit as the first backup node. The target master node selection method is determined based on the data type of the data to be stored, and this embodiment of the present specification does not impose any restrictions on this. Step 208: Storing the data to be stored in the target master node. In one or more embodiments of this specification, the data to be stored on the first master node is obtained; in the event of a failure of the first master node, the type of the data to be stored is identified to determine the data type of the data to be stored; and after selecting the target master node corresponding to the data to be stored from storage nodes other than the first master node based on the data type, the data to be stored can be further stored in the target master node. Since the target master node is selected from storage nodes other than the first master node based on the data type of the data to be stored, the solution of the embodiments of this specification is compatible with multiple data types and provides a high-availability storage solution suitable for various scenarios. Furthermore, each storage node includes a primary node and a backup node, allowing a single machine to simultaneously serve as both a primary and a backup node. This prevents some machines from being idle as backup nodes, conserving resources, and improving storage performance.In an optional embodiment of this specification, to enhance the transparency of the data storage process, a notification unit (Notifier) is provided in the data storage system. The notification unit is used to notify clients of changes in the data storage route and complete fault recovery. Specifically, the aforementioned data storage method may further include the following steps: obtaining the fault status of the first master node; and sending storage routing information to the client based on the fault status. It should be noted that the notification unit is a fault reporting component that can store storage routing information. Storage routing information represents the path of data from the source address to the destination address. The notification unit can be embedded in the cluster providing routing services, or it can be proactively constructed by the client through broker detection. In the event of a broker failure, the notification unit can promptly update the client's routing information. After the cluster recovers, the notification unit can notify the client of the route to the newly available broker. During cluster recovery, not only does the broker need to be restored, but the client also needs to adapt to ensure the effectiveness of the recovery. In practical applications, the notification unit can obtain the fault status of the first master node. If the fault status is not a fault, the storage routing information is determined to be stored on the first master node; if the fault status is a fault, the storage routing information is determined to be stored on the target master node. Using the solution of an embodiment of this specification, the fault status of the first master node is obtained; and based on the fault status, the storage routing information is sent to the client. By sending the storage routing information to the client based on the fault status, the client's data transmission and consumption process can remain uninterrupted even in the event of a fault. In an optional embodiment of this specification, the data type includes a non-contiguous data type; and the aforementioned method of selecting the target master node corresponding to the to-be-stored data from storage nodes other than the first master node based on the data type may include the following steps: if the to-be-stored data is determined to be non-contiguous data based on the non-contiguous data type, determining a first backup node corresponding to the first master node from multiple storage nodes; and determining a second master node located in the same storage node as the first backup node as the target master node. Specifically, the first backup node and the second master node being located in the same storage node can be understood as the first backup node and the second master node being located in the same machine. Non-continuous data types refer to data types that do not have the property of time continuity.Non-continuous data can be understood as discrete data, including but not limited to the number of products and the number of people. It should be noted that, depending on the data type, when selecting the target master node corresponding to the data to be stored from storage nodes other than the first master node, a node election may be required to determine the target master node. Therefore, embodiments of this specification provide an imposter unit in the data storage system that can or cannot participate in node elections. The imposter unit is used to enable brokers to have more diverse roles, such as serving as a simple backup node or acting as a master node. For example, the first backup node corresponding to the first master node can be designated as the imposter unit. The first backup node can decide whether to assume full master node responsibilities based on the data type. Full master node responsibilities include data writing, data reading, and API (Application Programming Interface) responses (such as obtaining cluster metadata). If the first backup node does not assume full master node responsibilities, it can only assume data reading responsibilities, omitting data writing and API responses. In practical applications, if the imposter unit is exposed to the client, to improve client usability, even if the imposter unit is actually a backup node, it will be displayed as a master node from the client's perspective. After the second master node is determined as the target master node, special messages (such as timed messages) in the data to be stored can be forwarded to the second master node to ensure normal delivery of special messages. Using the solution of the embodiments of this specification, when the data to be stored is determined to be non-contiguous based on its type, a first backup node corresponding to the first master node is determined from multiple storage nodes. The second master node, located at the same storage node as the first backup node, is determined as the target master node. If strict data order is not required and the first master node is down, re-election is not performed; the second master node is directly determined as the target master node to continue providing services. This prevents data loss, avoids election costs, and achieves high-performance data storage.In an optional embodiment of this specification, after determining the second master node located at the same storage node as the first backup node as the target master node, the method may further include the following steps: if the first master node fails and remains unrecovered, storing the data to be stored sent to the first master node at the target master node. It should be noted that if the data to be stored is non-contiguous data, after determining the second master node as the target master node, if the first master node fails and remains unrecovered, subsequent non-contiguous data to be stored from the first master node can be directly stored at the second master node, eliminating the need to filter nodes from storage nodes other than the first master node. By applying the solution of this embodiment of this specification, if the first master node fails and remains unrecovered, storing the data to be stored sent to the first master node at the target master node improves data storage efficiency. In an optional embodiment of this specification, after storing the data to be stored at the target master node, the method may further include the following steps: in response to a data acquisition request for the data to be stored, reading the data to be stored from the first backup node. It should be noted that if the data to be stored is non-continuous, the first standby node only performs the data reading task and does not perform the complete master node tasks. In this case, in response to a data acquisition request for the data to be stored, the data to be stored can be directly read from the first standby node. By applying the solution of the embodiments of this specification, in response to a data acquisition request for the data to be stored, the data to be stored is read from the first standby node, thereby achieving rapid and accurate acquisition of the data to be stored.4 , which shows a flowchart of a processing process of a data storage method provided by an embodiment of the present specification. The four horizontal lines in FIG4 represent a client, a first master node, a first backup node, and a second master node, respectively. The first backup node and the second backup node are located in the same machine. In a message transmission scenario, when the first master node fails, the process of responding to a client request is shown in FIG4 , and specifically includes the following three stages: Before the failure of the first master node: the client sends data to be stored to the first master node. The first master node stores the data to be stored and synchronizes the data to the first backup node. The first backup node sends a storage confirmation message to the first master node. The first master node returns the storage confirmation message to the client, indicating that the data storage is successful. The first master node provides data reading services. During the failure of the first master node: When the process of sending the data to be stored to the first master node fails, it is determined that the first master node has failed. At this time, since the data to be stored in the message transmission scenario is non-continuous data, the first backup node does not participate in the election and can send special messages to the second master node to ensure normal delivery of these messages. The first backup node provides data reading services. If the first master node fails and has not yet recovered, the data to be stored is directly sent to the second master node for storage. After the first master node recovers, the behavior of the first master node after recovery is consistent with that before the failure of the first master node, and will not be further described in this embodiment. In an optional embodiment of this specification, the data type includes a continuous data type. The aforementioned method of selecting a target master node corresponding to the data to be stored from storage nodes other than the first master node based on the data type may include the following steps: if the data to be stored is determined to be continuous data based on the continuous data type, obtaining a synchronization state set, wherein the synchronization state set includes the data synchronization relationship between the primary node and the backup node; and selecting a target master node from storage nodes other than the first master node based on the data synchronization relationship. Specifically, the synchronization state set stores the synchronization status between the primary node and the backup node. If the first master node fails, a backup node with synchronized data replication progress can be selected from the synchronization state set as the new primary node, and all nodes are notified.In an embodiment of this specification, an adaptation unit (Regulator) can be set up in the master node to determine whether the backup node is synchronized with the master node. Each backup node can report its data replication status, i.e., location, to the adaptation unit during each data synchronization task. When the difference between this location and the master node's location is less than a set threshold, the master and backup nodes are considered synchronized. Synchronization here refers to normal data replication progress. For backup nodes in the synchronized state, the adaptation unit can include them in a synchronization status set. If the synchronization process is too slow (due to network or hardware issues), the adaptation unit can remove them from the synchronization status set, and subsequent data transmission does not require confirmation from the backup node. Successful synchronization is crucial to avoid data loss. The adaptation unit can monitor the synchronization progress of each backup node and evaluate the synchronization status. If a backup node cannot keep up with data changes on the master node, the adaptation unit will trigger appropriate processing mechanisms, such as resynchronization or issuing an alarm. See Figure 5, which shows a schematic diagram of the processing flow of the adaptation unit in a data storage method provided in one embodiment of this specification. As shown in Figure 5, the control unit includes a synchronization status set, and data consistency is maintained across multiple control units. Storage Node A includes master node 1, backup node 2, and backup node 3; storage node B includes master node 1, backup node 2 (awaiting synchronization), and backup node 3; and storage node C includes master node 1, backup node 2, and backup node 3. All adaptation units store the data synchronization status of the master and backup nodes. This data synchronization status can be reported to the control unit. Master node 1 in storage nodes A and B, and master node 3 in storage node C, report synchronization status. The list of backup nodes in the synchronization status set is core data in the control unit. When a master node fails, the control unit elects a backup node from the synchronization status set as the new master node and notifies all nodes. For example, in the storage unit C cluster, if master node 1 fails, master node 3 is the newly elected master node by the control unit and will be responsible for reporting the synchronization status set.It should be noted that if the data to be stored is continuous, indicating a strict sequential order during data transfer, a synchronization state set can be obtained, and node election can be performed based on the data synchronization relationship to determine the target master node. Therefore, the embodiments of this specification provide a independently implemented, independently deployed, and fault-tolerant control unit (Controller) in the data storage system. The Controller is the core component of node election and is used to globally assign the leader status to an appropriate broker, thereby determining the appropriate broker as the target master node. In practical applications, there are various methods for selecting the target master node from storage nodes other than the primary master node based on the data synchronization relationship. The specific method to be selected depends on the actual situation and is not limited in this embodiment. In one possible implementation, a backup node with synchronized data replication progress can be randomly selected as the new master node. In another possible implementation of this specification, the first backup node corresponding to the first master node can be directly determined as the target master node. Specifically, the aforementioned selection of the target master node from storage nodes other than the first master node based on the data synchronization relationship may include the following steps: selecting a first backup node from storage nodes other than the first master node based on the data synchronization relationship, wherein the first backup node is the backup node corresponding to the first master node; and determining the first backup node as the target master node. It should be noted that because the first backup node is the backup node corresponding to the first master node, the data replication progress between the first backup node and the first master node is highly synchronized. Therefore, the first backup node can be directly determined as the target master node, ensuring high availability of the cluster. 6 , which shows a flowchart of node election in a data storage method provided in one embodiment of the present specification. As shown in FIG6 , the node election process includes the following three stages: Before node election: Standby node 1 and standby node 2 register with the control unit and the routing service; During node election: The control unit elects standby node 1 as the master node and notifies all nodes; After node election: Both the master node and standby node 2 register with the control unit and the routing service, and the data of the master node is synchronized with the standby node 2.Applying the solution of an embodiment of this specification, when the data to be stored is determined to be continuous data based on the continuous data type, a synchronization state set is obtained; a target master node is selected from storage nodes other than the first master node based on the data synchronization relationship; and a suitable broker is assigned the leader status and designated as the target master node, thereby ensuring high availability of the cluster. In an optional embodiment of this specification, after selecting the target master node from storage nodes other than the first master node based on the data synchronization relationship, the following steps may also be included: upon recovery from a failure of the first master node, data of the first master node and the target master node are synchronized; upon completion of data synchronization, the first master node is determined as the target master node. It should be noted that after recovery from a failure of the first master node, the first master node can participate in node election and resume full master node responsibilities. Furthermore, since some data was lost during the first master node's failure, data of the first master node and the target master node can be synchronized before the first master node participates in node election to ensure that the first master node catches up with the target master node's data synchronization progress. Consequently, upon completion of data synchronization, the first master node is determined as the target master node. By applying the solution of the embodiments of this specification, when the first master node recovers from a failure, the data of the first master node and the target master node are synchronized; when data synchronization is completed, the first master node is determined as the target master node, thereby ensuring the integrity of the data of the first master node.7 , which shows a flowchart of a processing process of another data storage method provided by an embodiment of the present specification. The four horizontal lines in FIG7 represent a client, a first master node, a first backup node, and a control unit, respectively. In a stream processing scenario, when the first master node fails, the process of responding to a client request is shown in FIG7 , and specifically includes the following three stages: Before the failure of the first master node: the client sends data to be stored to the first master node. The first master node stores the data to be stored and synchronizes the data to the first backup node. The first backup node sends a storage confirmation message to the first master node. The first master node returns the storage confirmation message to the client, indicating that the data storage is successful. The first master node provides data read services. At the same time, the first master node sends a heartbeat to the control unit to inform the control unit that it is not faulty, and no node election is triggered at this time. During the failure of the first master node: After the failure of the first master node, the first master node stops sending heartbeats to the control unit. At this time, the heartbeat list in the control unit determines that the heartbeat of the first master node has expired, triggering an election. During the election process, the first backup node participates in the election and provides the same services as the first master node, such as data reading and storing the sent data. After the failure of the first master node is recovered: After the first master node recovers from the failure, it resends heartbeats and participates in node election. Furthermore, the first master node performs data synchronization to catch up with the first backup node's data synchronization progress. The control unit re-elects the first master node as the target master node. Thereafter, the first master node behaves the same as before the failure. In an optional embodiment of this specification, synchronizing data between the first master node and the target master node may include the following steps: obtaining a storage offset point and a data truncation point for the first master node during data storage; determining a data synchronization point based on the data truncation point and the storage offset point; and synchronizing data after the data synchronization point in the target master node to the first master node. It should be noted that since data inconsistencies may occur between nodes after node reelection, to better align with cloud-native design concepts, this embodiment of this specification includes a merge unit (Merger) in the data storage system, independent of the control unit and broker storage service. The merge unit is responsible for data replication and merging, ensuring data synchronization between nodes.In practical applications, during data storage, the merge unit can operate in the Ready, Handshake, Transfer, and Shutdown phases. During the Ready phase, the primary and standby nodes establish a high-availability (HA) connection. During the Handshake phase, the primary and standby nodes exchange handshakes, during which the merge unit truncates inappropriate storage on the standby node in preparation for replication. The primary and standby nodes continue data transfers normally on the Transfer node. During the Shutdown phase, the primary and standby nodes complete synchronization and disconnect. In data processing systems, we add an epoch file to record epochs and their corresponding physical start offsets (startOffsets). Epoch represents the term number of the primary node, ensuring that the primary node is unique within each epoch. If the primary node fails, the control unit elects a new primary node. At this point, the new master node is assigned an incremental epoch, and the starting physical offset of the master node's term corresponding to this epoch is recorded. The epoch and starting physical offset ensure data consistency after the master-slave node switchover. See Figure 8, which shows a schematic diagram of the processing flow of a merging unit in a data storage method provided by one embodiment of this specification. Figure 8 includes the logs of the master and standby nodes, which contain topics A, B, and C, respectively. The locations corresponding to each topic in the master's log are shown in Figure 8. The standby node can find the location with the largest consistent epoch-start physical offset, i.e., point <8,2250> in Figure 8, and then truncate to this location and begin replicating backward. This replication is performed by a separate service in the data storage system, so the master-slave replication and election processes are decoupled. Only when the merging unit has brought a standby node as close to the master as possible is it included in the synchronization state set.Referring to Figure 9, it shows an architecture diagram of another data storage system provided in one embodiment of this specification. The data storage system consists of a client and a server. The server includes six decoupled units: a storage unit, a notification unit, a replacement unit, a merging unit, a control unit, and an adaptation unit. These six units can be implemented in a pluggable manner, providing flexibility and scalability, achieving high availability in various scenarios at an optimal cost. Furthermore, this data storage system represents a design paradigm applicable to all "log storage-based software." As shown in Figure 9, the accommodation unit allows multiple brokers to coexist on the same machine, improving machine utilization. For example, broker 1 includes primary node A and alternate unit B, with the adaptation unit configured in primary node A. Broker 2 includes primary node B and alternate unit C, with the adaptation unit configured in primary node B. Broker 3 includes primary node C and alternate unit A, with the adaptation unit configured in primary node C. The alternate unit enables brokers to have more diverse roles, improving machine flexibility. The notification unit promptly notifies clients of routing changes, ensuring fault recovery. The control unit assigns leader status to appropriate brokers, ensuring high availability of the cluster. The merge unit ensures data synchronization between primary and backup nodes, preventing data inconsistency. The adaptation unit identifies synchronized nodes in the primary node and reports this to the control unit. Together, these six units form a reliable and efficient high-availability design paradigm that can cope with various failure and data synchronization scenarios, ensuring data consistency and reliability. It should be noted that the notification unit, accommodation unit, replacement unit, and merging unit are common components across all scenarios. For messaging scenarios, these three components alone can meet the high availability requirements and reduce recovery time to seconds. However, for stream processing scenarios, a control unit and a user unit are required to implement node election. In practical applications, chaos testing was conducted on the data storage solution proposed in the embodiments of this specification. The experimental results demonstrate that this solution effectively achieves high system availability, provides low latency, high throughput, and fault tolerance with no message loss during failures, and exhibits excellent recovery performance in both messaging and stream processing scenarios.Testing has shown that the data recovery time objective (RTO) of this solution is approximately 1 second in a messaging scenario and approximately 3 seconds in a streaming scenario. Specifically, in the experiment, the data storage system proposed in the embodiments of this specification was performance tested by injecting multiple failure types (including broker crashes and network partitions). See Figure 10, which shows a schematic diagram of performance test results for a data storage method provided by an embodiment of this specification. As shown in Figure 10, the horizontal axis represents time (in seconds) and the vertical axis represents throughput (in megabytes per second). Figure (a) shows the throughput results obtained with a random failure of two brokers (16 partitions), Figure (b) shows the throughput results obtained with a random failure of two brokers (1 partition), Figure (c) shows the throughput results with a random network partition (16 partitions), and Figure (d) shows the throughput results with a random network partition (1 partition). Referring to Figure 11, Figure 11 shows a schematic diagram of performance test results for another data storage method provided by one embodiment of this specification. As shown in Figure 11, Figure (a) illustrates the aggregated publishing delay when using and not using a high-availability solution. The horizontal axis of Figure (a) represents the performance indicator TP (Top Percentile) values, including average, TP50, TP95, TP99, TP99.9, TP99.99, and maximum, and the vertical axis represents the aggregated publishing delay (in milliseconds). Figure (b) illustrates the average publishing rate when using and not using a high-availability solution. The horizontal axis of Figure (b) represents time (in minutes) and the vertical axis represents the average publishing rate (in megabytes per second). The experimental results show that the data storage system can recover quickly after a failure, with a short recovery time. Furthermore, in the case of multiple partitions and frequent failures, the recovery time of the data storage system does not increase significantly, indicating that the number of partitions does not increase the recovery cost of the data storage system. It's worth noting that this solution improves the slow data transmission process, reducing TP99.99 and maximum transmission delay. Corresponding to the above method embodiments, this specification also provides a data storage device embodiment. FIG12 shows a schematic diagram of the structure of a data storage device provided in one embodiment of this specification.As shown in FIG12 , the apparatus is applied to a data storage system comprising multiple storage nodes, including master nodes and backup nodes. The apparatus comprises: an acquisition component 1202 configured to acquire data to be stored from a first master node, where the first master node is any one of the multiple master nodes; an identification component 1204 configured to, in the event of a failure of the first master node, identify the type of the data to be stored and determine the data type of the data to be stored; a screening component 1206 configured to, based on the data type, screen a target master node corresponding to the data to be stored from storage nodes other than the first master node; and a first storage component 1208 configured to store the data to be stored in the target master node. Optionally, the data type includes a non-contiguous data type; the screening component 1206 is further configured to, if the data to be stored is determined to be non-contiguous data based on the non-contiguous data type, determine a first backup node corresponding to the first master node from the multiple storage nodes; and determine a second master node located in the same storage node as the first backup node as the target master node. Optionally, the apparatus further includes: a second storage component configured to, if the first master node fails and remains unrecovered, store the to-be-stored data sent to the first master node in a target master node. Optionally, the apparatus further includes: a reading component configured to, in response to a data acquisition request for the to-be-stored data, read the to-be-stored data from the first backup node. Optionally, the data type includes a continuous data type; the screening component 1206 is further configured to, if the to-be-stored data is determined to be continuous data based on the continuous data type, obtain a synchronization status set, wherein the synchronization status set includes a data synchronization relationship between the master node and the backup node; and select the target master node from storage nodes other than the first master node based on the data synchronization relationship. Optionally, the screening component 1206 is further configured to, based on the data synchronization relationship, select a first backup node from storage nodes other than the first master node, wherein the first backup node is a backup node corresponding to the first master node; and determine the first backup node as the target master node. Optionally, the device further includes: a synchronization component configured to synchronize data of the first master node and the target master node when the first master node recovers from a failure; and determine the first master node as the target master node when data synchronization is completed.Optionally, the determination component is further configured to obtain a storage offset point and a data truncation point of the first master node during data storage; determine a data synchronization point based on the data truncation point and the storage offset point; and synchronize data after the data synchronization point in the target master node to the first master node. Optionally, the apparatus further includes: a third storage component configured to, if the first master node is not faulty, store the data to be stored in the first master node; obtain storage confirmation information from the first master node, and send the storage confirmation information to the client, wherein the storage confirmation information is sent to the first master node after the first backup node stores the data to be stored synchronized by the first master node, and the first backup node is the backup node corresponding to the first master node. Optionally, the apparatus further includes: a determination component configured to determine that the first master node has failed if the first master node fails to store the data to be stored; and / or to determine that the first master node has failed if a first heartbeat sent by the first master node expires. Optionally, the apparatus further includes: a sending component configured to obtain a fault status of the first master node; and send storage routing information to the client based on the fault status. Applying the solution of the embodiments of this specification, since the target master node is selected from storage nodes other than the first master node based on the data type of the data to be stored, this solution is compatible with multiple data types and provides a high-availability storage solution suitable for various scenarios. Furthermore, each storage node includes a master node and a backup node, allowing a single machine to simultaneously serve as both a master and a backup node. This prevents some machines from being idle as backup nodes, conserving resources, and improving storage performance. The above is a schematic diagram of a data storage device according to this embodiment. It should be noted that the technical solution of this data storage device and the technical solution of the aforementioned data storage method are based on the same concept. For details not described in detail in the technical solution of the data storage device, please refer to the description of the technical solution of the aforementioned data storage method. Figure 13 shows a block diagram of a computing device according to one embodiment of this specification. Components of computing device 1300 include, but are not limited to, memory 1310 and processor 1320. oProcessor 1320 is connected to memory 1310 via bus 1330. Database 1350 is used to store data. Computing device 1300 also includes access device 1340, which enables computing device 1300 to communicate via one or more networks 1360. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1340 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like. In one embodiment of the present specification, the aforementioned components of the computing device 1300 and other components not shown in FIG. 13 may also be connected to each other, for example, via a bus. It should be understood that the computing device structure block diagram shown in FIG. 13 is for illustrative purposes only and does not limit the scope of this specification. Those skilled in the art may add or replace other components as needed.Computing device 1300 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, personal digital assistant, laptop computer, notebook computer, netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or personal computer (PC). Computing device 1300 can also be a mobile or stationary server. Processor 1320 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the aforementioned data storage method. The above is a schematic diagram of a computing device according to this embodiment. It should be noted that the technical solutions of this computing device and the technical solutions of the aforementioned data storage method are based on the same concept. For details not described in detail in the technical solutions of the computing device, please refer to the description of the technical solutions of the aforementioned data storage method. This specification also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by the processor, implement the steps of the aforementioned data storage method. The above is a schematic diagram of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium is based on the same concept as the technical solution of the data storage method described above. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the data storage method described above. This specification also provides a computer program product according to one embodiment, including a computer program / instructions. When executed by a processor, this computer program / instructions implements the steps of the data storage method described above. The above is a schematic diagram of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product is based on the same concept as the technical solution of the data storage method described above. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the data storage method described above. The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims.In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous. The computer instructions include computer program code, which may be in source code form, object code form, executable files, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, removable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. It should be noted that the content of the computer-readable medium may be appropriately increased or decreased based on the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media does not include electrical carrier signals and telecommunication signals. It should be noted that, for ease of description, the aforementioned method embodiments are presented as a series of combined actions. However, those skilled in the art should be aware that the embodiments of this specification are not limited to the order of the actions described, as certain steps may be performed in a different order or simultaneously, depending on the embodiments of this specification. Furthermore, those skilled in the art should also be aware that the embodiments described in this specification are preferred embodiments, and the actions and components described are not necessarily required for the embodiments of this specification. In the above embodiments, the description of each embodiment has its own emphasis. For portions not described in detail in a particular embodiment, reference should be made to the relevant descriptions of other embodiments. The preferred embodiments disclosed above are intended solely to facilitate illustrative purposes. The optional embodiments do not describe all details, nor do they limit the invention to the specific implementations described. Clearly, numerous modifications and variations are possible based on the content of the embodiments of this specification.This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents. Industrial Applicability: The solutions provided by the embodiments of this disclosure can be applied to data storage processes and data storage systems. By selecting a target master node from storage nodes other than the first master node based on the data type of the data to be stored, compatibility with different data types can be improved, providing a high-availability storage solution suitable for various scenarios. Furthermore, each storage node includes a master node and a backup node, allowing a single machine to simultaneously serve as both a master node and a backup node. This prevents some machines from being idle as backup nodes, conserving resources, and improving storage performance.
Claims
Claims 1. A data storage method, applied to a data storage system, wherein the data storage system includes multiple storage nodes, the storage nodes including a master node and a backup node, the method comprising: Obtaining data to be stored from a first master node, wherein the first master node is any one of a plurality of master nodes; in the event of a failure of the first master node, performing type identification on the data to be stored to determine a data type of the data to be stored; screening a target master node corresponding to the data to be stored from storage nodes other than the first master node based on the data type; and storing the data to be stored in the target master node.
2. The data storage method according to claim 1, wherein: The data type includes a non-continuous data type; and selecting, based on the data type, a target master node corresponding to the data to be stored from storage nodes other than the first master node, including: determining, based on the non-continuous data type, that the data to be stored is non-continuous data, from the multiple storage nodes, a first backup node corresponding to the first master node; and determining a second master node located in the same storage node as the first backup node as the target master node.
3. The data storage method according to claim 2, wherein: After determining the second master node located at the same storage node as the first backup node as the target master node, the method further includes: storing the to-be-stored data sent to the first master node in the target master node when the first master node fails and has not recovered.
4. The data storage method according to claim 2, wherein: After storing the data to be stored in the target master node, the method further includes: reading the data to be stored from the first backup node in response to a data acquisition request for the data to be stored.
5. The data storage method according to claim 1, wherein: The data types include continuous numbers 27 According to the type of data; the filtering out, according to the data type, a target master node corresponding to the data to be stored from storage nodes other than the first master node, including: when it is determined according to the continuous data type that the data to be stored is continuous data, obtaining a synchronization status set, wherein the synchronization status set includes a data synchronization relationship between the master node and the backup node; and selecting a target master node from storage nodes other than the first master node according to the data synchronization relationship.
6. The data storage method according to claim 5, wherein: The selecting, based on the data synchronization relationship, a target master node from storage nodes other than the first master node includes: selecting, based on the data synchronization relationship, a first backup node from storage nodes other than the first master node, wherein the first backup node is a backup node corresponding to the first master node; and determining the first backup node as the target master node.
7. The data storage method according to claim 5, wherein: After selecting a target master node from storage nodes other than the first master node according to the data synchronization relationship, the method further includes: synchronizing data of the first master node and the target master node when the first master node recovers from a failure; and determining the first master node as the target master node when data synchronization is completed.
8. The data storage method according to claim 7, wherein: The synchronizing the data of the first master node and the target master node includes: obtaining a storage offset position and a data truncation position of the first master node during data storage; determining a data synchronization position according to the data truncation position and the storage offset position; synchronizing the data after the data synchronization position in the target master node to the first master node.
9. The data storage method according to claim 1, wherein: After obtaining the data to be stored of the first master node, the method further includes: storing the data to be stored in the first master node when the first master node is not faulty. Node; obtain storage confirmation information from the first master node, and send the storage confirmation information to the client, wherein the storage confirmation information is sent to the first master node after the first standby node stores the data to be stored synchronized by the first master node, and the first standby node is the standby node corresponding to the first master node.
10. The data storage method according to claim 1, wherein: After obtaining the data to be stored of the first master node, the method further includes: determining that the first master node is faulty when the first master node fails to store the data to be stored; and / or determining that the first master node is faulty when a first heartbeat sent by the first master node expires.
11. The data storage method according to claim 1, further comprising: Acquire a fault status of the first master node; and send storage routing information to the client according to the fault status.
12. A data storage device, applied to a data storage system, wherein the data storage system includes a plurality of storage nodes, the storage nodes including a master node and a backup node, and the device includes: An acquisition component is configured to acquire data to be stored from a first master node, wherein the first master node is any one of a plurality of master nodes; an identification component is configured to perform type identification on the data to be stored and determine the data type of the data to be stored in the event of a failure of the first master node; a screening component is configured to screen out a target master node corresponding to the data to be stored from storage nodes other than the first master node based on the data type; and a first storage component is configured to store the data to be stored in the target master node.
13. A computing device, comprising: A memory and a processor; the memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, and the computer programs / instructions are implemented when executed by the processor according to any one of claims 1 to 11. Describe the steps of the data storage method.
14. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the data storage method according to any one of claims 1 to 11.
15. A computer program product comprising a computer program / instructions, which, when executed by a processor, implements the steps of the data storage method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Database system and deployment method thereof
CN107644035A
Data synchronization method and system, electronic equipment and computer readable storage medium
CN111049928A
Data management method, device and equipment and computer storage medium
CN112311596A
Disaster recovery switching method of message storage node and message middleware system
CN116614347A