CN117135162A - Method, system, equipment and storage medium for selecting key value database cluster - Google Patents

Method, system, equipment and storage medium for selecting key value database cluster Download PDF

Info

Publication number
CN117135162A
CN117135162A CN202311117720.1A CN202311117720A CN117135162A CN 117135162 A CN117135162 A CN 117135162A CN 202311117720 A CN202311117720 A CN 202311117720A CN 117135162 A CN117135162 A CN 117135162A
Authority
CN
China
Prior art keywords
node
election
request
information
cluster
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
CN202311117720.1A
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.)
Inspur Jinan data Technology Co ltd
Original Assignee
Inspur Jinan data 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 Inspur Jinan data Technology Co ltd filed Critical Inspur Jinan data Technology Co ltd
Priority to CN202311117720.1A priority Critical patent/CN117135162A/en
Publication of CN117135162A publication Critical patent/CN117135162A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/16Arrangements for providing special services to substations
    • H04L12/18Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
    • H04L12/1886Arrangements for providing special services to substations for broadcast or conference, e.g. multicast with traffic restrictions for efficiency improvement, e.g. involving subnets or subdomains
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/16Arrangements for providing special services to substations
    • H04L12/18Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
    • H04L12/1895Arrangements for providing special services to substations for broadcast or conference, e.g. multicast for short real-time information, e.g. alarms, notifications, alerts, updates
    • 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/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • H04L67/1051Group master selection mechanisms
    • 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]
    • 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
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a method, a system, equipment and a storage medium for selecting a key value database cluster, wherein the method comprises the following steps: responding to receiving election requests of other nodes in the key value database cluster, and comparing the information of the request node carried in the election request with the information of the current node to determine whether the request node wins the election; the current node sends an election response message and information about whether the request node is agreed to be a master node to the request node according to an election result; responding to the fact that all nodes in the cluster agree that the request node is a master node, broadcasting an election ending request message to all nodes in the cluster, and attaching master node information to the election ending request message; and ending the election process of the request node in response to the existence of the node in the cluster not agreeing that the request node is the master node. The application optimizes the existing election process, and if the election process is finished within the preset time, the application does not wait any more and continues the subsequent process.

Description

