Address switching method, device, system, storage medium and electronic device

By having the server negotiate and initiate preset commands and execute preset operations, the problem of low switching efficiency and high cost caused by intermediate temporary IPs and control nodes is solved, achieving efficient and low-cost IP address switching.

CN116506406BActive Publication Date: 2026-07-03INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2023-03-30
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

When switching IPs between server networks, using an intermediate temporary IP to control a single pair of servers through a control node to complete the IP switch results in low switching efficiency and high switching costs.

Method used

By receiving a switching script from the control server, the server initiates preset commands and executes preset operations to negotiate address switching with the peer server, thus avoiding dependence on intermediate temporary IPs and control nodes.

Benefits of technology

It improves the efficiency of server IP switching, achieves conflict-free switching, and reduces switching costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116506406B_ABST
    Figure CN116506406B_ABST
Patent Text Reader

Abstract

The application discloses an address switching method, device, system, storage medium and electronic equipment. It relates to the technical field of communication and can be used in the field of financial technology or other fields. The method comprises the following steps: receiving a switching script from a control server, wherein the switching script is used to instruct a first server to perform address switching with a second server by initiating a preset command and performing a preset operation, the initiator of the preset command determines whether the receiver of the preset command performs the preset operation according to whether a response to the preset command is received, and the preset operation is used to indicate that the response to the preset command is stopped; and performing address switching with the second server according to the switching script. Through the application, the problem that the switching efficiency is low and the switching cost is high due to the use of an intermediate temporary IP and the control of the single pair of servers to complete IP switching by a control node in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology and can be used in the fields of fintech or other areas. Specifically, it relates to an address switching method, apparatus, system, storage medium, and electronic device. Background Technology

[0002] Switching between servers connected via Internet Protocol (IP) is a common requirement in production operations and maintenance. However, when remote maintenance personnel switch between old and new server IPs, the location of the personnel differs from that of the data center, so the IP switch can only be achieved through remote network operation. Typically, intermediate temporary IPs are used, with a control node controlling a single pair of servers to complete the IP switch. However, in large-scale server environments, the limited number of intermediate temporary IPs means the control node cannot allocate an intermediate temporary IP to every pair of servers requiring it, resulting in low server IP switching efficiency. Furthermore, this method requires the control node to participate in scheduling during server IP switching, leading to high switching costs.

[0003] There is currently no effective solution to the problem of low switching efficiency and high switching costs caused by the use of intermediate temporary IPs in related technologies and the control of a single pair of servers to complete IP switching through a control node. Summary of the Invention

[0004] The main purpose of this application is to provide an address switching method to solve the problems of low switching efficiency and high switching cost caused by the use of intermediate temporary IPs in related technologies and the control of a single pair of servers by a control node to complete the IP switching.

[0005] To achieve the above objectives, according to one aspect of this application, an address switching method is provided. The method includes: receiving a switching script from a control server, wherein the switching script instructs a first server to switch addresses with a second server by initiating a preset command and executing a preset operation; the initiator of the preset command determines whether the receiver of the preset command executes the preset operation based on whether a response to the preset command is received; the preset operation indicates stopping the response to the preset command; and performing an address switch with the second server according to the switching script.

[0006] Optionally, switching addresses with the second server according to the switching script includes: sending a first preset command to the second server to obtain a first working state, wherein the first working state is used to indicate whether the second server is ready for switching; and performing address switching based on the first working state.

[0007] Optionally, sending a first preset command to the second server to obtain a first working state includes: sending a first preset command to the second server and obtaining a first command result, wherein the first command result is used to determine whether the second server has performed a preset operation; in response to determining that the second server has performed a preset operation, obtaining a first working state indicating that the second server is ready to switch.

[0008] Optionally, address switching based on the first working state includes: in response to the second server being ready for switching, performing a preset operation and stopping operation within a first time interval, wherein the first time interval is the time interval from a first moment to a second moment; in response to satisfying a preset condition, performing an address switching operation within a second time interval to complete the address switching, wherein the preset condition is used to indicate that both the first server and the second server are ready for switching, the second server stops network service and stops operation within a third time interval, the third time interval is the time interval from a third moment to a fourth moment, the first moment is earlier than the third moment, the second moment is later than the third moment, the second time interval is the time interval from the second moment to a fifth moment, the fifth moment is earlier than the fourth moment, and performing the address switching operation includes stopping network service and restarting network service.

[0009] Optionally, before sending a first preset command to the second server and obtaining a first working state, the method further includes: verifying the switching script and obtaining a first verification result, wherein the switching script includes a switching parameter table, and the first verification result includes the verification result corresponding to the switching parameter table; in response to the first verification result being a verification failure, stopping the address switching.

[0010] Optionally, the method further includes: stopping the address switching in response to the second server not being ready to switch within a first preset time period, wherein the first preset time period is a period of time starting from the moment the first preset command is initiated.

[0011] Optionally, the method further includes: in response to the completion of the address switch, performing a cleanup operation, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation being used to indicate the start of responding to a preset command, and the cleanup operation being used to indicate the deletion of the switch script.

[0012] To achieve the above objectives, according to another aspect of this application, an address switching method is provided. The method includes: receiving a switching script from a control server, wherein the switching script instructs a second server to switch addresses with a first server by initiating a preset command and executing a preset operation; the initiator of the preset command determines whether the receiver of the preset command executes the preset operation based on whether a response to the preset command is received; the preset operation indicates stopping the response to the preset command; and performing an address switch with the first server according to the switching script.

[0013] Optionally, switching addresses with the first server according to the switching script includes: sending a second preset command to the first server to obtain a second working state, wherein the second working state is used to indicate whether the first server is ready to switch; and performing address switching based on the second working state.

[0014] Optionally, sending a second preset command to the first server to obtain a second working state includes: performing a preset operation and sending a second preset command to the first server to obtain a second command result, wherein the second command result is used to determine whether the first server has performed the preset operation; in response to determining that the first server has performed the preset operation, obtaining a second working state indicating that the first server is ready to switch.

[0015] Optionally, address switching based on the second working state includes: in response to the first server being ready for switching, stopping network services and ceasing operation within a third time interval, wherein the first server stops operation within the first time interval, the first time interval being the time interval from the first moment to the second moment, the third time interval being the time interval from the third moment to the fourth moment, the first moment being earlier than the third moment, and the second moment being later than the third moment; in response to the satisfaction of a preset condition, restarting network services after the fourth moment to complete the address switching, wherein the preset condition is used to indicate that both the first server and the second server are ready for switching.

[0016] Optionally, before performing the preset operation, the method further includes: verifying the switching script to obtain a second verification result, wherein the switching script includes a switching parameter table, and the second verification result includes the verification result corresponding to the switching parameter table; and stopping the address switching in response to the second verification result being a verification failure.

[0017] Optionally, the method further includes: in response to the first server not being ready for switching within a second preset time period, performing a recovery operation and stopping the address switching, wherein the second preset time period is a period of time from the moment the second preset command is initiated, and the recovery operation is used to indicate the start of responding to the preset command.

[0018] Optionally, the method further includes: in response to the completion of the address switch, performing a cleanup operation, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation being used to indicate the start of responding to a preset command, and the cleanup operation being used to indicate the deletion of the switch script.

[0019] To achieve the above objectives, according to another aspect of this application, an address switching device is provided. The device includes: a first receiving module, configured to receive a switching script from a control server, wherein the switching script instructs a first server to switch addresses with a second server by initiating a preset command and executing a preset operation; the initiator of the preset command determines whether the receiver of the preset command executes the preset operation based on whether a response to the preset command is received; and a first switching module, configured to switch addresses with the second server according to the switching script.

