CN117221093A - Control method and device for distributed storage service - Google Patents

Control method and device for distributed storage service Download PDF

Info

Publication number
CN117221093A
CN117221093A CN202311139447.2A CN202311139447A CN117221093A CN 117221093 A CN117221093 A CN 117221093A CN 202311139447 A CN202311139447 A CN 202311139447A CN 117221093 A CN117221093 A CN 117221093A
Authority
CN
China
Prior art keywords
node
service
version number
switching
storage service
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
CN202311139447.2A
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.)
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology Information 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 Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Information Technology Co Ltd
Priority to CN202311139447.2A priority Critical patent/CN117221093A/en
Publication of CN117221093A publication Critical patent/CN117221093A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a control method and a device for distributed storage service, and relates to the technical field of computers. One embodiment of the method comprises the following steps: obtaining version information of a storage service group, wherein the version information comprises: the identification of the master node and the current version number; determining a switching node and a switching version number of the service group in response to a master node abnormality of the storage service group, the switching version number being different from the current version number; switching the main node of the storage service group to the switching node; and updating version information of the storage service group according to the switching node and the switching version number of the storage service group, wherein the updated version information is used for controlling service response of the storage service group. According to the embodiment, the node switching can be realized without a lease lock, the consumed system resources are small, and the execution efficiency is high.

Description

