CN112492030A - Data storage method and device, computer equipment and storage medium - Google Patents

Data storage method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112492030A
CN112492030A CN202011364752.8A CN202011364752A CN112492030A CN 112492030 A CN112492030 A CN 112492030A CN 202011364752 A CN202011364752 A CN 202011364752A CN 112492030 A CN112492030 A CN 112492030A
Authority
CN
China
Prior art keywords
node
data storage
node group
group
communication address
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.)
Granted
Application number
CN202011364752.8A
Other languages
Chinese (zh)
Other versions
CN112492030B (en
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.)
Beijing Qingyun Science And Technology Co ltd
Original Assignee
Beijing Qingyun Science And Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qingyun Science And Technology Co ltd filed Critical Beijing Qingyun Science And Technology Co ltd
Priority to CN202011364752.8A priority Critical patent/CN112492030B/en
Publication of CN112492030A publication Critical patent/CN112492030A/en
Application granted granted Critical
Publication of CN112492030B publication Critical patent/CN112492030B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a data storage method, a data storage device, computer equipment and a storage medium. The method comprises the following steps: when the node group becomes a main node of the node group, acquiring a target communication address of the node group; setting the target communication address as the node communication address of the node; and receiving a data storage request sent by the client to the node group based on the target communication address through a small computer system interface, and storing data according to the data storage request. By adopting the technical scheme, the embodiment of the invention can avoid the switching of the client in different nodes in the same node group, thereby avoiding the situation that the data written in a certain node is wrongly covered by the data written in other nodes in the same node group and ensuring the integrity of the data stored in the data storage system.

Description

