[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN116938881B - Method, system, equipment and readable storage medium for realizing dynamic IP pool - Google Patents

Method, system, equipment and readable storage medium for realizing dynamic IP pool Download PDF

Info

Publication number
CN116938881B
CN116938881B CN202311196972.8A CN202311196972A CN116938881B CN 116938881 B CN116938881 B CN 116938881B CN 202311196972 A CN202311196972 A CN 202311196972A CN 116938881 B CN116938881 B CN 116938881B
Authority
CN
China
Prior art keywords
node
nodes
auxiliary
abnormal
unit
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.)
Active
Application number
CN202311196972.8A
Other languages
Chinese (zh)
Other versions
CN116938881A (en
Inventor
尹行刚
陈毓泰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Innovation Technology Co ltd
Original Assignee
Shenzhen Innovation 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 Shenzhen Innovation Technology Co ltd filed Critical Shenzhen Innovation Technology Co ltd
Priority to CN202311196972.8A priority Critical patent/CN116938881B/en
Publication of CN116938881A publication Critical patent/CN116938881A/en
Application granted granted Critical
Publication of CN116938881B publication Critical patent/CN116938881B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5061Pools of addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a method, a system, a device and a readable storage medium for realizing a dynamic IP pool, which relate to the technical field of communication processing and comprise the following steps: each node simultaneously competes with the ETCD distributed lock to elect a master node; periodically interacting the main node and the auxiliary node through gRPC, detecting whether the main node and the auxiliary node are abnormal, and reelecting the main node if the main node is abnormal; if the auxiliary node is abnormal, the main node takes over the auxiliary node IP or distributes the auxiliary node IP to other normal auxiliary nodes to take over; and the main node and the auxiliary node execute a preset detection cycle script respectively, and if the self service execution is abnormal, the node is processed according to the preset IP change. Based on the gRPC+ETCD framework, the main node election and the state monitoring are carried out by the ETCD; through gRPC communication, the service detection content is planned, various types of abnormal IP takeover are defined, and when the node fails or the IP is lost, the invention can still realize NAS high-availability service.

Description

Method, system, equipment and readable storage medium for realizing dynamic IP pool
Technical Field
The present invention relates to the field of communications processing technologies, and in particular, to a method, a system, an apparatus, and a readable storage medium for implementing a dynamic IP pool.
Background
The existing Network Attached Storage (NAS) high-availability design architecture based on Unified Distributed Storage (UDS) is highly dependent on a distributed key value storage system (ETCD), an ETCD database and NAS storage can be mixed and deployed on the same node in the cluster deployment process, and when the ETCD breaks down, the cluster node is abnormal, so that the drift and the takeover of NAS high-availability service and high-availability NAS IP cannot be completely realized. And the architecture highly binds ETCD, and after finding ETCD fault or cluster node abnormality, it is difficult to increase and modify related services.
Disclosure of Invention
The present invention aims to provide a method, a system, a device and a readable storage medium for implementing a dynamic IP pool, so as to solve the above problems. In order to achieve the above purpose, the technical scheme adopted by the invention is as follows:
in a first aspect, the present application provides a method for implementing a dynamic IP pool, for a node, including: the cluster nodes are connected with the distributed key value storage system, all nodes compete for the distributed lock of the distributed key value storage system to elect a master node, the node for obtaining the distributed lock is the master node, and other nodes are slave nodes; periodically interacting the master node and the slave node through a Google remote procedure call protocol, detecting whether the master node and the slave node are abnormal, and reelecting the master node if the master node is abnormal to obtain a new master node; if the auxiliary node is abnormal, the main node takes over the auxiliary node IP or distributes the auxiliary node IP to other normal auxiliary nodes to take over; and the main node and the auxiliary node execute a preset detection cycle script respectively, judge whether own business is abnormal, and process the node according to the preset IP change if the own business is abnormal.
In a second aspect, the present application further provides a system for implementing a dynamic IP pool, including: the system comprises a node election unit, a node interaction unit, an interface unit and a service detection unit. The node election unit is used for each node to compete with the distributed lock election master node of the distributed key value storage system at the same time. The node interaction unit is used for periodically interacting the master node and the slave node through a google remote procedure call protocol. The interface unit is used for inputting a preset detection cycle script. The service detection unit is used for respectively executing a preset detection cycle script by the main node and the auxiliary node and judging whether the service of the main node and the auxiliary node is abnormal.
In a third aspect, the present application further provides an apparatus for implementing a dynamic IP pool, including:
a memory for storing a computer program;
and a processor for implementing the steps of the method for implementing a dynamic IP pool when executing the computer program.
In a fourth aspect, the present application further provides a readable storage medium, including a computer program stored on the readable storage medium, where the computer program, when executed by a processor, implements the steps of the method for implementing a dynamic IP pool.
The beneficial effects of the invention are as follows:
the invention uses the distributed key value storage system (ETCD) architecture based on google remote procedure call protocol (gRPC), and uses the ETCD to perform main node election, state monitoring, service discovery and load balancing; through gRPC frame, the invention can plan the service detection content, and solve the problem of abnormal take over of various types, when node fails or IP is lost, the invention can still realize NAS high availability service.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the embodiments of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following description will briefly explain the drawings needed in the embodiments, it being understood that the following drawings illustrate only some embodiments of the invention and are therefore not to be considered limiting of its scope, since other related drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method step S100 for implementing a dynamic IP pool in the practice of the present invention;
FIG. 2 is a flowchart of a method step S200 for implementing a dynamic IP pool in the practice of the present invention;
FIG. 3 is a flowchart of a method step S300 for implementing a dynamic IP pool in the practice of the present invention;
FIG. 4 is a schematic diagram of a system architecture for implementing dynamic IP pools in an embodiment of the present invention;
fig. 5 is a schematic diagram of a device structure for implementing a dynamic IP pool in the implementation of the present invention.
The marks in the figure:
400. a node election unit; 500. a node interaction unit; 600. an interface unit; 700. a service detection unit; 410. a renting unit; 420. a revision unit; 430. a first comparing unit; 440. a rental unit; 510. a reporting unit; 520. a character lifting unit; 530. a second comparing unit; 540. a third comparing unit; 550. a notification unit; 560. a collection unit; 570. a distribution unit; 580. a return unit; 710. a detection unit; 711. a service planning unit; 720. a first judgment unit; 730. a second judgment unit; 731. an IP change unit; 800. a device implementing a dynamic IP pool; 801. a processor; 802. a memory; 803. an instruction input port; 804. an I/O interface; 805. a communication component.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Example 1:
the embodiment provides a method for realizing a dynamic IP pool, which is used for a node end and comprises the following steps:
s100, the cluster nodes are connected with the distributed key value storage system, all nodes compete for the distributed lock of the distributed key value storage system to elect a master node, the node for obtaining the distributed lock is the master node, and other nodes are slave nodes. The master node is unique in the cluster nodes and has the synchronization and scheduling allocation privileges, and after the master node is elected, each node starts to execute own business.
S200, periodically interacting the master node and the slave node through a Google remote procedure call protocol, detecting whether the master node and the slave node are abnormal, and re-electing the master node if the master node is abnormal to obtain a new master node; if the auxiliary node is abnormal, the main node takes over the auxiliary node IP or distributes the auxiliary node IP to other normal auxiliary nodes to take over;
s300, the main node and the auxiliary node execute preset detection cycle scripts respectively, whether own business is abnormal or not is judged, and if the own business is abnormal, the node is processed according to preset IP change.
As shown in fig. 1, in some embodiments, step S100 includes step S110, step S120, step S130, and step S140.
S110, taking the machine ID of each node as a corresponding unique identifier, and each node respectively creates leases for the unique identifiers of the nodes;
s120, each node writes the identifier and lease of the node into a distributed key value storage system, and obtains a returned revision value according to a revision mechanism of the distributed key value storage system, and each node records the revision value of the node;
s130, comparing the sizes of the revision values of all nodes, and selecting the node with the smallest revision value to obtain a distributed lock, wherein the node is a main node, and other nodes are auxiliary nodes;
and S140, the master node performs lease renewal on the lease through a heartbeat mechanism.
The periodic interaction in step S200 includes that the secondary node periodically reports own information to the primary node and the primary node periodically collects secondary node information. As shown in fig. 2, in some embodiments, step S200 includes step S210, step S220, step S230, step S240, step S250, step S260, step S270, and step S280.
S210, when the slave node periodically reports the role of the slave node to the master node through a Google remote procedure call protocol and is online, if the report is overtime, judging that the master node is abnormal, and the slave node initiates election;
s220, the auxiliary node promotes the role of the auxiliary node to be an competitor, and the period number is added with 1 to obtain an updated period number;
s230, acquiring the tenure numbers of other nodes, comparing whether the updated tenure numbers are consistent with the tenure numbers of other nodes, and if not, using the competitor as a new master node;
s240, if the two nodes are consistent, the competitor compares the IP size with other nodes, selects the node with large IP as a new main node, and automatically reduces the role to a secondary node by the node with small IP;
it should be noted that, in the architecture of the present application, the asynchronous model has a plurality of nodes that become competitors at the same time, and the situation that the opposite party has not updated any period number is obtained, so when this occurs, the cluster nodes need to compete for the distributed lock again to avoid generating a plurality of master nodes.
S250, after the new master node is elected, the new master node informs other nodes of the tening period number of the new master node and synchronizes the tening period of other nodes;
s260, the main node periodically collects the information of the auxiliary node through a google remote procedure call protocol;
s270, if the information of a certain auxiliary node collected by the main node in the step S260 is overtime, judging that the auxiliary node is abnormal, and the main node takes over the auxiliary node IP or distributes the auxiliary node IP to other normal auxiliary nodes for taking over;
s280, the main node collects the auxiliary node information again through the step S260, and if the auxiliary node information is collected normally, the auxiliary node IP is automatically returned by the take-over node.
As shown in fig. 3, in some embodiments, step S300 includes step S310, step S320, and step S330.
S310, detecting node roles, and calling corresponding google remote procedure call protocols according to different roles to carry out cycle detection on node services; the detection includes a high availability service node state, a high availability configuration network card state, a physical device state, a network file system process, and an information service block process.
S320, if the detection on the main node in the step S310 is abnormal, judging that the service execution of the main node is abnormal, and reelecting the main node;
s330, if the detection on the secondary node in the step S310 is abnormal, judging that the service execution of the secondary node is abnormal, and processing the secondary node by the main node according to the preset IP change.
It should be noted that the preset IP change specifically includes:
when the high available service node pauses, the node IP is taken over by other normal nodes; when the high available service node is recovered, the node IP is automatically returned by the takeover node; when the high-availability configuration network card is disconnected, the node IP is taken over by other normal nodes; when the high-availability configuration network card is reconnected, the node IP is automatically returned by the takeover node; when the physical equipment corresponding to the node is shut down, restarted or powered off, the node IP is taken over by other normal nodes; when the physical equipment corresponding to the node is started and normally operates, the node IP is automatically returned by the takeover node; when the network file system process stops or is abnormal, the node IP is taken over by other normal nodes; the node IP is taken over by other normal nodes when the information service block process stops or is abnormal.
In some specific embodiments, step S140 includes step S141 and step S142.
S141, when the node crashes during the period that the master node holds the distributed lock, the heartbeat mechanism stops, the unique identifier is deleted due to the expiration of the lease, and the master node releases the distributed lock, so that deadlock is avoided;
s142, the other nodes compete for the distributed lock, and a new master node is selected.
Example 2:
as shown in fig. 4, the present embodiment provides a system for implementing a dynamic IP pool, including:
the node election unit 400 is used for simultaneously competing the distributed lock election master node of the distributed key value storage system by each node;
the node interaction unit 500 is configured to periodically interact with the master node and the slave node through a google remote procedure call protocol;
an interface unit 600 for inputting a preset detection cycle script;
the service detection unit 700 is configured to execute a preset detection cycle script by the master node and the slave node respectively, and determine whether the own service is abnormal.
In some specific embodiments, the node election unit 400 includes:
a lease creating unit 410, configured to use a machine ID of each node as a corresponding unique identifier, where each node creates a lease for its own unique identifier;
the revising unit 420 is configured to write the identifier and lease of each node into the distributed key value storage system, obtain a returned revised value according to a revising mechanism of the distributed key value storage system, and record each node's own revised value;
the first comparing unit 430 is configured to compare the sizes of the revision values of the nodes, select a node with the smallest revision value to obtain a distributed lock, where the node is a master node, and other nodes are slave nodes;
and the renewing unit 440 is configured to renew the lease by the master node through a heartbeat mechanism.
In some specific embodiments, the node interaction unit 500 includes:
a reporting unit 510, configured to periodically report, to the master node, that the slave node has a role of slave node and is online through google remote procedure call protocol;
a role lifting unit 520, configured to lift the role of the secondary node to be an competitor, and add 1 to the tenn to obtain an updated tenn;
a second comparing unit 530, configured to obtain the tenns of the other nodes, compare whether the updated tenns are consistent with the tenns of the other nodes, and if they are inconsistent, use the competitor as a new master node;
a third comparing unit 540, configured to compare the IP size of the competitor with other nodes when the result of the second comparing unit is consistent, select a node with a large IP as a new master node, and automatically reduce the role to a slave node by a node with a small IP;
a notification unit 550, configured to notify the new master node of the tening period number of the new master node of the other nodes after the new master node is elected, and synchronize the tening periods of the other nodes;
the collecting unit 560 is configured to periodically collect information of the secondary node by the primary node through google remote procedure call protocol;
an allocation unit 570, configured to, when the master node collects information about a certain slave node and times out, take over the slave node IP by the master node or allocate the slave node IP to other normal slave nodes;
and the return unit 580 is configured to collect the secondary node information again by the master node through google remote procedure call protocol, and when the secondary node information is collected normally, the secondary node IP is automatically returned by the takeover node.
In some specific embodiments, the traffic detection unit 700 includes:
the detecting unit 710 is configured to detect a node role, and call a corresponding google remote procedure call protocol according to different roles to perform cycle detection on a node service;
a first judging unit 720, configured to judge that the service execution of the master node is abnormal when the detection on the master node is abnormal, and reselect the master node;
and a second judging unit 730, configured to judge that the service execution of the secondary node is abnormal when the detection on the secondary node is abnormal, and the primary node processes the secondary node according to the preset IP change.
In some specific real-time examples, the detection unit 710 includes:
a service planning unit 711, configured to plan detection contents, where the detection includes a high available service node state, a high available configuration network card state, a physical device state, a network file system process, and an information service block process;
in some specific real-time examples, the second determining unit 730 includes:
an IP change unit 731 for taking over the node IP by other normal nodes when the high available service node is suspended; when the high available service node is recovered, the node IP is automatically returned by the takeover node; when the high-availability configuration network card is disconnected, the node IP is taken over by other normal nodes; when the high-availability configuration network card is reconnected, the node IP is automatically returned by the takeover node; when the physical equipment corresponding to the node is shut down, restarted or powered off, the node IP is taken over by other normal nodes; when the physical equipment corresponding to the node is started and normally operates, the node IP is automatically returned by the takeover node; when the network file system process stops or is abnormal, the node IP is taken over by other normal nodes; the node IP is taken over by other normal nodes when the information service block process stops or is abnormal.
Example 3:
corresponding to the above method embodiment, there is further provided a device for implementing a dynamic IP pool in this embodiment, where the device for implementing a dynamic IP pool described below and the method for implementing a dynamic IP pool described above may be referred to correspondingly with each other.
Fig. 5 is a block diagram illustrating an apparatus implementing dynamic IP pooling in accordance with an exemplary embodiment. As shown in fig. 5, the apparatus 800 for implementing a dynamic IP pool includes: a processor 801, a memory 802. The device implementing dynamic IP pooling may also include one or more of an instruction input port 803, an i/O interface 804, and a communication component 805.
Wherein the processor 801 is configured to control overall operation of a device implementing the dynamic IP pool to complete all or part of the steps in the method for implementing the dynamic IP pool described above. Memory 802 is used to store various types of data to support the operation of devices implementing the dynamic IP pool, which may include, for example, instructions for any application or method operating on the device implementing the dynamic IP pool, as well as application-related data. The Memory 802 may be implemented by any type or combination of volatile or non-volatile Memory devices, such as static random access Memory (Static Random Access Memory, SRAM for short), electrically erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM for short), erasable programmable Read-Only Memory (Erasable Programmable Read-Only Memory, EPROM for short), programmable Read-Only Memory (Programmable Read-Only Memory, PROM for short), read-Only Memory (ROM for short), magnetic Memory, flash Memory, magnetic disk, or optical disk. The instruction input port 803 may include a screen and a keyboard. Wherein the screen may be, for example, a touch screen, a keyboard for outputting and/or inputting program instructions. The received program instructions may be further stored in memory 802 or transmitted via communications component 805. The I/O interface 804 provides an interface between the processor 801 and other interface modules, which may be a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is configured to perform wired or wireless communication between the device implementing the dynamic IP pool and other devices. Wireless communication, such as Wi-Fi, bluetooth, near field communication (Near FieldCommunication, NFC for short), 2G, 3G or 4G, or a combination of one or more thereof, the respective communication component 805 may thus comprise: wi-Fi module, bluetooth module, NFC module.
In an exemplary embodiment, the device 800 implementing the dynamic IP pool may be implemented by one or more application specific integrated circuits (Application Specific Integrated Circuit, abbreviated ASIC), digital signal processor (DigitalSignal Processor, abbreviated DSP), digital signal processing device (Digital Signal Processing Device, abbreviated DSPD), programmable logic device (Programmable Logic Device, abbreviated PLD), field programmable gate array (Field Programmable Gate Array, abbreviated FPGA), controller, microcontroller, microprocessor, or other electronic component for performing the above-described method of implementing the dynamic IP pool.
Example 4:
corresponding to the above method embodiment, there is further provided a storage medium in this embodiment, where the storage medium is a readable storage medium, and a readable storage medium described below and a method for implementing a dynamic IP pool described above may be referred to correspondingly.
A readable storage medium having stored thereon a computer program which when executed by a processor 801 performs the steps of the method of implementing a dynamic IP pool of the above-described method embodiments.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, and the like.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (8)