[0020] To achieve the above objectives, according to another aspect of this application, an address switching device is provided. The device includes: a second receiving module, configured to receive a switching script from a control server, wherein the switching script instructs a second server to switch addresses with a first server by initiating a preset command and executing a preset operation; the initiator of the preset command determines whether the receiver of the preset command executes the preset operation based on whether a response to the preset command is received; and a second switching module, configured to switch addresses with the first server according to the switching script.

[0021] To achieve the above objectives, according to another aspect of this application, an address switching system is provided. The system includes: a control server, a first server, and a second server. The control server is used to push a switching script to the first server and the second server in parallel. The first server is used to execute the address switching method described in any one of the above-mentioned methods, and the second server is used to execute the address switching method described in any one of the above-mentioned methods.

[0022] To achieve the above objectives, according to another aspect of this application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer program, which is configured to execute the address switching method described in any one of the above when run on a computer or processor.

[0023] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, including a memory and a processor, characterized in that the memory stores a computer program, and the processor is configured to run the computer program to perform the address switching method described in any one of the above.

[0024] This application employs the following steps: receiving a switching script from a control server, wherein the switching script instructs a first server to switch addresses with a second server by initiating a preset command and executing a preset operation; the initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received; the preset operation indicates stopping the response to the preset command; and the address is switched with the second server according to the switching script. By pushing a switching script to the server, enabling the server to automatically initiate a preset command (e.g., a ping command) and execute a preset operation (e.g., disabling ICMP protocol or setting firewall rules) to perform an IP switch, the server negotiates the address switch with the peer server independently using the switching script. This solves the problems of low switching efficiency and high switching costs associated with related technologies that use intermediate temporary IPs and control a single pair of servers to complete the IP switch through a control node. Therefore, it achieves the effects of improving server IP switching efficiency, realizing conflict-free switching, and reducing switching costs. Attached Figure Description

[0025] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0026] Figure 1 This is a diagram illustrating the method of address switching using an intermediate temporary IP address;

[0027] Figure 2 This is a diagram illustrating the method by which control nodes use intermediate temporary IPs for address switching;

[0028] Figure 3 This is a flowchart of the address switching method provided according to the embodiments of this application;

[0029] Figure 4 This is a schematic diagram of time intervals provided according to embodiments of this application;

[0030] Figure 5 This is a flowchart of an address switching method according to another embodiment of this application;

[0031] Figure 6 This is a schematic diagram of IP slicing under ideal conditions;

[0032] Figure 7 This is a diagram illustrating IP handover under network latency conditions;

[0033] Figure 8 This is a schematic diagram of IP slicing according to an embodiment of this application;

[0034] Figure 9 This is a schematic diagram of the IP splitting architecture provided according to an embodiment of this application;

[0035] Figure 10 This is a flowchart of IP switching according to an embodiment of this application;

[0036] Figure 11 This is a schematic diagram of an address switching device provided according to an embodiment of this application;

[0037] Figure 12 This is a schematic diagram of an address switching device according to another embodiment of this application;

[0038] Figure 13 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0039] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0040] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0041] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0042] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0043] The ping command is a network diagnostic tool available on Windows, Unix, and Linux systems. It's part of the TCP / IP protocol suite and is used to determine whether a local host can exchange datagrams with another host. Based on the returned information, we can infer whether the TCP / IP parameter settings are correct and whether the system is functioning correctly.

[0044] Currently, when a server switches IP addresses, it typically uses an intermediate temporary IP address to assist in the switching process. Figure 1 This is a diagram illustrating the method of address switching using an intermediate temporary IP address, as shown below. Figure 1 As shown, before the switch, server A's IP address is 1.1.1.1, server B's IP address is 1.1.1.2, and the intermediate temporary IP address is 1.1.1.3. During the switch, server A first switches from 1.1.1.1 to the intermediate temporary IP address 1.1.1.3, then server B switches from 1.1.1.2 to 1.1.1.1, and finally server A switches from 1.1.1.3 to 1.1.1.2, thus completing the IP address handover between server A and server B.

[0045] Specifically, Figure 2 This is a diagram illustrating the method of control nodes using intermediate temporary IPs for address switching, as shown below. Figure 2 As shown, during server IP switching, the control node first pushes script A to server A, causing server A to switch from 1.1.1.1 to the intermediate temporary IP 1.1.1.3. Then, the control node pushes script B to server B, causing server B to switch from 1.1.1.2 to 1.1.1.1. Finally, the control node pushes script C to server A, causing server A to switch from the intermediate temporary IP 1.1.1.3 to 1.1.1.2, thus completing the IP switching between server A and server B.

[0046] However, the above method requires the use of intermediate temporary IPs for switching. The control node assigns an intermediate temporary IP to each pair of servers and controls the single pair of servers to complete the IP switching, resulting in low switching efficiency, high switching cost, and is not suitable for large-scale server IP switching scenarios.

[0047] The following describes this application in conjunction with the preferred implementation steps. Figure 3 This is a flowchart of the address switching method provided according to the embodiments of this application, such as... Figure 3 As shown, the method includes the following steps:

[0048] Step S301: Receive the switching script from the control server;

[0049] Step S302: Switch the address with the second server according to the switching script.

[0050] The switching script instructs the first server to switch addresses with the second server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation is used to indicate that the response to the preset command should be stopped.

[0051] The control server can be understood as a control node, used to push the switching script to the server whose IP address is to be switched. The first server can be understood as the server whose IP address is to be switched. In this embodiment, the first server is used to switch IP addresses with the second server. The first server can be understood as the active switching server, denoted as the main driver.

[0052] The switching script is a script pushed by the control server to the first server, used to enable the first server to switch IP addresses with the second server. Specifically, the switching script instructs the first server to switch addresses with the second server by initiating preset commands and performing preset operations. It can be understood that the switching script enables the first server to negotiate with the second server on its own, thereby switching IP addresses with the second server.

[0053] The default command can be the ping command, which the server uses to send a ping command to the peer server to determine whether the peer server can transmit data normally.

[0054] Preset operations are used to indicate that the server will stop responding to preset commands. In Linux operating systems, preset operations can be operations that disable the ICMP protocol or operations that set firewall rules. In operating systems such as AIX / Windows, since kernel parameters cannot be used to disable the ICMP protocol, preset operations can be operations that set firewall rules. After the server executes the preset operation, it will stop responding to preset commands, that is, it will stop responding to ping commands.

[0055] Understandably, once the second server executes the preset operation, it will not respond to the preset command, and therefore the first server will not receive a response to the preset command. In other words, if the first server receives a response from the second server after sending a preset command, it means the second server did not execute the preset operation; if it does not receive a response from the second server, it means the second server executed the preset operation.

[0056] In this embodiment of the application, the first server sends a ping command to the second server. The first server determines whether the second server has performed an operation to block the ICMP protocol or set a firewall denial rule based on whether it receives a response from the second server to the ping command.

[0057] For example, taking the Linux operating system as an example, after receiving the switching script from the control server, the first server sends a ping command to the second server according to the instructions in the switching script, and performs an operation to disable the ICMP protocol, thereby negotiating the IP address switch with the second server itself. Thus, IP address switching can be performed without the need for an intermediate temporary IP address, and without the need for a control node to participate in scheduling, thereby effectively improving switching efficiency and reducing switching costs.