Data storage method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data storage technologies, and in particular, to a data storage method and apparatus, a computer device, and a storage medium.
Background
Currently, the most common external Interface for interfacing with a client in the storage field is a Small Computer System Interface (iSCSI). iSCSI utilizes TCP/IP protocol as a communication channel and uses iSCSI protocol to exchange SCIC commands. When the storage device is used as a storage server to interface with an iSCSI client, redundancy on a link is generally implemented in a multi-path redundancy (Multipath) manner, so as to ensure high availability of storage.
The Multipath data storage system has a plurality of active servers, and an initiator (initiator) of a client switches input/output (I/O) paths between targets (targets) of the active servers, so that the two servers complete data storage together. However, in this data storage method, when the initiator is switched from the first target to the second target, if the time that the first target writes the data to be stored into the disk is later than the time that the second target writes the data to be stored into the disk, the risk that the data written into the disk by the second target is overwritten by the data written into the disk by the first target may be caused.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data storage method, an apparatus, a computer device, and a storage medium, so as to avoid a situation that data written to a disk is erroneously overwritten.
In a first aspect, an embodiment of the present invention provides a data storage method, including:
when the node group becomes a main node of the node group, acquiring a target communication address of the node group;
setting the target communication address as the node communication address of the node;
receiving a data storage request sent by a client to the node group based on the target communication address through a small computer system interface, and storing data according to the data storage request
In a second aspect, an embodiment of the present invention provides a data storage device, including:
the address acquisition module is used for acquiring a target communication address of the node group when the node group becomes a main node of the node group;
the address setting module is used for setting the target communication address as the node communication address of the node;
and the data storage module is used for receiving a data storage request sent by the client to the node group based on the target communication address through a small computer system interface and storing data according to the data storage request.
In a third aspect, an embodiment of the present invention provides a computer device, including:
one or more processors;
a memory for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the data storage method according to the embodiment of the present invention.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the data storage method according to the embodiment of the present invention.
In the above-described technical solution for storing data, when a node in a node group becomes a master node of the node group, a target communication address of the node group is acquired, the target communication address is set as a node communication address of the node, a data storage request sent by a client to the node group based on the target communication address is received through an interface of a small computer system, and data is stored according to the data storage request. By adopting the technical scheme, each node group in the data storage system only provides data storage service to the outside through the master node in the node group, and the slave nodes in the node groups are invisible relative to the client, so that the client can be prevented from switching among different nodes in the same node group, the situation that data written by a certain node is mistakenly covered by data written by other nodes in the same node group is further avoided, and the integrity of the data stored in the data storage system is ensured.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
fig. 1 is a schematic flowchart of a data storage method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a data storage method according to a second embodiment of the present invention;
fig. 3 is a block diagram of a data storage device according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some but not all of the relevant aspects of the present invention are shown in the drawings. In addition, the embodiments and features of the embodiments in the present invention may be combined with each other without conflict.
Example one
The embodiment of the invention provides a data storage method. The method may be performed by a data storage apparatus, wherein the apparatus may be implemented by software and/or hardware, may be integrated in each data storage node of a data storage system, and typically may be integrated in each data storage node of a distributed data storage system. Fig. 1 is a schematic flowchart of a data storage method according to an embodiment of the present invention. As shown in fig. 1, the data storage method provided in this embodiment includes:
s110, when the node group is taken as the main node of the node group, the target communication address of the node group is obtained.
The target communication address may be understood as a communication address provided outside the node group to which the master node belongs, which executes the data storage method provided in this embodiment. The data storage system may be provided with a plurality of node groups, each node group includes a master node and a slave node, each node group provides only one communication address (such as a virtual IP address) to the outside, and the master node provides a data storage service to the outside by using the communication address. When a certain master node executes the data storage method provided in this embodiment, the node group may be understood as a node group to which the master node belongs, and the target communication address may be understood as a communication address provided externally by the node group to which the master node belongs, where the communication address may be stored in each node of the node group or may be stored in a master node of the data storage system. In an embodiment, the storage devices or storage volumes corresponding to different node groups in the data storage system may be the same or different; the storage volumes corresponding to different nodes in the same node group may be different, so that when a storage volume corresponding to a certain node fails, the storage volumes corresponding to other nodes in the node group may be used to store data, thereby further improving the availability of the data storage system.
Specifically, after any node in the node group is designated or elected by a worker to become a master node in the node group, that is, after any node in the node group monitors that the node itself becomes a master node of the node group, the target communication address of the node group may be locally acquired, or a communication address acquisition request is sent to a master control node of the data storage system, and the master control node of the data storage system receives the target communication address of the node group returned based on the communication address acquisition request.
In an embodiment, the data storage method provided in this embodiment may further include: before becoming the main node of the node group, receiving the heartbeat packet sent by the original main node in the node group, and initiating election when the heartbeat packet sent by the original main node is not received within a preset time length so as to obtain the current main node of the node group by election.
The preset time length may be set by a worker as needed, for example, when the original master node in the node group periodically sends the heartbeat packet to each slave node in the node group according to a preset certain period length, the preset time length may be set to be 2 times or 3 times of the period length, and the like, which is not limited in this embodiment.
In the foregoing embodiment, when the original master node in the node group cannot normally provide the storage service, for example, when the original master node in the node group fails or has a high delay, the slave node in the node group may re-determine the current master node in the node group by means of election, and use the current master node to replace the original master node in the node group to provide the storage service to the outside. At this time, for example, the original master node in the node group may periodically send a heartbeat packet to each slave node in the node group; correspondingly, each slave node in the node group receives a heartbeat packet sent by an original master node, whether the time interval from the current moment to the last heartbeat packet sent by the original master node received by the node reaches a preset time length or not is monitored in real time, when the time interval reaches the preset time length, election is initiated, and when the time interval becomes the master node of the node group, a target communication address in the node group is obtained, and the target communication address is set as the node communication address of the node, so that the original master node in the node group is replaced to provide data storage service for the outside.
In this embodiment, after a certain slave node in the node group elects to become the current master node of the node group, the current master node may also periodically send a heartbeat packet to the slave node in the node group, so that when the slave node in the node group cannot normally provide a storage service at the current master node, the master node of the node group is reselected. At this time, preferably, the data storage method provided in this embodiment may further include: and periodically sending heartbeat packets to the slave nodes in the node group so that the slave nodes in the node group determine the node state of the node.
And S120, setting the target communication address as the node communication address of the node.
The node communication address may be understood as a communication address of a data storage node in the data storage system.
Specifically, when the current master node in the node group becomes the master node of the node group, that is, when the identity of the current master node in the node group is switched from the slave node to the master node, the current master node may obtain the target communication address in the node group, and set the target communication address as the node communication address of the current master node, so that the subsequent receiving client sends the data storage request to the node group according to the target communication address of the node group and processes the data storage request.
S130, receiving a data storage request sent by the client to the node group based on the target communication address through the small computer system interface, and storing data according to the data storage request.
In this embodiment, each node in the data storage System may be provided with an Internet Small Computer System Interface (iSCSI), and may communicate with the client or other nodes in the data storage System through iSCSI.
Illustratively, when a client needs to store data through a certain node group, a data storage request is sent to the node group according to a target communication address of the node group under a SCSI protocol and a TCP/IP protocol; because the current master node in the node group sets the target communication address of the node group as the node communication address of the current master node, when the client sends a data storage request to the node group according to the target communication address, the current master node in the node group can receive the data storage request sent by the client through the iSCSI of the current master node and store the data requested to be stored by the data storage request. In addition, after the current master node completes the data storage requested by the data storage request, the current master node can further return storage response information to the client, and the storage response information reminds the client of successful data storage so that the client can continue to execute subsequent data storage operation.
It can be understood that, when the storage devices or storage volumes corresponding to different nodes in the same node group are different, after the current master node stores the data requested to be stored by the data storage request in the storage device or storage volume corresponding to the current master node, the data requested to be stored by the data storage request may also be synchronized to each slave node in the node group for storage, so as to ensure that after a certain slave node in the master node elects to become a new master node, the data requested to be stored by the data storage request can be read or updated based on a request of a client, in this case, it is preferable that the storing the data according to the data storage request includes: and storing the target data requested to be stored by the data storage request, and sending a data storage instruction to other nodes in the node group to instruct the other nodes in the node group to store the target data through the data storage instruction.
In this embodiment, when a node in a node group becomes a master node of the node group, a target communication address of the node group is obtained, the target communication address is set as a node communication address of the node, a data storage request sent by a client to the node group based on the target communication address is received through an interface of a small computer system, and data is stored according to the data storage request. By adopting the above technical solution, each node group in the data storage system only provides data storage service to the outside through the master node in the node group, and the slave nodes in the node group are invisible to the client, so that the client can be prevented from switching among different nodes in the same node group, and the situation that data written by a certain node is mistakenly covered by data written by other nodes in the same node group is avoided, and the integrity of the data stored in the data storage system is ensured.
Example two
Fig. 2 is a schematic flowchart of a data storage method according to a second embodiment of the present invention. The embodiment is optimized on the basis of the above embodiment, and further, the data storage method provided by the embodiment may further include: and controlling the client to be disconnected from the original main node in the node group.
Further, before the obtaining the target communication address of the node group, the method further includes: deleting the access control identification of the node from the access control list, and adding the access control identification for the original main node in the node group in the access control list, wherein the access control identification is used for forbidding the node corresponding to the access control identification to establish communication connection with the node in the node group.
Correspondingly, as shown in fig. 2, the data storage method provided by this embodiment includes:
and S210, when the master node is the master node of the node group, controlling the client to be disconnected from the original master node in the node group.
The original master node may be understood as a master node in the node group to which the node executing the step belongs before becoming a master node of the node group to which the node belongs.
In this embodiment, after the slave node in the node group replaces the original master node in the node group and becomes the master node in the node group, the client may be controlled to disconnect from the original master node, so as to avoid a situation that the client continues to communicate with the original master node, and ensure that the client does not continue to send the data storage request to the original master node in the node group after a new master node is elected. In addition, after the slave node in the node group replaces the original master node in the node group to become the master node in the node group, the slave node in the node group may further control the node not located in the node group in the data storage system to disconnect from the original master node in the node group, so as to avoid a situation that the node not located in the node group continues to send communication information to the original master node in the node group based on the established communication connection, which is described below as an example.
For example, after becoming a master node in the node group, a certain slave node in the node group may send a disconnection instruction to other nodes except for the node in the node group in the data storage system and a client end that establishes a communication connection with the original master node, where the disconnection instruction instructs other nodes except for the node in the node group in the data storage system and the client end that establishes a communication connection with the original master node to disconnect the communication connection with the original master node; accordingly, after receiving the disconnection instruction sent by the master node, the corresponding node in the data storage system and the client end establishing communication connection with the original master node may disconnect, based on the disconnection instruction, communication connection between the corresponding node and the original master node in the node group to which the master node sending the disconnection instruction belongs.
In addition, the data storage method provided by this embodiment may further include: and sending a first connection establishment request to the main nodes of other node groups in the data storage system so as to establish communication connection with the main nodes of the other node groups.
The first connection establishment request may be understood as a communication connection establishment request sent by a master node in a node group to another node outside the node group.
In this embodiment, after replacing the original master node in the node group to which the slave node belongs to become a new master node in the node group to which the slave node belongs, the slave node in the node group may establish a communication connection with the master node in another node group in the data storage system, so as to communicate with the master node in another node group in the following. At this time, for example, after a slave node in a node group replaces an original master node in the node group to which the slave node belongs to become a new master node in the node group to which the slave node belongs, a first connection establishment request may be sent to the master node in another node group in the data storage system based on a communication address provided by another node group in the data storage system to the outside; correspondingly, after receiving the first connection establishment request, the master nodes in other node groups can query the access control list, judge whether the node sending the first connection establishment request has an access control identifier, and reject the first connection establishment request if the node sending the first connection establishment request has the access control identifier; and if not, establishing communication connection with the main node sending the first connection establishment request based on the first connection establishment request.
It can be understood that, after a slave node in a node group replaces an original master node in the node group to which the slave node belongs to become a new master node in the node group to which the slave node belongs, it may also be determined whether the slave node has a requirement for communicating with other nodes in the data storage system except for the nodes in the node group, and if so, a first connection establishment request is sent to the other nodes having the requirement for communication, so as to establish communication connection with the other nodes; if not, the first connection establishment request may not be sent to other nodes except the local node in the data storage system until a need for communication with some other node is met or a second connection establishment request sent by some other node is received.
S220, deleting the access control identification of the node from the access control list, and adding the access control identification to the original main node in the node group in the access control list, wherein the access control identification is used for forbidding the node corresponding to the access control identification to establish communication connection with the node in the node group.
The access control identifier may be understood as an identifier for indicating whether a node can perform access, and when a certain node has the access control identifier, it indicates that the node is in an inaccessible state, that is, a communication connection cannot be established with the node; an access control list may be understood as a form for recording whether each node in the data storage system is provided with an access control identifier, which may be stored in a database configured by the data storage system.
In this embodiment, after a slave node in a node group replaces an original master node in the node group to become a master node in the node group, an access control identifier of the node may be deleted, which is recorded in an access control list, and an access control identifier is added to the original master node in the node group in the control list, so as to adjust the node to be in an accessible state, and adjust the original master node in the node group to be in an inaccessible state, thereby avoiding a situation that the original master node in the node group actively establishes communication connection with other nodes except for the node in the node group in the data storage system after the original master node in the node group is recovered to be normal.
In an embodiment, the data storage method provided in this embodiment may further include: when receiving a second connection establishment request sent by a node in other node groups, inquiring the access control list to determine whether the node sending the connection establishment request is provided with an access control identifier; if the node sending the connection establishment request is provided with an access control identifier, rejecting the second connection establishment request; and if the access control identifier is not set by the node sending the connection establishment request, establishing communication connection with the node sending the connection establishment request based on the second connection establishment request.
The second connection establishment request may be understood as a communication connection establishment request received by the master node in the node group and sent by a node other than the nodes in the node group.
In the foregoing embodiment, when a node in a data storage system needs to establish a communication connection with a master node in a certain node group of the data storage system, a second connection establishment request may be sent to the master node in the node group based on an externally provided communication address of the node group; correspondingly, when receiving a second connection establishment request which is not sent by a node in the node group, the master node in the node group can judge whether the node sending the second connection establishment request is provided with an access control identifier based on the access control list, if so, the operation of establishing communication connection is not executed, and response refusing information can be further returned to the node; if not, the communication connection with the node sending the second connection establishment request can be established based on the second connection establishment request.
And S230, acquiring the target communication address of the node group.
S240, setting the target communication address as the node communication address of the node.
S250, receiving a data storage request sent by a client to the node group based on the target communication address through a small computer system interface, storing target data requested to be stored by the data storage request, and sending a data storage instruction to other nodes in the node group so as to instruct other nodes in the node group to store the target data through the data storage instruction.
In an embodiment, the data storage method provided in this embodiment may further include: when a data storage instruction sent by a target node in the node group is received, inquiring the access control list to determine whether the target node is provided with an access control identifier; if the target node is provided with an access control identifier, rejecting the data storage instruction; and if the target node does not set the access control identification, storing data based on the data storage instruction.
The data storage instruction can be understood as an instruction which is received by the node, sent by other nodes in the node group and used for instructing the node to store data; the target node may be understood as the node that sent the data storage instruction.
In the above embodiment, when receiving a data storage instruction sent by another node in the node group, any node in the node group may determine whether the node sending the data storage instruction has an access control identifier, and if so, do not respond to the data storage instruction, that is, do not perform a data storage operation based on the data storage instruction; if not, storing the data stored by the data storage instruction based on the data storage instruction, so that when the original master node in the node group continues to store the data based on the data storage request which is received but not executed in the task queue of the original master node, and the node in the node group is indicated to store the data by sending the data storage instruction, the data storage instruction sent by the original master node is ensured not to be executed, further the data storage request in the task queue of the original master node fails to be executed, and the situation that the original master node continues to execute the data storage request sent by the client after a new master node is elected is avoided. In the data storage method provided in this embodiment, when becoming the master node of the node group, the control client disconnects communication with the original master node in the node group, deletes the access control identifier of the node from the access control list, and adds the access control identifier to the original master node in the node group in the access control list, so that not only the node can be adjusted to be in an accessible state, but also the original master node in the node group can be adjusted to be in an inaccessible state, and the original master node in the node group is controlled to stop executing a data storage task that has not been executed by itself, thereby reducing the probability that the original master node in the node group is accessed by mistake, and further improving the integrity of data stored in the data storage system.
EXAMPLE III
The third embodiment of the invention provides a data storage device. The apparatus may be implemented by software and/or hardware, and may be integrated in each data storage node of a data storage system, and typically may be integrated in each data storage node of a distributed data storage system, and may store data by performing a data storage method. Fig. 3 is a block diagram of a data storage device according to a third embodiment of the present invention. As shown in fig. 3, the data storage device provided in this embodiment may include: an address acquisition module 301, an address setting module 302, and a data storage module 303, wherein,
an address obtaining module 301, configured to obtain a target communication address of the node group when the node group becomes a master node of the node group;
an address setting module 302, configured to set the target communication address as a node communication address of the node;
and the data storage module 303 is configured to receive, through the scsi interface, a data storage request sent by the client to the node group based on the target communication address, and store data according to the data storage request.
In this embodiment, when a node in a node group becomes a master node of the node group, an address obtaining module obtains a target communication address of the node group, an address setting module sets the target communication address as a node communication address of the node, a data storage module receives a data storage request sent by a client to the node group based on the target communication address through a small computer system interface, and stores data according to the data storage request. By adopting the above technical solution, each node group in the data storage system only provides data storage service to the outside through the master node in the node group, and the slave nodes in the node group are invisible to the client, so that the client can be prevented from switching among different nodes in the same node group, and the situation that data written by a certain node is mistakenly covered by data written by other nodes in the same node group is avoided, and the integrity of the data stored in the data storage system is ensured.
Further, the data storage device provided in this embodiment may further include: and the connection disconnection module is used for controlling the client to disconnect the communication connection with the original main node in the node group.
Further, the data storage device provided in this embodiment may further include: and the identifier deleting module is used for deleting the access control identifier of the node from the access control list before the target communication address of the node group is obtained, and adding the access control identifier for the original main node in the node group in the access control list, wherein the access control identifier is used for forbidding the node corresponding to the access control identifier to establish communication connection with the node in the non-node group.
In the above solution, the data storage module 303 may be configured to: and receiving a data storage request sent by a client to the local node group based on the target communication address through a small computer system interface, storing target data requested to be stored by the data storage request, and sending a data storage instruction to other nodes in the local node group so as to instruct the other nodes in the local node group to store the target data through the data storage instruction.
Further, the data storage device provided in this embodiment may further include: the instruction processing module is used for inquiring the access control list when receiving a data storage instruction sent by a target node in the node group so as to determine whether the target node is provided with an access control identifier; if the target node is provided with an access control identifier, rejecting the data storage instruction; and if the target node does not set the access control identification, storing data based on the data storage instruction.
Further, the data storage device provided in this embodiment may further include: and the election module is used for receiving the heartbeat packet sent by the original main node in the node group before the node becomes the main node of the node group, and initiating election when the heartbeat packet sent by the original main node is not received within a preset time length so as to obtain the current main node of the node group by election.
Further, the data storage device provided in this embodiment may further include: and the heartbeat packet sending module is used for periodically sending heartbeat packets to the slave nodes in the node group so as to enable the slave nodes in the node group to determine the node state of the node.
The data storage device provided by the third embodiment of the invention can execute the data storage method provided by any embodiment of the invention, and has the corresponding functional module and the beneficial effect of executing the data storage method. For details of the data storage method provided in any embodiment of the present invention, reference may be made to the technical details not described in detail in this embodiment.
Example four
Fig. 4 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention, as shown in fig. 4, the computer device includes a processor 40 and a memory 41, and may further include an input device 42 and an output device 43; the number of processors 40 in the computer device may be one or more, and one processor 40 is taken as an example in fig. 4; the processor 40, the memory 41, the input device 42 and the output device 43 in the computer apparatus may be connected by a bus or other means, and the connection by the bus is exemplified in fig. 4.
The memory 41, as a computer-readable storage medium, may be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the data storage method in the embodiment of the present invention (for example, the address acquisition module 301, the address setting module 302, and the data storage module 303 in the data storage device). The processor 40 executes various functional applications of the computer device and data processing by executing software programs, instructions and modules stored in the memory 41, that is, implements the data storage method described above.
The memory 41 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 41 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 41 may further include memory located remotely from processor 40, which may be connected to a computer device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 42 is operable to receive input numeric or character information and to generate key signal inputs relating to user settings and function controls of the computer apparatus. The output device 43 may include a display device such as a display screen.
A fourth embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a data storage method, including:
when the node group becomes a main node of the node group, acquiring a target communication address of the node group;
setting the target communication address as the node communication address of the node;
and receiving a data storage request sent by the client to the node group based on the target communication address through a small computer system interface, and storing data according to the data storage request.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the operations of the method described above, and may also perform related operations in the data storage method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the data storage device, the included units and modules are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method of storing data, comprising:
when the node group becomes a main node of the node group, acquiring a target communication address of the node group;
setting the target communication address as the node communication address of the node;
and receiving a data storage request sent by the client to the node group based on the target communication address through a small computer system interface, and storing data according to the data storage request.
2. The method of claim 1, further comprising:
and controlling the client to be disconnected from the original main node in the node group.
3. The method according to claim 1, further comprising, before said obtaining the target communication address of the local node group:
deleting the access control identification of the node from the access control list, and adding the access control identification for the original main node in the node group in the access control list, wherein the access control identification is used for forbidding the node corresponding to the access control identification to establish communication connection with the node in the node group.
4. The method of claim 3, wherein storing data in accordance with the data storage request comprises:
and storing the target data requested to be stored by the data storage request, and sending a data storage instruction to other nodes in the node group to instruct the other nodes in the node group to store the target data through the data storage instruction.
5. The method of claim 4, further comprising:
when a data storage instruction sent by a target node in the node group is received, inquiring the access control list to determine whether the target node is provided with an access control identifier;
if the target node is provided with an access control identifier, rejecting the data storage instruction;
and if the target node does not set the access control identification, storing data based on the data storage instruction.
6. The method of any of claims 1-5, further comprising:
before becoming the main node of the node group, receiving the heartbeat packet sent by the original main node in the node group, and initiating election when the heartbeat packet sent by the original main node is not received within a preset time length so as to obtain the current main node of the node group by election.
7. The method of claim 6, further comprising:
and periodically sending heartbeat packets to the slave nodes in the node group so that the slave nodes in the node group determine the node state of the node.
8. A data storage device, comprising:
the address acquisition module is used for acquiring a target communication address of the node group when the node group becomes a main node of the node group;
the address setting module is used for setting the target communication address as the node communication address of the node;
and the data storage module is used for receiving a data storage request sent by the client to the node group based on the target communication address through a small computer system interface and storing data according to the data storage request.
9. A computer device, comprising:
one or more processors;
a memory for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a data storage method as claimed in any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the data storage method of any one of claims 1 to 7.
CN202011364752.8A 2020-11-27 2020-11-27 Data storage method, device, computer equipment and storage medium Active CN112492030B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011364752.8A CN112492030B (en) 2020-11-27 2020-11-27 Data storage method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011364752.8A CN112492030B (en) 2020-11-27 2020-11-27 Data storage method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112492030A true CN112492030A (en) 2021-03-12
CN112492030B CN112492030B (en) 2024-03-15