1. A method for implementing a dynamic IP pool, for a node, comprising:
the cluster nodes are connected with the distributed key value storage system, all nodes compete for the distributed lock of the distributed key value storage system to elect a master node, the node for obtaining the distributed lock is the master node, and other nodes are slave nodes;
periodically interacting the master node and the slave node through a Google remote procedure call protocol, detecting whether the master node and the slave node are abnormal, and reelecting the master node if the master node is abnormal to obtain a new master node; if the auxiliary node is abnormal, the main node takes over the auxiliary node IP or distributes the auxiliary node IP to other normal auxiliary nodes to take over;
the main node and the auxiliary node execute a preset detection cycle script respectively, and judge whether own business is abnormal or not, comprising the following steps:
detecting node roles, and calling corresponding google remote procedure call protocols according to different roles to circularly detect node services; the detection comprises a high-availability service node state, a high-availability configuration network card state, a physical equipment state, a network file system process and an information service block process;
if the detection on the main node is abnormal, judging that the service execution of the main node is abnormal, and reelecting the main node;
if the detection on the auxiliary node is abnormal, judging that the service execution of the auxiliary node is abnormal, and processing the auxiliary node by the main node according to the preset IP change, wherein the preset IP change specifically comprises:
when the high available service node pauses, the node IP is taken over by other normal nodes; when the high available service node is recovered, the node IP is automatically returned by the takeover node; when the high-availability configuration network card is disconnected, the node IP is taken over by other normal nodes; when the high-availability configuration network card is reconnected, the node IP is automatically returned by the takeover node; when the physical equipment corresponding to the node is shut down, restarted or powered off, the node IP is taken over by other normal nodes; when the physical equipment corresponding to the node is started and normally operates, the node IP is automatically returned by the takeover node; when the network file system process stops or is abnormal, the node IP is taken over by other normal nodes; the node IP is taken over by other normal nodes when the information service block process stops or is abnormal.
2. The method for implementing a dynamic IP pool of claim 1, wherein each node simultaneously contends for a distributed lock of a distributed key value storage system, the node that obtains the distributed lock being a primary node, and the other nodes being secondary nodes, comprising:
taking the machine ID of each node as a corresponding unique identifier, and each node respectively creates leases for the unique identifiers of the nodes;
each node writes the identifier and lease of the node into a distributed key value storage system, obtains a returned revision value according to a revision mechanism of the distributed key value storage system, and records the revision value of the node;
comparing the sizes of the revisions of the nodes, and selecting the node with the smallest revisions to obtain a distributed lock, wherein the node is a main node, and other nodes are auxiliary nodes;
the master node renews the lease through a heartbeat mechanism.
3. The method for implementing a dynamic IP pool according to claim 1, wherein the master node performs periodic interaction with the slave node through a google remote procedure call protocol, and detects whether the master node and the slave node are abnormal, the periodic interaction includes the slave node periodically reporting own information to the master node and the master node periodically collecting slave node information, including:
when the slave node periodically reports the role of the slave node to the master node through the Google remote procedure call protocol and is online, if the report is overtime, the master node is judged to be abnormal, and the slave node initiates election;
the auxiliary node promotes the role of the auxiliary node to be an competitor, and adds 1 to the tenn to obtain an updated tenn;
acquiring the tenure numbers of other nodes, comparing whether the updated tenure numbers are consistent with the tenure numbers of other nodes, and if not, using the competitor as a new master node;
if the nodes are consistent, the competitor compares the IP size with other nodes, selects the node with large IP as a new main node, and the node with small IP automatically reduces the role to a secondary node;
after the new master node is selected, the new master node informs other nodes of the tening period number of the new master node and synchronizes the tening period of other nodes;
the main node periodically collects information of the auxiliary node through a google remote procedure call protocol;
if the information of a certain auxiliary node collected by the main node is overtime, judging that the auxiliary node is abnormal, and the main node takes over the auxiliary node IP or distributes the auxiliary node IP to other normal auxiliary nodes to take over;
and the main node collects the information of the auxiliary node again through the google remote procedure call protocol, and if the information of the auxiliary node is collected normally, the auxiliary node IP is automatically returned by the take-over node.
4. A system for implementing a dynamic IP pool, comprising:
the node election unit is used for simultaneously competing the distributed lock election master node of the distributed key value storage system by each node;
the node interaction unit is used for periodically interacting the main node and the auxiliary node through a google remote procedure call protocol;
the interface unit is used for inputting a preset detection cycle script;
the service detection unit is used for respectively executing a preset detection cycle script by the main node and the auxiliary node and judging whether the own service is abnormal;
the service detection unit includes:
the detection unit is used for detecting node roles, and calling corresponding google remote procedure call protocols according to different roles to carry out cyclic detection on node services;
the first judging unit is used for judging that the service execution of the main node is abnormal when the detection on the main node is abnormal, and reelecting the main node;
the second judging unit is used for judging that the service execution of the auxiliary node is abnormal when the detection on the auxiliary node is abnormal, and the main node processes the auxiliary node according to the preset IP change;
the detection unit includes:
the service planning unit is used for planning detection contents, wherein the detection comprises a high-availability service node state, a high-availability configuration network card state, a physical equipment state, a network file system process and an information service block process;
the second judging unit includes:
an IP change unit, configured to take over, when a high available service node is suspended, the node IP by other normal nodes; when the high available service node is recovered, the node IP is automatically returned by the takeover node; when the high-availability configuration network card is disconnected, the node IP is taken over by other normal nodes; when the high-availability configuration network card is reconnected, the node IP is automatically returned by the takeover node; when the physical equipment corresponding to the node is shut down, restarted or powered off, the node IP is taken over by other normal nodes; when the physical equipment corresponding to the node is started and normally operates, the node IP is automatically returned by the takeover node; when the network file system process stops or is abnormal, the node IP is taken over by other normal nodes; the node IP is taken over by other normal nodes when the information service block process stops or is abnormal.
5. The system for implementing a dynamic IP pool of claim 4 wherein said node election unit comprises:
the lease creating unit is used for taking the machine ID of each node as a corresponding unique identifier, and each node creates lease for the unique identifier of each node;
the revising unit is used for writing the identifier and lease of each node into the distributed key value storage system, obtaining a returned revised value according to a revising mechanism of the distributed key value storage system, and recording the revised value of each node;
the first comparison unit is used for comparing the sizes of the revisions of the nodes, selecting the node with the smallest revisions to obtain a distributed lock, wherein the node is a main node, and other nodes are auxiliary nodes;
and the renewing unit is used for renewing the lease by the master node through a heartbeat mechanism.
6. The system for implementing a dynamic IP pool of claim 4 wherein said node interaction unit comprises:
the reporting unit is used for periodically reporting the role of the slave node to the master node through the Google remote procedure call protocol as the slave node and is online;
the role lifting unit is used for lifting the role of the auxiliary node to be an competitor, and adding 1 to the tenn number to obtain an updated tenn number;
the second comparison unit is used for acquiring the tenure numbers of other nodes, comparing whether the updated tenure numbers are consistent with the tenure numbers of other nodes or not, and if not, using the competitor as a new master node;
the third comparison unit is used for comparing the IP size of the competitor with other nodes when the results of the second comparison unit are consistent, selecting the node with large IP as a new main node, and automatically reducing the role to a secondary node by the node with small IP;
the notification unit is used for notifying other nodes of the tening period number of the new master node after the new master node is elected, and synchronizing the tening periods of other nodes;
the collecting unit is used for periodically collecting auxiliary node information by the main node through a google remote procedure call protocol;
the distribution unit is used for taking over the auxiliary node IP by the main node or distributing the auxiliary node IP to other normal auxiliary nodes when the main node collects certain auxiliary node information overtime;
and the return unit is used for collecting the information of the auxiliary node again by the main node through the google remote procedure call protocol, and when the information of the auxiliary node is collected normally, the auxiliary node IP is automatically returned by the take-over node.
7. An apparatus for implementing a dynamic IP pool, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the method of implementing a dynamic IP pool according to any of claims 1 to 3 when said computer program is executed.
8. A readable storage medium, comprising a computer program stored thereon, which when executed by a processor, implements the steps of the method of implementing a dynamic IP pool according to any of claims 1 to 3.
CN202311196972.8A 2023-09-18 2023-09-18 Method, system, equipment and readable storage medium for realizing dynamic IP pool Active CN116938881B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311196972.8A CN116938881B (en) 2023-09-18 2023-09-18 Method, system, equipment and readable storage medium for realizing dynamic IP pool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311196972.8A CN116938881B (en) 2023-09-18 2023-09-18 Method, system, equipment and readable storage medium for realizing dynamic IP pool

