A SCADA system, a master-slave system, and a master-slave server switching method

By using preset storage documents and transmission protocols in the SCADA system, mutual access and switching between the main and standby servers is achieved, and the problems of complex communication and high coupling of the main and standby servers in the prior art are solved, and the reliability of the system is improved Sex and ease of maintenance.

CN115633109BActive Publication Date: 2024-11-19SUNGROW POWER SUPPLY (NANJING) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211272661.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-18
Publication Date
2024-11-19
Estimated Expiration
2042-10-18

AI Technical Summary

Technical Problem

In the existing SCADA system, the host server and the standby server need to communicate through a dedicated network, which is complex in networking and triggers fault migration based on probe service, which has high coupling and is difficult to maintain.

Method used

There are preset storage documents in the host server and the standby server to store the health status information and static information of the components, and to achieve mutual access between the two through the preset transmission protocol, and to trigger the main and standby server based on these documents Switch logic to avoid fault migration triggered by dedicated network communication and highly coupled probe services.

Benefits of technology

It simplifies communication between the main and spare servers, reduces system complexity, improves maintenance convenience, and effectively avoids data loss, achieving uninterrupted service provision.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115633109B_ABST
    Figure CN115633109B_ABST
Patent Text Reader

Abstract

The present application discloses a SCADA system, a master-slave system and a master-slave server switching method. The master server and the standby server in the master-slave system are both provided with corresponding preset storage documents for storing the health status information of each component obtained through the corresponding probe and the static information thereof. The master server and the standby server use a preset transmission protocol to achieve mutual access to the preset storage documents in the two, and trigger the master-slave server switching of the master-slave system based on the preset storage documents, thus solving the problems in the existing solution of the need for the host server and the standby server to communicate through a dedicated network, complex networking, fault migration triggered based on probe services, high degree of coupling and difficult maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of switching control technology, and in particular to a SCADA system, a master-slave system, and a master-slave server switching method. Background Art

[0002] SCADA (Supervisory Control And Data Acquisition) system is a computer-based DCS and power automation monitoring system. In the power system, SCADA system plays an important role in the telecontrol system, which can monitor and control the operating equipment on site to realize various functions such as data acquisition, equipment control, measurement, parameter adjustment and various signal alarms.

[0003] Since SCADA systems are usually installed at remote sites, operation and maintenance personnel are unable to handle faults in a timely manner, resulting in frequent loss of monitoring data. In order to reduce the loss of monitoring data, the current dual-machine deployment of the host server and the backup server is generally used to avoid single point failures, thereby ensuring the high availability of the SCADA system.

[0004] The existing switch between the main and backup servers is mainly achieved by installing probe services on the main and backup servers, periodically polling the health status of each component, and triggering fault migration when a component (such as a database service) fails, pointing the virtual IP accessed by the business layer to the healthy backup server, thereby providing uninterrupted services. However, the main server and the backup server need to communicate through a dedicated network line, which makes the networking complex, and the fault migration logic is triggered by the probe service, which has a high degree of coupling and is difficult to maintain. Summary of the invention

[0005] Based on the above-mentioned deficiencies in the prior art, the present application provides a SCADA system, a master-slave system, and a master-slave server switching method to solve the problems in the existing solution that the host server and the backup server need to communicate through a dedicated network, the networking is complex, the fault migration is triggered based on the probe service, the degree of coupling is high, and it is difficult to maintain.

[0006] In order to achieve the above objectives, this application provides the following technical solutions:

[0007] In a first aspect, the present application provides a master-slave system of a SCADA system, wherein a host server and a standby server in the master-slave system are each provided with a corresponding preset storage document for storing health status information of each component obtained by a corresponding probe and static information of the server itself;

[0008] The host server and the backup server use a preset transmission protocol to achieve mutual access to preset storage documents in both of them, and trigger the master-slave server switching logic of the master-slave system based on the preset storage documents.

[0009] Optionally, in the master-slave system of the above-mentioned SCADA system, the installation method between the probe and the corresponding component is plug-in installation.

[0010] Optionally, the preset storage document in the main and standby systems of the above-mentioned SCADA system is a txt text.

