CN111884919A - Method, device, equipment and readable medium for clearing invalid virtual IP - Google Patents

Method, device, equipment and readable medium for clearing invalid virtual IP Download PDF

Info

Publication number
CN111884919A
CN111884919A CN202010625519.4A CN202010625519A CN111884919A CN 111884919 A CN111884919 A CN 111884919A CN 202010625519 A CN202010625519 A CN 202010625519A CN 111884919 A CN111884919 A CN 111884919A
Authority
CN
China
Prior art keywords
state information
virtual
container
docker service
keepalived
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010625519.4A
Other languages
Chinese (zh)
Other versions
CN111884919B (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202010625519.4A priority Critical patent/CN111884919B/en
Publication of CN111884919A publication Critical patent/CN111884919A/en
Application granted granted Critical
Publication of CN111884919B publication Critical patent/CN111884919B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/22Alternate routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/28Routing or path finding of packets in data switching networks using route fault recovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/58Association of routers
    • H04L45/586Association of routers of virtual routers
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method for clearing invalid virtual IP, which comprises the following steps: acquiring state information of a docker service and state information of a keepalive container at preset time intervals; judging whether the virtual IP of the local machine is invalid or not according to the state information of the docker service and the state information of the keepalive container; and if the virtual IP fails, clearing the virtual IP. The invention also discloses a device for clearing the invalid virtual IP, computer equipment and a readable storage medium. According to the method and the device, the state of the docker service and the keepalive container is monitored, and the dynamic clearing of the invalid VIP of the cluster is realized, so that the normal switching of the VIP in the cluster is ensured, and the high availability of the cluster environment is ensured.

Description

Method, device, equipment and readable medium for clearing invalid virtual IP
Technical Field
The invention relates to the technical field of cloud computing, in particular to a method, a device, equipment and a readable medium for clearing invalid virtual IP.
Background
Cloud computing technology has developed as a trend in the IT industry today. The cloud computing can build physical resources through a professional network company, and a user can obtain cloud services through an internet access mode. Just like a kind of negotiable goods, the biggest characteristic is transmission through the internet. Any cloud environment should guarantee connectivity and high availability of services, whether in a system environment or a production environment.
Therefore, in the system deployment process, the requirements on the safety and the reliability of the server are high, and in the case of server failure, the operation needs to be recovered in the shortest possible time. And whether the function can be realized is a main index of whether the system achieves high availability.
Among the many schemes that are highly available, keepalived + Haproxy is one implementation that is often employed. The keepalived is used for detecting the state of the server, if one server is down or other faults occur to cause that the current server is unavailable, the keepalived can detect and remove the fault server from the system, meanwhile, the standby server is used for replacing the work of the server, when the server works normally, the keepalived automatically adds the server into a server group, and all the work is automatically completed without manual interference. The keepalived software mainly realizes the high available function through the VRRP protocol. VRRP (Virtual Router redundancy protocol), which aims to solve the problem of single point failure of static routing, can ensure that the whole network can operate uninterruptedly when an individual node is down. However, when keepalive and Haproxy are deployed by containerization installation, when a docker container service or a keepalive container is restarted, the VIP of the local host cannot be normally released occasionally, and the situation that two identical VIPs exist in the same cluster environment occurs, but one of the VIPs cannot provide service at this time, so that normal use of the system is affected.
Disclosure of Invention
In view of this, an object of the embodiments of the present invention is to provide a method, an apparatus, a device, and a readable medium for clearing an invalid virtual IP, which implement dynamic clearing of a cluster invalid VIP by monitoring states of a docker service and a keepalived container, so as to ensure normal switching of VIPs in a cluster and ensure high availability of a cluster environment.
Based on the above object, an aspect of the embodiments of the present invention provides a method for clearing an invalid virtual IP, including the following steps: acquiring state information of a docker service and state information of a keepalive container at preset time intervals; judging whether the virtual IP of the local machine is invalid or not according to the state information of the docker service and the state information of the keepalive container; and if the virtual IP fails, clearing the virtual IP.
In some embodiments, acquiring the state information of the docker service and the state information of the keepalived container at preset time intervals includes: creating a timing task which is executed once per minute by using a crontab to execute a processing script for acquiring the state information of the docker service and the state information of the keepalive container; and running the processing script to execute the operation of acquiring the state information of the docker service and the state information of the keepalived container once every preset time.
In some embodiments, determining whether the native virtual IP fails according to the state information of the docker service and the state information of the keepalived container includes: judging whether the state of the docker service is running or not according to the state information of the docker service; and if the status of the docker service is not running, the virtual IP is considered to be invalid.
In some embodiments, determining whether the native virtual IP fails according to the state information of the docker service and the state information of the keepalived container includes: judging whether the state of the keepalive container is up according to the state information of the keepalive container; if the status of the keepalived container is not up, the virtual IP is considered to be invalid.
In some embodiments, determining whether the native virtual IP fails according to the state information of the docker service and the state information of the keepalived container includes: judging whether the state of the docker service is running or not according to the state information of the docker service, and judging whether the state of the keepalive container is up or not according to the state information of the keepalive container; if the status of the docker service is running and the status of the keepalive container is up, the virtual IP is considered to be not failed.
In some embodiments, clearing the virtual IP comprises: and acquiring the network card name of the detection node where the virtual IP is located, and clearing the virtual IP under the network card name path.
In another aspect of the embodiments of the present invention, an apparatus for clearing an invalid virtual IP is further provided, including: the state acquisition module is configured to acquire state information of the docker service and state information of the keepalived container at preset time intervals; the judging module is configured to judge whether the virtual IP of the local machine fails according to the state information of the docker service and the state information of the keepalive container; and the execution module is configured to clear the virtual IP if the virtual IP fails.
In some embodiments, the state acquisition module is further configured to: creating a timing task which is executed once per minute by using a crontab to execute a processing script for acquiring the state information of the docker service and the state information of the keepalive container; and running the processing script to execute the operation of acquiring the state information of the docker service and the state information of the keepalived container once every preset time.
In some embodiments, the determining module is further configured to: judging whether the state of the docker service is running or not according to the state information of the docker service; and if the status of the docker service is not running, the virtual IP is considered to be invalid.
In some embodiments, the determining module is further configured to: judging whether the state of the keepalive container is up according to the state information of the keepalive container; if the status of the keepalived container is not up, the virtual IP is considered to be invalid.
In some embodiments, the determining module is further configured to: judging whether the state of the docker service is running or not according to the state information of the docker service, and judging whether the state of the keepalive container is up or not according to the state information of the keepalive container; if the status of the docker service is running and the status of the keepalive container is up, the virtual IP is considered to be not failed.
In some embodiments, the execution module is further configured to: and acquiring the network card name of the detection node where the virtual IP is located, and clearing the virtual IP under the network card name path.
In another aspect of the embodiments of the present invention, there is also provided a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the method.
In a further aspect of the embodiments of the present invention, a computer-readable storage medium is also provided, in which a computer program for implementing the above method steps is stored when the computer program is executed by a processor.
The invention has the following beneficial technical effects: by monitoring the states of the docker service and the keepalive container, the dynamic clearing of the invalid VIP of the cluster is realized, so that the normal switching of the VIP in the cluster is ensured, and the high availability of the cluster environment is ensured.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
Fig. 1 is a schematic diagram of an embodiment of a method for clearing invalid virtual IP according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
In view of the above object, a first aspect of the embodiments of the present invention proposes an embodiment of a method for clearing an invalid virtual IP. Fig. 1 is a schematic diagram illustrating an embodiment of a method for clearing invalid virtual IPs according to the present invention. As shown in fig. 1, the embodiment of the present invention includes the following steps:
s1, acquiring status information of the docker service and status information of the keepalived container at preset time intervals;
s2, judging whether the virtual IP of the local machine is invalid or not according to the state information of the docker service and the state information of the keepalive container; and
and S3, if the virtual IP fails, clearing the virtual IP.
In this embodiment, Docker is an open source application container engine; keepalived is high-availability solution software that implements high-availability functionality via the VRRP protocol; HAProxy is a piece of proxy software that offers high availability, load balancing, and TCP (layer four) and HTTP (layer seven) based applications; VRRP (Virtual router redundancy protocol), which aims to solve the problem of single point failure of static routing, can ensure that the whole network can operate uninterruptedly when an individual node is down.
Take the following cluster deployment as an example: two Hasproxy agents are added in front of three application servers, then VIP is used for carrying out access requests to services, the requests of users are sent to the proxy servers firstly, and then are distributed to specific application servers according to a load balancing strategy. Once the Haproxy on the first node fails, the second node takes over the proxy service to ensure the availability of the application service, and both Haproxy and keepalived are deployed in a docker containerization mode. To ensure high availability of the clustered environment, the VIP in the clustered environment is guaranteed to be active. That is, only one VIP can exist in the cluster environment and this VIP is active. Therefore, real-time monitoring of VIPs in a cluster network environment needs to be achieved, and invalid VIPs which are not released in time and are generated due to docker service restart or keepalived container restart are removed in time.
And creating a script for dynamically detecting the states of the docker service and the keepalive container and judging whether to delete the VIP of the local machine according to the states of the docker service and the keepalive container. The script content is defined as: firstly, acquiring the state of a docker service and the state of a keepalid container, and then judging according to the acquired state information: when the acquired docker service state is not running or the acquired keepalive container state is not Up, the fact that the VIP of the local computer is invalid is proved, and the VIP needs to be cleared; if the judgment condition is not satisfied, no processing is performed. 2) A timed task, executed once per minute, is created with the crontab to execute the above-described process script. Meanwhile, in the script, a loop executed once every second is executed to detect the states of the docker service and the keepalived container. Therefore, the detection can be executed once per second, dynamic monitoring of the states of the docker service and the keepalived container is realized, and dynamic clearing of invalid VIP is realized. Meanwhile, the starting self-starting of the timing task is set, the timing task can still continue to run after the server is powered off and restarted, and the dynamic detection of the docker service and the keepalived container state is realized. The dynamic clearing of the invalid VIP of the cluster is realized under the high-availability deployment environment, so that the normal switching of the VIP in the cluster is ensured, and the normal operation of the high-availability cluster environment is ensured.
In some embodiments of the present invention, acquiring the state information of the docker service and the state information of the keepalived container at preset time intervals includes: creating a timing task which is executed once per minute by using a crontab to execute a processing script for acquiring the state information of the docker service and the state information of the keepalive container; the processing script is run to perform an operation of acquiring the state information of the docker service and the state information of the keepalived container once every preset time (for example, every 1 second).
A timed task, executed once per minute, is created with the crontab to execute the above-described process script. Meanwhile, in the script, a loop executed once every second is executed to detect the states of the docker service and the keepalived container. Therefore, the detection can be executed once per second, dynamic monitoring of the states of the docker service and the keepalived container is realized, and dynamic clearing of invalid VIP is realized.
In some embodiments of the present invention, determining whether a local virtual IP fails according to the state information of the docker service and the state information of the keepalived container includes: judging whether the state of the docker service is running or not according to the state information of the docker service; and if the status of the docker service is not running, the virtual IP is considered to be invalid.
In some embodiments of the present invention, determining whether a native virtual IP fails according to the state information of the docker service and the state information of the keepalived container includes: judging whether the state of the keepalive container is up according to the state information of the keepalive container; if the status of the keepalived container is not up, the virtual IP is considered to be invalid.
In some embodiments of the present invention, determining whether a native virtual IP fails according to the state information of the docker service and the state information of the keepalived container includes: judging whether the state of the docker service is running or not according to the state information of the docker service, and judging whether the state of the keepalive container is up or not according to the state information of the keepalive container; if the status of the docker service is running and the status of the keepalive container is up, the virtual IP is considered to be not failed.
In some embodiments of the invention, clearing the virtual IP comprises: and acquiring the network card name of the detection node where the virtual IP is located, and clearing the virtual IP under the network card name path.
Executing the following commands on the current detection node: IP addr del { vip } dev { network _ name }, wherein vip is a specified virtual IP, and network _ name is a network card name of the detection node.
It should be particularly noted that, the steps in the embodiments of the method for clearing invalid virtual IP may be intersected, replaced, added, or deleted, and therefore, these methods for clearing invalid virtual IP with reasonable permutation and combination transformation also belong to the scope of the present invention, and should not limit the scope of the present invention to the embodiments.
In view of the above object, according to a second aspect of the embodiments of the present invention, there is provided an apparatus for clearing an invalid virtual IP, including: the state acquisition module is configured to acquire state information of the docker service and state information of the keepalived container at preset time intervals; the judging module is configured to judge whether the virtual IP of the local machine fails according to the state information of the docker service and the state information of the keepalive container; and the execution module is configured to clear the virtual IP if the virtual IP fails.
In some embodiments of the invention, the status acquisition module is further configured to: creating a timing task which is executed once per minute by using a crontab to execute a processing script for acquiring the state information of the docker service and the state information of the keepalive container; and running the processing script to execute the operation of acquiring the state information of the docker service and the state information of the keepalived container once every preset time.
In some embodiments of the invention, the determining module is further configured to: judging whether the state of the docker service is running or not according to the state information of the docker service; and if the status of the docker service is not running, the virtual IP is considered to be invalid.
In some embodiments of the invention, the determining module is further configured to: judging whether the state of the keepalive container is up according to the state information of the keepalive container; if the status of the keepalived container is not up, the virtual IP is considered to be invalid.
In some embodiments of the invention, the determining module is further configured to: judging whether the state of the docker service is running or not according to the state information of the docker service, and judging whether the state of the keepalive container is up or not according to the state information of the keepalive container; if the status of the docker service is running and the status of the keepalive container is up, the virtual IP is considered to be not failed.
In some embodiments of the invention, the execution module is further configured to: and acquiring the network card name of the detection node where the virtual IP is located, and clearing the virtual IP under the network card name path.
In view of the above object, a third aspect of the embodiments of the present invention provides a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the above method.
The invention also provides a computer readable storage medium storing a computer program which, when executed by a processor, performs the method as above.
Finally, it should be noted that, as one of ordinary skill in the art can appreciate that all or part of the processes of the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the program of the method for clearing invalid virtual IPs can be stored in a computer readable storage medium, and when executed, the program can include the processes of the embodiments of the methods as described above. 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 embodiments of the computer program may achieve the same or similar effects as any of the above-described method embodiments.
Furthermore, the methods disclosed according to embodiments of the present invention may also be implemented as a computer program executed by a processor, which may be stored in a computer-readable storage medium. Which when executed by a processor performs the above-described functions defined in the methods disclosed in embodiments of the invention.
Further, the above method steps and system elements may also be implemented using a controller and a computer readable storage medium for storing a computer program for causing the controller to implement the functions of the above steps or elements.
Further, it should be appreciated that the computer-readable storage media (e.g., memory) herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM is available in a variety of forms such as synchronous RAM (DRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein may be implemented or performed with the following components designed to perform the functions herein: a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
The steps of a method or algorithm described in connection with the disclosure herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.
In one or more exemplary designs, the functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Also, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, Digital Versatile Disc (DVD), floppy disk, blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
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 present 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 of the invention 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 numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits 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 instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.

Claims (10)

1. A method for clearing invalid virtual IPs, comprising the steps of:
acquiring state information of a docker service and state information of a keepalive container at preset time intervals;
judging whether the virtual IP of the local machine is invalid or not according to the state information of the docker service and the state information of the keepalived container; and
and if the virtual IP fails, clearing the virtual IP.
2. The method of claim 1, wherein the obtaining the state information of the docker service and the state information of the keepalive container at preset time intervals comprises:
creating a timing task which is executed once per minute by using a crontab to execute a processing script for acquiring the state information of the docker service and the state information of the keepalive container;
and running the processing script to execute the operation of acquiring the state information of the docker service and the state information of the keepalived container once every preset time.
3. The method of claim 1, wherein determining whether the native virtual IP fails according to the state information of the docker service and the state information of the keepalived container comprises:
judging whether the state of the docker service is running or not according to the state information of the docker service;
and if the status of the docker service is not running, the virtual IP is considered to be invalid.
4. The method of claim 1, wherein determining whether the native virtual IP fails according to the state information of the docker service and the state information of the keepalived container comprises:
judging whether the state of the keepalive container is up according to the state information of the keepalive container;
and if the status of the keepalived container is not up, the virtual IP is considered to be invalid.
5. The method of claim 1, wherein determining whether the native virtual IP fails according to the state information of the docker service and the state information of the keepalived container comprises:
judging whether the state of the docker service is running or not according to the state information of the docker service, and judging whether the state of the keepalive container is up or not according to the state information of the keepalive container;
and if the status of the docker service is running and the status of the keepalived container is up, the virtual IP is considered to be not failed.
6. The method of claim 1, wherein clearing the invalid virtual IP comprises:
and acquiring the network card name of the detection node where the virtual IP is located, and clearing the virtual IP under the network card name path.
7. An apparatus for clearing invalid virtual IPs, comprising:
the state acquisition module is configured to acquire state information of the docker service and state information of the keepalived container at preset time intervals;
the judging module is configured to judge whether the virtual IP of the local machine fails according to the state information of the docker service and the state information of the keepalived container; and
and the execution module is configured to clear the virtual IP if the virtual IP fails.
8. The apparatus for clearing invalid virtual IPs according to claim 7, wherein the status acquisition module is further configured to:
creating a timing task which is executed once per minute by using a crontab to execute a processing script for acquiring the state information of the docker service and the state information of the keepalive container;
and running the processing script to execute the operation of acquiring the state information of the docker service and the state information of the keepalived container once every preset time.
9. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of any of the methods 1-6.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
CN202010625519.4A 2020-07-02 2020-07-02 Method, device, equipment and readable medium for clearing invalid virtual IP Active CN111884919B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010625519.4A CN111884919B (en) 2020-07-02 2020-07-02 Method, device, equipment and readable medium for clearing invalid virtual IP

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010625519.4A CN111884919B (en) 2020-07-02 2020-07-02 Method, device, equipment and readable medium for clearing invalid virtual IP

Publications (2)

Publication Number Publication Date
CN111884919A true CN111884919A (en) 2020-11-03
CN111884919B CN111884919B (en) 2022-12-02

Family

ID=73149901

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010625519.4A Active CN111884919B (en) 2020-07-02 2020-07-02 Method, device, equipment and readable medium for clearing invalid virtual IP

Country Status (1)

Country Link
CN (1) CN111884919B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113746951A (en) * 2021-09-10 2021-12-03 成都高新愿景数字科技有限公司 Method for preventing keepalive virtual IP from being lost

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090182954A1 (en) * 2008-01-11 2009-07-16 Mejdrich Eric O Network on Chip That Maintains Cache Coherency with Invalidation Messages
CN106790658A (en) * 2017-01-19 2017-05-31 郑州云海信息技术有限公司 A kind of Docker network plug-ins implementation method
CN108206842A (en) * 2016-12-16 2018-06-26 广州杰赛科技股份有限公司 Cloud Desktop Remote cut-in method and system
CN111162941A (en) * 2019-12-26 2020-05-15 浪潮云信息技术有限公司 Method for automatically managing virtual IP (Internet protocol) in Kubernetes environment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090182954A1 (en) * 2008-01-11 2009-07-16 Mejdrich Eric O Network on Chip That Maintains Cache Coherency with Invalidation Messages
CN108206842A (en) * 2016-12-16 2018-06-26 广州杰赛科技股份有限公司 Cloud Desktop Remote cut-in method and system
CN106790658A (en) * 2017-01-19 2017-05-31 郑州云海信息技术有限公司 A kind of Docker network plug-ins implementation method
CN111162941A (en) * 2019-12-26 2020-05-15 浪潮云信息技术有限公司 Method for automatically managing virtual IP (Internet protocol) in Kubernetes environment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113746951A (en) * 2021-09-10 2021-12-03 成都高新愿景数字科技有限公司 Method for preventing keepalive virtual IP from being lost
CN113746951B (en) * 2021-09-10 2023-07-11 成都高新愿景数字科技有限公司 Method for preventing keep virtual IP from losing

Also Published As

Publication number Publication date
CN111884919B (en) 2022-12-02

Similar Documents

Publication Publication Date Title
US11070431B2 (en) System and method for network validation architecture for clustered and federated storage systems
US11163653B2 (en) Storage cluster failure detection
CN109347675B (en) Server configuration method and device and electronic equipment
CN110224871B (en) High-availability method and device for Redis cluster
CN108476231B (en) System and method for maintaining sessions via an intermediary device
EP3353952B1 (en) Managing groups of servers
US8843622B1 (en) System and method to contact and maintain status of managed devices
CN112003961B (en) Resource exposure method, system, equipment and medium in kubernets
CN110784400B (en) N: 1 method, system and standby service gateway for redundancy of stateful application gateway
US11165690B2 (en) Request routing based on server software versions
WO2017100365A1 (en) Directing data traffic between intra-server virtual machines
US7539150B2 (en) Node discovery and communications in a network
CN113572831B (en) Communication method, computer equipment and medium between Kubernetes clusters
CN110944068B (en) Method for automatically recovering from duplicate network addresses, network device and storage medium thereof
CN107508694B (en) Node management method and node equipment in cluster
CN111884919B (en) Method, device, equipment and readable medium for clearing invalid virtual IP
CN111813507A (en) Method, system, equipment and medium for high availability of virtual machine based on sanlock
CN111813606A (en) Fault-tolerant method, system, equipment and medium for double-node virtual machine
CN112131201B (en) Method, system, equipment and medium for high availability of network additional storage
CN116192885A (en) High-availability cluster architecture artificial intelligent experiment cloud platform data processing method and system
US20220337503A1 (en) Identifying zero redundancy paths and affected endpoints in a software defined network
CN111130941B (en) Network error detection method and device and computer readable storage medium
CN111240933B (en) Method, system, device and medium for monitoring performance data of multiple data centers
CN109753292B (en) Method and device for deploying multiple applications in multiple single instance database service
CN115801554A (en) Main/standby switching communication method and device, electronic equipment and storage 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
GR01 Patent grant
GR01 Patent grant