CN117729095A - Data management method, storage system and related equipment - Google Patents

Data management method, storage system and related equipment Download PDF

Info

Publication number
CN117729095A
CN117729095A CN202311036053.4A CN202311036053A CN117729095A CN 117729095 A CN117729095 A CN 117729095A CN 202311036053 A CN202311036053 A CN 202311036053A CN 117729095 A CN117729095 A CN 117729095A
Authority
CN
China
Prior art keywords
node
master
state information
slave
state
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
CN202311036053.4A
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.)
Xingyin Information Technology Shanghai Co ltd
Original Assignee
Xingyin Information Technology Shanghai 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 Xingyin Information Technology Shanghai Co ltd filed Critical Xingyin Information Technology Shanghai Co ltd
Priority to CN202311036053.4A priority Critical patent/CN117729095A/en
Publication of CN117729095A publication Critical patent/CN117729095A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a data management method, a storage system and related equipment, wherein the method comprises the following steps: the management node maintains a state information base for storing state information of each node, so that when a first node serving as a master node performs master-slave switching, the management node can modify the state information of the first node into a first state, then sends a master-slave switching request to the first node to instruct the first node to switch into a slave node, and updates the state information of the first node into a second state under the condition that the first node is determined to switch into the slave node.

Description

Data management method, storage system and related equipment
Technical Field
The present disclosure relates to the field of storage, and in particular, to a data management method, a storage system, and related devices.
Background
The master-slave switching technology is an important means for ensuring high availability of the system, is widely applied to distributed systems such as a database system, a server system, a network system, a storage system and the like, and is used for enabling slave nodes to take over the work of the master nodes when the master nodes are in fault or upgrade so as to ensure the continuous operation and stability of the system.
However, in the master-slave switching process, the master node needs to be restarted, in the process, the data writing request of the user cannot be processed, the system is temporarily unavailable, and the use experience of the user is reduced.
Disclosure of Invention
The application provides a data management method, a storage system and related equipment, which are used for solving the problem that a system is temporarily unavailable in a master-slave switching process and improving the use experience of a user.
In a first aspect, a data management method is provided, which is applicable to a management node side, and includes the following steps: the management node updates the state information of the first node in the state information base into a first state, wherein the first node is a master node, the state information base is used for a client to acquire the state information of the first node in a subscription mode, the management node sends a master-slave switching request to the first node, and the management node updates the state information of the first node into a second state under the condition that the management node determines that the first node is switched into a slave node.
When the method described in the first aspect is implemented, the management node maintains a state information base for storing state information of each node, and when the first node serving as the master node performs master-slave switching, the management node can modify the state information of the first node into a first state, then instruct the first node to switch into a slave node, update the state information of the first node into a second state under the condition that the first node is determined to switch into the slave node, and because the state information base is subscribed by the client, the client can timely know whether the first node is in master-slave switching or not, so that data writing failure or data loss caused by master-slave switching is avoided, and the problem of short-time unavailability in the master-slave switching process is solved.
In a possible implementation manner, the client performs data reading and writing through other nodes except the first node when the state information is in the first state. The first node is a master node, and the state information base is used for the client to acquire the state information of the first node in a subscription mode. When the state information of the first node is the first state, the client may return, to the user, a description that the first node cannot read or write currently when receiving a write request sent by the user to write data to the first node, or write the data to another node, and after the first node and the second node complete master-slave switching, rewrite the data to the second node serving as the master node at this time, where the above description is not limited specifically by the application.
Alternatively, the state information library may be implemented based on a distributed key-value store (ETCD), which uses a shift algorithm to ensure consistency and reliability of data, and a simple API is provided so that a developer can easily interact with the ETCD, resulting in higher feasibility of the scheme. The client can realize the function of subscribing the state information base through the corvus, wherein the corvus is a cache system and can store and manage data, and the client can interact with the corvus through a Redis protocol to realize the read-write management of the data. In short, after the read-write request of the user passes through the corvus and then is sent to the corresponding node to read and write data, the corvus subscribes to the state information base, and then the read-write request can be processed according to the state information, so that when the first node performs master-slave switching, the write request related to the first node is not processed, or is written into other nodes, the problem of data writing failure or data loss caused by master-slave switching is avoided, and the use experience of the user is improved.
According to the implementation mode, the working state of the first node is timely obtained through the client subscription state information base, so that when the first node performs master-slave switching, the client can obtain that the first node cannot process a data writing request currently, at the moment, the client can select to feed back information that the first node cannot process the writing request to a user, and can write data into other nodes, the problem that data writing fails or data is lost due to master-slave switching is avoided, and the use experience of the user is improved.
In a possible implementation manner, in the case that the first node is a master node, the second node is a slave node of the first node, and after the master-slave switching request is used for indicating that the first node synchronizes the unsynchronized target data to the second node, the first node is switched to a slave node of the second node, and the second node is switched to the master node.
When the first node and the second node perform data synchronization, the data synchronization can be performed through a data slicing transmission mode, namely, the target data in the first node is transmitted to the second node through a data slicing mode, the target data is divided into a plurality of sliced data, the sliced data is transmitted to the second node, and in the transmission process, problems such as network delay and hardware faults possibly occur, so that part of sliced data cannot be transmitted to the slave node in time, the sliced information of each sliced data can be periodically or regularly checked to determine which sliced data are transmitted to the second node, and which sliced data still need to be retransmitted, and the first node can be helped to determine data difference and take corresponding measures to ensure the accuracy and the integrity of the data by regularly checking the sliced information.
In the above implementation manner, the master node is configured to process a write request of a user, the slave node is configured to process a read request of the user, and the slave node implements data synchronization with the master node by means of asynchronous storage, so that data may not be stored in the slave node until a period of time after the data is written into the master node. Therefore, during master-slave switching, a part of target data may not be synchronized to the slave node, and if the master-slave switching is directly performed, the target data may be lost, thereby reducing the use experience of the user. According to the method and the device, the target data which are not synchronized in the first node are synchronized to the second node before master-slave switching, so that the problem of target data loss can be avoided, and the use experience of a user is improved.
In one possible implementation manner, after the first node may determine that the target data is transmitted to the second node, the first node and the second node are restarted, the restarted first node is switched to the slave node, and the restarted second node is switched to the master node.
Alternatively, the first node may periodically or periodically check the fragmentation information of each fragmented data, determine whether a difference (diff) between the data in the first node and the data in the second node is below a threshold, and start a node restart in case of being below the threshold. The threshold may be a default value, or a value obtained by the client from the user, for example, a value obtained when the user inputs the upgrade request of the first node, or may be obtained at other times, which is not limited in this application.
Optionally, the first node may restart the first node using version data of the slave node, so that the restarted first node is switched to the slave node, and the second node may restart the second node using version data of the master node, so that the restarted second node is switched to the master node.
It should be noted that, the version data used by the first node and the second node may be version data issued by the management node, which may be issued by the management node after acquiring the master-slave switching request, or may be issued by the management node after acquiring the master-slave switching request and updating the state information base, or may be issued when the management node sends the master-slave switching request to the first node and the second node.
In a specific implementation, the version data may be a binary version file, where the version data includes, but is not limited to, a program code required for a master-slave switch, a database file, a configuration file, a dependency library file, a script file, and the like, where the database file includes information such as a structure definition, a data table, an index, and the like of a database that the program code needs to use, the configuration file includes parameter settings, log configuration, database connection information, and the like of the program code, the dependency library file includes some third party library files that the program code depends on, and the script file includes a script file such as database initialization, environment script variable settings, and the like that the program code needs, and it should be understood that the version data may include more or less content for illustration, and the application is not specifically limited.
According to the implementation mode, when the first node and the second node perform master-slave switching, the unsynchronized target data in the first node and the unsynchronized target data in the second node are synchronized, so that the first node and the second node cannot lose data due to master-slave switching, and the use experience of a user is improved.
In one possible implementation, before the management node updates the state information of the first node in the state information base to the first state, the method further includes: the management node receives an upgrade request of the first node sent by the user.
Optionally, before the management node updates the state information of the first node in the state information base to the first state, the method further includes: the management node obtains fault information of the first node.
It should be understood that the master-slave switching request may also be produced in other scenarios, such as disaster recovery drilling, and planned master-slave switching scenarios, such as application scenarios where the load of the master node is too high, the network delay of the master node, the maintenance of the master node is required, etc., which are not illustrated herein.
According to the implementation mode, the data management method provided by the application can be suitable for various application scenes needing master-slave switching, the scheme is high in applicability, the read service is not affected completely in the master-slave switching process, the write service can also reduce the influence by writing other nodes or returning error information to the user, the influence degree on the service is greatly reduced, and the use experience of the user is improved.
In a second aspect, a data management method is provided, the method being applicable to a first node side, the method comprising the steps of: the first node receives a master-slave switching request sent by the management node, wherein the first node is a master node, the slave node of the first node is a second node, the first node synchronizes unsynchronized target data to the second node, and the first node is switched to the slave node.
When the method described in the second aspect is implemented, the management node maintains a state information base for storing state information of each node, and when a first node serving as a master node performs master-slave switching, the management node can modify the state information of the first node into a first state, then instruct the first node to switch into a slave node, update the state information of the first node into a second state under the condition that the first node is determined to switch into the slave node, and because the state information base is subscribed by a client, the client can timely know whether the first node is in master-slave switching or not, so that data writing failure or data loss caused by master-slave switching is avoided, and the problem of short-time unavailability in the master-slave switching process is solved.
In a possible implementation manner, the master-slave switching request is generated after the management node modifies the state information of the first node in the state information base into the first state, where the state information base is used for the client to obtain the state information of the first node through a subscription mode, and the client reads and writes data through other nodes except the first node when the state information is in the first state.
In one possible implementation, after the first node is switched to the slave node, the method further includes: the first node sends information of completion of master-slave switching to the management node, and the information of completion of master-slave switching is used for indicating the management node to update the state information base and modifying the state information of the first node into a second state.
In one possible implementation, the master-slave switching request is generated by the management node after receiving the upgrade request of the first node sent by the user.
In one possible implementation, the master-slave switching request is generated after the management node obtains the failure information of the first node.
In a third aspect, there is provided a management node comprising: the state updating unit is used for updating the state information of a first node in the state information base into a first state, wherein the first node is a master node, and the state information base is used for a client to acquire the state information of the first node in a subscription mode; a state updating unit for transmitting a master-slave switching request to the first node; and the state updating unit is used for updating the state information of the first node to be in the second state under the condition that the first node is determined to be switched to the slave node.
The management node described in the third aspect is implemented, the management node maintains a state information base for storing state information of each node, when a first node serving as a master node performs master-slave switching, the management node can modify the state information of the first node into a first state, then sends a master-slave switching request to the first node to instruct the first node to switch into a slave node, and updates the state information of the first node into a second state under the condition that the first node is determined to switch into the slave node.
In a possible implementation manner, the client performs data reading and writing through other nodes except the first node in the case that the state information is the first state.
In a possible implementation manner, in the case that the first node is a master node, the second node is a slave node of the first node, and the master-slave switching request is used to instruct the first node to synchronize the unsynchronized target data to the second node, and then the first node is switched to the slave node, and the second node is switched to the master node.
In a possible implementation manner, the management node further includes an obtaining unit, where the obtaining unit is configured to receive an upgrade request of the first node sent by the user before the management node updates the state information of the first node in the state information base to the first state.
In a possible implementation manner, the management node further includes an acquiring unit, where the acquiring unit is configured to acquire the fault information of the first node before the management node updates the state information of the first node in the state information base to the first state.
In a fourth aspect, there is provided a computing node comprising: the synchronous unit is used for receiving a master-slave switching request sent by the management node, wherein the computing node is a master node; a synchronization unit for synchronizing the unsynchronized target data to a slave node of the computing node; and the switching unit is used for switching the first node into the slave node.
The computing node described in the fourth aspect is implemented, the management node maintains a state information base for storing state information of each node, when the first node serving as the master node performs master-slave switching, the management node can modify the state information of the first node into a first state, then sends a master-slave switching request to the first node to instruct the first node to switch into a slave node, and updates the state information of the first node into a second state under the condition that the first node is determined to switch into the slave node.
In one possible implementation manner, the master-slave switching request is generated after the management node modifies the state information of the computing node in the state information base into the first state, where the state information base is used for the client to obtain the state information of the computing node through a subscription mode, and the client performs data reading and writing through other nodes except the computing node when the state information is in the first state.
In a possible implementation manner, the switching unit is further configured to send, after switching the computing node to the slave node, information of completion of master-slave switching to the management node, where the information of completion of master-slave switching is used to instruct the management node to update the state information base, and modify the state information of the computing node to the second state.
In one possible implementation, the master-slave switching request is generated by the management node after receiving an upgrade request of the computing node sent by the user.
In one possible implementation, the master-slave switching request is generated after the management node obtains failure information of the computing node.
In a fifth aspect, there is provided a storage system comprising a management node and a first node, wherein the management node implements the method as described in the first aspect of the claims and the first node implements the method as described in the second aspect.
In a sixth aspect, there is provided a computing device comprising a processor and a memory, the memory for storing instructions, the processor for executing the instructions to cause the computing device to implement a method as described in the first or second aspect.
In a seventh aspect, there is provided a cluster of computing devices comprising at least one computing device, each of the at least one computing device comprising a processor and a memory, the processor of the at least one computing device being operable to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to implement a method as described in the first or fifth aspect.
In an eighth aspect, a computer readable storage medium is provided, wherein instructions are stored in the computer readable storage medium, which instructions, when executed by a computing device or cluster of computing devices, implement a method as described in the first or second aspect.
Drawings
FIG. 1 is a block diagram of a memory system provided herein;
FIG. 2 is a schematic diagram of a storage system according to the present application;
FIG. 3 is a flowchart illustrating a data management method according to the present application;
FIG. 4 is a flowchart illustrating steps of a data management method according to the present application in an application scenario;
FIG. 5 is a schematic diagram of a computing device provided herein;
fig. 6 is a schematic structural diagram of a computing device cluster provided herein.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The master-slave switching technology is an important means for ensuring high availability of the system, is widely applied to distributed systems such as a database system, a server system, a network system, a storage system and the like, and is used for enabling slave nodes to take over the work of the master nodes when the master nodes are in fault or upgrade so as to ensure the continuous operation and stability of the system.
However, in the master-slave switching process, the master node needs to be restarted, in the process, the data writing request of the user cannot be processed, the system is temporarily unavailable, and the use experience of the user is reduced.
Meanwhile, the master node and the slave node achieve data synchronization through asynchronous replication, that is, the update operation of the data is performed on the master node, and then the updated data is transmitted to the slave node through an asynchronous manner, so that there may be a certain delay in the data between the master and slave nodes. Therefore, when the master node fails or upgrades, the slave node takes over the work of the master node, not only the data which are not synchronized between the master node and the slave node can be lost, but also the user can not read the data, the system can have the condition of short temporary unavailability, the master-slave switching technology has the problems of data loss and short temporary unavailability, and the use experience of the user is reduced.
In order to solve the problems of data loss and short temporary unavailability of a master-slave switching technology of a current distributed storage system, the application provides a storage system, a management node in the system maintains a state information base for storing state information of each node, so that when a first node serving as a master node performs master-slave switching, the management node can modify the state information of the first node into a first state, then sends a master-slave switching request to the first node to instruct the first node to switch into a slave node, and finally, the management node updates the state information of the first node into a second state under the condition that the management node determines that the first node is switched into the slave node, and because the state information base is subscribed by a client, the client can timely acquire whether the first node is in master-slave switching or not, thereby avoiding data writing failure or data loss caused by master-slave switching and solving the short temporary unavailability problem in the master-slave switching process; meanwhile, when the first node performs master-slave switching, unsynchronized target data can be synchronized to the second node, then the node is restarted and switched to the slave node, so that the problem of data loss caused by unsynchronized in master-slave switching is solved, and the use experience of a user is improved.
Fig. 1 is a schematic diagram of a storage system provided in the present application, as shown in fig. 1, where the storage system includes a client 100, a management node 210, a first node 220, a second node 230, and a state information base 240, where a communication connection is established between the client 100, the management node 210, the first node 220, the second node 230, and the state information base 240, and the network may be a wired network or a wireless network. The number of the clients 100, the first nodes 220 and the second nodes 230 may be one or more, which is not specifically limited herein.
The client 100 may be deployed on a terminal device or a computing device, where the terminal device includes a personal computer, a smart phone, a palm processing device, a tablet computer, a mobile notebook, an augmented reality (augmented reality, AR) device, a Virtual Reality (VR) device, an integrated palm, a wearable device, a vehicle-mounted device, a smart meeting device, a smart advertisement device, a smart home appliance, and the like, and the smart home appliance may be a floor sweeping robot, a floor mopping robot, and the like, which is not specifically limited herein. The computing devices may include bare metal servers (bare metal server, BMS), virtual machines, containers, edge computing devices, etc., where BMS refers to a general purpose physical server, such as an ARM server or an X86 server; virtual machines refer to complete computer systems implemented by network function virtualization (network functions virtualization, NFV) technology, with complete hardware system functions, through software emulation, running in a completely isolated environment; the container refers to a group of processes which are mutually isolated from each other and are limited by resources; edge computing devices refer to devices that are closer to the data source and end user, having low latency, high bandwidth features, such as intelligent routing, edge servers, and the like.
The first node 220 and the second node 230 may be the above-described computing devices or storage arrays, wherein the computing devices include one or more of bare metal servers (bare metal server, BMS), virtual machines, containers, edge computing devices, to which reference is made in particular. The storage array refers to a redundant array of independent disks (redundant array of independent disks, RAID) array composed of a plurality of hard disks, and high reliability of data is realized through data blocking, redundancy backup and other modes.
It should be noted that the first node 220 may be a master node, and the second node 230 may be a slave node. When a user stores data, a data writing request can be sent to a master node, and a slave node synchronizes the data stored in the master node in an asynchronous storage mode, wherein the master node mainly processes the writing request, and the slave node mainly processes the reading request. It should be appreciated that a master node may have multiple slave nodes, only one slave node (second node 230) being shown in fig. 1 by way of example, and the present application is not limited in detail.
The management node 210 may be the above-described computing device or a computing device cluster composed of a plurality of the above-described computing devices, and each of the computing devices in the computing device cluster may include any one of a BMS, a virtual machine, a container, and an edge computing device. The state information repository 240 may be disposed in the computing device or the storage array, and the description of the computing device and the storage array is not repeated here.
It should be noted that the management node 210, the first node 220, the second node 230, and the state information base 240 may form a computing device cluster, such as a data center, a distributed storage system, and the like, which is not specifically limited in this application. The state information repository 240 may be deployed on the management node 210, the first node 220, the second node 230, or other computing devices in the computing device cluster, which is not specifically limited herein.
In one possible implementation, the client 100 may be deployed at a terminal device, and the management node 210, the first node 220, the second node 230, and the state information library 240 are deployed at a cluster of computing devices. In another possible implementation manner, when the client 100 is disposed on a computing device, the management node 210, the first node 220, the second node 230, and the state information library 240 are disposed on a computing device cluster, where the computing device on which the client is located may be a computing device inside the computing device cluster, or may be a computing device outside the computing cluster, which may be specifically determined according to an actual application scenario, and the application is not limited specifically.
Alternatively, the client 100 may be implemented in software, and specifically may be independent software that is specifically used for data reading and writing by a user, such as a database client, a file system client, a storage system client, and the like, where the user may use the data management method provided in the present application by downloading and installing the software. The above examples are for illustration, and the present application is not limited in particular.
Alternatively, the client 100 may be built into an application tool as a plug-in, for example, as a master-slave switching plug-in a database system, and the master-slave switching plug-in is configured to implement a failover of a master node or implement an upgrade function of a master node, which should be understood that the foregoing examples are not limited in detail.
Optionally, the client 100 may also be a console (console) of a cloud platform, which is used as a sub-service of the cloud platform to provide a function of master-slave switching for a user, for example, to upgrade a master node of a storage system formed by a virtual machine purchased by the user, or to perform master-slave switching when a failure occurs in a master node, etc., so that the user may use the master-slave switching method provided by the present application by purchasing the cloud service. The console may be a web-based client, an application client, or an application program interface (application programming interface, API), and the application is not particularly limited.
Further, the storage system may be further divided into a plurality of unit modules, and for example, fig. 2 is a schematic structural diagram of a storage system provided in the present application, as shown in fig. 2, the client 100 includes a read-write unit 120 and a subscription unit 110, the management node 210 includes a status update unit 212 and an acquisition unit 211, the first node 220 includes a first switching unit 221 and a first synchronization unit 222, and the second node 230 includes a second switching unit 231 and a second synchronization unit 232. It should be understood that the client 100, the second node 230, the first node 220, and the management node 210 may further include further unit modules, for example, the management node 210 may further include a transmitting unit and a receiving unit, and it should be understood that the foregoing examples are for illustration and are not limited in detail herein.
The management node 210 may be disposed on a single computing device or may be disposed on a plurality of computing devices, so that the state updating unit 212 and the obtaining unit 211 may be implemented by software or may be implemented by hardware. Illustratively, the implementation of the status updating unit 212 is described next by taking the status updating unit 212 as an example. Similarly, the implementation of the acquisition unit 211 may refer to the implementation of the status updating unit 212.
Status update unit 212 as an example of a software functional unit, the status update unit 212 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container, among others. Further, the above-described computing examples may be one or more. For example, the state update unit 212 may include code running on multiple hosts/virtual machines/containers. It should be noted that, multiple hosts/virtual machines/containers for running the code may be distributed in the same region, or may be distributed in different regions. Further, multiple hosts/virtual machines/containers for running the code may be distributed in the same availability zone (availability zone, AZ) or may be distributed in different AZs, each AZ comprising a data center or multiple geographically close data centers. Wherein typically a region may comprise a plurality of AZs.
Status update unit 212 as an example of a hardware functional unit, the status update unit 212 may include at least one computing device, such as a server or the like. Alternatively, the status updating unit 212 may be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (programmable logic device, PLD), or the like. The PLD may be implemented as a complex program logic device (complex programmable logical device, CPLD), a field-programmable gate array (FPGA), a general-purpose array logic (generic array logic, GAL), or any combination thereof.
The functions of the respective unit modules in the client 100, the management node 210, and the first node 220 as the second node 230 will be described below.
The obtaining unit 211 of the management node 210 is configured to obtain a master-slave switching request, where the master-slave switching request is used to instruct the management node 210 to switch the first node 220 from a master node to a slave node, and switch the second node 230 from the slave node to the master node.
Alternatively, the master-slave switching request may be generated when the user requests to upgrade the first node 220, specifically, the user may send an upgrade request of the first node 220 through the client 100, the client 100 sends the upgrade request to the management node 210, and the management node 210 may generate a master-slave switching request to switch the first node 220 to a slave node, switch the second node 230 to a master node, and then upgrade the first node 220 switched to the slave node.
Alternatively, the master-slave switching request may be generated after the management node 210 determines that the first node 220 has a fault, and in a specific implementation, the management node 210 may monitor a fault state of each node, determine that the first node 220 has a fault, generate a master-slave switching request, switch the first node 220 from a master node to a slave node, switch the second node 230 to a master node, and then perform fault processing on the first node 220 switched to the slave node.
It should be understood that the master-slave switching request may also be produced in other scenarios, such as disaster recovery drilling, and planned master-slave switching scenarios, such as application scenarios where the load of the master node is too high, the network delay of the master node, the maintenance of the master node is required, etc., which are not illustrated herein.
The state updating unit 212 of the management node 210 is configured to update the state information of the first node 220 recorded in the state information base 240, so that the state information of the first node 220 is modified from a second state to a first state, where the first state is used to indicate that the first node 220 is performing a master-slave switching, and cannot process a write request, and the second state is used to indicate that the first node 220 is not performing a master-slave switching, and can process a write request.
In a specific implementation, the first state and the second state may be represented by characters, such as adding a "stoping" character to represent the first state, removing a "stoping" character to represent the second state, or "1" to represent the first state and "0" to represent the second state, which is not limited in particular.
It should be noted that, the state information repository 240 is configured to store state information of each node, where the state information includes the first state or the second state for indicating whether the node is performing master-slave switching, and may further include other information capable of guaranteeing that the distributed system implements various functions, such as node information, key value pair information, monitoring information of the distributed system, where the node information may include, but is not limited to, information of IP addresses, port numbers, node IDs, and the like of all nodes in the cluster; the key value pair information can include, but is not limited to, data in the formats of character strings, certificates, JSON and the like, can be used for configuration management, such as cache configuration, database connection configuration and the like, and can also be used for lock management, such as realizing mutual exclusion access among a plurality of nodes, ensuring that only a selected few nodes can access a certain resource and the like; the monitoring information may include, but is not limited to, response time of the cluster, memory usage, failure conditions, and the like. It should be appreciated that the status information may also include more than one, not illustrated herein.
The state updating unit 212 is further configured to send a master-slave switching request to the first node 220 after updating the state information of the first node 220, and instruct the first node 220 serving as a master node to start master-slave switching.
Alternatively, the master-slave switching request may be a master-slave switching request acquired by the acquiring unit 211, or may be a master-slave switching request that can be responded by the first node 220 after being processed based on the master-slave switching request acquired by the acquiring unit, which may be specifically determined according to an actual application scenario, which is not specifically limited in this application.
Alternatively, the state updating unit 212 may send a master-slave switching request to the second node 230, to instruct the second node 230, which is a slave node, to start master-slave switching, or the state updating unit 212 sends a master-slave switching request to the first node 220, and then the first node 220 sends a master-slave switching request to the second node 230, which may be determined according to an actual application scenario, and the application is not limited specifically.
The first synchronization unit 222 of the first node 220 is configured to synchronize target data to the second node 230 in response to the master-slave switching request, where the target data is data that the first node 220 is not synchronized to the second node 230. Referring to the foregoing, the first node 220 is used as a master node of the second node 230, the second node 230 is used as a slave node of the first node 220, the master node is used for processing a write request of a user, the slave node is used for processing a read request of the user, and the slave node realizes data synchronization with the master node by an asynchronous storage mode, so that data can be stored in the slave node after being written into the master node for a period of time. Therefore, during master-slave switching, a part of target data may not be synchronized to the slave node, and if the master-slave switching is directly performed, the target data may be lost, thereby reducing the use experience of the user. According to the method and the device, the target data which are not synchronized in the first node 220 are synchronized to the second node 230 before the master-slave switching, so that the problem of target data loss can be avoided, and the use experience of a user is improved.
The second synchronization unit 232 of the second node 230 is configured to receive the target data sent by the first node 220, and store the target data, so that the data of the first node 220 and the data in the second node 230 remain synchronized.
Optionally, when the first node 220 and the second node 230 perform data synchronization, the data synchronization may be performed by a manner of slicing transmission, that is, the target data in the first node 220 is transmitted to the second node 230 in a data slicing manner, the target data is divided into a plurality of sliced data, and the sliced data is transmitted to the second node 230, and in the transmission process, problems such as network delay, hardware failure and the like may occur, so that part of the sliced data cannot be transmitted to the slave node in time, and therefore, the sliced information of each sliced data may be periodically or periodically checked to determine which sliced data has been transmitted to the second node 230, and which sliced data still needs to be retransmitted, and by periodically checking the sliced information, the first node 220 may be assisted in determining the data difference and taking corresponding measures to ensure the accuracy and the integrity of the data.
The first switching unit 221 of the first node 220 may determine that the target data is transmitted to the second node 230, then restart the first node 220, the restarted first node 220 switches to the slave node, the second switching unit 231 of the second node 230 may restart the second node 230, and the restarted second node 230 switches to the master node.
Alternatively, the first switching unit 221 may periodically or periodically check the fragmentation information of each fragmented data, determine whether a difference (diff) between the data in the first node 220 and the data in the second node 230 is below a threshold value, and start the node restart in case of being below the threshold value.
Alternatively, the threshold may be a default value, or a value obtained by the client 100 from the user, for example, a value obtained when the user inputs the upgrade request of the first node 220, or may be obtained at other times, which is not specifically limited in this application.
In a specific implementation, the first switching unit 221 may restart the first node 220 using version data of the slave node, so that the restarted first node 220 is switched to the slave node, and the second switching unit 231 may restart the second node 230 using version data of the master node, so that the restarted second node 230 is switched to the master node.
It should be noted that, the version data used by the first switching unit 221 and the second switching unit 231 may be version data issued by the management node 210, may be issued by the management node 210 after acquiring a master-slave switching request, may be issued by the management node after acquiring a master-slave switching request and updating the state information base 240, or may be issued when the management node 210 sends the master-slave switching request to the first node 220 and the second node 230, which is not limited in this application.
In a specific implementation, the version data may be a binary version file, where the version data includes, but is not limited to, a program code required for a master-slave switch, a database file, a configuration file, a dependency library file, a script file, and the like, where the database file includes information such as a structure definition, a data table, an index, and the like of a database that the program code needs to use, the configuration file includes parameter settings, log configuration, database connection information, and the like of the program code, the dependency library file includes some third party library files that the program code depends on, and the script file includes a script file such as database initialization, environment script variable settings, and the like that the program code needs, and it should be understood that the version data may include more or less content for illustration, and the application is not specifically limited.
Alternatively, the first switching unit 221 may transmit information of completion of the master-slave switching to the management node 210 after completion of the node restart. The state updating unit 212 of the management node 210 may update the state information base 240 to modify the state information of the first node 220 to the second state, i.e. the state where the master-slave switching point is not performed.
The subscription unit 110 in the client 100 may subscribe to the state information in the state information base 240 to obtain the state information of each node. When the state information of the first node 220 is the first state, when the read/write unit 120 of the client 100 receives a write request sent by the user to write data to the first node 220, the instruction that the first node 220 cannot read and write currently may be returned to the user, or the data may be written into another node, and after the first node 220 and the second node 230 complete the master-slave switching, the data may be rewritten into the second node 230 serving as the master node at this time.
It can be understood that, through the subscription of the client 100 to the state information base 240, the working state of the first node 220 is timely known, so that when the first node 220 performs the master-slave switching, the client 100 can learn that the first node 220 cannot process the data writing request currently, at this time, the client 100 can choose to feed back the information that the first node 220 cannot process the writing request to the user, and also can write the data into other nodes, thereby avoiding the problem of data writing failure or data loss caused by the master-slave switching, and improving the use experience of the user.
Alternatively, the state information library 240 may be implemented based on a distributed key-value store (ETCD), which uses a shift algorithm to ensure consistency and reliability of data, and provides a simple API so that a developer can easily interact with the ETCD, resulting in higher feasibility of the scheme.
Optionally, the subscription unit 110 of the client 100 may implement a function of subscribing to the state information base 240 through corvus, where corvus is a cache system, may store and manage data, and the client 100 may interact with corvus through a Redis protocol to implement read-write management of data, where corvus obtains a state of each node through the subscription state information base 240. In short, after the read-write request of the user passes through the corvus and then is sent to the corresponding node to perform data read-write, the corvus subscribes to the state information base 240, and can process the read-write request according to the state information, so that when the first node 220 performs master-slave switching, the write request related to the first node 220 will not be processed, or is written into other nodes, thereby avoiding the problem of data write failure or data loss caused by master-slave switching, and improving the use experience of the user.
It should be noted that, when the client implements the function of subscribing to the state information base through corvus, the client 100 may be deployed on a plurality of terminal devices and/or a plurality of computing devices, and, by way of example, the read-write unit 120 for interaction between the client 100 and the user may be deployed on a terminal device, and the subscription unit 110 for subscribing to the state information base 240, for example, corvus may be deployed on a computing device, where it should be understood that the foregoing examples are for illustration and not a specific limitation in the present application.
In summary, the present application provides a storage system, where a management node in the system maintains a state information base for storing state information of each node, so that when a first node serving as a master node performs master-slave switching, the management node can modify the state information of the first node into a first state, then instruct the first node to switch into a slave node by sending a master-slave switching request to the first node, and finally update the state information of the first node into a second state when the management node determines that the first node switches into the slave node, and because the state information base is subscribed by a client, the client can timely acquire whether the first node is in master-slave switching, thereby avoiding data writing failure or data loss caused by master-slave switching, and solving the problem of short temporary availability in the master-slave switching process; meanwhile, when the first node performs master-slave switching, unsynchronized target data can be synchronized to the second node, then the node is restarted and switched to the slave node, so that the problem of data loss caused by unsynchronized in master-slave switching is solved, and the use experience of a user is improved.
The storage system according to the technical solution provided in the present application is described above with reference to the drawings, and next, a data management method provided in the present application is described in detail with reference to fig. 3 and fig. 4.
Fig. 3 is a flowchart illustrating a data management method provided in the present application, as shown in fig. 3, the method may include the following steps:
step S310: the management node updates the state information of the first node in the state information base to the first state. This step may be implemented by the acquisition unit 211 and the status updating unit 212 in the embodiment of fig. 2.
In a possible implementation manner, the management node may perform step S310 after receiving the upgrade request of the first node sent by the user, in other words, after the user requests to upgrade the first node, the management node may prepare to perform a master-slave switching, update the state information of the first node first, and then issue a master-slave switching request to the first node.
In a possible implementation manner, the management node may perform step S310 after obtaining the failure state of the first node, in other words, the management node may monitor the failure state of each node, determine that when the first node fails, prepare to perform master-slave switching, update the state information of the first node first, and then issue a master-slave switching request to the first node.
It should be understood that the master-slave switching request may also be produced in other scenarios, such as disaster recovery drilling, and planned master-slave switching scenarios, such as application scenarios where the load of the master node is too high, the network delay of the master node, the maintenance of the master node is required, etc., which are not illustrated herein.
In one possible implementation, the first state is used to indicate that the first node is performing a master-slave switch, and cannot process the write request, and the client performs data reading and writing through other nodes except the first node. The second state is used for indicating that the first node does not perform master-slave switching, can process a write request, and the client can perform data reading and writing through the first node. In a specific implementation, the first state and the second state may be represented by characters, such as adding a "stoping" character to represent the first state, removing a "stoping" character to represent the second state, or "1" to represent the first state and "0" to represent the second state, which is not limited in particular.
It should be noted that, the state information base is configured to store state information of each node, where the state information includes the first state or the second state for indicating whether the node is performing master-slave switching, and may further include other information capable of guaranteeing that the distributed system implements various functions, such as node information, key value pair information, monitoring information of the distributed system, where the node information may include, but is not limited to, information of IP addresses, port numbers, node IDs, and the like of all nodes in the cluster; the key value pair information can include, but is not limited to, data in the formats of character strings, certificates, JSON and the like, can be used for configuration management, such as cache configuration, database connection configuration and the like, and can also be used for lock management, such as realizing mutual exclusion access among a plurality of nodes, ensuring that only a selected few nodes can access a certain resource and the like; the monitoring information may include, but is not limited to, response time of the cluster, memory usage, failure conditions, and the like. It should be appreciated that the status information may also include more than one, not illustrated herein.
In a possible implementation manner, the first node is a master node, and the state information base is used for the client to obtain the state information of the first node through a subscription mode. When the state information of the first node is the first state, the client may return, to the user, a description that the first node cannot read or write currently when receiving a write request sent by the user to write data to the first node, or write the data to another node, and after the first node and the second node complete master-slave switching, rewrite the data to the second node serving as the master node at this time, where the above description is not limited specifically by the application.
It can be understood that the working state of the first node is timely obtained through the subscription state information base of the client, so that when the first node performs master-slave switching, the client can obtain that the first node cannot process a data writing request currently, at the moment, the client can select to feed back information that the first node cannot process the writing request to a user, and can also write data into other nodes, thereby avoiding the problem of data writing failure or data loss caused by master-slave switching and improving the use experience of the user.
Alternatively, the state information library may be implemented based on ETCD, which uses a shift algorithm to ensure consistency and reliability of data, and provides a simple API so that a developer can easily interact with ETCD, resulting in higher feasibility of the scheme. The client can realize the function of subscribing the state information base through the corvus, wherein the corvus is a cache system and can store and manage data, and the client can interact with the corvus through a Redis protocol to realize the read-write management of the data. In short, after the read-write request of the user passes through the corvus and then is sent to the corresponding node to read and write data, the corvus subscribes to the state information base, and then the read-write request can be processed according to the state information, so that when the first node performs master-slave switching, the write request related to the first node is not processed, or is written into other nodes, the problem of data writing failure or data loss caused by master-slave switching is avoided, and the use experience of the user is improved.
Step S320: the management node sends a master-slave switching request to the first node. This step may be implemented by the status updating unit 212 in the embodiment of fig. 2.
In a possible implementation manner, the first node is a master node, the second node is a slave node of the first node, and after the master-slave switching request is used for indicating the first node to synchronize the unsynchronized target data to the second node, the first node is switched to the slave node of the second node, and the second node is switched to the master node. With reference to the foregoing, the master node is configured to process a write request of a user, and the slave node is configured to process a read request of the user, and the slave node implements data synchronization with the master node by means of asynchronous storage, so that data may not be stored in the slave node until the data is written into the master node for a period of time. Therefore, during master-slave switching, a part of target data may not be synchronized to the slave node, and if the master-slave switching is directly performed, the target data may be lost, thereby reducing the use experience of the user. According to the method and the device, the target data which are not synchronized in the first node are synchronized to the second node 230 before the master-slave switching, so that the problem of target data loss can be avoided, and the use experience of a user is improved.
Optionally, when the first node and the second node perform data synchronization, the data synchronization may be performed by a manner of slicing transmission, that is, the target data in the first node is transmitted to the second node in a data slicing manner, the target data is divided into a plurality of sliced data, and the sliced data is transmitted to the second node, in a transmission process, problems such as network delay and hardware failure may occur, which may cause that part of the sliced data cannot be timely transmitted to the slave node, so that the sliced information of each sliced data may be periodically or periodically checked to determine which sliced data has been transmitted to the second node, and which sliced data still needs to be retransmitted, and by periodically checking the sliced information, the first node may be assisted in determining the data difference and taking corresponding measures to ensure the accuracy and integrity of the data.
In one possible implementation manner, after the first node may determine that the target data is transmitted to the second node, the first node and the second node are restarted, the restarted first node is switched to the slave node, and the restarted second node is switched to the master node.
Alternatively, the first node may periodically or periodically check the fragmentation information of each fragmented data, determine whether a difference (diff) between the data in the first node and the data in the second node is below a threshold, and start a node restart in case of being below the threshold. The threshold may be a default value, or a value obtained by the client from the user, for example, a value obtained when the user inputs the upgrade request of the first node, or may be obtained at other times, which is not limited in this application.
Optionally, the first node may restart the first node using version data of the slave node, so that the restarted first node is switched to the slave node, and the second node may restart the second node using version data of the master node, so that the restarted second node is switched to the master node.
It should be noted that, the version data used by the first node and the second node may be version data issued by the management node, which may be issued by the management node after acquiring the master-slave switching request, or may be issued by the management node after acquiring the master-slave switching request and updating the state information base, or may be issued when the management node sends the master-slave switching request to the first node and the second node.
In a specific implementation, the version data may be a binary version file, where the version data includes, but is not limited to, a program code required for a master-slave switch, a database file, a configuration file, a dependency library file, a script file, and the like, where the database file includes information such as a structure definition, a data table, an index, and the like of a database that the program code needs to use, the configuration file includes parameter settings, log configuration, database connection information, and the like of the program code, the dependency library file includes some third party library files that the program code depends on, and the script file includes a script file such as database initialization, environment script variable settings, and the like that the program code needs, and it should be understood that the version data may include more or less content for illustration, and the application is not specifically limited.
Step S330: and under the condition that the management node determines that the first node is switched to the slave node, updating the state information of the first node to be in the second state. This step may be implemented by the status updating unit 212 in the embodiment of fig. 2.
Alternatively, the first node may send information of completion of the master-slave handover to the management node after completion of the node restart. The management node may update the state information base to modify the state information of the first node to a second state, i.e. a state in which the master-slave switching point is not performed.
With reference to the foregoing, the client subscribes to the state information base, so that the client can timely learn the state of the first node, and can continue to read and write data through the first node, thereby improving the use experience of the user.
In order to better understand the present application, fig. 4 is a schematic flow chart of steps of a data management method provided in the present application in an application scenario, taking an application scenario in which a user requests to upgrade the first node 220 as an example, the method may include the following steps:
step 1, the client 100 sends an upgrade instruction to the management node 210.
It should be appreciated that the upgrade instructions may be instructions sent by the user via the client 100 to upgrade the first node 220. In another application scenario, the management node 210 may also execute steps 2 to 9 when it monitors that the first node 220 fails, which is not illustrated here.
Step 2, the management node 210 transmits upgrade scripts to the first node 220 and the second node 230.
The upgrade script may be a binary file, the upgrade script received by the first node 220 may include version data of the slave node, the upgrade script received by the second node 230 may include version data of the master node, and description of the version data may refer to the foregoing, which is not repeated herein.
Step 3, the management node 210 modifies the state information of the first node in the state information base 240 to the first state.
In a specific implementation, after the upgrade scripts are deployed at the first node 220 and the second node 230, the upgrade scripts may notify the management node 210 to modify the state information, cut off the traffic of the first node 220, and no longer participate in data reading and writing.
In a specific implementation, the state information repository 240 may be implemented by etcd, and the description of etcd may refer to the foregoing, and a detailed description is not repeated here.
Step 4, the client 100 acquires the state information of the first node in a subscription view manner.
In a specific implementation, the client 100 may implement a function of subscribing to a state information base through corvus, where corvus is a cache system, and may store and manage data, and the client may interact with corvus through a Redis protocol, so as to implement read-write management of data. In short, after the read-write request of the user passes through the corvus and then is sent to the corresponding node to read and write data, the corvus subscribes to the state information base, and then the read-write request can be processed according to the state information, so that when the first node performs master-slave switching, the write request related to the first node is not processed, or is written into other nodes, the problem of data writing failure or data loss caused by master-slave switching is avoided, and the use experience of the user is improved.
Optionally, the client 100 subscribes to learn that the state of the first node is the first state, for example, a "stop" state, and the client 100 may cut the read traffic accessing the first node to other nodes, return information about the write error, or write data into other nodes, and write the data into the first node after the first node is restarted.
Step 5, the first node 220 synchronizes the unsynchronized target data to the second node 230.
In a specific implementation, the first node 220 may synchronize the target data to the second node 230 in a manner of slice transmission, where the target data refers to a portion of data that has not yet been synchronized with the second node 230 in the first node 220 in the asynchronous storage process, and detailed description may refer to the foregoing related content, and redundant description is omitted herein.
Step 6, when the management node 210 determines that the data consistency between the first node 220 and the second node 230 is higher than the threshold, the first node and the second node are notified to perform master-slave switching.
In particular implementations, the management node 210 may periodically or periodically check the fragmentation information, determine diff between the first node 220 and the second node 230, and set the second node 230 as a new master node and the first node 220 as a new slave node when diff is 0, assuming that the threshold is 0. The threshold may be a threshold obtained from a user when the user sends an upgrade instruction through the client 100.
Step 7, the first node 220 and the second node 230 restart the first node and the second node using the new version.
In a specific implementation, the first node 220 and the second node 230 may run the upgrade script obtained in the step 2 to restart the new version, and use the new software version to pull up the process, so as to complete the master-slave switching.
Step 8, the first node 220 and the second node 230 notify the management node 210 that the upgrade is completed.
In a specific implementation, after a new software version in the first node pulls up a process, the new process may notify the management node 210 that the upgrade is complete.
Step 9, the management node 210 modifies the state information of the first node in the state information base 240 to the second state.
It can be understood that, in the process from step 4 to step 9, the state information of the first node recorded in the state information base 240 is the first state, the client 100 subscribes to the state information base 240 to obtain the state of the first node, so in the process from step 4 to step 9, the client 100 can cut the read traffic accessing the first node to other nodes, return information of writing errors, and after step 9, the client 100 can cut the read traffic of the first node back to the first node, and the write traffic can also be sent to the first node for processing. The problem of data writing failure or data loss caused by master-slave switching is avoided, and the use experience of a user is improved.
In summary, the present application provides a data management method, where a management node maintains a state information base for storing state information of each node, so that when a first node serving as a master node performs master-slave switching, the management node can modify the state information of the first node into a first state, then sends a master-slave switching request to the first node to instruct the first node to switch into a slave node, and finally, under the condition that the management node determines that the first node switches into the slave node, updates the state information of the first node into a second state, and because the state information base is subscribed by a client, the client can timely acquire whether the first node is in master-slave switching, thereby avoiding data writing failure or data loss caused by master-slave switching, and solving the problem of short-time temporary unavailability in the master-slave switching process; meanwhile, when the first node performs master-slave switching, unsynchronized target data can be synchronized to the second node, then the node is restarted and switched to the slave node, so that the problem of data loss caused by unsynchronized in master-slave switching is solved, and the use experience of a user is improved.
The data management method provided according to the present application is described in detail above in connection with fig. 3 to 4, and the computing device cluster provided according to the present application will be described below in connection with fig. 5 to 6.
Fig. 5 is a schematic structural diagram of a computing device 500 provided in the present application, where the computing device 500 may be a management node, a first node, a second node, a client, or a state information base in the foregoing.
Further, the computing device 500 includes a processor 501, a storage unit 502, a storage medium 503, and a communication interface 504, where the processor 501, the storage unit 502, the storage medium 503, and the communication interface 504 communicate via a bus 505, and also communicate via other means such as wireless transmission.
The processor 501 is made up of multiple general purpose processors, such as a CPU, NPU, or a combination of CPU and hardware chips. The hardware chip is an application-specific integrated circuit (ASIC), a programmed logic device (programmable logic device, PLD), or a combination thereof. The PLD is a complex programmable logic device (complex programmable logic device, CPLD), field-programmable gate array (FPGA), general-purpose array logic (generic array logic, GAL), data processing unit (data processing unit, DPU), system on chip (SoC), or any combination thereof. The processor 501 executes various types of digitally stored instructions, such as software or firmware programs stored in the storage unit 502, that enable the computing device 500 to provide a wide variety of services.
In a specific implementation, as one embodiment, processor 501 includes one or more CPUs, such as CPU0 and CPU1 shown in FIG. 5.
In a particular implementation, computing device 500 also includes multiple processors, such as processor 501 and processor 506 shown in FIG. 5, as one embodiment. Each of these processors may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). A processor herein refers to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
The storage unit 502 is configured to store program codes and is controlled by the processor 501 to execute the processing steps of the data management method in any one of the embodiments of fig. 1 to 4. The program code includes one or more software elements.
In the case where the computing device 500 is a management node, the one or more software units are a state updating unit and an acquiring unit in the embodiment of fig. 2, where the state updating unit is specifically configured to update, before the first node prepares for a master-slave switch, the state information of the first node in the state information base to a first state, and after the master-slave switch of the first node is completed, update, to a second state, the state information of the first node, specifically configured to execute steps S310 to S330 in the embodiment of fig. 3, steps 2, 3, 5, and optional steps in the embodiment of fig. 4, and the acquiring unit is specifically configured to acquire a master-slave switch request, and specifically configured to execute step S310 in the embodiment of fig. 3, step 1 in the embodiment of fig. 4, and optional steps thereof, which are not described herein.
In the case that the computing device 500 is the first node, the one or more software units are the first synchronization unit and the first switching unit in the embodiment of fig. 2, specifically, the first synchronization unit is configured to synchronize target data that is not synchronized by the first node to the second node, specifically, to perform step S320 in the embodiment of fig. 3, step 5 in the embodiment of fig. 4, and optional steps thereof. The first switching unit is configured to restart the first node, where the restarted first node is a slave node of the second node, and is specifically configured to execute step S320 in the embodiment of fig. 2, and step 6 and step 7 and optional steps in the embodiment of fig. 4 are not described herein.
In the case that the computing device 500 is the second node, the one or more software units are the second synchronization unit and the second switching unit in the embodiment of fig. 2, specifically, the second synchronization unit is configured to receive the target data sent by the first node, implement data synchronization between the first node and the second node, and specifically, is configured to perform step S320 in the embodiment of fig. 3, step 5 in the embodiment of fig. 4, and optional steps thereof. The second switching unit is configured to restart the second node, where the restarted second node is a master node of the first node, and is specifically configured to execute step S320 in the embodiment of fig. 2, and step 6 and step 7 and optional steps in the embodiment of fig. 4 are not described herein.
In the case where the computing device 500 is a client, the one or more software units are a subscription unit and a read-write unit in the embodiment of fig. 2, where the subscription unit is configured to subscribe to the state information base to obtain the state information of the first node, and specifically configured to execute step S310 in the embodiment of fig. 3, step 4 in the embodiment of fig. 4, and optional steps thereof, and the read-write unit is configured to process, according to the state information of each node, a read-write request sent by a user, and specifically configured to execute steps in the embodiment of fig. 4, which are not described herein.
The memory unit 502 includes a read only memory and a random access memory, and provides instructions and data to the processor 501. The memory unit 502 also includes a nonvolatile random access memory. The storage unit 502 is a volatile memory or a nonvolatile memory, or includes both volatile and nonvolatile memories. The nonvolatile memory is a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. Volatile memory is random access memory (random access memory, RAM), which acts as external cache memory. By way of example, and not limitation, many forms of RAM are used, such as Static RAM (SRAM), dynamic RAM (dynamic random access memory, DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous DRAM (SLDRAM), and direct RAM (DR RAM). Also, a hard disk (hard disk), a U-disk (universal serial bus, USB), a flash memory (flash), an SD card (secure digital memory Card, SD card), a memory stick, etc., and the hard disk is a Hard Disk Drive (HDD), a Solid State Disk (SSD), a mechanical hard disk (mechanical hard disk, HDD), etc., which are not particularly limited in this application.
The storage medium 503 is a carrier storing data, such as a hard disk (hard disk), a USB (universal serial bus, USB), a flash (flash), an SD card (secure digital memory Card, SD card), a memory stick, or the like, and the hard disk may be a Hard Disk Drive (HDD), a Solid State Disk (SSD), a mechanical hard disk (mechanical hard disk, HDD), or the like, which is not particularly limited in this application.
Alternatively, where computing device 500 is a state information repository, storage medium 503 may be used to store state information for various nodes.
The communication interface 504 is a wired interface (e.g., an ethernet interface), an internal interface (e.g., a high-speed serial computer expansion bus (Peripheral Component Interconnect express, PCIe) bus interface), a wired interface (e.g., an ethernet interface), or a wireless interface (e.g., a cellular network interface or using a wireless local area network interface) for communicating with other servers or units.
Bus 505 is a peripheral component interconnect express (Peripheral Component Interconnect Express, PCIe) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, a unified bus (Ubus or UB), a computer quick link (compute express link, CXL), a cache coherent interconnect protocol (cache coherent interconnect for accelerators, CCIX), or the like. The bus 505 is classified into an address bus, a data bus, a control bus, and the like.
The bus 505 includes a power bus, a control bus, a status signal bus, and the like in addition to a data bus. But for clarity of illustration, the various buses are labeled as bus 505 in the figures.
It should be noted that fig. 5 is merely one possible implementation of the embodiments of the present application, and in practical applications, the computing device 500 may further include more or fewer components, which is not limited herein. For matters not shown or described in the embodiments of the present application, reference may be made to the foregoing descriptions in the embodiments of fig. 1 to fig. 4, which are not repeated here.
Fig. 6 is a schematic structural diagram of a computing device cluster provided herein, where the computing device cluster includes at least one computing device. The computing device may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device may also be a terminal device such as a desktop, notebook, or smart phone.
As shown in fig. 6, a cluster of computing devices includes at least one computing device 500. The description of each computing device 500 may refer to the description of the embodiment of fig. 5, and is not repeated here.
In some possible implementations, the storage unit 502 of one or more computing devices 500 in the computing device cluster may also have stored therein a portion of the instructions for the data management method, respectively. In other words, a combination of one or more computing devices 500 may collectively execute instructions for performing a data management method.
It should be noted that the storage units 502 in different computing devices 500 in the computing device cluster may store different instructions for performing part of the functions of the resource migration system, respectively. That is, the instructions stored in the storage unit 502 in the different computing devices 500 may implement the functions of the read-write unit, the subscription unit, the status update unit, the obtaining unit, the first switching unit, the second switching unit, the first synchronization unit, and the second synchronization unit, respectively, and specifically, the functions of the respective units may be described with reference to the embodiment of fig. 5, which is not repeated herein.
In some possible implementations, one or more computing devices in a cluster of computing devices may be connected through a network. Wherein the network may be a wide area network or a local area network, etc. Fig. 6 illustrates one possible implementation, as shown in fig. 6, of a connection between computing devices 500A-500E over a network. Specifically, the connection to the network is made through a communication interface in each computing device. In this type of possible implementation, the computing device 500A may be a management node having instructions stored in its storage unit 502 to implement a status updating unit and a retrieval unit. The computing device 500B may be a first node having stored in its memory unit 502 instructions for implementing a first switching unit and a first synchronization unit. The computing device 500D may be a second node having instructions stored in the storage unit 502 to implement a second switching unit and a second synchronization unit. Computing device 500E may be a client having stored in storage unit 502 instructions to implement a read-write unit and a subscription unit. Computing device 500C may be a state information library having state information stored in storage medium 503.
It should be appreciated that the functionality of computing devices 500A, 500C, and 500E shown in fig. 6 may also be performed by multiple computing devices 500. Fig. 6 is an exemplary implementation, which is not particularly limited in this application.
Embodiments of the present application also provide a computer program product comprising instructions. The computer program product may be a software or program product containing instructions capable of running on a computing device or stored in any useful medium. The computer program product, when run on at least one computing device, causes the at least one computing device to perform a data management method.
Embodiments of the present application also provide a computer-readable storage medium. Computer readable storage media can be any available media that can be stored by a computing device or data storage device such as a data center containing one or more available media. Usable media may be magnetic media (e.g., floppy disks, hard disks, magnetic tape), optical media (e.g., high-density digital video discs (digital video disc, DVDs)), or semiconductor media (e.g., solid state disks), etc. The computer-readable storage medium includes instructions that instruct a computing device to perform a data management method or instruct a cluster of computing devices to perform a data management method.
The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes a plurality of computer instructions. When the computer program instructions are loaded or executed on a computer, the processes or functions in accordance with embodiments of the present invention are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. Computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various equivalents may be substituted and equivalents will fall within the true scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (24)

1. A method of data management, the method comprising:
The method comprises the steps that a management node updates state information of a first node in a state information base to a first state, wherein the first node is a master node, and the state information base is used for enabling a client to obtain the state information of the first node in a subscription mode;
the management node transmits a master-slave switching request to the first node;
and under the condition that the management node determines that the first node is switched to the slave node, updating the state information of the first node into a second state.
2. The method according to claim 1, wherein the client performs data reading and writing by other nodes than the first node in the case where the state information is the first state.
3. The method according to claim 2, wherein in the case that the first node is a master node, the second node is a slave node of the first node, and the master-slave switching request is used to instruct the first node to synchronize unsynchronized target data to the second node, and after the first node switches to the slave node of the second node, the second node switches to the master node.
4. A method according to any one of claims 1 to 3, wherein before the management node updates the state information of the first node in the state information base to the first state, the method further comprises:
And the management node receives the upgrade request of the first node sent by the user.
5. A method according to any one of claims 1 to 3, wherein before the management node updates the state information of the first node in the state information base to the first state, the method further comprises:
and the management node acquires the fault information of the first node.
6. A method of data management, the method comprising:
a first node receives a master-slave switching request sent by a management node, wherein the first node is a master node, and a slave node of the first node is a second node;
the first node synchronizes unsynchronized target data to the second node;
the first node switches to a slave node.
7. The method according to claim 6, wherein the master-slave switching request is generated after the management node modifies the state information of the first node into the first state in a state information base, where the state information base is used for a client to learn the state information of the first node through a subscription manner, and the client performs data reading and writing through other nodes except the first node when the state information is the first state.
8. The method of claim 7, wherein after the first node switches to the slave node, the method further comprises:
and the first node sends information of completion of master-slave switching to the management node, wherein the information of completion of master-slave switching is used for indicating the management node to update the state information base and modifying the state information of the first node into a second state.
9. A method according to any of claims 6 to 8, wherein the master-slave switch request is generated by the management node after receiving an upgrade request from a first node sent by a user.
10. A method according to any of claims 6 to 8, wherein the master-slave switch request is generated after the management node has acquired fault information of the first node.
11. A management node, the management node comprising:
the state updating unit is used for updating the state information of a first node in the state information base into a first state, wherein the first node is a master node, and the state information base is used for the client to acquire the state information of the first node in a subscription mode;
The state updating unit is used for sending a master-slave switching request to the first node;
the state updating unit is configured to update state information of the first node to a second state when determining that the first node is switched to a slave node.
12. The node according to claim 11, wherein the client performs data reading and writing by other nodes than the first node in the case where the state information is the first state.
13. The node of claim 12, wherein in the case where the first node is a master node, the second node is a slave node of the first node, and the master-slave switching request is used to instruct the first node to switch to the slave node and the second node to switch to the master node after the first node synchronizes the unsynchronized target data to the second node.
14. The node according to any of the claims 11 to 13, wherein the management node further comprises an obtaining unit, the obtaining unit being configured to receive an upgrade request of the first node sent by the user before the management node updates the state information of the first node in the state information base to the first state.
15. The node according to any of the claims 11 to 13, wherein the management node further comprises an obtaining unit, the obtaining unit being configured to obtain failure information of a first node in the state information base before the management node updates the state information of the first node to the first state.
16. A computing node, the computing node comprising:
the synchronous unit is used for receiving a master-slave switching request sent by the management node, wherein the computing node is a master node;
the synchronization unit is used for synchronizing the unsynchronized target data to the slave node of the computing node;
and the switching unit is used for switching the first node into the slave node.
17. The node according to claim 16, wherein the master-slave switching request is generated after the management node modifies the state information of the computing node in a state information base to a first state, where the state information base is used for a client to learn the state information of the computing node through a subscription manner, and the client performs data reading and writing through other nodes except the computing node when the state information is the first state.
18. The node according to claim 17, wherein the switching unit is further configured to send, after switching the computing node to the slave node, master-slave switching completion information to the management node, the master-slave switching completion information being used to instruct the management node to update the state information base to modify the state information of the computing node to the second state.
19. A node according to any of claims 16 to 18, wherein the master-slave switch request is generated by the management node after receiving a user sent upgrade request of a computing node.
20. A node according to any of claims 16 to 18, wherein the master-slave switch request is generated after the management node has acquired fault information for the computing node.
21. A storage system comprising a management node implementing the method of any of claims 1 to 5 and a first node implementing the method of any of claims 6 to 10.
22. A computing device comprising a processor and a memory, the memory to store instructions, the processor to execute the instructions to cause the computing device to implement the method of any of claims 1-5 or 6-10.
23. A cluster of computing devices, comprising at least one computing device, each of the at least one computing device comprising a processor and a memory, the processor of the at least one computing device to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to implement the method of any of claims 1-5.
24. A computer readable storage medium having instructions stored therein, which when executed by a computing device or cluster of computing devices, implement a method as claimed in any one of claims 1 to 5 or 6 to 10.
CN202311036053.4A 2023-08-16 2023-08-16 Data management method, storage system and related equipment Pending CN117729095A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311036053.4A CN117729095A (en) 2023-08-16 2023-08-16 Data management method, storage system and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311036053.4A CN117729095A (en) 2023-08-16 2023-08-16 Data management method, storage system and related equipment

Publications (1)

Publication Number Publication Date
CN117729095A true CN117729095A (en) 2024-03-19

Family

ID=90198534

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311036053.4A Pending CN117729095A (en) 2023-08-16 2023-08-16 Data management method, storage system and related equipment

Country Status (1)

Country Link
CN (1) CN117729095A (en)

Similar Documents

Publication Publication Date Title
US20210329072A1 (en) Optimized communication pathways in a vast storage system
US11163479B2 (en) Replicated state cluster with standby node state assessment during leadership transition
CN109683826B (en) Capacity expansion method and device for distributed storage system
US8655851B2 (en) Method and system for performing a clean file lock recovery during a network filesystem server migration or failover
US11321291B2 (en) Persistent version control for data transfer between heterogeneous data stores
EP2923272B1 (en) Distributed caching cluster management
US8533171B2 (en) Method and system for restarting file lock services at an adoptive node during a network filesystem server migration or failover
US8726274B2 (en) Registration and initialization of cluster-aware virtual input/output server nodes
CN111049928B (en) Data synchronization method, system, electronic device and computer readable storage medium
AU2016218381A1 (en) Storage system architecture
US11184435B2 (en) Message transmission method and apparatus in cluster file system
CN112015595B (en) Master-slave database switching method, computing device and storage medium
CN108572976A (en) Data reconstruction method, relevant device and system in a kind of distributed data base
US12101379B2 (en) Multilevel load balancing
CN109254873B (en) Data backup method, related device and system
CN111147274A (en) System and method for creating a highly available arbitration set for a cluster solution
CN112749178A (en) Method for ensuring data consistency and related equipment
CN108133034B (en) Shared storage access method and related device
US8621260B1 (en) Site-level sub-cluster dependencies
CN109992447B (en) Data copying method, device and storage medium
CN114172917B (en) Distributed cache system and deployment method thereof
CN113596195B (en) Public IP address management method, device, main node and storage medium
CN117729095A (en) Data management method, storage system and related equipment
CN115470041A (en) Data disaster recovery management method and device
US20240028611A1 (en) Granular Replica Healing for Distributed Databases

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