[0011] Optionally, the preset transmission protocol in the master-slave system of the above-mentioned SCADA system is Hypertext Transfer Protocol.

[0012] The second aspect of the present application provides a SCADA system, comprising: a business layer system and a master / standby system of the SCADA system as disclosed in any one of the first aspects; wherein:

[0013] The business layer system is used to obtain the document storage information of the primary and backup systems, and parse the document storage information to obtain the health status of the primary and backup systems; the document storage information is the information stored in the preset storage documents of the host server and the backup server in the primary and backup systems.

[0014] Optionally, in the above-mentioned SCADA system, the business layer system is used to obtain the document storage information of the primary and standby systems, specifically:

[0015] Initiate a document acquisition request to the host server and the standby server respectively; wherein, after receiving the document acquisition request, the host server and the standby server package and send the information stored in their own preset storage documents;

[0016] The packaging information sent by the host server and the standby server is received to obtain the document storage information of the primary and standby systems.

[0017] A third aspect of the present application provides a method for switching between a primary and a standby server, which is applied to a primary and a standby system of a SCADA system as disclosed in any one of the first aspects, and the method comprises:

[0018] Determine whether an abnormality occurs in the server currently involved in providing the service in the primary and standby systems;

[0019] If it is determined that a server currently participating in the provision of services in the active / standby system is abnormal, the server currently not participating in the provision of services in the active / standby system is switched to continue providing services.

[0020] Optionally, in the above-mentioned method for switching between the primary and standby servers, determining whether a server currently involved in providing services in the primary and standby systems is abnormal includes:

[0021] Obtain the number of components in the down state in the servers currently participating in providing services in the active / standby system;

[0022] Determining whether the number of components is greater than zero;

[0023] If it is determined that the number of components is greater than zero, it is determined that an abnormality occurs in a server currently involved in providing services in the active / standby system;

[0024] If it is determined that the number of components is not greater than zero, it is determined that there is no abnormality in the server currently participating in the provision of services in the primary and standby systems.

[0025] Optionally, in the above-mentioned method for switching between the primary and standby servers, if it is determined that a server currently involved in providing services in the primary and standby systems is abnormal, the method further includes:

[0026] Determine whether a server in the primary and standby systems that is not currently involved in providing services has an abnormality;

[0027] If it is determined that the server in the active / standby system that is not currently participating in providing services has no abnormality, the step of switching to the server in the active / standby system that is not currently participating in providing services to continue providing services is performed.

[0028] Optionally, in the above-mentioned method for switching between the primary and standby servers, determining whether a server in the primary and standby systems that is not currently involved in providing services is abnormal includes:

[0029] Obtain the number of components in the down state in the server that is not currently participating in the service provision in the active and standby systems;

[0030] Determining whether the number of components is greater than zero;

[0031] If it is determined that the number of components is greater than zero, it is determined that a server in the active / standby system that is not currently involved in providing services is abnormal;

[0032] If it is determined that the number of components is not greater than zero, it is determined that there is no abnormality in the server in the primary and standby systems that is not currently involved in providing services.

[0033] Optionally, in the above-mentioned method for switching between the primary and standby servers, if it is determined that the server in the primary and standby systems that is not currently involved in providing services has no abnormality, the method further includes:

[0034] Determine whether the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision match the current state;

[0035] If it is determined that the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision do not match the current state, the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision are respectively adjusted to match the current state;

[0036] Among them, the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision match the current state, including: the activation flag of the server currently participating in the service provision is true, and the activation flag of the server currently not participating in the service provision is false.

[0037] The present application provides a master-slave system of a SCADA system, in which the host server and the standby server in the master-slave system are each provided with a corresponding preset storage document for storing the health status information of each component obtained by the corresponding probe and its own static information; the host server and the standby server use a preset transmission protocol to achieve mutual access to the preset storage documents in both, and trigger the switching of the master-slave servers of the master-slave system based on the preset storage documents, that is, the present application can achieve mutual access to the preset storage documents in the host server and the standby server through a preset transmission protocol, without the need to build a dedicated communication network, thus avoiding the problem of complex networking caused by the need for the host server and the standby server to communicate through a dedicated network in the existing solution; moreover, the system can directly trigger the switching of the master-slave servers of the master-slave system based on the preset storage document, thus avoiding the problem of fault migration triggered by the existing probe service, high degree of coupling, and difficult maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0039] Figure 1 A schematic diagram of a working mode in a probe service mode provided in an embodiment of the present application;