[0058] The execution entity of the above steps can be a processor or a controller. Through these steps, a switching script is received from the control server. This switching script instructs the first server to switch addresses with the second server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response is received. The preset operation indicates stopping the response to the preset command. The address switch is then performed with the second server according to the switching script. By pushing a switching script to the server, enabling it to initiate preset commands (e.g., ping commands) and execute preset operations (e.g., disabling ICMP protocol or setting firewall rules) to perform IP switching, the server negotiates the address switch with the peer server independently using this script. This solves the problems of low switching efficiency and high switching costs associated with related technologies that use intermediate temporary IPs and control single-server IP switching via a control node. This achieves the effects of improving server IP switching efficiency, realizing conflict-free switching, and reducing switching costs.

[0059] Optionally, switching addresses with the second server according to the switching script includes: sending a first preset command to the second server to obtain a first working state, wherein the first working state is used to indicate whether the second server is ready for switching; and performing address switching based on the first working state.

[0060] The first preset command is the ping command initiated by the first server to the second server, and the first working status is the working status of the second server, which is used to indicate whether the second server is ready to switch over.

[0061] When the first server switches addresses with the second server according to the switching script, it will first send a ping command (first preset command) to the second server to determine the working status of the second server (first working status). The working status of the second server is used to indicate whether the second server is ready to switch.

[0062] In this embodiment, after receiving the switching script, the first server continuously sends ping commands to the second server. Based on whether it receives a response from the second server based on these ping commands, it determines whether the second server has performed ICMP blocking or firewall rule setting. If the second server has performed ICMP blocking or firewall rule setting, it indicates that the second server is ready to perform IP switching; if the second server has not performed ICMP blocking or firewall rule setting, it indicates that the second server is not ready to perform IP switching.

[0063] Understandably, when switching addresses based on the first working state, if the second server is not ready to switch, the IP address will not be switched; if the second server is ready to switch, the IP address will be switched.

[0064] Optionally, sending a first preset command to the second server to obtain a first working state includes: sending a first preset command to the second server and obtaining a first command result, wherein the first command result is used to determine whether the second server has performed a preset operation; in response to determining that the second server has performed a preset operation, obtaining a first working state indicating that the second server is ready to switch.

[0065] The first command result is the response to the first preset command, which is the response of the second server to the ping command initiated by the first server, and is used to indicate whether the second server performs the preset operation.

[0066] When the first server switches addresses with the second server according to the switching script, it first sends a ping command (first preset command) to the second server. The first server determines whether the second server should perform ICMP blocking or set firewall denial rules based on the response result of the second server to the ping command (first command result).

[0067] It is understandable that if the first server receives a response from the second server to the ping command, it means that the second server has not performed any ICMP blocking operations or set any firewall rules to deny access. Conversely, if the first server does not receive a response from the second server to the ping command, it means that the second server has performed any ICMP blocking operations or set any firewall rules to deny access.

[0068] When the first server determines that the second server has performed an ICMP blocking operation or set a firewall denial rule, the first server considers that the second server is ready to switch IP addresses, and thus obtains the first working state indicating that the second server is ready to switch.

[0069] Optionally, address switching based on the first working state includes: in response to the second server being ready for switching, performing a preset operation and stopping operation within a first time interval, wherein the first time interval is the time interval from a first moment to a second moment; in response to satisfying a preset condition, performing an address switching operation within a second time interval to complete the address switching, wherein the preset condition is used to indicate that both the first server and the second server are ready for switching, the second server stops network service and stops operation within a third time interval, the third time interval is the time interval from a third moment to a fourth moment, the first moment is earlier than the third moment, the second moment is later than the third moment, the second time interval is the time interval from the second moment to a fifth moment, the fifth moment is earlier than the fourth moment, and performing the address switching operation includes stopping network service and restarting network service.

[0070] Stopping operation can be understood as executing the sleep command. When the server executes the sleep command, it will stop running and enter a sleep state.

[0071] Stopping network services can be understood as the server stopping network services. Since communication between servers requires the network, and changing the server IP requires restarting the network service, the server needs to stop and then restart the network to complete the IP switch.

[0072] If the first server determines that the second server is ready to switch over, the first server will either disable ICMP or set firewall rules to block it, causing itself to stop responding to ping commands. Simultaneously, the first server will execute a sleep command within the first time interval to stop itself from running.

[0073] Figure 4 This is a schematic diagram of time intervals provided according to embodiments of this application, such as... Figure 4 As shown, the first time interval W1 can be the time interval from the first time t1 to the second time t2. The first time interval W1 represents the waiting time used to prevent the first server from starting the switch before the second server network has completely stopped. For example, the first time interval W1 can be set between 5s and 15s depending on the server performance.

[0074] Understandably, in a Linux operating system, after the first server performs operations such as disabling ICMP or setting firewall rules, it will also modify its own static configuration and then execute the `sleep` command to stop itself. However, operating systems like AIX / Windows, which do not have static configuration files, do not have this static configuration adjustment phase.

[0075] In this embodiment of the application, when the preset conditions are met, that is, when both the first server and the second server are ready to switch over, the second server will stop the network service and stop running within the third time interval. It can be understood that the second server will only perform the operation of stopping the network service and stopping running after determining that the first server is ready to switch over. Therefore, the third time interval can be used to determine the time when the first server is ready to switch over for the second server.

[0076] like Figure 4 As shown, the third time interval W2 is the time interval from the third time t3 to the fourth time t4. The first time t1 is earlier than the third time t3, and the second time t2 is later than the third time t3. The third time interval W2 is used to indicate the duration for which the second server stops the network, so that the first server can complete the switch within this window. For example, the third time interval W2 can be set between 45s and 90s depending on the server performance.

[0077] Accordingly, when the preset conditions are met, the first server will perform the operation of stopping the network service and restarting the network service within the second time interval to complete the address switch.

[0078] like Figure 4 As shown, the second time interval W3 is the time interval from the second time t2 to the fifth time t5, and the fifth time t5 is earlier than the fourth time t4.

[0079] As can be seen, the first server will stop operating first. The first server will only perform the switchover operation after ensuring that the second server has stopped its network and is no longer operational. That is, the first server will stop the network service and then restart the network service only after ensuring that the second server has stopped its network and is no longer operational. Furthermore, the first server needs to complete the switchover operation while the second server is stopped. This can be understood as ensuring that the active machine (first server) completes the IP switch first, and that the passive machine (second server) is in a stopped network and stopped operational state when the active machine is switching. This avoids IP conflicts during server IP switching and ensures conflict-free IP switching.

[0080] Optionally, before sending a first preset command to the second server and obtaining a first working state, the method further includes: verifying the switching script to obtain a first verification result, wherein the switching script includes a switching parameter table, and the first verification result includes the verification result corresponding to the switching parameter table; in response to the first verification result being a verification failure, stopping the address switching.

[0081] Since communication between servers requires a network, and changing a server IP requires restarting the network service, this application addresses this issue by designing a switching parameter table to ensure that no server IP conflicts occur at the same time.

[0082] Optionally, when the control server pushes the switching script to the first server, it may simultaneously push the switching parameter table, or the switching script may include the switching parameter table. The switching parameter table is used to instruct the first server and the second server to perform IP switching, and is also used to indicate the current IP of the first server and the current IP of the second server, as well as the corresponding gateway IP. For example, the switching parameter table is shown in Table 1 below, wherein the first column of the switching parameter table is filled with the IP of the active switching server (active machine), and the third column is filled with the IP of the passive switching server (passive machine).