Method, system, equipment and storage medium for selecting key value database cluster
Technical Field
The present application relates to the field of distributed storage systems, and in particular, to a method, system, device, and storage medium for key-value database cluster election.
Background
The existing election mechanism of CTDB (key value database cluster) is that after each node enters an election state, the node decides who is the master node of the CTDB cluster through negotiation (comprising a process starting time point and a physical node number size), after the negotiation is finished, the node still needs to wait for 3 seconds to overtime, and the election process is finished; the purpose of waiting for a 3 second timeout is to cope with the problem of message transmission delay in an environment where the network is poor. However, for CTDB clusters where the network environment is good, these three seconds of waiting are not required at all.
Disclosure of Invention
In view of this, an object of the embodiments of the present application is to provide a method, a system, an electronic device, and a computer readable storage medium for electing a key value database cluster, where after receiving an election request message of another node, the application does not update a 3 second timer to wait again, and when the node wins the election, the application also does not send an election request to all nodes in the cluster; by adding an election ending message processing flow, the election ending message carries the PNN number of the CTDB cluster master node and is used for synchronizing a final negotiation result, information dyssynchrony among nodes is avoided, and a timer waiting for 3 seconds to overtime is canceled; the high availability of storage service is improved, the robustness, usability and functional richness of the system are improved, and the distributed product competitiveness is improved.
Based on the above objects, an aspect of the embodiments of the present application provides a method for selecting a key-value database cluster, including the following steps: responding to receiving election requests of other nodes in the key value database cluster, and comparing the information of the request node carried in the election request with the information of the current node to determine whether the request node wins the election; the current node sends an election response message and information about whether the request node is agreed to be a master node to the request node according to an election result; responding to the fact that all nodes in the cluster agree that the request node is a master node, broadcasting an election ending request message to all nodes in the cluster, and attaching master node information to the election ending request message; and ending the election process of the request node in response to the existence of the node in the cluster not agreeing that the request node is the master node.
In some embodiments, the step of the current node sending an election response message to the requesting node and information about whether to agree to the requesting node as a master node according to an election result includes: responding to the request node to win election, the current node sends an election response message with the PNN number of the current node and information for agreeing that the request node is a master node to the request node; and responding to the fact that the request node does not win election, the current node sends an election response message with the PNN number of the current node and information of disagreeing that the request node is a master node to the request node.
In some embodiments, the step of the current node sending an election response message to the requesting node and information about whether to agree to the requesting node as a master node according to an election result includes: and in response to the request node winning the election and the current node holding the recovery lock, releasing the recovery lock and notifying the main process to update the main node information to the request node.
In some embodiments, the method further comprises: and determining whether all nodes in the cluster agree with the request node as the master node according to election response messages returned by other nodes and information of whether the request node is agreed to be the master node.
In some embodiments, the step of determining whether all nodes in the cluster agree to the request node as the master node according to the election response message returned by the other nodes and the information about whether to agree to the request node as the master node includes: updating global variables of the election results of all nodes in the cluster according to PNN numbers in election response messages returned by other nodes and information about whether the request node is agreed to be a master node; and traversing the election result of each node in the locally stored global variable to check whether all nodes in the cluster agree that the request node is the master node.
In some embodiments, the method further comprises: and in response to the node receiving the election ending message, releasing a timer started when the election begins.
In some embodiments, the method further comprises: and synchronizing the master node information of the key value database cluster carried in the election ending message to the master process of the current node, and ending the election flow.
In another aspect of the embodiment of the present application, a system for selecting a key-value database cluster is provided, including: the comparison module is used for responding to the received election request of other nodes in the key value database cluster, and comparing the information of the request node carried in the election request with the information of the current node to determine whether the request node wins the election; the sending module is used for sending an election response message and information about whether the request node is agreed to be a master node to the request node according to an election result by the current node; the broadcasting module is used for responding to the fact that all the nodes in the cluster agree that the request node is the master node, broadcasting an election ending request message to all the nodes in the cluster, and attaching master node information to the election ending request message; and the ending module is used for ending the election flow of the request node in response to the fact that the node in the cluster does not agree that the request node is the master node.
In still another aspect of the embodiment of the present application, there is also provided an electronic device, including: at least one processor; and a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method as above.
In yet another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium storing a computer program which, when executed by a processor, implements the method steps as described above.
The application has the following beneficial technical effects: after receiving the election request message of other nodes, the timer is not updated for waiting again for 3 seconds, and after the node wins the election, the election request is not sent to all the nodes in the cluster; by adding an election ending message processing flow, the election ending message carries the PNN number of the CTDB cluster master node and is used for synchronizing a final negotiation result, information dyssynchrony among nodes is avoided, and a timer waiting for 3 seconds to overtime is canceled; the high availability of storage service is improved, the robustness, usability and functional richness of the system are improved, and the distributed product competitiveness is improved.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are necessary for the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application and that other embodiments may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an embodiment of a method for key-value database cluster election provided by the present application;
FIG. 2 is a flowchart illustrating the resolution of an election process switch according to the present application;
FIG. 3 is a flowchart of an election request process provided by the present application;
FIG. 4 is a flowchart of an election response message process provided by the present application;
FIG. 5 is a flowchart of the process of the election ending message provided by the present application;
FIG. 6 is a logical view of a new election process provided by the present application;
FIG. 7 is a schematic diagram of an embodiment of a system for key-value database cluster election provided by the present application;
FIG. 8 is a schematic diagram of a hardware structure of an embodiment of an electronic device for key database cluster election provided by the present application;
FIG. 9 is a schematic diagram of an embodiment of a computer storage medium for key-value database cluster election provided by the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the following embodiments of the present application will be described in further detail with reference to the accompanying drawings.
It should be noted that, in the embodiments of the present application, all the expressions "first" and "second" are used to distinguish two entities with the same name but different entities or different parameters, and it is noted that the "first" and "second" are only used for convenience of expression, and should not be construed as limiting the embodiments of the present application, and the following embodiments are not described one by one.
In a first aspect of the embodiment of the present application, an embodiment of a method for selecting a key-value database cluster is provided. FIG. 1 is a schematic diagram of an embodiment of a method for key-value database cluster election provided by the present application. As shown in fig. 1, the embodiment of the present application includes the following steps:
s1, responding to receiving election requests of other nodes in a key value database cluster, and comparing information of a request node carried in the election requests with information of a current node to determine whether the request node wins election;
s2, the current node sends an election response message and information about whether the request node is agreed to be a master node or not to the request node according to an election result;
s3, responding to the fact that all nodes in the cluster agree that the request node is the master node, broadcasting an election ending request message to all nodes in the cluster, and attaching master node information to the election ending request message; and
and S4, responding to the fact that the nodes in the cluster do not agree with the request node as the master node, and ending the election flow of the request node.
The embodiment of the application adds a new election process, and the new election process mainly achieves the aim by adding and modifying the following processes: modifying a process for initiating election, mainly initializing the process, and subsequently recording global variables of election states of all nodes; after receiving the election request message of other nodes, the timer is not updated for waiting again for 3 seconds, and after the node wins the election, the election request is not sent to all the nodes in the cluster; adding an election response message processing flow, and checking whether other nodes in the cluster agree that the node is a master node of the CTDB cluster; by adding the election ending message processing flow, the election ending message carries the PNN number of the CTDB cluster master node for synchronizing the final negotiation result, avoiding the information non-synchronization among nodes, and canceling the timer waiting for 3 seconds to overtime.
The embodiment of the application also reserves the original election process, so that an election process switch is additionally arranged, and a user can select whether to enable a new election process in the CTDB service.
Fig. 2 is a flowchart of analysis of an election process switch provided by the present application, as shown in fig. 2, a new analysis process of an election process switch is as follows: the user configures a new election flow switch to be on or off in the configuration file; starting a CTDB process according to starting parameters set in the configuration file; calling a CTDB set command in a start script to set a value of a switch into a CTDB process according to a switch of a new election process configured in a configuration file; according to the configured switch, the CTDB process is determined to use the original election process or the new election process for election.
In the new election process, after receiving the election request of other nodes in the CTDB cluster, the 3-second timer is not updated to wait for the election request of other nodes, and whether the node initiating the election request is the master node of the CTDB cluster or not is judged by comparison (comprising the process starting time point and the physical node number size), an election response message is returned to the node initiating the request, the comparison result is carried back in the message, and corresponding operation is carried out according to the comparison result.
In some embodiments, the step of the current node sending an election response message to the requesting node and information about whether to agree to the requesting node as a master node according to an election result includes: responding to the request node to win election, the current node sends an election response message with the PNN number of the current node and information for agreeing that the request node is a master node to the request node; and responding to the fact that the request node does not win election, the current node sends an election response message with the PNN number of the current node and information of disagreeing that the request node is a master node to the request node.
In some embodiments, the step of the current node sending an election response message to the requesting node and information about whether to agree to the requesting node as a master node according to an election result includes: and in response to the request node winning the election and the current node holding the recovery lock, releasing the recovery lock and notifying the main process to update the main node information to the request node.
Fig. 3 is a flowchart of an election request processing provided by the present application, and as shown in fig. 3, a processing flow of a node receiving an election request of another node is as follows: according to the configuration file, a switch of a new election process is configured to determine whether to walk the new election process, the following processes all assume that the switch of the new election process is opened, and the new election process does not update the 3s timeout timer to wait for the election request message of other nodes; comparing the information of the request node brought by the election request message with the information of the node to elect a master node; if the node wins the election, sending an election response message to the node sending the election request, wherein the message is attached with the PNN number of the node and the information of not agreeing to the request node as the main node, and ending the election request processing flow; if the node fails in election, sending an election response message to the node sending the election request, wherein the message is attached with the PNN number of the node and information of the node agreeing to be the main node, if the node holds a recovery lock, releasing the recovery lock, informing a main process to update the main node information to be the election request node, and ending the election request processing flow.
In some embodiments, the method further comprises: and determining whether all nodes in the cluster agree with the request node as the master node according to election response messages returned by other nodes and information of whether the request node is agreed to be the master node.
In some embodiments, the step of determining whether all nodes in the cluster agree to the request node as the master node according to the election response message returned by the other nodes and the information about whether to agree to the request node as the master node includes: updating global variables of the election results of all nodes in the cluster according to PNN numbers in election response messages returned by other nodes and information about whether the request node is agreed to be a master node; and traversing the election result of each node in the locally stored global variable to check whether all nodes in the cluster agree that the request node is the master node.
After receiving the election response message, the node checks whether all nodes in the cluster agree that the node becomes a master node of the CTDB cluster, if all other nodes in the cluster agree that the node is the master node, the node broadcasts an election ending request message to all nodes in the cluster, and the message is attached with the information of the master node; otherwise, ending the election response message processing flow.
Fig. 4 is a flowchart of an election response message processing provided by the present application, as shown in fig. 4, the election response message processing is as follows: determining whether to walk the new election process according to the configuration file configured with the switch of the new election process, wherein the following processes all assume that the switch of the new election process is opened, and the old election process does not process the message; using PNN number carried back by the election response message and information about whether to agree with the election request node as a master node, and updating global variables of the election results of all nodes in the cluster recorded by the node; traversing election results of all nodes in the locally stored global variable, and checking whether all nodes in the cluster agree that the node is a master node; if all nodes in the cluster agree that the node is the master node, broadcasting an election ending message with information of the master node to all nodes in the cluster to synchronize the master node information of all nodes in the cluster; if the node does not agree that the node is the master node, ending the response message processing flow.
In some embodiments, the method further comprises: and synchronizing the master node information of the key value database cluster carried in the election ending message to the master process of the current node, and ending the election flow.
When the node receives the election ending message, the node can consider that the master node of the CTDB cluster has been elected and is approved by all nodes in the CTDB cluster, and in order to avoid inconsistent master node information of all nodes in the cluster, the master node information is synchronized in the processing flow of the election ending message, and a 3-second timeout timer started in the election flow is canceled to finish the election flow.
In some embodiments, the method further comprises: and in response to the node receiving the election ending message, releasing a timer started when the election begins.
Fig. 5 is a flowchart of processing an election ending message provided by the present application, as shown in fig. 5, the processing flow of the election ending message is as follows: determining whether to walk the new election process according to the configuration file configured with the switch of the new election process, wherein the following processes all assume that the switch of the new election process is opened, and the old election process does not process the message; when the node receives the election ending message, the node can consider that the election is ended, and a timer for waiting for receiving the election message started at the beginning of the election is not necessary, so that the timer is released; and synchronizing the information of the master node of the CTDB cluster carried in the message to the master process of the node, and ending the election process.
Fig. 6 is a logic view of a new election process provided in the present application, as shown in fig. 6, when CTDB3 fails, CTDB0 sends an election request to CTDB1 and CTDB2, and when CTDB1 and CTDB2 agree with CTDB0 as a master node, the election ends.
The user controls the new election process switch through the ctdbd.conf configuration file. The new election process is used when the profile parameter ctdb_set_electric new enabled is 1, and the old election process is used when it is 0. Default to use the old election process (i.e., no such configuration is added to the configuration file and the new election process is off). The configuration using the new election process is exemplified as follows: ctdb_set_electric newenabled=1; the configuration using the old election process is exemplified as follows: ctdb_set_electric newenabled=0.
It should be noted that, in the above embodiments of the key-value database cluster election method, the steps may be intersected, replaced, added and deleted, so that the method of selecting the key-value database cluster by using these reasonable permutation and combination transformations shall also belong to the protection scope of the present application, and shall not limit the protection scope of the present application to the embodiments.
Based on the above object, in a second aspect of the embodiments of the present application, a system for electing a key-value database cluster is provided. As shown in fig. 7, the system 200 includes the following modules: the comparison module is used for responding to the received election request of other nodes in the key value database cluster, and comparing the information of the request node carried in the election request with the information of the current node to determine whether the request node wins the election; the sending module is used for sending an election response message and information about whether the request node is agreed to be a master node to the request node according to an election result by the current node; the broadcasting module is used for responding to the fact that all the nodes in the cluster agree that the request node is the master node, broadcasting an election ending request message to all the nodes in the cluster, and attaching master node information to the election ending request message; and the ending module is used for ending the election flow of the request node in response to the fact that the node in the cluster does not agree that the request node is the master node.
In some embodiments, the sending module is further configured to: responding to the request node to win election, the current node sends an election response message with the PNN number of the current node and information for agreeing that the request node is a master node to the request node; and responding to the fact that the request node does not win election, the current node sends an election response message with the PNN number of the current node and information of disagreeing that the request node is a master node to the request node.
In some embodiments, the sending module is further configured to: and in response to the request node winning the election and the current node holding the recovery lock, releasing the recovery lock and notifying the main process to update the main node information to the request node.
In some embodiments, the system further comprises an inspection module for: and determining whether all nodes in the cluster agree with the request node as the master node according to election response messages returned by other nodes and information of whether the request node is agreed to be the master node.
In some embodiments, the inspection module is further to: updating global variables of the election results of all nodes in the cluster according to PNN numbers in election response messages returned by other nodes and information about whether the request node is agreed to be a master node; and traversing the election result of each node in the locally stored global variable to check whether all nodes in the cluster agree that the request node is the master node.
In some embodiments, the system further comprises a release module for: and in response to the node receiving the election ending message, releasing a timer started when the election begins.
In some embodiments, the system further comprises a synchronization module for: and synchronizing the master node information of the key value database cluster carried in the election ending message to the master process of the current node, and ending the election flow.
In view of the above object, a third aspect of an embodiment of the present application provides an electronic device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions being executable by the processor to perform the steps of: s1, responding to receiving election requests of other nodes in a key value database cluster, and comparing information of a request node carried in the election requests with information of a current node to determine whether the request node wins election; s2, the current node sends an election response message and information about whether the request node is agreed to be a master node or not to the request node according to an election result; s3, responding to the fact that all nodes in the cluster agree that the request node is the master node, broadcasting an election ending request message to all nodes in the cluster, and attaching master node information to the election ending request message; and S4, responding to the fact that the nodes in the cluster do not agree with the request node as the master node, and ending the election flow of the request node.
In some embodiments, the step of the current node sending an election response message to the requesting node and information about whether to agree to the requesting node as a master node according to an election result includes: responding to the request node to win election, the current node sends an election response message with the PNN number of the current node and information for agreeing that the request node is a master node to the request node; and responding to the fact that the request node does not win election, the current node sends an election response message with the PNN number of the current node and information of disagreeing that the request node is a master node to the request node.
In some embodiments, the step of the current node sending an election response message to the requesting node and information about whether to agree to the requesting node as a master node according to an election result includes: and in response to the request node winning the election and the current node holding the recovery lock, releasing the recovery lock and notifying the main process to update the main node information to the request node.
In some embodiments, the steps further comprise: and determining whether all nodes in the cluster agree with the request node as the master node according to election response messages returned by other nodes and information of whether the request node is agreed to be the master node.
In some embodiments, the step of determining whether all nodes in the cluster agree to the request node as the master node according to the election response message returned by the other nodes and the information about whether to agree to the request node as the master node includes: updating global variables of the election results of all nodes in the cluster according to PNN numbers in election response messages returned by other nodes and information about whether the request node is agreed to be a master node; and traversing the election result of each node in the locally stored global variable to check whether all nodes in the cluster agree that the request node is the master node.
In some embodiments, the steps further comprise: and in response to the node receiving the election ending message, releasing a timer started when the election begins.
In some embodiments, the steps further comprise: and synchronizing the master node information of the key value database cluster carried in the election ending message to the master process of the current node, and ending the election flow.
Fig. 8 is a schematic hardware structure of an embodiment of the electronic device for key-value database cluster election provided by the present application.
Taking the example of the apparatus shown in fig. 8, a processor 301 and a memory 302 are included in the apparatus.
The processor 301 and the memory 302 may be connected by a bus or otherwise, for example in fig. 8.
The memory 302 is used as a non-volatile computer readable storage medium for storing non-volatile software programs, non-volatile computer executable programs, and modules, such as program instructions/modules corresponding to the method for selecting a key-value database cluster in the embodiment of the present application. The processor 301 executes various functional applications of the server and data processing, i.e. a method of implementing key-value database cluster election, by running non-volatile software programs, instructions and modules stored in the memory 302.
Memory 302 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created from the use of the method of key-value database cluster election, etc. In addition, memory 302 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 embodiments, memory 302 may optionally include memory located remotely from processor 301, which may be connected to the local module via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Computer instructions 303 corresponding to the method of key-value database cluster election, or methods of key-value database cluster election, are stored in memory 302 that, when executed by processor 301, perform the method of key-value database cluster election in any of the method embodiments described above.
Any one embodiment of the electronic device executing the key value database cluster election method can achieve the same or similar effect as any one embodiment of the method corresponding to the embodiment of the key value database cluster election method.
The application also provides a computer readable storage medium storing a computer program which when executed by a processor performs a method of key value database cluster election.
FIG. 9 is a schematic diagram of a computer storage medium for selecting the key-value database cluster according to an embodiment of the present application. Taking a computer storage medium as shown in fig. 9 as an example, the computer-readable storage medium 401 stores a computer program 402 that when executed by a processor performs the above method.
Finally, it should be noted that, as will be appreciated by those skilled in the art, all or part of the processes in the methods of the embodiments described above may be implemented by a computer program for instructing the relevant hardware, and the program of the method for selecting a key database cluster may be stored in a computer readable storage medium, where the program may include the processes in the embodiments of the methods described above when executed. The storage medium of the program may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (RAM), or the like. The computer program embodiments described above may achieve the same or similar effects as any of the method embodiments described above.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that as used herein, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The foregoing embodiment of the present application has been disclosed with reference to the number of embodiments for the purpose of description only, and does not represent the advantages or disadvantages of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, and the program may be stored in a computer readable storage medium, where the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will appreciate that: the above discussion of any embodiment is merely exemplary and is not intended to imply that the scope of the disclosure of embodiments of the application, including the claims, is limited to such examples; combinations of features of the above embodiments or in different embodiments are also possible within the idea of an embodiment of the application, and many other variations of the different aspects of the embodiments of the application as described above exist, which are not provided in detail for the sake of brevity. Therefore, any omission, modification, equivalent replacement, improvement, etc. of the embodiments should be included in the protection scope of the embodiments of the present application.