[0040] Figure 2 A flowchart of a method for switching between a primary and standby servers provided in an embodiment of the present application;

[0041] Figure 3 A flowchart of abnormality determination of a server currently involved in providing a service provided in an embodiment of the present application;

[0042] Figure 4 A flowchart of a method for switching a primary and standby server provided in another embodiment of the present application;

[0043] Figure 5 Another embodiment of the present application provides a flowchart of abnormality determination of a server that is not currently involved in providing a service;

[0044] Figure 6 A flowchart of a method for switching between primary and standby servers provided in another embodiment of the present application. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0046] The present application provides a master-slave system of a SCADA system to solve the problems in existing solutions that the host server and the backup server need to communicate through a dedicated network, the networking is complex, fault migration is triggered based on probe services, the degree of coupling is high, and maintenance is difficult.

[0047] The main and standby systems of the SCADA system mainly include: a host server and a standby server. The host server and the standby server are both provided with corresponding preset storage documents for storing the health status information of each component obtained through the corresponding probe and the static information of the server itself.

[0048] The master server and the backup server use a preset transmission protocol to achieve mutual access to preset storage documents in both of them, and trigger the switching of the master and backup servers of the master-slave system based on the preset storage documents.

[0049] Among them, the preset storage document can be a txt text; of course, it is not limited to this, and can also be determined according to the specific application environment and user needs. This application does not limit the specific type of the preset storage document. It only needs to be able to save the health status information of each component obtained by the corresponding probe and the static information of its own server, which are all within the protection scope of this application.

[0050] In practical applications, the preset transmission protocol may be the Hypertext Transfer Protocol, but is not limited thereto. It may also be other existing protocols, which are not specifically limited in this application and are within the protection scope of this application.

[0051] It should be noted that when installing the host server and the standby server, a new txt file can be created in the agreed directory to save the static information of the server and the health status information of each component. The format of the newly created txt file is as follows:

[0052] # / path / scada_status.txt text file path

[0053] #Whether the current machine is activated as running state

[0054] active:true

[0055] #Attachment information

[0056] key1:value1

[0057] key1:value2

[0058] …

[0059] key_n:value_n

[0060] #Static roles defined during installation

[0061] static_role:master

[0062] #Host monitoring information

[0063] master_ip:xxx.xxx.xxx.xxx

[0064] master:mysql:up

[0065] master:kafka:up

[0066] master:redis:up

[0067] master: component name: up

[0068] #Reserved rows can be expanded to add monitoring items

[0069] #Backup monitoring information

[0070] slave_ip:xxx.xxx.xxx.xxx

[0071] slave:mysql:up

[0072] slave:kafka:up

[0073] slave:redis:up

[0074] slave:Component name:up

[0075] #Reserved rows can be expanded to add monitoring items

[0076] Specifically, the probe services corresponding to the components in the host server and the standby server under the txt text file can be freely expanded or removed, registered as services, and set to start automatically. The probe service will write the detection results to the corresponding lines of the txt text file in real time. If a component works normally, modify the string of the corresponding line to [role name]: [component name]: [tag], such as master:mysql:up, which means that the mysql component running on the host server master is currently in the up healthy state; if a component is abnormal, the corresponding line string can be modified to master:mysql:down, which means that the mysql component running on the host server master is currently in the down fault state. The sed command that comes with Linux is cleverly used here to process strings simply and efficiently.

[0077] It can be understood that the probe service of each component records its own health status in the specified line of the preset storage text, and finally forms a complete status text file. This file records the health status of each component in the local server and additional information of each server in the system, such as virtual IP, static role during installation, activation flag, etc.; of course, it is not limited to this and can be expanded according to business needs.

