CN116781494A - Main-standby switching judgment method based on existing network equipment - Google Patents
Main-standby switching judgment method based on existing network equipment Download PDFInfo
- Publication number
- CN116781494A CN116781494A CN202311034688.0A CN202311034688A CN116781494A CN 116781494 A CN116781494 A CN 116781494A CN 202311034688 A CN202311034688 A CN 202311034688A CN 116781494 A CN116781494 A CN 116781494A
- Authority
- CN
- China
- Prior art keywords
- node
- vip
- dhcp
- standby
- standby switching
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 29
- 101100465000 Mus musculus Prag1 gene Proteins 0.000 claims abstract description 10
- 230000000593 degrading effect Effects 0.000 claims description 5
- 230000009286 beneficial effect Effects 0.000 abstract description 2
- 206010008118 cerebral infarction Diseases 0.000 abstract description 2
- 208000026106 cerebrovascular disease Diseases 0.000 abstract description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 210000004556 brain Anatomy 0.000 description 1
- 230000002490 cerebral effect Effects 0.000 description 1
- 238000005336 cracking Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The application provides a main-standby switching judgment method based on the existing network equipment, which comprises the following steps: s1, a node sends a DHCP request message to a DHCP server through a service port network card; s2, after receiving the DHCP request message, the DHCP server judges and sends a judging result to the node; s3, in the step S2, if the node receives the DHCP ack message, the high-availability component binds the VIP to the node service port network card and promotes the database instance to a host; s4, in the step S2, if the node receives the DHCP nack message, the high-availability component sets the database instance as a standby machine; and if the network port bound with the VIP has network faults, performing main/standby switching according to a fault processing strategy. The application has the beneficial effects that: the phenomenon of cerebral infarction during main/standby switching can be avoided; through the exclusivity of the DHCP server on the VIP allocation request, only one instance in the cluster is ensured to be capable of taking the VIP to provide service to the outside, and the occurrence of double owners is avoided.
Description
Technical Field
The application belongs to the field of databases, and particularly relates to a main/standby switching judgment method based on existing network equipment.
Background
In the database master-slave cluster, when the master node fails, a high-availability component can select one from the available slave nodes according to a decision algorithm to serve as a new master node to provide service. However, in a deployment scenario with only one master and one slave, the master node does not fail, and if a link for detecting the availability of the node is broken, a high availability component considers that an original master node fails and lifts the slave node to the master, so that two master nodes appear in the cluster, namely, a brain fracture phenomenon appears.
Disclosure of Invention
In view of this, the present application aims to provide a main/standby switching decision method based on the existing network device, which can implement main/standby switching without adding an additional server.
In order to achieve the above purpose, the technical scheme of the application is realized as follows:
a main-standby switching judgment method based on the existing network equipment comprises the following steps:
s1, a node sends a DHCP request message to a DHCP server through a service port network card;
s2, after receiving the DHCP request message, the DHCP server judges and sends a judging result to the node;
s3, in the step S2, if the node receives the DHCP ack message, the high-availability component binds the VIP to the node service port network card and promotes the database instance to a host;
s4, in the step S2, if the node receives the DHCP nack message, the high-availability component sets the database instance as a standby machine;
and if the network port bound with the VIP has network faults, performing main/standby switching according to a fault processing strategy.
Further, in step S1, binding the service mac address of the node and the service VIP in the request message, where the duration of the lease is equal to the TTL;
the node sends a request message every other loop_time.
Further, in step S2, if the VIP is unoccupied or is occupied by the node sending the request, the node sending the request in step S1 is allowed to continue to use the current VIP, and replies with a DHCP ack message; if the VIP is already occupied by other nodes, the DHCP server replies a DHCP nack negative message to the requesting node in step S1.
Further, in step S3, for the node that is already in the host state, only the host state of the node needs to be maintained, and at this time, the node provides the read-write service to the outside through VIP;
in step S4, if it was previously the host, the high availability also requires unbinding the VIP from the service port network card and restarting the database instance.
Further, if the network port binding the VIP has a network failure, after the time of not receiving the DHCP ack exceeds the TTL, the high availability component considers that the node has a failure, and the failure processing policy includes: unbinding the VIP from the service port network card, restarting the database instance, and degrading the node to a standby machine.
Further, if the host node fails after the time of not receiving the DHCP ack exceeds the TTL, the high-availability component considers that the node fails, and the failure processing policy includes: unbinding the VIP from the service port network card, restarting the database instance, and degrading the node to a standby machine.
Further, the DHCP request sent by the master node is not received in the lease, and the fault handling policy includes: the DHCP server cancels the binding of the VIP and the service port mac of the master node, and changes the VIP into an allocable state.
Further, the DHCP server receives the DHCP request message from the standby node, so that the VIP becomes an allocable state, replies a DHCP ack message to the standby node, binds the VIP and the service port of the standby node, and resets the lease.
Further, the standby node receives the DHCP ack message, the high availability component binds the VIP to the service port network card, and promotes the database instance to the host, after which the node serves as the host to provide the database service.
Further, the original master node receives the DHCP nack message replied by the DHCP server, and sets the database instance to the standby state.
Compared with the prior art, the main/standby switching judgment method based on the prior network equipment has the following beneficial effects:
(1) The main-standby switching judgment method based on the existing network equipment can avoid the phenomenon of cerebral cracking during main-standby switching;
(2) The main-standby switching judging method based on the prior network equipment ensures that only one instance in the cluster can take the VIP to provide service to the outside through the exclusivity of the DHCP server on the VIP allocation request, thereby avoiding the occurrence of double masters;
(3) The application discloses a main-standby switching judging method based on the prior network equipment, which utilizes the attribute of DHCP lease, and nodes automatically give up VIP after lease expiration to ensure that a main instance is automatically degraded when a network fails;
(4) The main-standby switching judgment method based on the existing network equipment carries out judgment through the existing network equipment without adding additional servers.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
fig. 1 is a schematic diagram of a main/standby switching decision method based on an existing network device according to an embodiment of the present application.
Detailed Description
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other.
The application will be described in detail below with reference to the drawings in connection with embodiments.
The value of the main-standby switching judgment method based on the existing network equipment is as follows: 1) The phenomenon of cerebral infarction during main/standby switching can be avoided; 2) Through the exclusivity of the DHCP server on the VIP allocation request, only one instance in the cluster is ensured to be capable of taking the VIP to provide service to the outside, and the occurrence of double owners is avoided. 3) The node automatically gives up the VIP after the lease expires by utilizing the DHCP lease attribute to ensure that the main instance is automatically degraded when the network fails; 4) The decision is made by the existing network equipment without adding additional servers.
The specific scheme is as follows:
step 1, a node sends a DHCP request message to a DHCP server through a service port network card, a service port mac address of the node and a service VIP are bound in the request message, and lease duration is equal to TTL; the node sends a request message once every other loop_time (the loop_time is smaller than TTL/3);
step 2, after receiving the DHCP request message, if the VIP is unoccupied or occupied by the node sending the request, the DHCP server enables the node to continue to use the VIP and replies a DHCP ack message; if the VIP is already occupied by other nodes, the DHCP server replies a DHCP nack negative acknowledgement message to the node.
And 3, when the node receives the DHCP ack message, the high availability assembly (HA) binds the VIP to the node service port network card, and promotes the database instance to a host. For a node that is already in host state, only the host state of the node needs to be maintained. At this time, the node provides read-write service to the outside through the VIP.
And 4, when the node receives the DHCP nack message, the high-availability component sets the database instance as a standby machine. If it was previously the host, the high availability also requires unbinding the VIP from the traffic port network card and restarting the database instance.
And 5, network faults occur at the network ports binding the VIP, and the main instance cannot provide database services to the outside. Meanwhile, the DHCP request sent by the node to the DHCP server cannot be sent in time, and further cannot receive the DHCP ack message.
Step 6, after the time of not receiving the DHCP ack exceeds TTL, the high availability component considers that the node has a fault, unbinding the VIP from the service port network card, restarting the database instance, and degrading the node into a standby machine;
step 7, the DHCP server cancels the binding of the VIP and the service port mac of the master node and changes the VIP into an allocable state when the DHCP request sent by the master node is not received in the lease (namely TTL);
step 8, the DHCP server receives the DHCP request message sent by the standby node, so that the VIP becomes an allocable state, replies a DHCP ack message to the standby node, binds the VIP and a service port of the standby node, and resets the lease;
and 9, the standby node receives the DHCP ack message, the high-availability component binds the VIP to the service port network card, and the database instance is promoted to a host. The node thereafter serves as a host for providing database services.
And step 10, the original master node receives the DHCP nack message replied by the DHCP server and sets the database instance to be in a standby state.
Those of ordinary skill in the art will appreciate that the elements and method steps of each example described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the elements and steps of each example have been described generally in terms of functionality in the foregoing description to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. 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 present application.
In the several embodiments provided in the present application, it should be understood that the disclosed methods and systems may be implemented in other ways. For example, the above-described division of units is merely a logical function division, and there may be another division manner when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted or not performed. The units may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present application.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application, and are intended to be included within the scope of the appended claims and description.
The foregoing description of the preferred embodiments of the application is not intended to be limiting, but rather is intended to cover all modifications, equivalents, alternatives, and improvements that fall within the spirit and scope of the application.
Claims (10)
1. The main/standby switching judgment method based on the existing network equipment is characterized by comprising the following steps:
s1, a node sends a DHCP request message to a DHCP server through a service port network card;
s2, after receiving the DHCP request message, the DHCP server judges and sends a judging result to the node;
s3, in the step S2, if the node receives the DHCP ack message, the high-availability component binds the VIP to the node service port network card and promotes the database instance to a host;
s4, in the step S2, if the node receives the DHCP nack message, the high-availability component sets the database instance as a standby machine;
and if the network port bound with the VIP has network faults, performing main/standby switching according to a fault processing strategy.
2. The method for judging active/standby switching based on the existing network equipment as claimed in claim 1, wherein in step S1, the mac address of the node service port and the service VIP are bound in the request message, and the lease duration is equal to the TTL;
the node sends a request message every other loop_time.
3. The active-standby switching decision method based on the existing network device according to claim 1, wherein in step S2, if the VIP is unoccupied or occupied by the node sending the request, the node sending the request in step S1 is given up to continue to use the current VIP and replies with a DHCP ack message; if the VIP is already occupied by other nodes, the DHCP server replies a DHCP nack negative message to the requesting node in step S1.
4. The method for judging active-standby switching based on the existing network device as claimed in claim 1, wherein in step S3, for the node in the host state, only the host state of the node is maintained, and the node provides the read-write service to the outside through VIP;
in step S4, if it was previously the host, the high availability also requires unbinding the VIP from the service port network card and restarting the database instance.
5. The method for judging active-standby switching based on the existing network device according to claim 1, wherein if a network failure occurs in a network port to which VIP is bound, after a time of not receiving DHCP ack exceeds TTL, the high-availability component considers that the node fails, and the failure processing policy includes: unbinding the VIP from the service port network card, restarting the database instance, and degrading the node to a standby machine.
6. The method for determining active-standby switching based on existing network equipment according to claim 1, wherein if the time of the active node not receiving DHCP ack exceeds TTL, the high-availability component considers that the node fails, and the failure processing policy includes: unbinding the VIP from the service port network card, restarting the database instance, and degrading the node to a standby machine.
7. The method for determining active-standby switching based on the existing network device according to claim 1, wherein the method comprises the steps of: the DHCP does not receive a DHCP request from the master node within the lease, and the failure processing policy includes: the DHCP server cancels the binding of the VIP and the service port mac of the master node, and changes the VIP into an allocable state.
8. The method for determining active-standby switching based on the existing network device according to claim 7, wherein the method comprises the steps of: the DHCP server receives the DHCP request message sent by the standby node, so that the VIP becomes an allocable state, replies a DHCP ack message to the standby node, binds the VIP and the standby node with a service port, and resets the lease.
9. The method for determining active-standby switching based on the existing network device according to claim 8, wherein the method comprises the steps of: the standby node receives the DHCP ack message, the high availability component binds the VIP to the service port network card and promotes the database instance to the host, after which the node serves as the host to provide database services.
10. The method for determining active-standby switching based on the existing network device according to claim 9, wherein the method comprises the steps of: and the original master node receives the DHCP nack message replied by the DHCP server and sets the database instance to be in a standby state.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311034688.0A CN116781494B (en) | 2023-08-17 | 2023-08-17 | Main-standby switching judgment method based on existing network equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311034688.0A CN116781494B (en) | 2023-08-17 | 2023-08-17 | Main-standby switching judgment method based on existing network equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116781494A true CN116781494A (en) | 2023-09-19 |
CN116781494B CN116781494B (en) | 2024-03-26 |
Family
ID=87993349
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311034688.0A Active CN116781494B (en) | 2023-08-17 | 2023-08-17 | Main-standby switching judgment method based on existing network equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116781494B (en) |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102769678A (en) * | 2012-07-23 | 2012-11-07 | 杭州华三通信技术有限公司 | DHCP (Dynamic Host Configuration Protocol) address distributing method and device |
CN103124240A (en) * | 2013-02-07 | 2013-05-29 | 北京华为数字技术有限公司 | Gateway configuration method, gateway devices and network system |
CN104579791A (en) * | 2015-01-26 | 2015-04-29 | 浪潮电子信息产业股份有限公司 | Method for achieving automatic K-DB main and standby disaster recovery cluster switching |
CN107710634A (en) * | 2015-09-14 | 2018-02-16 | 华为技术有限公司 | Communication means and equipment based on optical network system |
CN108712514A (en) * | 2018-04-28 | 2018-10-26 | 新华三技术有限公司 | IP address management method, apparatus and electronic equipment |
CN109101196A (en) * | 2018-08-14 | 2018-12-28 | 北京奇虎科技有限公司 | Host node switching method, device, electronic equipment and computer storage medium |
CN109344202A (en) * | 2018-10-31 | 2019-02-15 | 新华三大数据技术有限公司 | A kind of method of data synchronization and management node |
CN111064819A (en) * | 2019-12-18 | 2020-04-24 | 杭州迪普科技股份有限公司 | Address backup method and device |
CN111314098A (en) * | 2018-12-11 | 2020-06-19 | 杭州海康威视系统技术有限公司 | Method and device for realizing VIP address drift in HA system |
CN114124902A (en) * | 2021-11-12 | 2022-03-01 | 迈普通信技术股份有限公司 | Multi-activation detection method and system |
CN114461428A (en) * | 2021-12-29 | 2022-05-10 | 国能朗新明南京环保科技有限公司 | Arbitration method for split brain of double-computer cluster |
CN115834194A (en) * | 2022-11-22 | 2023-03-21 | 苏州浪潮智能科技有限公司 | Data management method and device, electronic equipment and storage medium |
-
2023
- 2023-08-17 CN CN202311034688.0A patent/CN116781494B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102769678A (en) * | 2012-07-23 | 2012-11-07 | 杭州华三通信技术有限公司 | DHCP (Dynamic Host Configuration Protocol) address distributing method and device |
CN103124240A (en) * | 2013-02-07 | 2013-05-29 | 北京华为数字技术有限公司 | Gateway configuration method, gateway devices and network system |
CN104579791A (en) * | 2015-01-26 | 2015-04-29 | 浪潮电子信息产业股份有限公司 | Method for achieving automatic K-DB main and standby disaster recovery cluster switching |
CN107710634A (en) * | 2015-09-14 | 2018-02-16 | 华为技术有限公司 | Communication means and equipment based on optical network system |
CN108712514A (en) * | 2018-04-28 | 2018-10-26 | 新华三技术有限公司 | IP address management method, apparatus and electronic equipment |
CN109101196A (en) * | 2018-08-14 | 2018-12-28 | 北京奇虎科技有限公司 | Host node switching method, device, electronic equipment and computer storage medium |
CN109344202A (en) * | 2018-10-31 | 2019-02-15 | 新华三大数据技术有限公司 | A kind of method of data synchronization and management node |
CN111314098A (en) * | 2018-12-11 | 2020-06-19 | 杭州海康威视系统技术有限公司 | Method and device for realizing VIP address drift in HA system |
CN111064819A (en) * | 2019-12-18 | 2020-04-24 | 杭州迪普科技股份有限公司 | Address backup method and device |
CN114124902A (en) * | 2021-11-12 | 2022-03-01 | 迈普通信技术股份有限公司 | Multi-activation detection method and system |
CN114461428A (en) * | 2021-12-29 | 2022-05-10 | 国能朗新明南京环保科技有限公司 | Arbitration method for split brain of double-computer cluster |
CN115834194A (en) * | 2022-11-22 | 2023-03-21 | 苏州浪潮智能科技有限公司 | Data management method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN116781494B (en) | 2024-03-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10979286B2 (en) | Method, device and computer program product for managing distributed system | |
EP2347563B1 (en) | Distributed master election | |
US7987266B2 (en) | Failover in proxy server networks | |
CN101330531B (en) | Method for processing DHCP address allocation and DHCP relay | |
US20110178985A1 (en) | Master monitoring mechanism for a geographical distributed database | |
US20120197822A1 (en) | System and method for using cluster level quorum to prevent split brain scenario in a data grid cluster | |
CN102281333B (en) | Method and system for avoiding IP address conflict, DHCP server and DHCP client | |
US10547650B2 (en) | Methods and apparatuses for assigning to a terminal device a service server in a telecommunications system | |
CN106612339A (en) | Domain name updating method, system and main DNS (Domain Name System) server | |
US20150113313A1 (en) | Method of operating a server system with high availability | |
CN108075971A (en) | A kind of main/standby switching method and device | |
CN111355600B (en) | Main node determining method and device | |
CN110213331A (en) | Processing method, terminal device, electronic equipment and the storage medium of service request | |
CN107682172A (en) | Control centre's device, the method and medium of operation system processing | |
CN116781494B (en) | Main-standby switching judgment method based on existing network equipment | |
JP5039975B2 (en) | Gateway device | |
CN101577914A (en) | Method and system for processing S-CSCF alteration in IMS network | |
CN115499414A (en) | Address allocation method and device | |
CN112995054B (en) | Flow distribution method and device, electronic equipment and computer readable medium | |
CN111045830B (en) | Multi-cluster uniform resource distribution system and method | |
CN111586110B (en) | Optimization processing method for raft in point-to-point fault | |
CN111835858A (en) | Equipment access method, equipment and system | |
CN109753292B (en) | Method and device for deploying multiple applications in multiple single instance database service | |
CN102316136A (en) | Load balancing method for dual-controller system | |
US20220232071A1 (en) | Load balancing systems and methods |
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 |