[0083] Table 1

[0084] First server IP Server Gateway Second server IP Server Gateway 1.1.1.1 1.1.1.254 1.1.1.2 1.1.1.254

[0085] This application designs a switching script and a switching parameter table, which are then pushed in parallel by the control server to a pair of servers (i.e., the first server and the second server) to be switched IPs, and set to run in the background. This decouples the first server and the second server from the control server, meaning that subsequent IP switching operations are all completed by the first server and the second server through mutual negotiation, thus eliminating the need for scheduling by the control server and reducing switching costs.

[0086] When the control server pushes the switching script to the first server and the second server in parallel, it can push the script and make background calls according to Table 2.

[0087] Table 2

[0088] OS type Push method Background call Linux SSH At / nohup Windows Wmi / WinRm Task Plan AIX SSH At / nohup

[0089] In this embodiment, when the first server receives the switching script, it can first verify the switching script, including verifying the switching parameter table to determine whether the parameters in the switching parameter table are filled in correctly, and obtain the verification result of the switching parameter table. In addition, it can also verify the dynamic and static network configurations and the static file format, etc., to determine whether the server's dynamic network configuration and static configuration are consistent, and whether the network static configuration file format is correct, thereby ensuring that the configuration file can be correctly modified in the subsequent static configuration switching, and thus ensuring that the configuration file is correct at the final switching time. This embodiment does not limit the scope of the application.

[0090] The server will decide whether to perform the IP switching operation based on the first verification result. If the first verification result is a failure, the server will stop performing the IP switching operation. Conversely, if the first verification result is a success, the server can continue to perform the IP switching operation.

[0091] Optionally, the method further includes: stopping the address switching in response to the second server not being ready to switch within a first preset time period, wherein the first preset time period is a period of time starting from the moment the first preset command is initiated.

[0092] Before the second server performs any ICMP blocking operations or sets firewall rules, after the first server initiates a ping command to the second server, the first server will receive the second server's response to that ping command. By continuously sending ping commands to the second server, the first server determines whether it will fail to receive a response from the second server within a preset time period, thereby determining whether the second server has performed any ICMP blocking operations or set firewall rules.

[0093] By setting a first preset time period, the system determines whether the second server is ready for the switchover within that period. If the second server is ready within the first preset time period, the IP switchover operation can continue. Conversely, if the second server is not ready within the first preset time period, the IP switchover process will stop.

[0094] Understandably, if the server has modified its static configuration when the IP switching is stopped, the static configuration parameters need to be changed back to the parameters before the modification.

[0095] The first preset time period W0 can be understood as the duration for waiting for the peer script to start, and also as the timeout for determining whether the peer should abandon the handover. For example, the first preset time period W0 can be set between 30s and 120s depending on network conditions.

[0096] Optionally, the method further includes: in response to the completion of the address switch, performing a cleanup operation, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation being used to indicate the start of responding to a preset command, and the cleanup operation being used to indicate the deletion of the switch script.

[0097] After the first server completes the IP switch, it can also perform cleanup operations, such as starting to respond to ping commands and deleting the switch script.

[0098] This application also provides another implementation method, which will be described in detail below. Figure 5 This is a flowchart of an address switching method according to another embodiment of this application, such as... Figure 5 As shown, the method includes the following steps:

[0099] Step S501: Receive the switching script from the control server;

[0100] Step S502: Switch the address with the first server according to the switching script.

[0101] The switching script instructs the second server to switch addresses with the first server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation is used to indicate stopping the response to the preset command.

[0102] The control server can be understood as a control node, used to push the switching script to the server whose IP address is to be switched. The second server can be understood as the server whose IP address is to be switched. In this embodiment, the second server is used to switch IP addresses with the first server. The second server can be understood as a passive switching server, denoted as the passive agent.

[0103] The switching script is a script pushed by the control server to the second server to enable the first server to switch IP addresses with the second server. Specifically, the switching script instructs the second server to switch addresses with the first server by initiating preset commands and performing preset operations. It can be understood that the switching script enables the second server to negotiate with the first server on its own, thereby switching IP addresses with the first server.

[0104] The default command can be the ping command, which the server uses to send a ping command to the peer server to determine whether the peer server can transmit data normally.

[0105] Preset operations are used to indicate that the server will stop responding to preset commands. In Linux operating systems, preset operations can be operations that disable the ICMP protocol or operations that set firewall rules. In operating systems such as AIX / Windows, since kernel parameters cannot be used to disable the ICMP protocol, preset operations can be operations that set firewall rules. After the server executes the preset operation, it will stop responding to preset commands, that is, it will stop responding to ping commands.

[0106] Understandably, once the first server executes the preset operation, it will not respond to the preset command, and therefore the second server will not receive a response to the preset command either. In other words, if the second server receives a response from the first server after sending a preset command to the first server, it means the first server did not execute the preset operation; if it does not receive a response from the first server, it means the first server executed the preset operation.

[0107] In this embodiment of the application, the second server initiates a ping command to the first server. The second server determines whether the first server has performed an operation to disable the ICMP protocol or set a firewall denial rule based on whether it receives a response from the first server to the ping command.

[0108] For example, taking the Linux operating system as an example, after receiving the switching script from the control server, the second server sends a ping command to the first server according to the instructions in the switching script, and performs an operation to disable the ICMP protocol, thereby negotiating the IP address switch with the first server itself. Thus, IP address switching can be performed without the need for an intermediate temporary IP address, and without the need for a control node to participate in scheduling, thereby effectively improving switching efficiency and reducing switching costs.

[0109] The execution entity of the above steps can be a processor or a controller. Through these steps, a switching script is received from the control server. This switching script instructs the second server to switch addresses with the first server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response is received. The preset operation indicates stopping the response to the preset command. The address switch is then performed with the first server according to the switching script. By pushing a switching script to the server, enabling it to initiate preset commands (e.g., ping commands) and execute preset operations (e.g., disabling ICMP protocol or setting firewall rules) to perform IP switching, the server negotiates the address switch with the peer server using this script. This solves the problems of low switching efficiency and high switching costs associated with related technologies that use intermediate temporary IPs and control single-server IP switching via a control node. This achieves improved server IP switching efficiency, conflict-free switching, and low switching costs.

[0110] Optionally, switching addresses with the first server according to the switching script includes: sending a second preset command to the first server to obtain a second working state, wherein the second working state is used to indicate whether the first server is ready to switch; and performing address switching based on the second working state.

[0111] The second preset command is the ping command initiated by the second server to the first server, and the second working status is the working status of the first server, which is used to indicate whether the first server is ready to switch over.

[0112] When the second server switches addresses with the first server according to the switching script, it will first send a ping command (second preset command) to the first server to determine the working status of the first server (second working status). The working status of the first server is used to indicate whether the first server is ready to switch.

[0113] In this embodiment, after receiving the switching script, the second server continuously sends ping commands to the first server. Based on whether it receives a response from the first server based on these ping commands, it determines whether the first server has performed ICMP blocking or firewall rule setting. If the first server has performed ICMP blocking or firewall rule setting, it indicates that the first server is ready to perform IP switching; if the first server has not performed ICMP blocking or firewall rule setting, it indicates that the first server is not ready to perform IP switching.

[0114] Understandably, when switching addresses based on the second working state, if the first server is not ready to switch, the IP address will not be switched; if the first server is ready to switch, the IP address will be switched.