[0078] It should also be noted that the working mode of the probe service in the entire system is as follows Figure 1 As shown. Although both the host server and the standby server have txt files that record their own running status, it is still necessary to obtain the running status of the other server. In order to allow the host server and the standby server to exchange their own information in real time, you can build an http server. In the Linux system, you can easily initiate an http request through the curl command to obtain the other party's status txt text file. In order not to rely on third-party plug-ins, build an http server as simple, efficient and lightweight as possible, and cleverly use python to build a simple http server.

[0079] Since Linux systems usually come with a Python environment, you can start an http service with just a short command. The command example is as follows:

[0080] #Start the http service

[0081] python-m SimpleHTTPServer 8000&

[0082] #Get the status file

[0083] curl -s http: / / master:8000 / scada_status.txt

[0084] Based on the above, it can be understood that the host server and the backup server exchange data in real time through the Hypertext Transfer Protocol (http), and since the host server and the backup server can obtain each other's status information, the master-slave server switching logic of the master-slave system can be triggered based on the information in the read txt text file.

[0085] It should be noted that the specific process of the primary and standby server switching logic can be found in the following corresponding embodiments, which will not be described in detail here.

[0086] Based on the above principles, the master-slave system of the SCADA system provided in this embodiment is provided with corresponding preset storage documents in the host server and the backup server of the master-slave system, which are used to store the health status information of each component obtained by the corresponding probe and its own static information; the host server and the backup server use a preset transmission protocol to achieve mutual access to the preset storage documents in both, and trigger the switching of the master-slave servers of the master-slave system based on the preset storage documents, that is, the present application can achieve mutual access to the preset storage documents in the host server and the backup server through a preset transmission protocol, the networking is simple, and there is no need to build a dedicated communication network, avoiding the problem of complex networking that the host server and the backup server need to communicate through a dedicated network in the existing solution; moreover, the system can directly trigger the switching of the master-slave servers of the master-slave system based on the preset storage documents, and the probe service can focus on detecting the running status of the components, avoiding the existing problems of triggering fault migration through probe services, high degree of coupling, and difficult maintenance.

[0087] In addition, data exchange between the host server and the backup server is achieved through a preset transmission protocol. You only need to build an http server, and then you can initiate an http request through the curl command to obtain the other party's status txt text file. Compared with the traditional method of using Web services, such as Tomcat, to achieve data exchange, this application can reduce system complexity.

[0088] In addition, the existing method generally stores the host server and backup server information in the memory, which is easy to be lost in the event of a crash. The present application can add preset storage documents in the host server and the backup server for data storage, which can effectively avoid data loss caused by crashes; and, the information stored in the preset storage documents can use the vim tool that comes with the Linux system, or the tools that come with other operating systems, to achieve status modification, query, addition, and deletion, which can simply, lightly, and efficiently achieve the persistence of the health status information of the host server and the backup server.

[0089] In actual applications, the host server and the standby server in the existing master-standby system can only be activated through a simple ping method, which causes the business layer system in the SCADA system to be unable to obtain information on the host server and the standby server, resulting in difficulties in operation and maintenance.

[0090] In this regard, another embodiment of the present application further provides a SCADA system, which mainly includes: a business layer system and a master-slave system of the SCADA system as described in any of the above embodiments.

[0091] Among them, the business layer system is used to obtain the document storage information of the primary and backup systems, and parse the document storage information to obtain the health status of the primary and backup systems; the document storage information is the information stored in the preset storage documents of the host server and the backup server in the primary and backup systems.

[0092] In actual applications, the specific process used by the business layer system to obtain the document storage information of the primary and backup systems can be:

[0093] Step 1: Initiate a document acquisition request to the host server and the backup server respectively.

[0094] After receiving the document acquisition request, the host server and the standby server package and send the information stored in their own preset storage documents.

[0095] Step 2: Receive the packaging information sent by the host server and the backup server, and obtain the document storage information of the primary and backup systems.

[0096] It should be noted that the document acquisition request can be an http request, of course, but is not limited to this, and can also be other requests. This application does not make specific limitations on them, and they are all within the protection scope of this application.

[0097] Specifically, the business layer system can initiate a document acquisition request to the primary and backup systems through the API interface of the HTTP protocol, thereby easily obtaining the document storage information of the current primary and backup systems.