Control method and device for distributed storage service
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for controlling a distributed storage service.
Background
To achieve high availability of the system, a multi-node distributed architecture is often employed. In a service group of a multi-node distributed architecture, multiple nodes may provide responsive services to the service group. When the main node of the service group is abnormal, the node switching is needed, and other nodes continue to provide services. For abnormal switching of multiple nodes, the abnormal switching is mostly realized based on lease locks. Lease locks require more system resources and are inefficient.
Disclosure of Invention
In view of this, the embodiment of the invention provides a method and a device for controlling distributed storage service, which can realize node switching without using a lease lock, and has the advantages of less consumed system resources and higher execution efficiency.
In a first aspect, an embodiment of the present invention provides a method for controlling a distributed storage service, which is applied to a monitoring node, including:
obtaining version information of a storage service group, wherein the version information comprises: the identification of the master node and the current version number;
determining a switching node and a switching version number of the storage service group in response to a master node abnormality of the storage service group, the switching version number being different from the current version number;
switching the main node of the storage service group to the switching node;
and updating version information of the storage service group according to the switching node and the switching version number of the storage service group, wherein the updated version information is used for controlling service response of the storage service group.
Optionally, before determining the switching node and the switching version number of the storage service group in response to the abnormality of the master node of the storage service group, the method further includes:
in response to monitoring an abnormal event for the storage service group, performing abnormality detection on the master node; wherein the abnormal event comprises: the heartbeat information of the master node is not received within a preset time period, and/or abnormal reporting information aiming at the storage service group is received;
And determining that the master node of the storage service group is abnormal in response to the master node failing to detect the abnormality.
Optionally, the switching the master node of the storage service group to the switching node includes:
transmitting first control information to the switching node; wherein the first control information includes: the switching version number and the first control information are used for calling up response service on the switching node;
sending second control information to the master node; and the second control information is used for closing the response service on the master node after the master node finishes processing the current service.
In a second aspect, an embodiment of the present invention provides a method for processing a distributed storage service, which is applied to a service node in a service group, including:
receiving first control information sent by a monitoring node, wherein the first control information comprises: switching the version number; the switching version number is a version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
sending a login request to an upstream server, the login request comprising: the switching version number;
And receiving the return information sent by the upstream server, and carrying out subsequent storage service processing according to the return information.
Optionally, after receiving the first control information sent by the monitoring node, the method further includes:
according to the first control information, calling up response service on the switching node;
receiving a service request sent by a terminal or a downstream server;
and calling the response service and responding to the service request.
In a third aspect, an embodiment of the present invention provides a method for processing a login request, which is applied to an upstream server, including:
receiving a login request sent by a service node in a storage service group;
determining whether the service node is a master node of the storage service group or not by using a monitoring node according to the switching version number in the login request and the identification of the storage service group; the switching version number is a version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
responding to the service node as the main node of the storage service group, and returning information of successful login to the service node;
And returning login failure information to the service node in response to the service node not being the master node of the storage service group.
Optionally, the determining, by the utilization monitoring node, whether the service node is a master node of the storage service group according to the version number in the login request and the identifier of the service group includes:
transmitting a version acquisition request to the monitoring node, wherein the version acquisition request comprises the following components: an identification of the service group;
receiving a return version number sent by the monitoring node;
determining whether the switching version number in the login request is the same as the return version number;
responding to the switching version number in the login request and the return version number to be the same, and determining the service node as a master node of the storage service group;
and determining that the service node is not the master node of the storage service group in response to the fact that the switching version number in the login request is different from the return version number.
Optionally, at a first time, a first service request is received from a first node of the storage service group, the first service request including: a first version number;
at a second time, receiving a service request from a second node of the stored service group, the second service request comprising: a second version number;
Responding to the first time being earlier than the second time, wherein the second version number is a switching version number of the first version number, processing the first service request, and processing the second service request after the first service request is processed;
and in response to the first time not being earlier than the second time and the second version number being a switch version number of the first version number, processing the second service request and discarding the first service request.
In a fourth aspect, an embodiment of the present invention provides a method for sending a storage service request, which is applied to a terminal or a downstream server, and includes:
sending a node acquisition request to a monitoring node, wherein the node acquisition request comprises the following steps: storing an identification of the service group; the monitoring node is used for switching other service nodes into the main node when the main node abnormality occurs in the storage service group, and distributing a switching version number for the other service nodes;
receiving master node information sent by the monitoring node;
and sending a service request to the master node of the storage service group according to the master node information.
In a fifth aspect, an embodiment of the present invention provides a control device for a distributed storage service, which is applied to a monitoring node, including:
The information acquisition module is used for acquiring version information of the storage service group, and the version information comprises: the identification of the master node and the current version number;
an information determining module, configured to determine a switching node and a switching version number of the storage service group in response to an abnormality of a master node of the storage service group, where the switching version number is different from the current version number;
the node switching module is used for switching the main node of the storage service group into the switching node;
and the information updating module is used for updating the version information of the storage service group according to the switching node and the switching version number of the storage service group, and the updated version information is used for controlling the service response of the storage service group.
In a sixth aspect, an embodiment of the present invention provides a processing apparatus for a distributed storage service, which is applied to a service node in a service group, including:
the information receiving module is configured to receive first control information sent by a monitoring node, where the first control information includes: switching the version number; the switching version number is a version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
The request sending module is used for sending a login request to the upstream server, and the login request comprises: the switching version number;
and the service processing module is used for receiving the return information sent by the upstream server and carrying out subsequent storage service processing according to the return information.
In a seventh aspect, an embodiment of the present invention provides a processing apparatus for a login request, which is applied to an upstream server, including:
the request receiving module is used for receiving a login request sent by a service node in the storage service group;
the node determining module is used for determining whether the service node is a main node of the storage service group or not by utilizing a monitoring node according to the switching version number in the login request and the identification of the storage service group; the switching version number is a version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
the information return module is used for responding the service node as the main node of the storage service group and returning the successful login information to the service node;
and returning login failure information to the service node in response to the service node not being the master node of the storage service group.
In an eighth aspect, an embodiment of the present invention provides a sending device for storing a service request, which is applied to a terminal or a downstream server, including:
the request sending module is configured to send a node acquisition request to a monitoring node, where the node acquisition request includes: storing an identification of the service group; the monitoring node is used for switching other service nodes into the main node when the main node abnormality occurs in the storage service group, and distributing a switching version number for the other service nodes;
the information receiving module is used for receiving the master node information sent by the monitoring node;
and the request sending module is used for sending a service request to the master node of the storage service group according to the master node information.
In a ninth aspect, an embodiment of the present invention provides an electronic device, including:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the methods of any of the embodiments described above.
In a tenth aspect, embodiments of the present invention provide a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method as described in any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: when the main node of the storage service group is abnormal, the monitoring node determines the switching node and the switching version number of the storage service group and switches the main node of the storage service group into the switching node. And updating the version information of the storage service group according to the switching node and the switching version number of the storage service group. And controlling the service response of the storage service group by using the main node identification and the version number in the updated version information. Therefore, the node switching can be realized without a lease lock, the consumed system resources are small, and the execution efficiency is high.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a flow of a method for controlling a distributed storage service according to an embodiment of the present invention;
fig. 2 is a schematic diagram of performing node switching by using a storage service group as a service end according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a flow of a method for processing a distributed storage service according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a flow of a method for processing a login request according to an embodiment of the present invention;
FIG. 5a is a schematic diagram of an upstream server processing a service request sent by a master node before and after a handover according to an embodiment of the present invention;
FIG. 5b is a schematic diagram of another upstream server according to an embodiment of the present invention processing service requests sent by a master node before and after a handover;
FIG. 6a is a schematic diagram of a storage service set as a client interacting with an upstream server according to one embodiment of the present invention;
FIG. 6b is a schematic diagram of another storage service set provided by one embodiment of the present invention as a client interacting with an upstream server;
FIG. 6c is a schematic diagram of a storage service set as a database client interacting with a database server according to one embodiment of the present invention;
FIG. 7 is a schematic diagram of a flow chart of a method for sending a storage service request according to an embodiment of the present invention;
FIG. 8 is a schematic diagram illustrating interaction between a storage service group and a server according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of a distributed storage service control device according to an embodiment of the present invention;
FIG. 10 is a schematic structural diagram of a processing device for distributed storage service according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of a device for processing login request according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of a sending device for storing a service request according to an embodiment of the present invention;
fig. 13 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that, in the technical solution of the embodiment of the present invention, the acquisition, storage, use, processing, etc. of the data all conform to the relevant regulations of the national laws and regulations.
Fig. 1 is a schematic diagram of a flow of a control method of a distributed storage service according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step 101: the method comprises the steps of obtaining version information of a storage service group, wherein the version information comprises the following steps: the identity of the master node and the current version number.
The method is applied to monitoring nodes. One monitoring node may be used to implement versioning and node switching for multiple storage service groups. Version information of a plurality of storage service groups can be stored in the monitoring node, and the version information can comprise: the identity of the storage service group, the identity of the master node, the current version number, etc.
The storage service group is used for providing relevant services for information storage. The storage service group comprises a plurality of service nodes, and each service node is independent of each other and can provide storage response service corresponding to the service group. At the same time, only one master node exists in the storage service group, and the storage service group performs service processing through the master node. The service processing comprises the following steps: and providing the service and sending the processing request to the outside.
Step 102: in response to a primary node of the storage service group being abnormal, determining a switch node and a switch version number of the storage service group, the switch version number being different from the current version number.
If the heartbeat information of the master node is not received within the preset time period, or the abnormal report information for the storage service group sent by the terminal or the downstream server is received, the master node abnormality of the storage service group can be determined.
In the storage service group, a service node capable of normal operation other than the current node is selected as the switching node. The switch version number is different from the current version number. For example, the current version number may be incremented by 1 or a fixed step size to obtain the switch version number. The switch version number may also be determined based on the current timestamp.
Step 103: and switching the master node of the storage service group to a switching node.
And the response service on the switching node is turned up, and the response service on the main node is turned off. After the master node of the storage service group is switched to the switching node, the switching node is used as a new master node to provide service processing for the outside.
In one embodiment of the present invention, switching a master node of a storage service group to a switching node includes: transmitting first control information to a switching node; wherein the first control information includes: switching the version number, wherein the first control information is used for calling a response service on the switching node; and sending second control information to the main node, and closing the response service on the main node after the main node finishes processing the current service.
The first control information may include: responding to the identification of the service, switching version number, call-up time, etc. After the switching node receives the first control information, the response service on the switching node is called up, and the switching version number is saved. The switching node realizes version control and fault transfer of the storage service group through switching the version number.
Step 104: and updating the version information of the storage service group according to the switching node and the switching version number of the storage service group, wherein the updated version information is used for controlling the service response of the storage service group.
The monitoring node is used for switching other service nodes into the master node when the storage service group is abnormal, and distributing a switching version number for the other service nodes.
Updating the main node identification in the version information stored by the control node to the switching node identification, and updating the current version number in the version information to the switching version number. And the monitoring node realizes version control and fault transfer aiming at the storage service group through the updated version information.
In the embodiment of the invention, when the main node of the storage service group is abnormal, the monitoring node determines the switching node and the switching version number of the storage service group and switches the main node of the storage service group into the switching node. And updating the version information of the storage service group according to the switching node and the switching version number of the storage service group. And controlling the service response of the storage service group by using the main node identification and the version number in the updated version information. The node switching can be realized without a lease lock, the consumed system resources are small, and the execution efficiency is high.
In one embodiment of the present invention, before determining the switching node and the switching version number of the storage service group in response to the abnormality of the master node of the storage service group, the method further includes: in response to monitoring an abnormal event for the storage service group, performing abnormality detection on the master node; wherein the abnormal event includes: the heartbeat information of the main node is not received within a preset time period, and/or abnormal report information aiming at the storage service group is received; and determining that the master node of the storage service group is abnormal in response to the master node failing the abnormality detection.
The master node in the storage service group sends heartbeat information to the monitoring node at regular time. If the monitoring node does not receive the heartbeat information of the main node within the preset time, determining that the storage service group has an abnormal event. The terminal or the downstream server can not normally communicate with the storage service group or the response time of the storage service group is too long, and can also send abnormal reporting information to the monitoring node.
The monitoring node monitors the abnormal event aiming at the storage service group and detects the abnormality of the main node. The anomaly detection may include sending a detection request to the master node, determining that the master node storing the service group is anomalous if a request failure occurs, the request time is long, or the request returns a specific value, etc. After receiving the probe request, the master node can return a specific value to the monitoring node if the conditions of slow self disk, overlarge load and the like are detected.
Fig. 2 is a schematic diagram of a storage service group as a service end for performing node switching according to an embodiment of the present invention. There are two nodes Node-1 and Node-2 in the cluster, providing two storage service groups service-1 and service-2. As shown in the left part of fig. 2, in the initial state, node-1 is the master node for service-1, and the version number is m. For service-2, node-2 is the master node and the version number is n. The node switching process comprises the following steps:
step S01: the service instance service-1 and service-2 report heartbeat information (heartbeat) to the monitoring node (monitor).
Step S02: and when the heartbeat information is reported overtime, the monitoring node triggers an abnormality detection mechanism and actively invokes an abnormality detection interface.
Step S03: and triggering the dispatching switching aiming at the service-1 after the abnormal detection fails. As shown in the right part of FIG. 2, the master node is switched from node-1 to node-2, while the version number (version) of service-1 is increased from m to m+1.
Step S04: and the node-2 logs in an upstream server by using a login request with a version number of m+1, so as to realize the service of the failover low version.
And when the main node of the storage service group is abnormal, the monitoring node sends second control information to the main node. The second control information is used for closing the response service on the main node after the main node finishes processing the current service. The current service needs a period of time after the processing of the main node, or the network delay, the failure of closing the response service, and the like may cause the situation that a plurality of active response nodes exist in the storage service group at the same time. Based on the above, the embodiment of the invention also provides a processing method of the distributed storage service.
Fig. 3 is a schematic diagram of a flow of a method for processing a distributed storage service according to an embodiment of the present invention. The method is applied to a service node in a storage service group. As shown in fig. 3, the method includes:
step 301: receiving first control information sent by a monitoring node, wherein the first control information comprises: the version number is switched.
The switching version number is the version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node. The switch version number is different from the version number corresponding to the original master node.
The monitoring node is a node for providing the control method of the distributed storage service. The first control information may include: responding to the identification of the service, switching version number, call-up time, etc. After the switching node receives the first control information, the response service on the switching node is called up, and the switching version number is saved. The switching node realizes version control and fault transfer of the storage service group through switching the version number.
Step 302: sending a login request to an upstream server, wherein the login request comprises: the version number is switched.
And sending a login request carrying the version number to an upstream server, and determining whether the node is a master node of the storage service group or not by the upstream server according to the version number. The upstream server determines whether to establish a login connection according to whether the node is the master node of the storage service group.
Step 303: and receiving the return information sent by the upstream server, and carrying out subsequent storage business processing according to the return information.
If the returned information indicates successful login, the service request is continuously sent to the upstream service to perform service processing. And if the returned information represents login failure, returning prompt information of processing failure to the terminal or the downstream service.
In the scheme of the embodiment of the invention, the storage service group is used as the client, and when the upstream server is requested, the access control to the service node can be realized through the version number. When abnormal switching of the nodes occurs, the fault recovery and timely response of the storage service group can be guaranteed.
In an embodiment of the present invention, after receiving the first control information sent by the monitoring node, the method further includes: according to the first control information, calling up response service on the switching node; receiving a service request sent by a terminal or a downstream server; and calling response service, and after the response service on the switching node is called in response to the service request, the switching node serves as a new master node to provide service for the terminal and the downstream server.
In the scheme of the embodiment of the invention, if the storage service group is taken as the client, the failover scheme of taking the storage service group as the client is realized through the version number when the upstream server is requested. Meanwhile, when the storage service group is taken as a server side to provide service to the outside, a fault transfer scheme of taking the storage service group as the server side is realized.
Fig. 4 is a schematic diagram of a flow of a processing method of a login request according to an embodiment of the present invention. The method is applied to an upstream server. As shown in fig. 4, the method includes:
step 401: and receiving a login request sent by a service node in the storage service group.
The login request may include: an identification of a service node, a version number, an identification of a storage service group, etc.
Step 402: and determining whether the service node is a master node of the storage service group or not by using the monitoring node according to the switching version number in the login request and the identification of the storage service group.
The switching version number is the version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node. The switch version number is different from the version number corresponding to the original master node.
The monitoring node is a node for providing the control method of the distributed storage service. The upstream service queries the local cache for the presence of a version number in the login request, and if not, or if not, updates the latest version number from the monitoring node and caches it.
In one embodiment of the present invention, determining whether the service node is a master node of the storage service group according to the switch version number in the login request and the identification of the storage service group includes: transmitting a version acquisition request to the monitoring node, wherein the version acquisition request comprises: storing an identification of the service group; receiving a return version number sent by a monitoring node; it is determined whether the switch version number in the login request is the same as the return version number. If the switch version number in the login request is the same as the return version number, determining the service node as the master node for storing the service group. If the switch version number in the login request is not the same as the return version number, determining that the service node is not the master node storing the service group.
Step 403: and responding the service node as the master node for storing the service group, and returning information of successful login to the service node.
Step 404: and returning login failure information to the service node in response to the service node not being a master node storing the service group.
If the service node is not the master node storing the service group, after the service request of the service node is processed, the link with the service node is disconnected.
In the embodiment of the invention, the storage service group is used as a client, and when an upstream server is requested, a login request carrying a version number is sent. And realizing access control to the service node through the version number in the login request. When abnormal switching of the nodes occurs, the fault recovery and timely response of the storage service group can be guaranteed.
In one embodiment of the invention, the method further comprises: at a first time, a first service request is received from a first node storing a service group, the first service request comprising: a first version number; at a second time, a service request is received from a second node storing a service group, the second service request comprising: a second version number; responding to the first time being earlier than the second time, wherein the second version number is a switching version number of the first version number, processing the first service request, and processing the second service request after the first service request is processed; in response to the first time not being earlier than the second time and the second version number being a switch version number of the first version number, the second service request is processed and the first service request is discarded.
If the first service request of the main node before switching is received, the second service request of the main node after switching is received, and the second service request is processed after the first service request is processed. And if the first service request of the master node before switching is received, the second service request of the master node after switching is received, the second service request is processed, and the first service request is discarded. Through the processing, the data consistency after the node switching is ensured.
The storage service group is used as a client, node switching occurs at the time T1, and two nodes can simultaneously send service requests to the outside due to the problem of network partition in a period of time. Fig. 5a and 5b are schematic diagrams illustrating a service group being stored as a client, and an upstream server processing service requests sent by a master node before and after handover according to an embodiment of the present invention. As shown in fig. 5a and 5b, both the pre-switch node with version number m and the post-switch node with version number m+1 send a service request to the upstream server to write value=1.
As shown in fig. 5a, a first service request of a node before switching with a version number m arrives at an upstream server before a second service request of a node after switching with a version number m+1 arrives at the upstream server, and the upstream server queues the second service request of the node after switching with a version number m+1, waits for the first service request of the node before switching with a version number m to be completed, and then processes the second service request of the node after switching with a version number m+1.
As shown in fig. 5b, the first service request of the pre-switch node with version number m arrives at the upstream server later than the second service request of the post-switch node with version number m+1, and the first service request of the upstream server to the pre-switch node with version number m is directly rejected.
FIG. 6a is a schematic diagram of a storage service set as a client interacting with an upstream server, according to one embodiment of the present invention. As shown in fig. 6a, the storage service group communicates with the upstream server using TCP protocol. The interactive process comprises the following steps:
step S11: and the service nodes in the storage service group send login requests to the upstream server by using the storage service group identification and the version number of the service nodes.
Step S12: and determining whether the service node is a master node for storing the service group according to the version number in the login request.
The upstream server queries the local cache if the version number of the storage service set matches the version number in the login request. If not, the latest version number is updated from the monitoring node and cached.
Step S13: if the service node is not the master node storing the service group, waiting for the requests on the old links to have responded and disconnecting the old links.
Step S14: if the service node is the master node storing the service group, the successful login information is returned, and the subsequent service node can communicate with the upstream server through the established long link.
FIG. 6b is a schematic diagram of another storage service set provided by one embodiment of the invention as a client interacting with an upstream server. As shown in fig. 6b, the storage service group communicates with the upstream server using the HTTP protocol. The HTTP protocol itself is stateless, and differs from the TCP protocol in that the login information is maintained by session, and the overall flow is the same as that of the TCP protocol. The interactive process comprises the following steps:
step S21: and the service nodes in the storage service group send login requests to the upstream server by using the storage service group identification and the version number of the service nodes.
Step S22: and determining whether the service node is a master node for storing the service group according to the version number in the login request.
The upstream server queries the local cache if the version number of the storage service set matches the version number in the login request. If not, the latest version number is updated from the monitoring node and cached.
Step S23: if the service node is not the master node storing the service group, the service node waits for the request on the old session to be responded and updates the session.
Step S24: and returning to a login state.
FIG. 6c is a schematic diagram of a storage service set as a database client interacting with a database server, according to one embodiment of the invention. As shown in fig. 6c, the interaction procedure comprises the following steps:
step S31: and creating a version information table on the database server, wherein the version information table comprises fields such as an identification, a version number, a serial number and the like of the storage service group.
Step S32: when the application program is started, version information obtained from the control node is used for updating the version information table of the database.
Step S33: and the application program starts a transaction first after the operation of updating the database, and inquires the current version number of the storage service group from the version information table.
Step S34: and judging whether the queried version number is consistent with the version number in the service request, and if the queried version number is inconsistent with the version number in the service request, indicating that the service node sending the service request is failed to be transferred.
Step S35: and under the condition that the queried version number is consistent with the version number in the service request, performing updating operation on the service corresponding to the service request, and submitting the transaction.
Fig. 7 is a schematic diagram of a flow of a method for sending a storage service request according to an embodiment of the present invention. The method is applied to a terminal or a downstream server. As shown in fig. 7, the method includes:
Step 701: sending a node acquisition request to a monitoring node, wherein the node acquisition request comprises: the identity of the service group is stored.
The monitoring node is used for switching other service nodes into the master node when the storage service group is abnormal, and distributing switching version numbers for the other service nodes. The switch version number is different from the version number corresponding to the original master node.
Step 702: and receiving the master node information sent by the monitoring node.
Step 703: and sending a service request to a master node storing the service group according to the master node information.
The monitoring node is a node for providing the control method of the distributed storage service. The master node information may include: the identity of the master node, the version number, the IP address of the master node, etc. And determining a master node for storing the service group according to the master node information, and sending a service request to the master node for storing the service group.
In the embodiment of the invention, a terminal or a downstream server firstly acquires the information of a main node through a monitoring node and sends a service request to the main node of a storage service group. When the storage service group serves as a server side to provide service, a fault transfer scheme of the storage service group serving as the server side is realized through the monitoring node.
Fig. 8 is a schematic diagram of interaction between a storage service group and a server according to an embodiment of the present invention. As shown in fig. 8, the interaction process includes:
step S41: the Client (Client) queries the network configuration of the storage service group service-1 from the monitoring node (Monitor), and the query result mainly comprises: service-1's home node's service address. The service address consists of an ip address and a port number.
Step S42: the activity detection logic can report the abnormal report information of the storage service group to the monitoring node after determining that the request of the storage service group is overtime except that the main node automatically sends heartbeat information and the monitoring node actively detects the abnormality.
Step S43: the monitoring node immediately schedules the response service of the service-1 with the version number of m+1 on the node-2 after detecting the abnormality of the service-1 on the node-1. The monitoring node sends two asynchronous concurrent notifications. The first concurrent notification is used to push a message to the client to trigger the link to be switched onto node-2. The second concurrent notification is used to push a message to the proxy on node-1 to turn off the response service of service-1 with version number m. When the master node fails, the client can complete switching of the storage service group node within the timeout period.
Step S44: if node-2 fails, service-1 may also switch back to node-1. The order in which the nodes switch is protected by the version numbers of the storage service group. When the client establishes connection with the storage service group, whether the version number of the destination node is consistent with the version number in the processing request can be checked through a callback function of service registration.
Fig. 9 is a schematic structural diagram of a control device for a distributed storage service according to an embodiment of the present invention. As shown in fig. 9, applied to a monitoring node, the apparatus includes:
an information obtaining module 901, configured to obtain version information of a storage service group, where the version information includes: the identification of the master node and the current version number;
an information determining module 902, configured to determine, in response to an abnormality of a master node of the storage service group, a switching node and a switching version number of the storage service group, the switching version number being different from a current version number;
the node switching module 903 is configured to switch a master node of the storage service group to a switching node;
the information updating module 904 is configured to update version information of the storage service group according to the switching node and the switching version number of the storage service group, where the updated version information is used to control a service response of the storage service group.
Optionally, before determining the switching node and the switching version number of the storage service group in response to the abnormality of the master node of the storage service group, the method further includes:
in response to monitoring an abnormal event for the storage service group, performing abnormality detection on the master node; wherein the abnormal event includes: the heartbeat information of the main node is not received within a preset time period, and/or abnormal report information aiming at the storage service group is received;
and determining that the master node of the storage service group is abnormal in response to the master node failing the abnormality detection.
Optionally, switching the master node of the storage service group to the switching node includes:
transmitting first control information to a switching node; wherein the first control information includes: switching the version number, wherein the first control information is used for calling a response service on the switching node;
sending second control information to the master node; and the second control information is used for closing the response service on the main node after the main node finishes processing the current service.
Fig. 10 is a schematic structural diagram of a processing device for distributed storage service according to an embodiment of the present invention. As shown in fig. 10, the apparatus applied to a service node in a storage service group includes:
The information receiving module 1001 is configured to receive first control information sent by the monitoring node, where the first control information includes: switching the version number; the switching version number is a version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
a request sending module 1002, configured to send a login request to an upstream server, where the login request includes: switching the version number;
the service processing module 1003 is configured to receive the return information sent by the upstream server, and perform subsequent storage service processing according to the return information.
Optionally, the method further comprises:
a response module 1004, configured to invoke a response service on the switching node according to the first control information;
receiving a service request sent by a terminal or a downstream server;
and calling a response service to respond to the service request.
Fig. 11 is a schematic structural diagram of a processing device for login request according to an embodiment of the present invention. As shown in fig. 11, applied to an upstream server, the apparatus includes:
a request receiving module 1101, configured to receive a login request sent by a service node in a storage service group;
The node determining module 1102 is configured to determine, by using the monitoring node, whether the service node is a master node of the storage service group according to the switch version number in the login request and the identifier of the storage service group; the switching version number is a version allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
an information return module 1103, configured to return information of successful login to the service node in response to the service node being a master node storing the service group;
and returning login failure information to the service node in response to the service node not being a master node storing the service group.
Optionally, the node determining module 1102 is specifically configured to:
transmitting a version acquisition request to the monitoring node, wherein the version acquisition request comprises: storing an identification of the service group;
receiving a return version number sent by a monitoring node;
determining whether the switching version number in the login request is the same as the return version number;
responding to the switching version number in the login request and the return version number to be the same, and determining the service node as a main node for storing the service group;
and in response to the change version number in the login request being different from the return version number, determining that the service node is not the master node storing the service group.
Optionally, the method further comprises:
the information processing module 1004 is configured to receive, at a first time, a first service request from a first node storing a service group, where the first service request includes: a first version number;
at a second time, a service request is received from a second node storing a service group, the second service request comprising: a second version number;
responding to the first time being earlier than the second time, wherein the second version number is a switching version number of the first version number, processing the first service request, and processing the second service request after the first service request is processed;
in response to the first time not being earlier than the second time and the second version number being a switch version number of the first version number, the second service request is processed and the first service request is discarded.
Fig. 12 is a schematic structural diagram of a sending device for storing a service request according to an embodiment of the present invention. As shown in fig. 12, the apparatus is applied to a terminal or a downstream server, and includes:
a request sending module 1201, configured to send a node acquisition request to a monitoring node, where the node acquisition request includes: storing an identification of the service group; the monitoring node is used for switching other service nodes into the main node when the main node abnormality occurs in the storage service group, and distributing a switching version number for the other service nodes;
An information receiving module 1202, configured to receive master node information sent by a monitoring node;
the request sending module 1203 is configured to send a service request to a master node storing a service group according to the master node information.
The embodiment of the invention provides electronic equipment, which comprises:
one or more processors;
storage means 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 are caused to implement the methods of any of the embodiments described above.
Referring now to FIG. 13, there is illustrated a schematic diagram of a computer system 1300 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 13 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 13, the computer system 1300 includes a Central Processing Unit (CPU) 1301, which can execute various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1302 or a program loaded from a storage section 1308 into a Random Access Memory (RAM) 1303. In the RAM 1303, various programs and data necessary for the operation of the system 1300 are also stored. The CPU 1301, ROM 1302, and RAM 1303 are connected to each other through a bus 1304. An input/output (I/O) interface 1305 is also connected to bus 1304.
The following components are connected to the I/O interface 1305: an input section 1306 including a keyboard, a mouse, and the like; an output portion 1307 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 1308 including a hard disk or the like; and a communication section 1309 including a network interface card such as a LAN card, a modem, or the like. The communication section 1309 performs a communication process via a network such as the internet. The drive 1310 is also connected to the I/O interface 1305 as needed. Removable media 1311, such as magnetic disks, optical disks, magneto-optical disks, semiconductor memory, and the like, is installed as needed on drive 1310 so that a computer program read therefrom is installed as needed into storage portion 1308.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communication portion 1309 and/or installed from the removable medium 1311. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 1301.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: the system comprises an information acquisition module, an information determination module, a node switching module and an information updating module. The names of these modules do not limit the module itself in some cases, and for example, the information acquisition module may also be described as "acquiring version information of a storage service group, where the version information includes: the identity of the master node and the current version number.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
obtaining version information of a storage service group, wherein the version information comprises: the identification of the master node and the current version number;
determining a switching node and a switching version number of the storage service group in response to a master node abnormality of the storage service group, the switching version number being different from the current version number;
switching the main node of the storage service group to the switching node;
and updating version information of the storage service group according to the switching node and the switching version number of the storage service group, wherein the updated version information is used for controlling service response of the storage service group.
According to the technical scheme of the embodiment of the invention, when the main node of the storage service group is abnormal, the monitoring node determines the switching node and the switching version number of the storage service group and switches the main node of the storage service group into the switching node. And updating the version information of the storage service group according to the switching node and the switching version number of the storage service group. And controlling the service response of the storage service group by using the main node identification and the version number in the updated version information. The node switching can be realized without a lease lock, the consumed system resources are small, and the execution efficiency is high.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (15)