[0115] Optionally, sending a second preset command to the first server to obtain a second working state includes: performing a preset operation and sending a second preset command to the first server to obtain a second command result, wherein the second command result is used to determine whether the first server has performed the preset operation; in response to determining that the first server has performed the preset operation, obtaining a second working state indicating that the first server is ready to switch.

[0116] The second command result is the response to the second preset command, that is, the response of the first server to the ping command initiated by the second server, which is used to indicate whether the first server performs the preset operation.

[0117] After receiving the switchover script, the second server will first perform preset operations, namely, disabling ICMP operations or setting firewall denial rules, and stopping the response to ping commands, so that the first server knows that the second server is ready to switch over.

[0118] Understandably, in a Linux operating system, after the first server performs operations such as disabling ICMP or setting firewall rules, it will also modify its own static configuration and then execute the `sleep` command to stop itself. However, operating systems like AIX / Windows, which do not have static configuration files, do not have this static configuration adjustment phase.

[0119] At the same time, the second server will also send a ping command (second preset command) to the first server. Based on the response result of the first server to the ping command (second command result), the second server determines whether the first server should perform ICMP blocking operation or set firewall denial rules.

[0120] It is understandable that if the second server receives a response from the first server to the ping command, it means that the first server has not performed any ICMP blocking operations or set any firewall rules to deny access. Conversely, if the second server does not receive a response from the first server to the ping command, it means that the first server has performed any ICMP blocking operations or set any firewall rules to deny access.

[0121] When the second server determines that the first server has performed an ICMP blocking operation or set a firewall denial rule, the second server considers that the first server is ready to switch IP addresses, and thus obtains a second working state indicating that the first server is ready to switch.

[0122] Optionally, address switching based on the second working state includes: in response to the first server being ready for switching, stopping network services and ceasing operation within a third time interval, wherein the first server stops operation within the first time interval, the first time interval being the time interval from the first moment to the second moment, the third time interval being the time interval from the third moment to the fourth moment, the first moment being earlier than the third moment, and the second moment being later than the third moment; in response to the satisfaction of a preset condition, restarting network services after the fourth moment to complete the address switching, wherein the preset condition is used to indicate that both the first server and the second server are ready for switching.

[0123] Stopping operation can be understood as executing the sleep command. When the server executes the sleep command, it will stop running and enter a sleep state.

[0124] Stopping network services can be understood as the server stopping network services. Since communication between servers requires the network, and changing the server IP requires restarting the network service, the server needs to stop and then restart the network to complete the IP switch.

[0125] Once the first server is ready to switch over, it will stop operating within the first time interval W1. If the second server determines that the first server is ready to switch over, it will stop providing network services and cease operation within the third time interval W2. Figure 4 As shown, the first time interval W1 is the time interval from the first time t1 to the second time t2, and the third time interval W2 is the time interval from the third time t3 to the fourth time t4. The first time t1 is earlier than the third time t3, and the second time t2 is later than the third time t3.

[0126] In this embodiment of the application, when the preset conditions are met, that is, when both the first server and the second server are ready to switch, the second server will restart the network service after the fourth time t4 to complete the address switch, thereby ensuring that the second server performs the IP switch after the first server has finished switching, thus avoiding IP conflict.

[0127] Optionally, before performing the preset operation, the method further includes: verifying the switching script to obtain a second verification result, wherein the switching script includes a switching parameter table, and the second verification result includes the verification result corresponding to the switching parameter table; and stopping the address switching in response to the second verification result being a verification failure.

[0128] Since communication between servers requires a network, and changing a server IP requires restarting the network service, this application addresses this issue by designing a switching parameter table to ensure that no server IP conflicts occur at the same time.

[0129] In this embodiment, when the second server receives the switching script, it can first verify the switching script, including verifying the switching parameter table to determine whether the parameters in the switching parameter table are filled in correctly, and obtain the verification result of the switching parameter table. In addition, it can also verify the dynamic and static network configurations and the static file format, etc., to determine whether the server's dynamic network configuration and static configuration are consistent, and whether the network static configuration file format is correct. This ensures that the configuration file can be correctly modified during subsequent static configuration switching, thereby ensuring that the configuration file is correct during the final switching. This embodiment does not impose any limitations.

[0130] The server will determine whether to perform the IP handover operation based on the second verification result. If the second verification result fails, the server will stop the IP handover. It's understood that if the server has modified its static configuration when the IP handover is stopped, the static configuration parameters need to be changed back to their original values. Conversely, if the second verification result passes, the server can continue performing the IP handover operation.

[0131] Optionally, the method further includes: in response to the first server not being ready for switching within a second preset time period, performing a recovery operation and stopping the address switching, wherein the second preset time period is a period of time from the moment the second preset command is initiated, and the recovery operation is used to indicate the start of responding to the preset command.

[0132] Before the first server performs any ICMP blocking operations or sets up firewall rules, after the second server initiates a ping command to the first server, the second server will receive the first server's response to that ping command. By continuously sending ping commands to the first server, the second server determines whether it will fail to receive a response from the first server within a preset time period, thereby determining whether the first server has performed any ICMP blocking operations or set up firewall rules.

[0133] By setting a second preset time period, the system determines whether the first server is ready for the switchover. If the first server is ready during the second preset time period, the IP switchover operation can continue. Conversely, if the first server is not ready during the second preset time period, the IP switchover process will stop.

[0134] Understandably, if the server has modified its static configuration when the IP switching is stopped, the static configuration parameters need to be changed back to the parameters before the modification.

[0135] The second preset time period W0' can be understood as the duration for waiting for the peer script to start, and also as the timeout for determining whether the peer should abandon the handover. For example, the second preset time period W0' can be set between 30s and 120s depending on network conditions.

[0136] Optionally, the method further includes: in response to the completion of the address switch, performing a cleanup operation, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation being used to indicate the start of responding to a preset command, and the cleanup operation being used to indicate the deletion of the switch script.

[0137] After the second server completes the IP switch, it can also perform cleanup operations, such as starting to respond to ping commands and deleting the switch script.

[0138] The address switching method provided in this application may include four stages: a verification stage, a static configuration switching stage, a switching stage, and a termination stage. The verification stage includes verification of the switching parameter table, verification of dynamic and static network configurations, and verification of the static file format. These verifications are used to ensure that the parameters in the parameter table are entered correctly, that the server's dynamic network configuration is consistent with its static configuration, and that the network static configuration file format is correct. The verification stage ensures that the configuration file can be correctly modified during the subsequent static configuration switching, thereby ensuring that the configuration file is correct during the final switching and that the network switching is successful.

[0139] The static configuration phase modifies various network configuration files, including the hosts file. The switchover phase stops and starts network services to make the static configuration files take effect. The termination phase is used to complete cleanup tasks such as script cleanup and task cleanup.

[0140] Figure 6 This is a schematic diagram of an ideal IP slicing operation, such as... Figure 6 As shown, during the server IP switching process, server A and server B execute synchronously at each stage, ensuring that both appear on the network with the new IP simultaneously without any conflict. Figure 7 This is a diagram illustrating IP handover under network latency conditions, such as... Figure 7 As shown, in the switching process, slight time differences caused by the order in which the control node pushes scripts and calls tasks or network latency will lead to timeline misalignment, making it impossible for both to switch IPs simultaneously. This will cause server A and server B to be unable to execute the corresponding actions synchronously at each stage, resulting in IP conflict.