Publications (2)

Publication Number Publication Date
CN116938881A CN116938881A (en) 2023-10-24
CN116938881B true CN116938881B (en) 2024-02-09

Family

ID=88382907

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311196972.8A Active CN116938881B (en) 2023-09-18 2023-09-18 Method, system, equipment and readable storage medium for realizing dynamic IP pool

Country Status (1)

Country Link
CN (1) CN116938881B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111258771A (en) * 2020-01-16 2020-06-09 青木数字技术股份有限公司 Method and system for realizing distributed lock based on Raft algorithm
CN112866408A (en) * 2021-02-09 2021-05-28 山东英信计算机技术有限公司 Service switching method, device, equipment and storage medium in cluster
CN113434279A (en) * 2021-07-14 2021-09-24 上海浦东发展银行股份有限公司 Task execution method, device, equipment and storage medium
CN113596195A (en) * 2021-08-23 2021-11-02 重庆紫光华山智安科技有限公司 Public IP address management method, device, main node and storage medium
CN113949691A (en) * 2021-10-15 2022-01-18 湖南麒麟信安科技股份有限公司 ETCD-based virtual network address high-availability implementation method and system
CN114764380A (en) * 2021-01-15 2022-07-19 国电南瑞科技股份有限公司 Distributed cluster control method and device based on ETCD
CN116319280A (en) * 2023-03-23 2023-06-23 中电云数智科技有限公司 Method for electing master and slave nodes based on kubernetes distributed lock

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080281938A1 (en) * 2007-05-09 2008-11-13 Oracle International Corporation Selecting a master node in a multi-node computer system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111258771A (en) * 2020-01-16 2020-06-09 青木数字技术股份有限公司 Method and system for realizing distributed lock based on Raft algorithm
CN114764380A (en) * 2021-01-15 2022-07-19 国电南瑞科技股份有限公司 Distributed cluster control method and device based on ETCD
CN112866408A (en) * 2021-02-09 2021-05-28 山东英信计算机技术有限公司 Service switching method, device, equipment and storage medium in cluster
CN113434279A (en) * 2021-07-14 2021-09-24 上海浦东发展银行股份有限公司 Task execution method, device, equipment and storage medium
CN113596195A (en) * 2021-08-23 2021-11-02 重庆紫光华山智安科技有限公司 Public IP address management method, device, main node and storage medium
CN113949691A (en) * 2021-10-15 2022-01-18 湖南麒麟信安科技股份有限公司 ETCD-based virtual network address high-availability implementation method and system
CN116319280A (en) * 2023-03-23 2023-06-23 中电云数智科技有限公司 Method for electing master and slave nodes based on kubernetes distributed lock