Family

ID=74936780

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011364752.8A Active CN112492030B (en) 2020-11-27 2020-11-27 Data storage method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112492030B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114189702A (en) * 2021-12-07 2022-03-15 广州市百果园网络科技有限公司 Resource object allocation method, device, equipment and storage medium based on live broadcast room
CN114745393A (en) * 2022-03-31 2022-07-12 阿里云计算有限公司 Session synchronization system and method, cloud computing center and cloud computing equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8554867B1 (en) * 2010-01-27 2013-10-08 Netapp Inc. Efficient data access in clustered storage system
WO2018036148A1 (en) * 2016-08-23 2018-03-01 东方网力科技股份有限公司 Server cluster system
CN108829787A (en) * 2018-05-31 2018-11-16 郑州云海信息技术有限公司 A kind of meta-data distribution formula system
US20190095293A1 (en) * 2016-07-27 2019-03-28 Tencent Technology (Shenzhen) Company Limited Data disaster recovery method, device and system
CN110287151A (en) * 2019-05-20 2019-09-27 平安科技(深圳)有限公司 Distributed memory system, method for writing data, device and storage medium
CN110908723A (en) * 2019-11-29 2020-03-24 新华三大数据技术有限公司 Main/standby switching method and device of operating system and related equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8554867B1 (en) * 2010-01-27 2013-10-08 Netapp Inc. Efficient data access in clustered storage system
US20190095293A1 (en) * 2016-07-27 2019-03-28 Tencent Technology (Shenzhen) Company Limited Data disaster recovery method, device and system
WO2018036148A1 (en) * 2016-08-23 2018-03-01 东方网力科技股份有限公司 Server cluster system
CN108829787A (en) * 2018-05-31 2018-11-16 郑州云海信息技术有限公司 A kind of meta-data distribution formula system
CN110287151A (en) * 2019-05-20 2019-09-27 平安科技(深圳)有限公司 Distributed memory system, method for writing data, device and storage medium
CN110908723A (en) * 2019-11-29 2020-03-24 新华三大数据技术有限公司 Main/standby switching method and device of operating system and related equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114189702A (en) * 2021-12-07 2022-03-15 广州市百果园网络科技有限公司 Resource object allocation method, device, equipment and storage medium based on live broadcast room
CN114745393A (en) * 2022-03-31 2022-07-12 阿里云计算有限公司 Session synchronization system and method, cloud computing center and cloud computing equipment