[0141] It can be seen that IP switching without the involvement of an intermediate IP places extremely stringent requirements on server time alignment, necessitating ensuring consistency in the start point of the switchover and the duration of the switchover. Furthermore, due to network interruptions during server IP switching, the execution progress of the other party cannot be obtained in a timely manner when the network is down.

[0142] Figure 8 This is a schematic diagram of IP slicing according to an embodiment of this application, such as... Figure 8 As shown, the address handover method provided in this application designs an ACK-free negotiation mechanism so that both parties can reach an agreement on whether to initiate the handover, eliminating the requirement for simultaneous initiation. Furthermore, to address potential IP conflict windows caused by non-simultaneous initiation, the handover is no longer required to be completed simultaneously. During the handover, the initiating party prioritizes network access to obtain an IP address, thereby ensuring IP handover without IP conflicts.

[0143] Figure 9 This is a schematic diagram of the IP splitting architecture provided in the embodiments of this application, such as... Figure 9 As shown, the address switching method provided in this application only requires the control server to send switching scripts to servers A and B in parallel. There is no need for the control server to schedule and participate in the IP switching process. Servers A and B negotiate the IP switching themselves, thereby effectively reducing the switching cost.

[0144] Figure 10 This is a flowchart of IP switching based on an embodiment of this application, such as... Figure 10As shown, the control server pushes switchover scripts to servers A and B in parallel. Due to network latency, there is a discrepancy in the time servers A and B receive the switchover scripts. Server A, acting as the active server, verifies the script upon receiving it. After successful verification, it continuously pings server B within a preset time period W0. When server A determines within W0 that server B has implemented ICMP blocking or firewall rules, i.e., the active server determines the passive server is ready for switchover, server A executes the ICMP blocking or firewall rules and executes a sleep command to stop operation. Correspondingly, server B, acting as the passive server, verifies the script upon receiving it. After successful verification, it executes the ICMP blocking or firewall rules and continuously pings server A within a preset time period W0'. When server B determines within W0' that server A has implemented ICMP blocking or firewall rules, i.e., the passive server determines the active server is ready for switchover, server B stops network services and ceases operation. Figure 10 Time T1 indicates that both the active and passive servers are ready for the switchover, and T1 must be within the time interval during which server A executes the sleep command and stops running. After time T1, server A performs the IP switchover operation and then performs a cleanup operation to complete the IP switchover. After server A completes the IP switchover, server B then restarts the network service and performs a cleanup operation to complete the IP switchover.

[0145] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0146] This application also provides an address switching device. It should be noted that the address switching device of this application can be used to execute the address switching method provided in this application. The address switching device provided in this application is described below.

[0147] Figure 11 This is a schematic diagram of an address switching device according to an embodiment of this application. Figure 11 As shown, the device includes a first receiving module 1101 and a first switching module 1102. The device will be described in detail below.

[0148] The first receiving module 1101 is used to receive a switching script from the control server. The switching script is used to instruct the first server to switch addresses with the second server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation is used to indicate stopping the response to the preset command. The first switching module 1102 is used to switch addresses with the second server according to the switching script.

[0149] Through the aforementioned apparatus, the first receiving module 1101 is used to receive a switching script from the control server. The switching script instructs the first server to switch addresses with the second server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation indicates stopping the response to the preset command. The first switching module 1102 is used to perform an address switch with the second server according to the switching script. By pushing a switching script to the server, which enables the server to automatically initiate a preset command (e.g., a ping command) and execute a preset operation (e.g., disabling ICMP protocol or setting firewall rules) to perform an IP switch, the server negotiates the address switch with the peer server using the switching script. This solves the problems of low switching efficiency and high switching costs associated with using intermediate temporary IPs and controlling a single pair of servers to complete the IP switch through a control node in related technologies. This achieves the effects of improving server IP switching efficiency, realizing conflict-free switching, and reducing switching costs.

[0150] The address switching device includes a processor and a memory. The first receiving module 1101 and the first switching module 1102 are stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.

[0151] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and by adjusting kernel parameters, a switching script can be pushed to the server. This script enables the server to automatically initiate preset commands (e.g., ping) and execute preset operations (e.g., disabling ICMP or setting firewall rules) to perform IP switching. This allows the server to negotiate the address switch with the peer server using the switching script, solving the problems of low efficiency and high cost associated with using intermediate temporary IPs and controlling single-server IP switching via a control node in related technologies. Ultimately, this improves server IP switching efficiency, achieves conflict-free switching, and reduces switching costs.

[0152] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0153] This application also provides another address switching device. It should be noted that the address switching device of this application can be used to execute the address switching method provided in this application. The address switching device provided in this application is described below.

[0154] Figure 12 This is a schematic diagram of an address switching device according to an embodiment of this application. Figure 12 As shown, the device includes a second receiving module 1201 and a second switching module 1202. The device will be described in detail below.

[0155] The second receiving module 1201 is used to receive a switching script from the control server. The switching script is used to instruct the second server to switch addresses with the first server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation is used to indicate stopping the response to the preset command. The second switching module 1202 is used to switch addresses with the first server according to the switching script.

[0156] Through the aforementioned apparatus, the second receiving module 1201 is used to receive a switching script from the control server. The switching script instructs the second server to switch addresses with the first server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation indicates stopping the response to the preset command. The second switching module 1202 is used to perform an address switch with the first server according to the switching script. By pushing a switching script to the server, which enables the server to automatically initiate a preset command (e.g., a ping command) and execute a preset operation (e.g., disabling ICMP protocol or setting firewall rules) to perform an IP switch, the server negotiates the address switch with the peer server using the switching script. This solves the problems of low switching efficiency and high switching costs associated with using intermediate temporary IPs and controlling a single pair of servers to complete the IP switch through a control node in related technologies. This achieves the effects of improving server IP switching efficiency, realizing conflict-free switching, and reducing switching costs.

[0157] The address switching device includes a processor and a memory. The second receiving module 1201 and the second switching module 1202 are stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.

[0158] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and by adjusting kernel parameters, a switching script can be pushed to the server. This script enables the server to automatically initiate preset commands (e.g., ping) and execute preset operations (e.g., disabling ICMP or setting firewall rules) to perform IP switching. This allows the server to negotiate the address switch with the peer server using the switching script, solving the problems of low efficiency and high cost associated with using intermediate temporary IPs and controlling single-server IP switching via a control node in related technologies. Ultimately, this improves server IP switching efficiency, achieves conflict-free switching, and reduces switching costs.

[0159] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0160] This application provides an address switching system. The system includes a control server, a first server, and a second server. The control server pushes switching scripts to the first server and the second server in parallel. The first server executes the address switching method described in any one of the above-described methods, and the second server executes the address switching method described in any one of the above-described methods.

[0161] This application provides a computer-readable storage medium storing a computer program configured to implement the address switching method when run on a computer or processor.

[0162] This application provides a processor for running a program, wherein the address switching method is executed during program execution.

[0163] like Figure 13 As shown in the figure, this application embodiment provides an electronic device. The electronic device 130 includes a processor and a memory. The memory stores a computer program, and the processor is configured to perform the following steps when running the computer program:

[0164] The system receives a switching script from the control server. The switching script instructs the first server to switch addresses with the second server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation indicates that the response to the preset command should be stopped. The system then switches addresses with the second server according to the switching script.

[0165] Optionally, switching addresses with the second server according to the switching script includes: sending a first preset command to the second server to obtain a first working state, wherein the first working state is used to indicate whether the second server is ready for switching; and performing address switching based on the first working state.