Also Published As

Publication number Publication date
CN116938881A (en) 2023-10-24

Similar Documents

Publication Publication Date Title
CN109308227B (en) Fault detection control method and related equipment
CN106330523A (en) Cluster server disaster recovery system and method, and server node
CN110417600B (en) Node switching method and device of distributed system and computer storage medium
CN107659948B (en) Method and device for controlling access of AP (access point)
CN114064414A (en) High-availability cluster state monitoring method and system
CN112948063A (en) Cloud platform creation method and device, cloud platform and cloud platform implementation system
CN103377101A (en) Testing system and testing method
CN112199240A (en) Method for switching nodes during node failure and related equipment
CN113377535A (en) Distributed timing task allocation method, device, equipment and readable storage medium
CN107122271B (en) Method, device and system for recovering node event
CN112865995B (en) Distributed master-slave system
CN108810166A (en) Route management method, system, computer equipment and computer readable storage medium
CN109587218B (en) Cluster election method and device
CN116938881B (en) Method, system, equipment and readable storage medium for realizing dynamic IP pool
CN105812159B (en) A kind of cloud platform monitoring alarm method
JP2009223519A (en) Cluster system and method for selecting master node in system
CN114020279A (en) Application software distributed deployment method, system, terminal and storage medium
CN113765690A (en) Cluster switching method, system, device, terminal, server and storage medium
CN105589787A (en) Health check method and heath check system for application program
CN108228328B (en) Stream task implementation method and device and electronic equipment
CN116991591B (en) Data scheduling method, device and storage medium
CN111324513A (en) Monitoring management method and system for artificial intelligence development platform
CN113515403B (en) Micro-service state checking method, computer device and storage medium
CN114785673B (en) Method and device for acquiring abnormal information during active-standby switching
CN110991676B (en) Operation and maintenance management platform based on modularized design

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
GR01 Patent grant
GR01 Patent grant