[0098] It should also be noted that after the business layer system obtains the storage document information of the primary and backup systems, it can parse each line of the document information and display the detailed health status of the current primary and backup systems through a visual interface, so as to handle fault recovery work in a timely manner.

[0099] In the SCADA system provided in this embodiment, the active-standby system can expose the preset storage documents in the host server and the standby server in itself in the form of an http interface through the http service, so that the business layer system can directly obtain them through the http protocol, and then display them in the operation and maintenance management interface, so that the switching of the active-standby server can be visualized, which not only enriches the operation and maintenance management means of the business layer system, but also makes the operation and maintenance of the SCADA system more convenient.

[0100] Optionally, another embodiment of the present application further provides a method for switching between a primary and a standby server, which can be applied to the primary and standby systems of the SCADA system provided in any of the above embodiments, see Figure 2 , the method may include:

[0101] S101, determining whether an abnormality occurs in a server currently involved in providing services in a primary and backup system.

[0102] In actual applications, the specific process of executing step S101 and determining whether an abnormality occurs in the server currently involved in providing services in the primary and standby systems can be as follows: Figure 3 As shown, it mainly includes:

[0103] S201. Obtain the number of components in the down state in the servers currently participating in providing services in the active-standby system.

[0104] The storage information of the preset storage documents in the server currently participating in the service provision in the active-standby system may be first obtained, and then the number of components in the down state may be determined based on the storage information.

[0105] Of course, obtaining the number of components in the down state in the servers currently participating in the service provision in the active-standby system is not limited to the above, and can also be obtained through other existing methods. This application does not limit it and it is within the protection scope of this application.

[0106] S202: Determine whether the number of components is greater than zero.

[0107] In actual applications, after obtaining the number of components in the down state in the server currently participating in the service provision in the active and standby system, it can be determined whether the number of components is greater than zero. If it is determined that the number of components is greater than zero, step S203 can be executed. If it is determined that the number of components is not greater than zero, step S204 can be executed.

[0108] S203: Determine if an abnormality occurs in a server currently involved in providing services in the primary and backup systems.

[0109] In actual applications, if it is determined that the number of components in the down state in the server currently participating in the service provision in the active and standby systems is greater than zero, it means that there is a component failure in the server, and it can be determined that the server currently participating in the service provision in the standby system has an abnormality.

[0110] S204: Determine whether the servers currently participating in providing services in the primary and standby systems have no abnormalities.

[0111] In actual applications, if it is determined that the number of components in the down state in the server currently participating in the service provision in the active-standby system is not greater than zero, it means that there is no component failure in the server, and it can be determined that there is no abnormality in the server currently participating in the service provision in the active-standby system.

[0112] It should be noted that the specific method for determining whether an abnormality occurs in the server currently participating in the provision of services in the primary-backup system is not limited to the above-mentioned method, and other existing methods can also be used for determination. This application does not specifically limit the determination method, and all methods are within the scope of protection of this application.

[0113] If it is determined that an abnormality occurs in the server currently involved in providing services in the primary and backup systems, step S102 may be executed.

[0114] S102: Switch to a server in the primary and backup systems that is not currently involved in providing services to continue providing services.

[0115] Assume that the server currently participating in service provision in the active-standby system is the active server, and the server currently not participating in service provision is the standby server. When an abnormality occurs on the active server, the standby server can be switched to continue providing services.

[0116] Similarly, if it is assumed that the server currently participating in service provision in the active-standby system is the standby server, and the server currently not participating in service provision is the main server, when an abnormality occurs on the standby server, the main server can be switched to continue providing services.

[0117] It should be noted that before actually executing step S101 and determining whether an abnormality occurs in the server currently participating in the provision of services in the primary and backup systems, it can also be determined whether the server currently participating in the provision of services can ping the server currently not participating in the provision of services. If the determination result is no, the server currently participating in the provision of services in the primary and backup systems continues to provide services. If the determination result is yes, it can be considered that the information stored in the preset storage documents in each server in the primary and backup systems is credible, and the step of determining whether an abnormality occurs in the server currently participating in the provision of services in the primary and backup systems can be executed.