1. A method for controlling a distributed storage service, applied to a monitoring node, comprising:
obtaining version information of a storage service group, wherein the version information comprises: the identification of the master node and the current version number;
determining a switching node and a switching version number of the storage service group in response to a master node abnormality of the storage service group, the switching version number being different from the current version number;
switching the main node of the storage service group to the switching node;
and updating version information of the storage service group according to the switching node and the switching version number of the storage service group, wherein the updated version information is used for controlling service response of the storage service group.
2. The method of claim 1, wherein before determining the switch node and switch version number of the storage service group in response to the primary node anomaly of the storage service group, further comprising:
In response to monitoring an abnormal event for the storage service group, performing abnormality detection on the master node; wherein the abnormal event comprises: the heartbeat information of the master node is not received within a preset time period, and/or abnormal reporting information aiming at the storage service group is received;
and determining that the master node of the storage service group is abnormal in response to the master node failing to detect the abnormality.
3. The method of claim 1, wherein said switching the primary node of the storage service group to the switching node comprises:
transmitting first control information to the switching node; wherein the first control information includes: the switching version number and the first control information are used for calling up response service on the switching node;
sending second control information to the master node; and the second control information is used for closing the response service on the master node after the master node finishes processing the current service.
4. A method for processing a distributed storage service, which is applied to a service node in a storage service group, comprising:
receiving first control information sent by a monitoring node, wherein the first control information comprises: switching the version number; the switching version number is a version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
Sending a login request to an upstream server, the login request comprising: the switching version number;
and receiving the return information sent by the upstream server, and carrying out subsequent storage service processing according to the return information.
5. The method of claim 4, wherein after receiving the first control information sent by the monitoring node, further comprising:
according to the first control information, calling up response service on the switching node;
receiving a service request sent by a terminal or a downstream server;
and calling the response service and responding to the service request.
6. A method for processing a login request, which is applied to an upstream server, comprising:
receiving a login request sent by a service node in a storage service group;
determining whether the service node is a master node of the storage service group or not by using a monitoring node according to the switching version number in the login request and the identification of the storage service group; the switching version number is a version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
Responding to the service node as the main node of the storage service group, and returning information of successful login to the service node;
and returning login failure information to the service node in response to the service node not being the master node of the storage service group.
7. The method of claim 6, wherein the determining, by the usage monitoring node, whether the service node is a master node of the storage service group according to the version number in the login request and the identification of the service group, comprises:
transmitting a version acquisition request to the monitoring node, wherein the version acquisition request comprises the following components: an identification of the service group;
receiving a return version number sent by the monitoring node;
determining whether the switching version number in the login request is the same as the return version number;
responding to the switching version number in the login request and the return version number to be the same, and determining the service node as a master node of the storage service group;
and determining that the service node is not the master node of the storage service group in response to the fact that the switching version number in the login request is different from the return version number.
8. The method as recited in claim 6, further comprising:
At a first time, receiving a first service request from a first node of the stored service group, the first service request comprising: a first version number;
at a second time, receiving a service request from a second node of the stored service group, the second service request comprising: a second version number;
responding to the first time being earlier than the second time, wherein the second version number is a switching version number of the first version number, processing the first service request, and processing the second service request after the first service request is processed;
and in response to the first time not being earlier than the second time and the second version number being a switch version number of the first version number, processing the second service request and discarding the first service request.
9. A method for sending a storage service request, which is applied to a terminal or a downstream server, comprising:
sending a node acquisition request to a monitoring node, wherein the node acquisition request comprises the following steps: storing an identification of the service group; the monitoring node is used for switching other service nodes into the main node when the main node abnormality occurs in the storage service group, and distributing a switching version number for the other service nodes;
Receiving master node information sent by the monitoring node;
and sending a service request to the master node of the storage service group according to the master node information.
10. A control device for a distributed storage service, applied to a monitoring node, comprising:
the information acquisition module is used for acquiring version information of the storage service group, and the version information comprises: the identification of the master node and the current version number;
an information determining module, configured to determine a switching node and a switching version number of the storage service group in response to an abnormality of a master node of the storage service group, where the switching version number is different from the current version number;
the node switching module is used for switching the main node of the storage service group into the switching node;
and the information updating module is used for updating the version information of the storage service group according to the switching node and the switching version number of the storage service group, and the updated version information is used for controlling the service response of the storage service group.
11. A processing apparatus for distributed storage of traffic, applied to a service node in a storage service group, comprising:
the information receiving module is configured to receive first control information sent by a monitoring node, where the first control information includes: switching the version number; the switching version number is a version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
The request sending module is used for sending a login request to the upstream server, and the login request comprises: the switching version number;
and the service processing module is used for receiving the return information sent by the upstream server and carrying out subsequent storage service processing according to the return information.
12. A processing apparatus for a login request, applied to an upstream server, comprising:
the request receiving module is used for receiving a login request sent by a service node in the storage service group;
the node determining module is used for determining whether the service node is a main node of the storage service group or not by utilizing a monitoring node according to the switching version number in the login request and the identification of the storage service group; the switching version number is a version number allocated to the service node by the monitoring node when the storage service group is abnormal and the service node is switched to the master node;
the information return module is used for responding the service node as the main node of the storage service group and returning the successful login information to the service node;
and returning login failure information to the service node in response to the service node not being the master node of the storage service group.
13. A transmitting device for storing a service request, applied to a terminal or a downstream server, comprising:
the request sending module is configured to send a node acquisition request to a monitoring node, where the node acquisition request includes: storing an identification of the service group; the monitoring node is used for switching other service nodes into the main node when the main node abnormality occurs in the storage service group, and distributing a switching version number for the other service nodes;
the information receiving module is used for receiving the master node information sent by the monitoring node;
and the request sending module is used for sending a service request to the master node of the storage service group according to the master node information.
14. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-9.
15. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-9.
CN202311139447.2A 2023-09-05 2023-09-05 Control method and device for distributed storage service Pending CN117221093A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311139447.2A CN117221093A (en) 2023-09-05 2023-09-05 Control method and device for distributed storage service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311139447.2A CN117221093A (en) 2023-09-05 2023-09-05 Control method and device for distributed storage service