[0166] Optionally, sending a first preset command to the second server to obtain a first working state includes: sending a first preset command to the second server and obtaining a first command result, wherein the first command result is used to determine whether the second server has performed a preset operation; in response to determining that the second server has performed a preset operation, obtaining a first working state indicating that the second server is ready to switch.

[0167] Optionally, address switching based on the first working state includes: in response to the second server being ready for switching, performing a preset operation and stopping operation within a first time interval, wherein the first time interval is the time interval from a first moment to a second moment; in response to satisfying a preset condition, performing an address switching operation within a second time interval to complete the address switching, wherein the preset condition is used to indicate that both the first server and the second server are ready for switching, the second server stops network service and stops operation within a third time interval, the third time interval is the time interval from a third moment to a fourth moment, the first moment is earlier than the third moment, the second moment is later than the third moment, the second time interval is the time interval from the second moment to a fifth moment, the fifth moment is earlier than the fourth moment, and performing the address switching operation includes stopping network service and restarting network service.

[0168] Optionally, before sending a first preset command to the second server and obtaining a first working state, the method further includes: verifying the switching script and obtaining a first verification result, wherein the switching script includes a switching parameter table, and the first verification result includes the verification result corresponding to the switching parameter table; in response to the first verification result being a verification failure, stopping the address switching.

[0169] Optionally, the method further includes: stopping the address switching in response to the second server not being ready to switch within a first preset time period, wherein the first preset time period is a period of time starting from the moment the first preset command is initiated.

[0170] Optionally, the method further includes: in response to the completion of the address switch, performing a cleanup operation, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation being used to indicate the start of responding to a preset command, and the cleanup operation being used to indicate the deletion of the switch script.

[0171] Furthermore, when the processor in electronic device 130 is configured to run a computer program, it can also perform the following steps:

[0172] The system receives a switching script from the control server. The switching script instructs the second server to switch addresses with the first server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation indicates that the response to the preset command should be stopped. The system then switches addresses with the first server according to the switching script.

[0173] Optionally, switching addresses with the first server according to the switching script includes: sending a second preset command to the first server to obtain a second working state, wherein the second working state is used to indicate whether the first server is ready to switch; and performing address switching based on the second working state.

[0174] Optionally, sending a second preset command to the first server to obtain a second working state includes: performing a preset operation and sending a second preset command to the first server to obtain a second command result, wherein the second command result is used to determine whether the first server has performed the preset operation; in response to determining that the first server has performed the preset operation, obtaining a second working state indicating that the first server is ready to switch.

[0175] Optionally, address switching based on the second working state includes: in response to the first server being ready for switching, stopping network services and ceasing operation within a third time interval, wherein the first server stops operation within the first time interval, the first time interval being the time interval from the first moment to the second moment, the third time interval being the time interval from the third moment to the fourth moment, the first moment being earlier than the third moment, and the second moment being later than the third moment; in response to the satisfaction of a preset condition, restarting network services after the fourth moment to complete the address switching, wherein the preset condition is used to indicate that both the first server and the second server are ready for switching.

[0176] Optionally, before performing the preset operation, the method further includes: verifying the switching script to obtain a second verification result, wherein the switching script includes a switching parameter table, and the second verification result includes the verification result corresponding to the switching parameter table; and stopping the address switching in response to the second verification result being a verification failure.

[0177] Optionally, the method further includes: in response to the first server not being ready for switching within a second preset time period, performing a recovery operation and stopping the address switching, wherein the second preset time period is a period of time from the moment the second preset command is initiated, and the recovery operation is used to indicate the start of responding to the preset command.

[0178] Optionally, the method further includes: in response to the completion of the address switch, performing a cleanup operation, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation being used to indicate the start of responding to a preset command, and the cleanup operation being used to indicate the deletion of the switch script.

[0179] The electronic devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0180] This application also provides a computer program product, which, when executed on an electronic device, is suitable for executing a program that initializes the following method steps:

[0181] The system receives a switching script from the control server. The switching script instructs the first server to switch addresses with the second server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation indicates that the response to the preset command should be stopped. The system then switches addresses with the second server according to the switching script.

[0182] Optionally, switching addresses with the second server according to the switching script includes: sending a first preset command to the second server to obtain a first working state, wherein the first working state is used to indicate whether the second server is ready for switching; and performing address switching based on the first working state.

[0183] Optionally, sending a first preset command to the second server to obtain a first working state includes: sending a first preset command to the second server and obtaining a first command result, wherein the first command result is used to determine whether the second server has performed a preset operation; in response to determining that the second server has performed a preset operation, obtaining a first working state indicating that the second server is ready to switch.

[0184] Optionally, address switching based on the first working state includes: in response to the second server being ready for switching, performing a preset operation and stopping operation within a first time interval, wherein the first time interval is the time interval from a first moment to a second moment; in response to satisfying a preset condition, performing an address switching operation within a second time interval to complete the address switching, wherein the preset condition is used to indicate that both the first server and the second server are ready for switching, the second server stops network service and stops operation within a third time interval, the third time interval is the time interval from a third moment to a fourth moment, the first moment is earlier than the third moment, the second moment is later than the third moment, the second time interval is the time interval from the second moment to a fifth moment, the fifth moment is earlier than the fourth moment, and performing the address switching operation includes stopping network service and restarting network service.

[0185] Optionally, before sending a first preset command to the second server and obtaining a first working state, the method further includes: verifying the switching script and obtaining a first verification result, wherein the switching script includes a switching parameter table, and the first verification result includes the verification result corresponding to the switching parameter table; in response to the first verification result being a verification failure, stopping the address switching.

[0186] Optionally, the method further includes: stopping the address switching in response to the second server not being ready to switch within a first preset time period, wherein the first preset time period is a period of time starting from the moment the first preset command is initiated.

[0187] Optionally, the method further includes: in response to the completion of the address switch, performing a cleanup operation, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation being used to indicate the start of responding to a preset command, and the cleanup operation being used to indicate the deletion of the switch script.

[0188] Furthermore, when this computer program product is executed on an electronic device, it is also suitable for executing an initialization program with the following method steps:

[0189] The system receives a switching script from the control server. The switching script instructs the first server to switch addresses with the second server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation indicates that the response to the preset command should be stopped. The system then switches addresses with the second server according to the switching script.

[0190] Optionally, switching addresses with the second server according to the switching script includes: sending a first preset command to the second server to obtain a first working state, wherein the first working state is used to indicate whether the second server is ready for switching; and performing address switching based on the first working state.

[0191] Optionally, sending a first preset command to the second server to obtain a first working state includes: sending a first preset command to the second server and obtaining a first command result, wherein the first command result is used to determine whether the second server has performed a preset operation; in response to determining that the second server has performed a preset operation, obtaining a first working state indicating that the second server is ready to switch.

[0192] Optionally, address switching based on the first working state includes: in response to the second server being ready for switching, performing a preset operation and stopping operation within a first time interval, wherein the first time interval is the time interval from a first moment to a second moment; in response to satisfying a preset condition, performing an address switching operation within a second time interval to complete the address switching, wherein the preset condition is used to indicate that both the first server and the second server are ready for switching, the second server stops network service and stops operation within a third time interval, the third time interval is the time interval from a third moment to a fourth moment, the first moment is earlier than the third moment, the second moment is later than the third moment, the second time interval is the time interval from the second moment to a fifth moment, the fifth moment is earlier than the fourth moment, and performing the address switching operation includes stopping network service and restarting network service.