Claims (10)

1. A method of key-value database cluster election, comprising the steps of:
responding to receiving election requests of other nodes in the key value database cluster, and comparing the information of the request node carried in the election request with the information of the current node to determine whether the request node wins the election;
the current node sends an election response message and information about whether the request node is agreed to be a master node to the request node according to an election result;
responding to the fact that all nodes in the cluster agree that the request node is a master node, broadcasting an election ending request message to all nodes in the cluster, and attaching master node information to the election ending request message; and
and ending the election flow of the request node in response to the fact that the node in the cluster does not agree that the request node is the master node.
2. The method of claim 1, wherein the step of the current node sending an election response message to the requesting node and information about whether to agree to the requesting node as a master node according to an election result comprises:
responding to the request node to win election, the current node sends an election response message with the PNN number of the current node and information for agreeing that the request node is a master node to the request node; and
and responding to the fact that the request node does not win election, the current node sends an election response message with the PNN number of the current node and information of disagreeing that the request node is a master node to the request node.
3. The method of claim 2, wherein the step of the current node sending an election response message to the requesting node and information about whether to agree to the requesting node as a master node according to an election result comprises:
and in response to the request node winning the election and the current node holding the recovery lock, releasing the recovery lock and notifying the main process to update the main node information to the request node.
4. The method of key-value database cluster election of claim 1, further comprising:
and determining whether all nodes in the cluster agree with the request node as the master node according to election response messages returned by other nodes and information of whether the request node is agreed to be the master node.
5. The method according to claim 4, wherein the step of determining whether all nodes in the cluster agree to the request node as the master node according to the election response message returned by other nodes and the information about whether to agree to the request node as the master node comprises:
updating global variables of the election results of all nodes in the cluster according to PNN numbers in election response messages returned by other nodes and information about whether the request node is agreed to be a master node; and
and traversing the election result of each node in the locally stored global variable to check whether all nodes in the cluster agree that the request node is a master node.
6. The method of key-value database cluster election of claim 1, further comprising:
and in response to the node receiving the election ending message, releasing a timer started when the election begins.
7. The method of key-value database cluster election of claim 6, further comprising:
and synchronizing the master node information of the key value database cluster carried in the election ending message to the master process of the current node, and ending the election flow.
8. A system for key-value database cluster election, comprising:
the comparison module is used for responding to the received election request of other nodes in the key value database cluster, and comparing the information of the request node carried in the election request with the information of the current node to determine whether the request node wins the election;
the sending module is used for sending an election response message and information about whether the request node is agreed to be a master node to the request node according to an election result by the current node;
the broadcasting module is used for responding to the fact that all the nodes in the cluster agree that the request node is the master node, broadcasting an election ending request message to all the nodes in the cluster, and attaching master node information to the election ending request message; and
and the ending module is used for ending the election flow of the request node in response to the fact that the node in the cluster does not agree that the request node is the master node.
9. An electronic device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method of any one of claims 1-7.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method of any one of claims 1-7.
CN202311117720.1A 2023-08-31 2023-08-31 Method, system, equipment and storage medium for selecting key value database cluster Pending CN117135162A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311117720.1A CN117135162A (en) 2023-08-31 2023-08-31 Method, system, equipment and storage medium for selecting key value database cluster

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311117720.1A CN117135162A (en) 2023-08-31 2023-08-31 Method, system, equipment and storage medium for selecting key value database cluster