Publications (1)

Publication Number Publication Date
CN117221093A true CN117221093A (en) 2023-12-12

Family

ID=89038069

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311139447.2A Pending CN117221093A (en) 2023-09-05 2023-09-05 Control method and device for distributed storage service

Country Status (1)

Country Link
CN (1) CN117221093A (en)

Similar Documents

Publication Publication Date Title
US11172023B2 (en) Data synchronization method and system
CN111615066B (en) Distributed micro-service registration and calling method based on broadcast
US7076691B1 (en) Robust indication processing failure mode handling
US7518983B2 (en) Proxy response apparatus
US7870425B2 (en) De-centralized nodal failover handling
CN112118315A (en) Data processing system, method, device, electronic equipment and storage medium
CN110120961B (en) Distributed service cluster and route synchronization method thereof
EP1989863A1 (en) Gateway for wireless mobile clients
US20130139178A1 (en) Cluster management system and method
CN111158949A (en) Configuration method, switching method and device of disaster recovery architecture, equipment and storage medium
US9026839B2 (en) Client based high availability method for message delivery
JP2005301436A (en) Cluster system and failure recovery method for it
CN111245939B (en) Data synchronization method, device and system
CN111240760B (en) Application publishing method, system, storage medium and equipment based on registry
CN112256447A (en) Message notification method and system
CN117221093A (en) Control method and device for distributed storage service
CN114968636A (en) Fault processing method and device
US20160261476A1 (en) Message system for avoiding processing-performance decline
CN114816866A (en) Fault processing method and device, electronic equipment and storage medium
US20230146880A1 (en) Management system and management method
CN111316606A (en) Optimized reconciliation in controller-switch networks
CN115208799B (en) Heartbeat management method, device and storage medium
JPH10116257A (en) Decentralized media processing server, and communication network using the same
US20230370332A1 (en) Computer system and communication method
CN115412562A (en) Service registration and subscription method, device and equipment

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