[0193] Optionally, before sending a first preset command to the second server and obtaining a first working state, the method further includes: verifying the switching script and obtaining a first verification result, wherein the switching script includes a switching parameter table, and the first verification result includes the verification result corresponding to the switching parameter table; in response to the first verification result being a verification failure, stopping the address switching.

[0194] Optionally, the method further includes: stopping the address switching in response to the second server not being ready to switch within a first preset time period, wherein the first preset time period is a period of time starting from the moment the first preset command is initiated.

[0195] Optionally, the method further includes: in response to the completion of the address switch, performing a cleanup operation, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation being used to indicate the start of responding to a preset command, and the cleanup operation being used to indicate the deletion of the switch script.

[0196] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0197] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0198] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0199] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0200] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0201] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0202] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0203] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0204] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0205] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. An address switching method, characterized by, include: The system receives a switching script from the control server. The switching script instructs the first server to switch addresses with the second server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation indicates that the response to the preset command should be stopped. The switching script is pushed to the first server and the second server in parallel by the control server. The address is switched with the second server according to the switching script; The step of switching addresses with the second server according to the switching script includes executing the preset operation when the first server initiates the preset command to determine that the second server is ready for address switching.

2. The method of claim 1, wherein, The step of switching addresses with the second server according to the switching script includes: A first preset command is sent to the second server to obtain a first working state, wherein the first working state is used to indicate whether the second server is ready to switch. Address switching is performed based on the first working state.

3. The method according to claim 2, characterized in that, The step of initiating a first preset command to the second server to obtain a first working state includes: The first preset command is sent to the second server to obtain a first command result, wherein the first command result is used to determine whether the second server executes the preset operation; In response to determining that the second server has performed the preset operation, a first working state is obtained to indicate that the second server is ready to switch over.

4. The method according to claim 3, characterized in that, The address switching based on the first working state includes: In response to the second server being ready for switching, the preset operation is executed, and operation is stopped within a first time interval, wherein the first time interval is the time interval from the first moment to the second moment; In response to the fulfillment of preset conditions, an address switching operation is performed within a second time interval to complete the address switching. The preset conditions indicate that both the first server and the second server are ready for switching. The second server stops network services and ceases operation within a third time interval. The third time interval is the time interval from a third moment to a fourth moment, where the first moment is earlier than the third moment and the second moment is later than the third moment. The second time interval is the time interval from the second moment to a fifth moment, where the fifth moment is earlier than the fourth moment. The execution of the address switching operation includes the operation of stopping network services and the operation of restarting network services.

5. The method according to claim 2, characterized in that, Before initiating the first preset command to the second server and obtaining the first working state, the process further includes: The switching script is validated to obtain a first validation result, wherein the switching script includes a switching parameter table, and the first validation result includes the validation result corresponding to the switching parameter table. In response to the first verification result being a verification failure, the address switching is stopped.

6. The method according to claim 3, characterized in that, Also includes: In response to the second server not being ready to switch within a first preset time period, the address switching is stopped, wherein the first preset time period is a period of time starting from the moment the first preset command is initiated.

7. The method according to any one of claims 1-6, characterized in that, Also includes: In response to the completion of the address switch, a cleanup operation is performed, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation is used to indicate the start of responding to the preset command, and the cleanup operation is used to indicate the deletion of the switch script.

8. An address switching method, characterized in that, include: The system receives a switching script from the control server. The switching script instructs the second server to switch addresses with the first server by initiating a second preset command and executing a preset operation. The initiator of the second preset command determines whether the receiver of the second preset command should execute the preset operation based on whether a response to the second preset command is received. The preset operation indicates that the response to the second preset command should be stopped. The switching script is pushed to the first server and the second server in parallel by the control server. The address is switched with the first server according to the switching script; The step of switching addresses with the first server according to the switching script includes first executing the preset operation, and then sending a second preset command to the first server.

9. The method according to claim 8, characterized in that, The step of switching addresses with the first server according to the switching script includes: A second preset command is sent to the first server to obtain a second working state, wherein the second working state is used to indicate whether the first server is ready to switch. Address switching is performed based on the second working state.

10. The method according to claim 9, characterized in that, The step of initiating a second preset command to the first server to obtain a second working state includes: The preset operation is executed, and a second preset command is sent to the first server to obtain a second command result, wherein the second command result is used to determine whether the first server has executed the preset operation; In response to determining that the first server has performed the preset operation, a second working state is obtained, indicating that the first server is ready to switch over.

11. The method according to claim 10, characterized in that, The address switching based on the second working state includes: In response to the first server being ready for a switchover, the network service is stopped and operation ceases within a third time interval, wherein the first server ceases operation within the first time interval, which is the time interval from a first moment to a second moment, and the third time interval is the time interval from a third moment to a fourth moment, wherein the first moment is earlier than the third moment, and the second moment is later than the third moment; In response to the fulfillment of preset conditions, the network service is restarted after the fourth time interval to complete the address switch, wherein the preset conditions indicate that both the first server and the second server are ready for the switch.

12. The method according to claim 10, characterized in that, Before performing the preset operation, the method further includes: The switching script is validated to obtain a second validation result, wherein the switching script includes a switching parameter table, and the second validation result includes the validation result corresponding to the switching parameter table; In response to the second verification result being a verification failure, the address switching is stopped.

13. The method according to claim 10, characterized in that, Also includes: In response to the first server not being ready for switching within a second preset time period, a recovery operation is performed and the address switching is stopped. The second preset time period is a period of time starting from the moment the second preset command is initiated, and the recovery operation is used to indicate the start of responding to the preset command.

14. The method according to any one of claims 8-13, characterized in that, Also includes: In response to the completion of the address switch, a cleanup operation is performed, wherein the cleanup operation includes a recovery operation and a cleanup operation, the recovery operation is used to indicate the start of responding to the preset command, and the cleanup operation is used to indicate the deletion of the switch script.

15. An address switching device, characterized in that, include: The first receiving module is used to receive a switching script from the control server. The switching script is used to instruct the first server to switch addresses with the second server by initiating a preset command and executing a preset operation. The initiator of the preset command determines whether the receiver of the preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation is used to indicate stopping the response to the preset command. The switching script is pushed to the first server and the second server in parallel by the control server. A first switching module is used to switch addresses with the second server according to the switching script. The step of switching addresses with the second server according to the switching script includes executing the preset operation when the first server initiates the preset command to determine that the second server is ready for address switching.

16. An address switching device, characterized in that, include: The second receiving module is used to receive a switching script from the control server. The switching script instructs the second server to switch addresses with the first server by initiating a second preset command and executing a preset operation. The initiator of the second preset command determines whether the receiver of the second preset command should execute the preset operation based on whether a response to the preset command is received. The preset operation indicates that the response to the second preset command should be stopped. The switching script is pushed to the first server and the second server in parallel by the control server. The second switching module is used to switch addresses with the first server according to the switching script. The step of switching addresses with the first server according to the switching script includes first executing the preset operation, and then sending a second preset command to the first server.

17. An address switching system, characterized in that, It includes a control server, a first server, and a second server. The control server is used to push switching scripts to the first server and the second server in parallel. The first server is used to execute the address switching method of any one of claims 1-7, and the second server is used to execute the address switching method of any one of claims 8-14.

18. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute, when run on a computer or processor, the address switching method of any one of claims 1 to 7 and / or the address switching method of any one of claims 8 to 14.

19. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the address switching method of any one of claims 1 to 7 and / or the address switching method of any one of claims 8 to 14.