[0118] Based on the above principles, the switching method of the master and standby servers provided in this embodiment can timely switch the servers that are not currently participating in the service provision in the master and standby systems to continue providing services when an abnormality occurs in the server currently participating in the service provision, thereby ensuring that the master and standby systems of the SCADA system can provide uninterrupted services and reduce the loss of monitoring data; and the switching logic of the present application is implemented based on the storage information of the preset storage documents in the server itself, so that the logic of fault migration is decoupled from the probe service.

[0119] Optionally, in another embodiment provided by the present application, after executing step S101 and determining whether a server currently participating in providing services in the primary and backup systems is abnormal, if it is determined that a server currently participating in providing services in the primary and backup systems is abnormal, refer to Figure 4 The method for switching the master and standby servers may further include:

[0120] S301, determining whether a server in the primary and standby systems that is not currently involved in providing services has an abnormality.

[0121] In actual applications, the specific process of determining whether a server that is not currently involved in providing services in the primary and standby systems is abnormal can be as follows: Figure 5 As shown, it mainly includes:

[0122] S401: Obtain the number of components in the down state in the server that is not currently participating in providing services in the active and standby systems.

[0123] The storage information of the preset storage documents in the server that is not currently involved in providing services in the active and standby systems may be first obtained, and then the number of components in the down state may be determined based on the storage information.

[0124] Of course, obtaining the number of components in the down state in the servers in the active-standby system that are not currently participating in the service provision is not limited to the above, and can also be obtained through other existing methods. This application does not limit it and it is within the protection scope of this application.

[0125] S402: Determine whether the number of components is greater than zero.

[0126] In actual applications, after obtaining the number of components in the down state in the server that is not currently involved in providing services in the active and standby systems, it can be determined whether the number of components is greater than zero. If it is determined that the number of components is greater than zero, step S403 can be executed. If it is determined that the number of components is not greater than zero, step S404 can be executed.

[0127] S403: Determine if a server in the primary and backup systems that is not currently involved in providing services has an abnormality.

[0128] In actual applications, if it is determined that the number of components in the down state in the server currently participating in the service provision in the active and standby systems is greater than zero, it means that there is a component failure in the server, and it can be determined that the server currently not participating in the service provision in the standby system has an abnormality.

[0129] S404: Determine that no abnormality occurs in the server in the primary and standby systems that is not currently involved in providing services.

[0130] It should be noted that the specific method for determining whether an abnormality occurs in a server that is not currently participating in service provision in the primary-backup system is not limited to the above, and can also be determined by other existing methods. This application does not specifically limit the determination method, and all are within the protection scope of this application.

[0131] If it is determined that there is no abnormality in the server that is not currently participating in the provision of services in the primary and standby systems, the step of switching to the server that is not currently participating in the provision of services in the primary and standby systems to continue providing services can be executed, that is, step S102; if it is determined that there is an abnormality in the server that is not currently participating in the provision of services in the primary and standby systems, it means that both the host server and the standby server in the primary and standby systems are in an abnormal state, and the host server and the standby server can be switched to not participate in the provision of services, so as to avoid the situation where dual hosts are prone to occur when the primary and standby systems are started up or restarted after a power outage after a crash.

[0132] In this embodiment, it is possible to first determine that there is no abnormality in the server in the primary and backup systems that is not currently participating in the service provision, and then switch to the server in the primary and backup systems that is not currently participating in the service provision to continue providing services. This can ensure in advance that the status of the server to be switched to is normal, avoiding invalid switching.

[0133] Optionally, in another embodiment provided by the present application, after executing step S301 and determining whether an abnormality occurs in a server in the active / standby system that is not currently participating in providing services, if it is determined that an abnormality does not occur in the server in the active / standby system that is not currently participating in providing services, refer to Figure 6 The method for switching the master and standby servers may further include:

[0134] S501: Determine whether the activation flags of the servers currently participating in service provision and the activation flags of the servers currently not participating in service provision match the current status.

[0135] Among them, the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision match the current state, including: the activation flag of the server currently participating in the service provision is true, and the activation flag of the server currently not participating in the service provision is false.

[0136] It should be noted that the activation flag is used to identify whether the server is in operation. Under normal circumstances, the flag of a server participating in the provision of services should indicate that it is in operation, and the flag of a server not participating in the provision of services should indicate that it is not in operation. Specifically, if the server is in operation, its activation flag can be represented as "true"; if the server is not in operation, its activation flag can be represented as "false".