Also Published As

Publication number Publication date
CN112492030B (en) 2024-03-15

Similar Documents

Publication Publication Date Title
CN112492030B (en) Data storage method, device, computer equipment and storage medium
EP3232609A1 (en) Locking request processing method and server
CN111338806B (en) Service control method and device
WO2016082078A1 (en) Path management system, device and method
CN108572976A (en) Data reconstruction method, relevant device and system in a kind of distributed data base
US20150244824A1 (en) Control Method, Control Device, and Processor in Software Defined Network
EP2597818A1 (en) Cluster management system and method
CN113660350A (en) Distributed lock coordination method, device, equipment and storage medium
CN113169895A (en) N +1 redundancy for virtualization services with low latency failover
CN106101297B (en) A kind of message answer method and device
CN107077429A (en) Method for reading data, equipment and system
CN110535947B (en) Storage device cluster configuration node switching method, device and equipment
CN110913028B (en) Method, device and system for processing virtual address
JP5039975B2 (en) Gateway device
CN108234358B (en) Multicast message transmission method, device and machine readable storage medium
CN110661836B (en) Message routing method, device and system, and storage medium
CN113810216A (en) Cluster fault switching method and device and electronic equipment
JP4309321B2 (en) Network system operation management method and storage apparatus
CN112260928A (en) Node switching method and device, electronic equipment and readable storage medium
JP2010086137A (en) Message queuing method and program
CN111010425A (en) Server connection method, load balancing equipment and electronic equipment
CN109831467B (en) Data transmission method, equipment and system
CA2960184C (en) Systems and methods for centrally-assisted distributed hash table
CN109039680B (en) Method and system for switching main Broadband Network Gateway (BNG) and standby BNG and BNG
CN109510864B (en) Forwarding method, transmission method and related device of cache request

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100000 Unit 501A, Floor 5, 101, Building 1, Yard 5, Laiguangying West Road, Chaoyang District, Beijing

Applicant after: Beijing Qingyun Science and Technology Co.,Ltd.

Address before: 100020 601, 6 floor, 16 building, No. 36 Chuang Yuan Road, Chaoyang District, Beijing.

Applicant before: Beijing Qingyun Science and Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant