A server switching method and system
Through the monitoring application module and the identity switching module working together, server switching is performed according to the monitoring card status, which solves the data loss problem caused by server switching in the DCS system and realizes uninterrupted data service.
Patent Information
- Application Number
- CN202510386489.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-03-28
AI Technical Summary
In DCS system, server switching uses network transmission data to cause data loss, which cannot meet the requirements of uninterrupted data service.
The monitoring application module periodically obtains the status of the local and peer monitoring cards, and notifies the identity switching module to perform server status switching when the master and slave status changes, ensuring that the server status switching follows the monitoring card status and realizes quick switching.
It realizes rapid server switching, ensures uninterrupted data service and avoids data loss.
Smart Images

Figure CN119892609B_ABST
Abstract
Description
Technical Field
[0001] This document relates to server control technology, especially a server switching method and system. Background Art
[0002] With the development of DCS systems, DCS has become the main means of nuclear power plant unit operation and management. The DCS system of nuclear power plants requires real-time servers to provide uninterrupted data services. Therefore, in order to ensure the stable and reliable operation of the system, the servers in the DCS system are configured in a dual-redundancy mode.
[0003] In related technologies, after the configuration in the dual-redundancy mode is completed, server switching often uses the method of network data transmission.
[0004] However, the time for server switching using the method of network data transmission is generally about 3s. During these 3s, the real-time server cannot receive the data sent by the IO server, resulting in the loss of the data collected during this process and failing to meet the requirement of uninterrupted data service. Summary of the Invention
[0005] The embodiments of the present application provide a server switching method and system, which can perform switching operations on the corresponding states of the server according to the master-slave status of the local monitoring card obtained, so as to achieve fast switching and ensure uninterrupted data service.
[0006] The embodiments of the present application provide a server switching method, which is applied to a server switching system. The server switching system includes: multiple servers set in a redundant manner, and each server is provided with a monitoring card, a monitoring card driver module, a monitoring application module, and an identity switching module, and the monitoring cards on all servers are connected. The method includes:
[0007] The monitoring application module periodically obtains the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the local monitoring card driver module; wherein, the status of the peer monitoring card is transmitted to the local monitoring card in real time;
[0008] After each acquisition operation is completed, the monitoring application module sets the master-slave status of the local monitoring card this time according to the status of the local monitoring card and the status of the peer monitoring card obtained, and when the master-slave status set this time changes compared with the master-slave status set last time, notifies the master-slave status of the local monitoring card set this time to the identity switching module;
[0009] The identity switching module performs switching operations on the corresponding states of the server according to the master-slave status of the local monitoring card obtained.
[0010] The embodiment of the present application further provides a server switching system, including: multiple servers set in a redundant manner, each server is provided with a monitoring card, a monitoring card driver module, a monitoring application module and an identity switching module, and the monitoring cards on all servers are connected;
[0011] The monitoring application module is configured to periodically obtain the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the local monitoring card driver module; wherein, the status of the peer monitoring card is transmitted to the local monitoring card in real time;
[0012] The monitoring application module is further configured to, after each acquisition operation, set the master-slave status of the local monitoring card this time according to the obtained status of the local monitoring card and the status of the peer monitoring card, and when the master-slave status set this time changes compared with the master-slave status set last time, notify the identity switching module of the master-slave status of the local monitoring card set this time;
[0013] The identity switching module is configured to perform a switching operation on the corresponding status of the server according to the obtained master-slave status of the local monitoring card.
[0014] The embodiment of the present application includes that the monitoring application module periodically obtains the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the local monitoring card driver module. After each acquisition operation, it sets the master-slave status of the local monitoring card this time according to the obtained status of the local monitoring card and the status of the peer monitoring card, and when the master-slave status of the local monitoring card set this time changes compared with the master-slave status of the local monitoring card set last time, it notifies the identity switching module of the master-slave status of the local monitoring card set this time; the identity switching module performs a switching operation on the corresponding status of the server according to the obtained master-slave status of the local monitoring card. Therefore, the negotiation of the status is completed between the local monitoring card and the peer monitoring card, and the status switching of the server only needs to follow the status of the monitoring card to complete the switching, thereby realizing the rapid switching of the server and ensuring uninterrupted data services.
[0015] Other features and advantages of the present application will be described in the subsequent specification, and part of them will become obvious from the specification, or will be understood by implementing the present application. Other advantages of the present application can be realized and obtained through the solutions described in the specification and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings are used to provide an understanding of the technical solutions of the present application, and constitute a part of the specification. They are used to explain the technical solutions of the present application together with the embodiments of the present application, and do not constitute a limitation to the technical solutions of the present application.
[0017] Figure 1 It is a schematic flow chart of a server switching method according to an embodiment of the present application;
[0018] Figure 2 Schematic diagram of the state reading and writing process of a dual - machine monitoring card according to an embodiment of the present application;
[0019] Figure 3 Schematic diagram of the process of initializing and setting the state of a monitoring card according to an embodiment of the present application;
[0020] Figure 4 Schematic diagram of the process of non - initializing and setting the state of a monitoring card according to an embodiment of the present application;
[0021] Figure 5 Schematic diagram of the structure of a server switching system according to an embodiment of the present application. Detailed implementation manners
[0022] The present application describes multiple embodiments, but the description is exemplary rather than restrictive, and it is obvious to those of ordinary skill in the art that there can be more embodiments and implementation solutions within the scope covered by the embodiments described in the present application. Although many possible feature combinations are shown in the drawings and discussed in the detailed implementation manners, many other combination ways of the disclosed features are also possible. Unless specifically restricted, any feature or element of any embodiment can be combined with any other feature or element in any other embodiment, or can replace any other feature or element in any other embodiment.
[0023] The present application includes and contemplates combinations with features and elements known to those of ordinary skill in the art. The embodiments, features, and elements already disclosed in the present application can also be combined with any conventional features or elements to form a unique inventive solution. Any feature or element of any embodiment can also be combined with features or elements from other inventive solutions to form another unique inventive solution. Therefore, it should be understood that any feature shown and / or discussed in the present application can be implemented alone or in any suitable combination. Therefore, except for the limitations made according to the appended claims and their equivalent replacements, the embodiments are not subject to other limitations. In addition, various modifications and changes can be made within the protection scope of the appended claims.
[0024] In addition, when describing representative embodiments, the specification may have presented the method and / or process as a specific sequence of steps. However, to the extent that the method or process does not depend on the specific order of the steps described herein, the method or process should not be limited to the specific order of steps described. As those of ordinary skill in the art will understand, other step orders are possible. Therefore, the specific order of steps set forth in the specification should not be construed as a limitation on the claims. In addition, the claims directed to the method and / or process should not be limited to performing their steps in the order written, as those skilled in the art can readily understand that these orders can vary and still remain within the spirit and scope of the embodiments of the present application.
[0025] The technical solutions of the embodiments of the present application are applicable to scenarios where server switching is required to avoid data loss caused by discontinuous switching processes, thereby meeting the requirements of uninterrupted data services. The following are common scenarios for server switching:
[0026] 1. Website hosting and cloud services: To ensure the continuous availability of online services, especially in the face of traffic peaks or hardware failures, server switching can automatically redirect user requests to a standby server, avoiding service interruptions.
[0027] 2. Database management systems: In database operations, the master-slave server architecture is a common configuration. When the primary database fails, server switching can quickly switch to the secondary database to ensure that data processing and services are not interrupted.
[0028] 3. Financial trading systems: For financial trading systems that require high reliability and real-time performance, server switching can complete failover within seconds, thereby minimizing the risk of trading interruptions.
[0029] 4. Telecommunications and communication: In telecommunications networks, server switching is used to ensure the continuity of communication services. For example, in a mobile communication network, if a base station controller has a problem, the system will quickly switch to a standby controller to maintain the continuity of calls and data transmission.
[0030] 5. Healthcare: Hospitals and other healthcare providers rely on highly available information systems to manage medical records, schedule resources, etc. Server switching technology ensures that the system can operate stably even in the event of hardware failures.
[0031] 6. Media and entertainment: Streaming service providers use server switching to cope with sudden increases in the number of viewers or hardware failures, ensuring that the quality and stability of video streams are not affected.
[0032] In the above scenario, in order to ensure the continuity of services, after the relevant technology is configured in a redundant manner, server switching often uses the method of network data transmission.
[0033] In addition, with the development of the DCS system, the DCS has become the main means for the operation and management of nuclear power plant units, ensuring the safe and reliable operation of the units. The field instruments collect on-site signals into the input / output module (IO module), and all signals are aggregated and processed by the controller and then forwarded to the IO server; the real-time server obtains data from the IO server for processing functions such as alarm, log, and trend, and provides various information for the operator station for on-line display.
[0034] The DCS system of a nuclear power plant requires that the real-time server can provide uninterrupted data services, and does not affect the collection and display of on-site data during the server failure switching process. Therefore, in order to ensure the stable and reliable operation of the system, the servers in the DCS system are all configured in a dual-machine redundant manner. For the real-time server, all data collection and processing and the functions of providing services for the operator station are completed by the primary server. When the primary server fails, the real-time server failure diagnosis is performed by the method of network data transmission and the standby server is automatically switched to the primary server.
[0035] However, the time for server switching using this method of network data transmission is generally about 3s. During these 3s, the real-time server cannot receive the data sent by the IO server, resulting in the loss of the data collected during this process and unable to meet the requirements of uninterrupted data services.
[0036] In view of this, the embodiments of the present application are committed to providing a server switching method and system, which can complete the negotiation of the state on the local monitoring card and the peer monitoring card, and the state switching of the server only needs to follow the state of the monitoring card to complete the switching, thereby realizing the rapid switching of the server and ensuring the uninterrupted data service. It will be described in detail one by one in the following embodiments.
[0037] The embodiments of the present disclosure provide a server switching method. The server switching system includes: multiple servers set in a redundant manner, and each server is provided with a monitoring card, a monitoring card driver module, a monitoring application module, and an identity switching module, and the monitoring cards on all servers are connected, as Figure 1 shown, the method includes:
[0038] Step 100, the monitoring application module periodically obtains the state of the local monitoring card and the state of the peer monitoring card from the local monitoring card through the local monitoring card driver module; wherein, the state of the peer monitoring card is transmitted to the local monitoring card in real time.
[0039] The monitoring application module used to execute step 100 refers to the monitoring application module in each server in the server switching system. The local end refers to the same end as the end where the monitoring application module is located, and the opposite end refers to the end that is different from the end where the monitoring application module is located. Assume that the server switching system is two servers set up in a redundant manner, namely server A and server B. Monitoring cards, monitoring card driver modules, monitoring application modules, and identity switching modules are all set up on both server A and server B, and the monitoring card in server A is connected to the monitoring card in server B. For the monitoring card driver module on server A, the local monitoring card driver module refers to the monitoring card driver module in server A, the local monitoring card refers to the monitoring card in server A, and the opposite monitoring card refers to the monitoring card in server B; for the monitoring card driver module on server B, the local monitoring card driver module refers to the monitoring card driver module in server B, the local monitoring card refers to the monitoring card in server B, and the opposite monitoring card refers to the monitoring card in server A.
[0040] The monitoring cards on all servers can be connected using DB15 signal transmission cables to transmit the status signals between all devices to each other. Taking the two servers, server A and server B, set up in the above redundant manner as an example, the monitoring card on server A is connected to the monitoring card on server B using a DB15 signal transmission cable. The status of the monitoring card on server A is transmitted in real time to the monitoring card in server B, and the status of the monitoring card on server B is transmitted in real time to the monitoring card in server A. Therefore, for the monitoring card driver module on server A, the monitoring application module in server A obtains the status of the monitoring card in server A and the status of the monitoring card in server B from the monitoring card in server A through the monitoring card driver module of server A. For the monitoring card driver module on server B, the monitoring application module in server B obtains the status of the monitoring card in server B and the status of the monitoring card in server A from the monitoring card in server B through the monitoring card driver module of server B.
[0041] The monitoring application module can use the built-in monitoring application program to perform the required operations, and the monitoring card driver module can use the built-in monitoring card driver program to perform the required operations.
[0042] Step 110: After each acquisition operation is completed, the monitoring application module sets the master-slave status of the local monitoring card this time according to the status of the local monitoring card and the opposite monitoring card obtained, and when the master-slave status set this time changes compared with the master-slave status set last time, notifies the identity switching module of the master-slave status of the local monitoring card set this time.
[0043] The local monitoring card driver module is used to control the normal operation of the local monitoring card and provide interfaces for the local monitoring application module. The provided interfaces include: a status read interface and a status write interface. When the local monitoring card driver module includes a status read interface and a status write interface, the monitoring application module periodically obtains the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the local monitoring card driver module, which means that the monitoring application module periodically reads the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the status read interface provided by the local monitoring card driver module; the monitoring application module sets the master-slave status of the local monitoring card this time according to the obtained status of the local monitoring card and the status of the peer monitoring card, which means that the monitoring application module writes the determined master-slave status into the local monitoring card through the status write interface provided by the local monitoring card driver module.
[0044] The status of the local monitoring card and the status of the peer monitoring card both include: master status, slave status, and idle status. The master-slave status refers to the master status or the slave status. The monitoring card is a PCI interface hardware device. When used on-site, the monitoring card is inserted into the PCI slot of the server. And in order to maintain the master-slave status of the monitoring card, the monitoring application module needs to periodically call the write card status interface of the monitoring card driver module to set the master-slave status of the monitoring card, otherwise the monitoring card will enter the idle status.
[0045] The DB15 signal transmission cable transmits 6 signals in parallel. Among them, 3 signals are used to receive the status of the peer monitoring card, and the other 3 signals are used to send the status of the local monitoring card to the peer monitoring card. Among the 3 signals used to receive the status of the peer monitoring card, 1 signal is used to identify whether the peer monitoring card exists, and the other 2 signals are used to identify the status of the peer monitoring card (such as master status, or slave status, or idle status). Among the 3 signals used to send the status of the local monitoring card to the peer monitoring card, 1 signal is used to identify whether the local monitoring card exists, and the other 2 signals are used to identify the status of the local monitoring card (such as master status, or slave status, or idle status).
[0046] Reading the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the status read interface provided by the local monitoring card driver module can be done by calling the status read interface. Each time the status read interface is called, the status of the local monitoring card can be read out, and the status of the peer monitoring card can also be read out.
[0047] The read status can be represented by four-bit binary data, and the four-bit binary data can be represented by D3D2D1D0.
[0048] Among them, D1D0 is the status of the local monitoring card read, and the definition is as follows:
[0049] D1D0 = 00 means that the read local monitoring card is in the idle status;
[0050] D1D0 = 01 indicates that the local monitoring card read is in the slave state;
[0051] D1D0 = 10 indicates that the local monitoring card read is in the master state;
[0052] D3D2 is the status of the peer monitoring card read, defined as follows:
[0053] D3D2 = 00 indicates that the peer monitoring card read is in the idle state;
[0054] D3D2 = 01 indicates that the peer monitoring card of the other party read is in the slave state;
[0055] D3D2 = 10 indicates that the peer monitoring card of the other party read is in the master state;
[0056] D3D2 = 11 indicates that the peer monitoring card read does not exist and operates in single - machine mode.
[0057] The set status (which can also be called the written status) can be represented by two - bit binary data, and the two - bit binary data can be represented by D1D0. Among them, the status of the local monitoring card set is defined as follows:
[0058] D1D0 = 00 indicates that the status of the local monitoring card is set to the idle state;
[0059] D1D0 = 01 indicates that the status of the local monitoring card is set to the slave state;
[0060] D1D0 = 10 indicates that the status of the local monitoring card is set to the master state.
[0061] The master - slave status set this time may be the same as the master - slave status set last time. For example, if the master - slave status set last time was the master state, and the master - slave status set this time is also the master state. Another example is that if the master - slave status set last time was the slave state, and the master - slave status set this time is also the slave state. When the master - slave status set this time is different from the master - slave status set last time, for example, if the master - slave status set last time was the master state, and the master - slave status set this time is the slave state, or if the master - slave status set this time is the slave state and the master - slave status set this time is the master state, it means that the master - slave status set this time has changed compared to the master - slave status set last time. Therefore, the master - slave status of the local monitoring card set this time is notified to the identity switching module.
[0062] Step 120, the identity switching module performs the switching operation of the corresponding server status according to the obtained master - slave status of the local monitoring card.
[0063] The operations for the identity switching module to perform the corresponding state switching of the server may include: data synchronization and consistency check, configuration update, service switching and load balancing, monitoring and alerting system update, logging and auditing.
[0064] Among them, data synchronization means that when switching the primary server to a secondary server, the identity switching module needs to ensure that all data of the secondary server is synchronized with the primary server, especially the database or critical business data, which can be achieved through data synchronization mechanisms (such as master-slave synchronization of databases, file synchronization, etc.). Consistency check means that before the switch, it is necessary to perform a data consistency check on the secondary server to ensure that the system will not have problems due to inconsistent data after the switch. For example, check the log synchronization, transaction status, etc. in the database.
[0065] Configuration update means that the identity switching module needs to update the role configuration of the primary server or the secondary server. Network configuration update means that the identity switching module needs to adjust the network configuration. For example, modify the routing, DNS, load balancing, etc. to ensure that the client or other components can access the new primary server.
[0066] Service switching means that the identity switching module needs to ensure that the new primary server can smoothly take over all services of the primary server, which may involve starting some specific services, configurations, or processes. Load balancing means that if there is a load balancer in the system (such as a hardware load balancer or a software load balancer), the identity switching module needs to notify the load balancer to update and direct the traffic to the new primary server to ensure that requests from the client to the primary server can be correctly routed to the new host.
[0067] Monitoring system update means that the identity switching module needs to guide the monitoring system to understand the new role of the primary server and start monitoring the running status of the new host, including system resource monitoring, performance monitoring, logging, etc. Alerting system update means that the identity switching module needs to synchronously update the alerting system to ensure that the status of the new primary server is correctly monitored and the administrator is notified in a timely manner when a failure or anomaly occurs.
[0068] Logging means that when the identity switching module performs any switching operation, it should record detailed log information, including the time, reason, operations performed, affected services, etc. of the switch. These logs will help with subsequent troubleshooting and auditing. Auditing means that if the system involves important business, the identity switching operation may need to comply with compliance requirements, and all switching operations should be recorded for later tracking and auditing.
[0069] The server switching method provided by the embodiments of this application is that the monitoring application module periodically obtains the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the local monitoring card driver module. After each acquisition operation is completed, the master-slave status of the local monitoring card for this time is set according to the obtained status of the local monitoring card and the status of the peer monitoring card, and when the master-slave status of the local monitoring card set for this time changes compared with the master-slave status of the local monitoring card set for the previous time, the master-slave status of the local monitoring card set for this time is notified to the identity switching module; the identity switching module performs the switching operation of the corresponding status of the server according to the obtained master-slave status of the local monitoring card. Therefore, the negotiation of the status is completed between the local monitoring card and the peer monitoring card, and the status switching of the server only needs to follow the status of the monitoring card to complete the switching, thereby realizing the rapid switching of the server and ensuring uninterrupted data services.
[0070] When the redundancy setting method is the dual-machine redundancy setting method (taking server A and server B as examples), the monitoring card can refer to the dual-machine monitoring card, the monitoring card driver module can refer to the dual-machine monitoring card driver module, and the monitoring card application module can refer to the dual-machine monitoring card application module. Therefore, a dual-machine monitoring card, a dual-machine monitoring card driver module, and a dual-machine monitoring card application module are respectively set in server A and server B. The process of reading and writing the status of the dual-machine monitoring card is as Figure 2 shown. For server A, the dual-machine monitoring card in server A reads the status of the local monitoring card (i.e., the dual-machine monitoring card in server A) and the status of the peer monitoring card (i.e., the dual-machine monitoring card in server B) from the dual-machine monitoring card in server A through the dual-machine monitoring card driver module in server A, and after determining the master-slave status of the local monitoring card, it writes it into the dual-machine monitoring card in server A through the dual-machine monitoring card driver module in server A. For server B, the process is similar and will not be elaborated.
[0071] In an exemplary example, the method further includes:
[0072] The monitoring application module opens the local monitoring card through the local monitoring card driver module;
[0073] In response to the successful opening of the local monitoring card and the successful opening of the peer monitoring card, and when the local monitoring card and the peer monitoring card are opened simultaneously, the monitoring application module obtains the local master status setting right, and determines whether the local monitoring card has the priority to set the master status according to the obtained local master status setting right;
[0074] In response to the determination result that the local monitoring card obtained enjoys the right to preferentially set the master state, the monitoring application module obtains the state of the local monitoring card and the state of the peer monitoring card from the local monitoring card through the local monitoring card driving module, and sets the master-slave state of the local master state to the master state when the state of the local monitoring card is the slave state and the state of the peer monitoring card is not the master state.
[0075] When setting up multiple servers in a redundant manner, usually one end that is pre-specified to enjoy the right to preferentially set the master state is determined. When both the local monitoring card and the peer monitoring card are successfully opened and opened simultaneously, it is necessary to obtain the right to set the local master state because it is necessary to determine whether the local monitoring card enjoys the right to set the master state, and then determine whether to "grab the lead" to set the master-slave state of the local monitoring card this time. Because after power-on, both the local monitoring card and the peer monitoring card are in the idle state, whichever monitoring application module acts first, the master-slave state of the local monitoring card of the corresponding monitoring application module will be set to the master state.
[0076] However, when the local monitoring card and the peer monitoring card are not opened simultaneously, the monitoring application module does not need to obtain the right to set the local master state, because the monitoring card that is successfully opened first will definitely "seize" the master state, regardless of whether it enjoys the right to preferentially set the master state.
[0077] Taking the example of setting up two servers (i.e., Server A and Server B) in a redundant manner in the above embodiment, and the monitoring cards in Server A and Server B are opened simultaneously. After initial power-on, the monitoring application module in Server A opens the local monitoring card (i.e., the monitoring card in Server A) through the local monitoring card driving module (i.e., the monitoring card driving module in Server A), and the state of the local monitoring card is the idle state. The monitoring application module in Server A sets the state of the local monitoring card to the slave state; the monitoring application module in Server B opens the local monitoring card (i.e., the monitoring card in Server B) through the local monitoring card driving module (i.e., the monitoring card driving module in Server B), and the state of the local monitoring card is the idle state. The monitoring application module in Server B sets the state of the local monitoring card to the slave state. Subsequently, the monitoring application module in Server A obtains the right to set the local master state, and determines whether the local monitoring card enjoys the right to preferentially set the master state based on the obtained right to set the local master state. When it is determined that the local monitoring card enjoys the right to preferentially set the master state, the monitoring application module in Server A obtains the state of the local monitoring card and the state of the peer monitoring card from the local monitoring card through the local monitoring card driving module, and sets the master-slave state of the local master state to the master state when the state of the local monitoring card is the slave state and the state of the peer monitoring card is not the master state.
[0078] In an exemplary instance, the method further includes:
[0079] In response to the obtained judgment result that the local monitoring card does not have the right to preferentially set the master state, the monitoring application module obtains the state of the local monitoring card and the state of the peer monitoring card from the local monitoring card through the local monitoring card driving module within a preset time, and sets the master-slave state of the local master state to the slave state when the state of the local monitoring card is the slave state and the state of the peer monitoring card is the master state.
[0080] Taking the redundant setting of two servers, Server A and Server B, in the above embodiment as an example, during the process of the monitoring application module in Server A setting the master-slave state of the local monitoring card, the monitoring application module in Server A obtains the right to set the local master state, and determines whether the local monitoring card has the right to preferentially set the master state based on the obtained right to set the local master state. When it is determined that the local monitoring card does not have the right to preferentially set the master state, the monitoring application module in Server A waits for a preset time period (the preset time period waited is sufficient for the monitoring application module in Server B to set the master-slave state of its monitoring card to the master state), and after the preset time period, obtains the state of the local monitoring card and the state of the peer monitoring card (i.e., the monitoring card in Server B) from the local monitoring card through the local monitoring card driving module, and sets the master-slave state of the local master state to the slave state when the state of the local monitoring card is the slave state and the state of the peer monitoring card is the master state.
[0081] The preset time can be set with reference to the total time required for a series of operations for setting the master state in the initial state. When setting the preset time with reference to the total time required for the aforementioned series of operations, the preset time should not be less than the total time required for the aforementioned series of operations. Among them, the aforementioned series of operations include: the application module obtains the right to set the local master state through the local monitoring card, obtains the state of the local monitoring card and the state of the peer monitoring card from the local monitoring card when determining whether the local monitoring card has the right to preferentially set the master state based on the right to set the local master state, and sets the master-slave state of the local monitoring card to the master state.
[0082] In an exemplary instance, the monitoring application module sets the master-slave state of the local monitoring card this time according to the obtained state of the local monitoring card and the state of the peer monitoring card, including:
[0083] In response to the state of the local monitoring card obtained and the state of the remote monitoring card obtained belonging to a reasonable state relationship, the monitoring application module sets the master-slave state of the local monitoring card this time according to the state of the local monitoring card obtained; wherein, the reasonable state relationship is a relationship in which the states are mapped to their respective servers so that multiple servers are set in a redundant manner;
[0084] In response to the state of the local monitoring card obtained and the state of the remote monitoring card obtained being in an unreasonable state relationship, the monitoring application module sets the master-slave state of the local monitoring card this time according to the local redundancy state, as well as the state of the local monitoring card obtained and the state of the remote monitoring card obtained; wherein, the unreasonable state relationship is a relationship in which the states are mapped to their respective servers and cannot make multiple servers be set in a redundant manner; the local redundancy state includes: the right to set the local master state or the redundancy state of the local monitoring card.
[0085] Still taking the two servers, server A and server B, set in the redundant manner in the above embodiment as an example, the fact that the state of the local monitoring card obtained and the state of the remote monitoring card obtained are in a reasonable state relationship means that: the state of the local monitoring card obtained is mapped to the local server, the state of the remote monitoring card obtained is mapped to the remote server, and the local server and the remote server are in a relationship set in a redundant manner; while the fact that the state of the local monitoring card obtained and the state of the remote monitoring card obtained are in an unreasonable state relationship means that: the state of the local monitoring card obtained is mapped to the local server, the state of the remote monitoring card obtained is mapped to the remote server, and the local server and the remote server cannot be set in a redundant manner;
[0086] In an exemplary instance, the reasonable state relationship includes: the state of the local monitoring card obtained is in a slave state and the state of the remote monitoring card obtained is in a master state;
[0087] Or, the reasonable state relationship includes: the state of the local monitoring card obtained is in a master state and the state of the remote monitoring card obtained is in a slave state.
[0088] When the state of the local monitoring card obtained and the state of the remote monitoring card obtained are in a master-slave state, it indicates that the state of the local monitoring card obtained and the state of the remote monitoring card obtained maintain a reasonable state relationship. And since the state of the server follows the state of the monitoring card and is consistent with the state of the monitoring card, it is possible to make the servers maintain a relationship set in a redundant manner.
[0089] In an exemplary instance, when the non - reasonable state relationship is that the state of the local monitoring card obtained is the slave state and the state of the peer - end monitoring card obtained is the non - master state, and the local redundancy state is the redundancy state of the local monitoring card, the redundancy state of the local monitoring card includes: the slave - state count of the local monitoring card;
[0090] The monitoring application module sets the master - slave state of the local monitoring card this time according to the local redundancy state, the state of the local monitoring card obtained, and the state of the peer - end monitoring card, including:
[0091] Obtain the slave - state count of the local monitoring card, and determine whether the obtained slave - state count of the local monitoring card reaches a preset number of times; wherein, the slave - state count of the local monitoring card starts from zero and is incremented when the master - slave state of the local monitoring card is the slave state, and is reset to zero when the master - slave state of the local monitoring card is not the slave state;
[0092] In response to the obtained slave - state count of the local monitoring card reaching the preset number of times, the monitoring application module sets the master - slave state of the local monitoring card this time to the master state.
[0093] When the state of the local monitoring card obtained is the slave state and the state of the peer - end monitoring card obtained is the non - master state, that is, the slave state or the idle state, it means that there is no master state between the state of the local monitoring card obtained and the state of the peer - end monitoring card obtained, which is a non - reasonable state relationship. Then, consider setting the master - slave state of the local monitoring card to the master state. Before setting the master - slave state of the local monitoring card to the master state, it is also necessary to consider the redundancy state of the local monitoring card in the recent period. Therefore, obtain the slave - state count of the local monitoring card, and when the obtained slave - state count of the local monitoring card reaches the preset number of times, it means that the local monitoring card is normal, and then set the state of the local monitoring card this time to the master state.
[0094] In an exemplary instance, when the non - reasonable state relationship is that the state of the local monitoring card obtained is the master state and the state of the obtained peer - end monitoring card is the master state, and the local redundancy state is the right to set the local master state, the monitoring application module sets the master - slave state of the local monitoring card this time according to the local redundancy state, the state of the local monitoring card obtained, and the state of the peer - end monitoring card, including:
[0095] The monitoring application module determines whether the local monitoring card has the right to preferentially set the master state according to the local master - state setting right;
[0096] In response to the judgment result that the local monitoring card does not have the right to preferentially set the master state, the monitoring application module sets the master - slave state of the local monitoring card this time to the slave state.
[0097] When the status of the local monitoring card obtained is the master status and the status of the peer monitoring card obtained is the master status, it indicates that both the status of the local monitoring card and the status of the peer monitoring card are the master status, which is an unreasonable status relationship. Then, consider setting the master status of one of the monitoring cards to the slave status. At this time, it is necessary to consider that the local monitoring card does not have the right to preferentially set the master status. If the local server does not have the right to preferentially set the master status, then consider leaving the master status to the peer monitoring card. The monitoring application module sets the master-slave status of the local monitoring card this time to the slave status, so as to ensure that the master-slave status of the local monitoring card and the master-slave status of the peer monitoring card do not conflict, which is a reasonable status relationship.
[0098] In an exemplary example, the method further includes:
[0099] In response to the judgment result that the local monitoring card has the right to preferentially set the master status, the monitoring application module sets the master-slave status of the local monitoring card this time to the master status.
[0100] If the local server has the right to preferentially set the master status, then "occupy" the master status. The monitoring application module sets the master-slave status of the local monitoring card this time to the master status, so as to ensure that the master-slave status of the local monitoring card and the master-slave status of the peer monitoring card do not conflict, which is a reasonable status relationship.
[0101] In the server switching method provided by the embodiments of the present application, according to the setting timing of the monitoring card status, it can be divided into: the process of setting the monitoring card status during initialization (initial power-on) and the process of setting the monitoring card status during non-initialization (normal use). Taking the dual-machine redundancy setting method as an example, the process of setting the monitoring card status during initialization can be as Figure 3 shown, including:
[0102] Step 300: Open the dual-machine monitoring card device, and execute step 310 when it is successfully opened.
[0103] If the opening of the dual-machine monitoring card fails, it can be judged that the dual-machine monitoring card is abnormal, prompt an error and exit the program.
[0104] Step 310: Judge whether the setting times of the local monitoring card are greater than the maximum setting times. If not greater than the maximum setting times, and when the local monitoring card and the peer monitoring card are both opened, execute step 320. If greater than the maximum setting times, execute step 330.
[0105] Step 320: Judge whether the local machine is machine B. If it is machine B, execute step 340. If it is not machine B, execute step 350.
[0106] In this step, the server is divided into one end that has the right to preferentially set the main state and the other end that does not have the right to preferentially set the main state according to the power supply source, which are denoted as Machine A and Machine B respectively. When Machine A and Machine B are started simultaneously, Machine A has the right to preferentially set the main state.
[0107] Step 330: Exit the setting process.
[0108] Step 340: Delay for a certain period of time, and after the delay, set the local monitoring card to the slave state according to the local monitoring card status and the peer monitoring card status.
[0109] After Step 340, Step 360 is continued. And in this step, since there is a delay, the peer monitoring card "seizes" the main state and the local monitoring card status is the idle state. Therefore, set the local monitoring card to the slave state. The delay time can be 1S.
[0110] Step 350: Set the local monitoring card status to the main state according to the local monitoring card status and the peer monitoring card status.
[0111] After Step 350, Step 360 is continued. In this step, since the local monitoring card status is the slave state and the peer monitoring card status is not the main state, the local monitoring card is set to the main state.
[0112] Step 360: Determine whether the setting is successful. If it is successful, the current setting is completed. If it is not successful, execute Step 370.
[0113] Step 370: Increment the setting count by 1, and then return to execute Step 310.
[0114] Still taking the dual-machine redundancy setting method as an example, the process of setting the monitoring card status in non-initialization can be as Figure 4 shown, including:
[0115] Step 400: Obtain the local monitoring card status and the peer monitoring card status.
[0116] Step 410: Determine whether the local monitoring card status and the peer monitoring card status are in a master-slave state. If they are in a master-slave state, execute Step 420. If they are not in a master-slave state, execute Steps 430 and 450 simultaneously.
[0117] Step 420: Set the master-slave state of the local monitoring card according to the local monitoring card status.
[0118] Step 430: Determine whether it simultaneously meets the conditions that the local monitoring card has been in the slave state for N consecutive cycles and the peer monitoring card is not in the main state. If the local monitoring card has been in the slave state for N consecutive cycles and the peer monitoring card is not in the main state, execute Step 440.
[0119] In this step, N can be 10.
[0120] Step 440: Set the local monitoring card to the main state.
[0121] Step 450: Determine whether both the local monitoring card and the remote monitoring card are in the main state, and whether the local server is Machine B. If both the local monitoring card and the remote monitoring card are in the main state, and the local server is Machine B, execute Step 460; if both the local monitoring card and the remote monitoring card are in the main state, and the local server is Machine A, execute Step 470.
[0122] Step 460: Set the local monitoring card to the slave state;
[0123] Step 470: Set the local monitoring card to the main state.
[0124] Corresponding to the above server switching method, an embodiment of the present application further provides a server switching system. Figure 5 It is a schematic structural diagram of a server switching system provided by an embodiment of the present application. As Figure 5 shown, the server switching system provided by an embodiment of the present application includes: multiple servers set in a redundant manner, and each server is provided with a monitoring card 500, a monitoring card driver module 510, a monitoring application module 520, and an identity switching module 530, and the monitoring cards on all servers are connected;
[0125] The monitoring application module 520 is configured to periodically obtain the state of the local monitoring card and the state of the remote monitoring card from the local monitoring card 500 through the local monitoring card driver module 510; wherein, the state of the remote monitoring card is transmitted to the local monitoring card in real time;
[0126] The monitoring application module 520 is further configured to set the master-slave state of the local monitoring card for this time according to the obtained state of the local monitoring card and the state of the remote monitoring card after each acquisition operation, and when the master-slave state set for this time changes compared with the master-slave state set for the previous time, notify the identity switching module 530 of the master-slave state of the local monitoring card set for this time;
[0127] The identity switching module 530 is configured to perform a switching operation on the corresponding state of the server according to the obtained master-slave state of the local monitoring card.
[0128] In an exemplary example, the monitoring application module 520 is further configured to:
[0129] Open the local monitoring card 500 through the local monitoring card driver module 510;
[0130] In response to the successful opening of the local monitoring card 500, obtain the local master status setting right, and determine whether the local monitoring card has the master status priority setting right according to the obtained local master status setting right;
[0131] In response to the judgment result that the local monitoring card has the master status priority setting right, through the local monitoring card driver module 510, obtain the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card, and when the status of the local monitoring card is the slave status and the status of the peer monitoring card is not the master status, set the master-slave status of the local master status to the master status.
[0132] In an exemplary instance, the monitoring application module 520 is further configured to, in response to the judgment result that the local monitoring card does not have the master status priority setting right, after a preset time period, through the local monitoring card driver module 510, obtain the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card 500, and when the status of the local monitoring card is the master status and the status of the peer monitoring card is the slave status, set the master-slave status of the local master status to the slave status.
[0133] In an exemplary instance, the monitoring application module 520 is further configured to:
[0134] In response to the reasonable status relationship between the obtained status of the local monitoring card and the obtained status of the peer monitoring card, set the master-slave status of the local monitoring card this time according to the obtained status of the local monitoring card; wherein, the reasonable status relationship is a relationship in which the status mapped to their respective servers can make the multiple servers set in a redundant manner;
[0135] In response to the non-reasonable status relationship between the obtained status of the local monitoring card and the obtained status of the peer monitoring card, set the master-slave status of the local monitoring card this time according to the local redundancy status, as well as the obtained status of the local monitoring card and the status of the peer monitoring card; wherein, the non-reasonable status relationship is a relationship in which the status mapped to their respective servers cannot make the multiple servers set in a redundant manner; the local redundancy status includes: the local master status setting right or the redundancy status of the local monitoring card.
[0136] In an exemplary instance, the reasonable status relationship includes: the obtained status of the local monitoring card is the slave status and the obtained status of the peer monitoring card is the master status;
[0137] Or, the reasonable status relationship includes: the obtained status of the local monitoring card is the master status and the obtained status of the peer monitoring card is the slave status.
[0138] In an exemplary instance, the unreasonable state relationship includes: the state of the local monitoring card obtained is the slave state and the state of the peer monitoring card obtained is the non-master state;
[0139] Or, the unreasonable state relationship includes: the state of the local monitoring card obtained is the slave state and the state of the peer monitoring card obtained is the slave state.
[0140] In an exemplary instance, when the unreasonable state relationship is that the state of the local monitoring card obtained is the slave state and the state of the peer monitoring card obtained is the non-master state, and the local redundancy state is the redundancy state of the local monitoring card, the redundancy state of the local monitoring card includes: the slave state count of the local monitoring card; the monitoring application module 520 is further configured to:
[0141] Obtain the slave state count of the local monitoring card, and determine whether the obtained slave state count of the local monitoring card reaches a preset number of times; wherein, the slave state count of the local monitoring card starts to accumulate from zero, accumulates when the master-slave state of the local monitoring card is the slave state, and is reset to zero when the master-slave state of the local monitoring card is the non-slave state;
[0142] In response to the obtained slave state count of the local monitoring card reaching the preset number of times, set the master-slave state of the local monitoring card this time to the master state.
[0143] In an exemplary instance, when the unreasonable state relationship is that the state of the local monitoring card obtained is the master state and the state of the peer monitoring card obtained is the master state, and the local redundancy state is the right to set the local master state; the monitoring application module 520 is further configured to:
[0144] Judge whether the local monitoring card has the right to preferentially set the master state according to the right to set the local master state;
[0145] In response to the judgment result that the local monitoring card does not have the right to preferentially set the master state, set the master-slave state of the local monitoring card this time to the slave state.
[0146] In an exemplary instance, the monitoring application module 520 is further configured to, in response to the judgment result that the local monitoring card has the right to preferentially set the master state, set the master-slave state of the local monitoring card this time to the master state.
[0147] The server switching system provided in this embodiment and the server switching method provided in the above embodiments of the present application belong to the same inventive concept, can execute the server switching method provided in any of the above embodiments of the present application, and has the corresponding functional modules and beneficial effects for executing the server switching method. For technical details not described in detail in this embodiment, reference may be made to the specific processing content of the server switching method provided in the above embodiments of the present application, which will not be elaborated here.
[0148] Those of ordinary skill in the art will understand that all or some of the steps in the methods disclosed above, and the functional modules / units in systems and devices, can be implemented as software, firmware, hardware, and their appropriate combinations. In the hardware implementation, the division of functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component can have multiple functions, or a function or step can be executed by several physical components working together. Some or all components can be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include a computer storage medium (or non-transitory medium) and a communication medium (or transitory medium). As is well known to those of ordinary skill in the art, the term "computer storage medium" includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassette, tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that a communication medium typically contains computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium.
Claims
1. A server switching method, which is applied to a server switching system, and is characterized in that The server switching system includes: multiple servers set in a redundant manner, each server is provided with a monitoring card, a monitoring card driver module, a monitoring application module, and an identity switching module, and the monitoring cards on all servers are connected. The method includes: The monitoring application module periodically obtains the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the local monitoring card driver module; wherein, the status of the peer monitoring card is transmitted to the local monitoring card in real time; After each acquisition operation is completed, the monitoring application module sets the master-slave status of the local monitoring card for this time according to the obtained status of the local monitoring card and the status of the peer monitoring card, and when the master-slave status set for this time changes compared with the master-slave status set for the previous time, notifies the identity switching module of the master-slave status of the local monitoring card set for this time; The identity switching module performs a switching operation on the corresponding status of the server according to the obtained master-slave status of the local monitoring card; The monitoring application module sets the master-slave status of the local monitoring card for this time according to the obtained status of the local monitoring card and the status of the peer monitoring card, including: In response to the status of the local monitoring card obtained and the status of the peer monitoring card obtained belonging to a reasonable status relationship, the monitoring application module sets the master-slave status of the local monitoring card for this time according to the obtained status of the local monitoring card; wherein, the reasonable status relationship is a relationship that can make the multiple servers set in a redundant manner when the status is mapped to their respective servers; In response to the status of the local monitoring card obtained and the status of the peer monitoring card obtained being in an unreasonable status relationship, the monitoring application module sets the master-slave status of the local monitoring card for this time according to the local redundancy status, and the obtained status of the local monitoring card and the status of the peer monitoring card; wherein, the unreasonable status relationship is a relationship that cannot make the multiple servers set in a redundant manner when the status is mapped to their respective servers; the local redundancy status includes: the right to set the local master status or the redundancy status of the local monitoring card.
2. The method according to claim 1, wherein The method further includes: The monitoring application module opens the local monitoring card through the local monitoring card driver module; In response to the successful opening of the local monitoring card and the peer monitoring card, and when the local monitoring card and the peer monitoring card are both opened, the monitoring application module obtains the right to set the local master status, and determines whether the local monitoring card has the priority right to set the master status according to the obtained right to set the local master status; In response to the judgment result that the local monitoring card has the priority right to set the master status, the monitoring application module obtains the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the local monitoring card driver module, and when the status of the local monitoring card is the slave status and the status of the peer monitoring card is not the master status, sets the master-slave status of the local master status to the master status.
3. The method according to claim 2, wherein The method further includes: In response to the judgment result that the local monitoring card obtained does not have the right to preferentially set the main state, after a preset time, the monitoring application module obtains the state of the local monitoring card and the state of the peer monitoring card from the local monitoring card through the local monitoring card driver module, and sets the main - slave state of the local main state to the slave state when the state of the local monitoring card is the slave state and the state of the peer monitoring card is the main state.
4. The method according to claim 1, wherein The reasonable state relationship includes: the state of the obtained local monitoring card is the slave state and the state of the obtained peer monitoring card is the main state; Or, the reasonable state relationship includes: the state of the obtained local monitoring card is the main state and the state of the obtained peer monitoring card is the slave state.
5. The method according to claim 1, wherein The unreasonable state relationship includes: the state of the obtained local monitoring card is the slave state and the state of the obtained peer monitoring card is not the main state; Or, the unreasonable state relationship includes: the state of the obtained local monitoring card is the slave state and the state of the obtained peer monitoring card is the slave state.
6. The method according to claim 5, characterized in that When the unreasonable state relationship is that the state of the obtained local monitoring card is the slave state and the state of the obtained peer monitoring card is not the main state, and the local redundancy state is the redundancy state of the local monitoring card, the redundancy state of the local monitoring card includes: the slave - state count of the local monitoring card; The monitoring application module sets the main - slave state of the local monitoring card this time according to the local redundancy state, and the obtained state of the local monitoring card and the state of the peer monitoring card, including: Obtaining the slave - state count of the local monitoring card, and judging whether the obtained slave - state count of the local monitoring card reaches the preset number of times; wherein, the slave - state count of the local monitoring card starts to accumulate from zero, accumulates when the main - slave state of the local monitoring card is the slave state, and resets to zero when the main - slave state of the local monitoring card is not the slave state; In response to the obtained slave - state count of the local monitoring card reaching the preset number of times, the monitoring application module sets the main - slave state of the local monitoring card this time to the main state.
7. The method according to claim 5, wherein When the unreasonable state relationship is that the state of the obtained local monitoring card is the main state and the state of the obtained peer monitoring card is the main state, and the local redundancy state is the right to set the local main state; the monitoring application module sets the main - slave state of the local monitoring card this time according to the local redundancy state, and the obtained state of the local monitoring card and the state of the peer monitoring card, including: The monitoring application module judges whether the local monitoring card has the right to preferentially set the main state according to the local main - state setting right; In response to the judgment result that the local monitoring card does not have the right to preferentially set the main state, the monitoring application module sets the main - slave state of the local monitoring card this time to the slave state.
8. The method according to claim 7, characterized in that, The method further includes: In response to the judgment result that the local monitoring card has the right to preferentially set the main state, the monitoring application module sets the main - slave state of the local monitoring card this time to the main state.
9. A server switching system, characterized in that, Including: Multiple servers set in a redundant manner, each server is provided with a monitoring card, a monitoring card driver module, a monitoring application module and an identity switching module, and the monitoring cards on all servers are connected; The monitoring application module is used to periodically obtain the status of the local monitoring card and the status of the peer monitoring card from the local monitoring card through the local monitoring card driver module; wherein, the status of the peer monitoring card is transmitted to the local monitoring card in real time; The monitoring application module is further used to set the master-slave status of the local monitoring card for this time according to the obtained status of the local monitoring card and the status of the peer monitoring card after each acquisition operation, and when the master-slave status set for this time changes compared with the master-slave status set for the previous time, notify the identity switching module of the master-slave status of the local monitoring card set for this time; The identity switching module is used to perform a switching operation on the corresponding status of the server according to the obtained master-slave status of the local monitoring card; The monitoring application module is further used for: In response to the fact that the status of the obtained local monitoring card and the status of the obtained peer monitoring card belong to a reasonable status relationship, setting the master-slave status of the local monitoring card for this time according to the obtained status of the local monitoring card; wherein, the reasonable status relationship is a relationship in which the status mapped to their respective servers can make multiple servers set in a redundant manner; In response to the fact that the status of the obtained local monitoring card and the status of the obtained peer monitoring card are in an unreasonable status relationship, setting the master-slave status of the local monitoring card for this time according to the local redundancy status, as well as the obtained status of the local monitoring card and the status of the peer monitoring card; wherein, the unreasonable status relationship is a relationship in which the status mapped to their respective servers cannot make multiple servers set in a redundant manner; the local redundancy status includes: the right to set the local master status or the redundancy status of the local monitoring card.
Citation Information
Patent Citations
Hot backup switching method and system based on network card detection
WO2023087858A1