[0137] It should also be noted that the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision may not match the current state as follows:

[0138] Case 1: The activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision are both true.

[0139] Case 2: The activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision are both false.

[0140] Case 3: The activation flag of the server currently participating in the service provision is false, and the activation flag of the server currently not participating in the service provision is true.

[0141] If it is determined that the activation flags of the servers currently participating in the service provision and the activation flags of the servers currently not participating in the service provision do not match the current status, step S502 may be executed.

[0142] S502: Adjust the activation flags of the servers currently participating in the service provision and the activation flags of the servers currently not participating in the service provision to match the current status respectively.

[0143] In actual applications, after determining that there are no abnormalities in the host server and the backup service in the active-standby system, the activation flags of each other can be exchanged to determine whether the activation flags correspond to their own states. When the activation flags do not match their own states, their own activation flags can be changed in time to make the activation flags match their own states. This can avoid the occurrence of dual hosts in the active-standby system to a certain extent and improve the stability of the switching method of the active-standby servers.

[0144] Based on the switching method of the master and standby servers provided in the above embodiment, when the switching method of the master and standby servers is applied to the Linux system, it can be implemented through the Switch service in the Linux system. For the convenience of description, it is assumed that when the master and standby systems of the SCADA system are installed, the agreed host server is "master" and the standby server is "slave". During the execution of the switching method of the master and standby servers, the server that is elected as the running server is "switched active", and the server that is elected as the non-running server is "switched inactive". If the current object server role is master, the specific implementation steps of the method are as follows:

[0145] Step 1: First check whether you can ping the other party. If not, switch to active.

[0146] Step 2: If the ping is successful, the information in the txt text is considered reliable. Use the sed command to count the number of components n in the down state on the host server and the backup server in the txt text. If n>0, it means that the corresponding server is abnormal, otherwise it means that it is healthy.

[0147] Step 3: If the master is healthy and the slave is abnormal, the master switches to active.

[0148] Step 4: If the master is abnormal and the slave is healthy, the master switches to inactive.

[0149] Step 5: If both the master and standby are healthy, they need to exchange their activation flags. If the active flags of both parties are one true and one false, everything remains unchanged and it is normal. If both are true, there is a dual-host phenomenon. According to the agreement, the host status remains unchanged and remains active; if both are false, the master switches to active according to the agreement.

[0150] Step 6: If both the master and slave are abnormal, which usually happens when the machine is just started, or when it is restarted after a power outage, immediately switch to inactive to prevent the occurrence of dual hosts after the startup is stable.

[0151] If the current object server role is slave, the specific implementation steps of this method are as follows:

[0152] Step 1: First check whether you can ping the other party. If not, switch to active.

[0153] Step 2: If the ping is successful, the information in the txt text can be considered reliable. Use the sed command to count the number of components n in the down state of the host server and the backup server in the txt text. If n>0, it means that the corresponding server is abnormal, otherwise it means that it is healthy.

[0154] Step 3: If the master is healthy and the slave is abnormal, the slave switches to inactive.

[0155] Step 4: If the master is abnormal and the slave is healthy, the slave switches to active.

[0156] Step 5: If both the master and slave are healthy, they need to exchange their activation flags. If the active flags of both parties are one true and one false, everything remains unchanged and it is normal. If both are true, there is a dual-master phenomenon. According to the agreement, the slave machine is switched to inactive; if both are false, the current slave machine remains in the inactive state.

[0157] Step 6: If both the master and slave are abnormal, which usually happens when the machine is just started, or when it is restarted after a power outage, immediately switch to inactive to prevent the occurrence of dual hosts after the startup is stable.

[0158] It is understandable that the problem of dual hosts that are prone to occur after communication interruption can be solved by adopting the method of agreement being greater than configuration, that is, giving priority to providing services according to the static roles specified during installation, and then providing services according to the agreement after an exception occurs.

[0159] It should be noted that the above example is only a specific application example provided by the present invention, but the application examples in actual applications are not limited to the above, and can also be modified according to the application environment and user needs. As long as the implementation method is the same as the principle and idea provided by this application, it is within the protection scope of this application.