Publications (1)

Publication Number Publication Date
CN117135162A true CN117135162A (en) 2023-11-28

Family

ID=88859727

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311117720.1A Pending CN117135162A (en) 2023-08-31 2023-08-31 Method, system, equipment and storage medium for selecting key value database cluster

Country Status (1)

Country Link
CN (1) CN117135162A (en)

Similar Documents

Publication Publication Date Title
CN109831500B (en) Synchronization method for configuration file and Pod in Kubernetes cluster
CN108683718B (en) Data increment synchronization method and device, electronic equipment and storage medium
CN106685917A (en) Method and system for realizing intelligent binding between Internet of Things device and controller
CN112860282B (en) Cluster plug-in upgrading method, device and server
CN110545207B (en) Synchronous automatic intelligent DNS system and configuration method
CN113965578B (en) Election method, device, equipment and storage medium of master node in cluster
CN112463318B (en) Timing task processing method, device and system
WO2023071999A1 (en) User matching method and apparatus, and device and storage medium
CN112650812A (en) Data fragment storage method and device, computer equipment and storage medium
CN112003943A (en) Voice data synchronization method and device
CN114765623A (en) Information subscribing method, information distributing method and device
CN109947081B (en) Internet vehicle control method and device
CN112437119B (en) Distributed system upgrading method, device and node
CN108536541B (en) Process engine object processing method and device
CN104104701A (en) Online service configuration updating method and system
CN109725964A (en) Skin change method, device, the electronic equipment of mixed type frame
CN117135162A (en) Method, system, equipment and storage medium for selecting key value database cluster
CN101751292B (en) Method for realizing consistency function of multimachine core data in ATC (automatic timing corrector) system
CN114780217B (en) Task scheduling method, device, computer equipment and medium
CN113900728B (en) Synchronous configuration method, system, electronic equipment and storage medium
CN113064950B (en) Data synchronization method, device, equipment and storage medium
CN110769399B (en) Internet of things equipment connection networking method, internet of things equipment system and information access and transmission method
CN114281395B (en) Method, system, device and storage medium for maintaining consistency of online upgrade data
CN111414242A (en) Running method, device, server, system and storage medium of state machine
CN116401317B (en) Cache data synchronization method and device, electronic equipment and medium

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