[0160] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0161] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0162] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A master-slave system of a SCADA system, characterized in that: The host server and the standby server in the master-standby system are both provided with corresponding preset storage documents for storing the health status information of each component obtained through the corresponding probe and the static information of the server itself; The host server and the backup server use a preset transmission protocol to achieve mutual access to preset storage documents in both of them, and trigger the master-slave server switching logic of the master-slave system based on the preset storage documents.

2. The main and standby system of the SCADA system according to claim 1, characterized in that: The installation method between the probe and the corresponding component is plug-in installation.

3. The main and standby system of the SCADA system according to claim 1, characterized in that: The preset storage document is a txt text.

4. The main and standby system of the SCADA system according to claim 1, characterized in that: The preset transmission protocol is the Hypertext Transfer Protocol.

5. A SCADA system, characterized in that: include: A business layer system and a master-slave system of a SCADA system as claimed in any one of claims 1 to 4; wherein: The business layer system is used to obtain the document storage information of the primary and backup systems, and parse the document storage information to obtain the health status of the primary and backup systems; the document storage information is the information stored in the preset storage documents of the host server and the backup server in the primary and backup systems.

6. The SCADA system according to claim 5, characterized in that: The business layer system is used to obtain the document storage information of the primary and backup systems, specifically: Initiate a document acquisition request to the host server and the standby server respectively; wherein, after receiving the document acquisition request, the host server and the standby server package and send the information stored in their own preset storage documents; The packaging information sent by the host server and the standby server is received to obtain the document storage information of the primary and standby systems.

7. A method for switching between a primary and a standby server, characterized in that: Applied to the master-slave system of the SCADA system according to any one of claims 1 to 4, the method comprising: Determine whether an abnormality occurs in the server currently involved in providing the service in the primary and standby systems; If it is determined that a server currently participating in the provision of services in the active / standby system is abnormal, the server currently not participating in the provision of services in the active / standby system is switched to continue providing services.

8. The method for switching between the primary and standby servers according to claim 7, characterized in that: Determining whether a server currently involved in providing services in the active / standby system is abnormal includes: Obtain the number of components in the down state in the servers currently participating in providing services in the active / standby system; Determining whether the number of components is greater than zero; If it is determined that the number of components is greater than zero, it is determined that an abnormality occurs in a server currently involved in providing services in the active / standby system; If it is determined that the number of components is not greater than zero, it is determined that there is no abnormality in the server currently participating in the provision of services in the primary and standby systems.

9. The method for switching between the primary and standby servers according to claim 7, characterized in that: If it is determined that an abnormality occurs in the server currently involved in providing the service in the primary and standby systems, the method further includes: Determine whether a server in the primary and standby systems that is not currently involved in providing services has an abnormality; If it is determined that the server in the active / standby system that is not currently participating in providing services has no abnormality, a step of switching to the server in the active / standby system that is not currently participating in providing services to continue providing services is performed.

10. The method for switching between the primary and standby servers according to claim 9, characterized in that: Determining whether a server in the active / standby system that is not currently involved in providing services is abnormal includes: Obtain the number of components in the down state in the server that is not currently participating in the service provision in the active and standby systems; Determining whether the number of components is greater than zero; If it is determined that the number of components is greater than zero, it is determined that a server in the active / standby system that is not currently involved in providing services is abnormal; If it is determined that the number of components is not greater than zero, it is determined that there is no abnormality in the server in the primary and standby systems that is not currently involved in providing services.

11. The method for switching between the primary and standby servers according to claim 9, characterized in that: If it is determined that the server in the active / standby system that is not currently involved in providing services has no abnormality, the following further includes: Determine whether the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision match the current state; If it is determined that the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision do not match the current state, the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision are respectively adjusted to match the current state; Among them, the activation flag of the server currently participating in the service provision and the activation flag of the server currently not participating in the service provision match the current state, including: the activation flag of the server currently participating in the service provision is true, and the activation flag of the server currently not participating in the service provision is false.

Citation Information

Patent Citations

  • Host group decision system in high availability cluster and switching method for host group decision system

    CN103647668A