CN115766410A - Method, system, device and medium for switching working states of machine - Google Patents

Method, system, device and medium for switching working states of machine Download PDF

Info

Publication number
CN115766410A
CN115766410A CN202211412425.4A CN202211412425A CN115766410A CN 115766410 A CN115766410 A CN 115766410A CN 202211412425 A CN202211412425 A CN 202211412425A CN 115766410 A CN115766410 A CN 115766410A
Authority
CN
China
Prior art keywords
machine
slave
master
state
host
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211412425.4A
Other languages
Chinese (zh)
Inventor
王如意
高祖汉
翟庆明
蒋书斌
张春山
马彦军
张亚成
何心
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Hollysys Industrial Software Co Ltd
Original Assignee
Beijing Hollysys Industrial Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Hollysys Industrial Software Co Ltd filed Critical Beijing Hollysys Industrial Software Co Ltd
Priority to CN202211412425.4A priority Critical patent/CN115766410A/en
Publication of CN115766410A publication Critical patent/CN115766410A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Hardware Redundancy (AREA)

Abstract

The application discloses a machine working state switching method, which is applied to the field of server redundancy and applied to a batch control system, wherein the batch control system comprises: the method specifically comprises the steps that the master machine and the slave machine carry out master-slave state synchronization according to the diagnostic information sending condition between the master machine and the slave machine, and according to the state synchronization result, when the machine is the master machine, the master machine reads data in the shared data machine and starts to work; when the machine is a slave machine, the slave machine stops working. The method adds another machine on the basis of the original working machine to form a double-machine cluster system, mutual diagnosis is carried out between the host machine and the slave machine through a network segment or a shared data machine, only one machine reads key data in the shared data machine at the same time, and the state synchronization of the host machine and the slave machine is carried out according to the diagnosis result between the host machine and the slave machine, so that the self redundancy of the working machine is realized, the shared data machine is not depended on, and the working efficiency of the system is improved.

Description

Method, system, device and medium for switching working states of machine
Technical Field
The present application relates to the field of server redundancy, and in particular, to a method, system, device, and medium for switching a machine operating state.
Background
With the development of the technology, the batch control system of the industrial software system based on the international standard for batch control is more and more widely applied, the batch control system is applied to the fields of intermittence and obvious batches, and the batch control system generally comprises important subsystems such as batch configuration, batch scheduling, batch setting, database service and batch servers. The batch server is the core of the whole system and provides a data processing function for other subsystems, but when software failure, computer failure, network environment and other irresistible factors occur, data processing errors of the batch server can be caused, the system can not run normally, and even normal production of industry can be influenced. At this time, a method for performing redundancy operation on a batch service system is needed, and data synchronization is currently realized by adopting a mirror server for building a database in the same network segment, or database redundancy is realized based on a disk array.
In the existing method, only the redundancy of data is considered, the redundancy of a batch control system is not considered, and the function of a database is excessively relied on, so that even if the data is protected, the batch control system is still in a fault state at the moment, and the problem that the system cannot normally operate cannot be fundamentally solved.
How to redundancy the batch control system becomes a problem to be solved urgently in the field.
Disclosure of Invention
The application aims to provide a machine working state switching method, and the problem that a batch control system cannot carry out redundancy on the machine working state switching method is solved.
In order to solve the above technical problem, the present application provides a machine operating state switching method, which is applied to a batch control system, where the batch control system includes: the method comprises the following steps of:
the master machine and the slave machine carry out master-slave state synchronization according to the diagnostic information sending condition between the master machine and the slave machine;
if the machine is the host, the host reads the data in the shared data machine and starts working;
and if the machine is the slave machine, stopping the work of the slave machine.
Specifically, the master and the slave performing master-slave state synchronization according to the diagnostic information transmission condition between the master and the slave includes:
establishing a model between the master machine and the slave machine for switching an operating state of the machine, wherein the operating state comprises: a master state, a slave state, an unknown state;
and the master machine and the slave machine carry out master-slave state synchronization based on the model according to the diagnosis information.
In particular, the model for switching the operating state of the machine comprises:
when the working states of the master machine and the slave machine are both the unknown state or both the master machine state, the working state of the master machine or the slave machine is the master machine state, and the working state of the other machine is the slave machine state;
when a network connection fault occurs in a local terminal machine and a heartbeat packet of an opposite terminal machine cannot be received, the working state of the local terminal machine is the unknown state;
when the working state of the local machine is the unknown state and normal with the heartbeat diagnosis of the opposite machine, and meanwhile, the opposite machine is the host and informs that the data of the local machine are synchronized, the working state of the local machine is increased from the unknown state to the slave state;
when the network connection of the slave is normal and the heartbeat diagnosis with the opposite terminal machine is overtime, if the data is synchronized, the working state of the slave is raised to the host state;
and when the network connection fails or is restarted in the running process of the host computer, the working state of the host computer is reduced to the unknown state.
Specifically, the performing, by the master and the slave, the master-slave state synchronization based on the model according to the diagnostic information includes:
when the host fails and the slave cannot diagnose the host and the slave needs to be upgraded to the host, the slave judges whether the slave can be communicated with the host through a network segment;
if the data can be communicated, the host is in a starting state, the slave is connected with the database of the opposite terminal machine, and whether the database exists is judged;
if not, the opposite end machine is not the host;
if the slave machine exists, the opposite-end machine is still the host machine, and the slave machine stops being upgraded to the host machine;
if the data sharing machine cannot be connected, the host does not exist, and the slave machine detects whether the host is still running according to the configuration file in the data sharing machine.
Specifically, the configuration file includes:
the master machine periodically updates the working system time of the master machine, the master machine periodically updates the redundant system time of the master machine, the slave machine periodically updates the working system time of the slave machine, and the slave machine periodically updates the redundant system time of the slave machine.
Specifically, the detecting, by the slave, whether the master is still running according to the configuration file in the shared modem includes:
before the slave is upgraded to the master, the slave judges whether the slave is upgraded to the master due to the fault in the process of switching to the slave;
if yes, the slave computer is upgraded to the master computer;
if not, the slave machine cannot detect the host machine, and the slave machine judges the working state of the host machine according to the configuration file.
Specifically, the determining, by the slave device, the working state of the master device according to the configuration file includes:
the slave machine judges whether the last writing time in the working system time of the master machine for periodically updating the master machine and the redundancy system time of the master machine for periodically updating the master machine is changed;
if yes, the slave machine is disconnected from the shared data machine;
if not, the slave computer is upgraded to be the master computer.
In order to solve the above technical problem, the present application further provides a machine operating state switching system, which is applied to a batch control system, the batch control system includes: host computer, slave computer and shared data machine, this system includes:
the state synchronization module is used for carrying out master-slave state synchronization on the master machine and the slave machine according to the diagnostic information sending condition between the master machine and the slave machine;
the reading module is used for reading the data in the shared data machine and starting to work by the host when the machine is the host;
and the stopping module is used for stopping the slave machine when the machine is the slave machine.
In order to solve the above technical problem, the present application further provides a device for switching a machine operating state, including a memory for storing a computer program;
a processor for implementing the steps of the machine working state switching method when executing the computer program.
In order to solve the above technical problem, the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the method for switching the operating state of a machine as described above are implemented.
The machine working state switching method provided by the application is applied to a batch control system, and the batch control system comprises the following steps: the method comprises the steps that a master machine, a slave machine and a shared data machine are used for carrying out master-slave state synchronization according to the diagnostic information sending condition between the master machine and the slave machine, and according to the state synchronization result, when the machine is the master machine, the master machine reads data in the shared data machine and starts to work; when the machine is a slave machine, the slave machine stops working. The method is characterized in that another machine is added on the basis of the original working machine to form a double-machine cluster system, mutual diagnosis is carried out between the host machine and the slave machine through a network segment or a shared data machine, so that only one machine reads key data in the shared data machine at the same time, the state synchronization of the host machine and the slave machine is carried out according to the diagnosis result between the host machine and the slave machine, the host machine executes the system working task under the normal condition, the slave machine replaces the host machine to execute the task when the host machine fails, the self redundancy of the working machine is realized, the shared data machine is not depended on, the working efficiency of the system is improved, and the working progress is guaranteed.
Drawings
In order to more clearly illustrate the embodiments of the present application, the drawings needed for the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
Fig. 1 is a flowchart of a method for switching a working state of a machine according to an embodiment of the present disclosure;
fig. 2 is a structural diagram of a master, a slave and a shared data machine provided in an embodiment of the present application;
fig. 3 is a working state switching model provided in an embodiment of the present application;
fig. 4 is a structural diagram of a machine operating state switching system according to an embodiment of the present disclosure;
fig. 5 is a structural diagram of a device for switching an operating state of a machine according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without any creative effort belong to the protection scope of the present application.
The core of the application is to provide a machine working state switching method, and the problem that a batch control system cannot carry out redundancy on the batch control system is solved.
In the method for switching the operating state of the machine provided by the present application, the operations of reading data, sending diagnostic information, stopping operation, etc. of the host machine and the slave machine may be implemented by a controller in an upper computer of the host machine or the slave machine, for example, the controller may be a Micro Controller Unit (MCU), and may of course be implemented by other controllers except the MCU.
In order that those skilled in the art will better understand the disclosure, the following detailed description is given with reference to the accompanying drawings.
Fig. 1 is a flowchart of a machine operating state switching method provided in an embodiment of the present application, where the method is applied to a batch control system, and the batch control system includes: a master, a slave and a shared modem, as shown in fig. 1, the method comprising:
s10: and the master machine and the slave machine carry out master-slave state synchronization according to the diagnostic information sending condition between the master machine and the slave machine. If the device is a master, the process proceeds to S11, and if the device is a slave, the process proceeds to S12.
Specifically, in the batch control system in this embodiment, an original working machine is upgraded to a cluster system of a master machine, slave machines and a shared data machine, where in a normal case, the master machine normally executes tasks of the batch control system, and performs data reading, mount sharing and the like on the shared data machine, and in a case where the master machine fails, the slave machine may be upgraded to the master machine, and continues to execute corresponding tasks, thereby ensuring normal operation of the system. Fig. 2 is a structural diagram of a master, a slave, and a shared modem provided in an embodiment of the present application, as shown in fig. 2, where: the main working service system and the main redundancy service system are internally provided with: the slave working service system and the slave redundant service system share data, and are provided with: and (3) a disk array. The diagnostic and transmit-receive information between the working service system and the redundant service system is communicated using Remote Procedure Calls (RPCs). The work service system is used for executing tasks of the batch control system, the redundancy service system is used for being connected with the opposite terminal to guarantee normal operation of the work service system, the structure of the redundancy service system is simpler than that of the work service system, faults are not prone to occurring, and countermeasures can be taken when the work service system fails. In this embodiment, the master redundant service system in the master and the slave redundant service systems in the slaves periodically send diagnostic information to each other, and the working states are synchronized according to the diagnostic information result. Wherein the operating condition includes: master state, slave state, unknown state. To facilitate understanding by those skilled in the art, the following description is given by way of example. For example, when the master redundancy service system detects that the opposite end is the slave redundancy service system and the host works normally, the master redundancy service system maintains the existing state; when the opposite end is a host and the local end is also a host, the master redundancy service system and the slave redundancy service system identify themselves as a machine A or a machine B according to an Internet Protocol (IP) address, the machine A is upgraded to be the host, and the machine B is downgraded to be the slave. The above examples are only for better understanding of those skilled in the art, and do not represent only this embodiment, and the present embodiment is not particularly limited. The working service System accesses the database in the shared data machine in the form of Internet Small Computer System Interface (ISCSI).
Therefore, by adding the cluster system of the host, the slave and the shared data machine and by the diagnostic information between the main redundant service system in the host and the slave redundant service system in the slave, the working states of the host and the slave are synchronized, at least one machine in the batch control system is ensured to be in a normal working state, the mutual switching between the host and the slave is realized, and the batch control system also realizes redundancy.
S11: the host reads the data in the shared modem and starts working.
Specifically, in this embodiment, after performing master-slave state synchronization, the host is used as the only working machine, the master redundancy service system in the host performs a function of mounting a shared disk, reads data from a shared data machine, and the master working service system in the host performs a working task of the system.
S12: the slave stops working.
Specifically, in this embodiment, after the master-slave state synchronization is performed, since the master is in the normal working state, the slave redundant service system in the slave performs a volume locking operation on the shared disk, stops the working task of the slave working service system, and stops reading data from the shared data machine.
The machine working state switching method provided by the embodiment is applied to a batch control system, and the batch control system comprises: the method specifically comprises the steps that the master machine and the slave machine carry out master-slave state synchronization according to the diagnostic information sending condition between the master machine and the slave machine, and according to the state synchronization result, when the machine is the master machine, the master machine reads data in the shared data machine and starts to work; when the machine is a slave machine, the slave machine stops working. The method is characterized in that another machine is added on the basis of the original working machine to form a double-machine cluster system, mutual diagnosis is carried out between the host machine and the slave machine through a network segment or a shared data machine, only one machine reads key data in the shared data machine at the same time, state synchronization of the host machine and the slave machine is carried out according to the diagnosis result between the host machine and the slave machine, the host machine executes system working tasks under normal conditions, the slave machine replaces the host machine to execute the tasks when the host machine fails, self redundancy of the working machine is realized, the shared data machine is not depended on, the working efficiency of the system is improved, the working progress is guaranteed, the robustness of a batch control system under complex working conditions is improved, the stability of a batch control process is enhanced, additional mirror image database service and related database service purchase are not needed, and the configuration cost is reduced.
On the basis of the foregoing embodiment, as a preferred embodiment, fig. 3 is an operating state switching model provided in the embodiment of the present application, and as shown in fig. 3, performing master-slave state synchronization between the master and the slave according to the diagnostic information transmission condition between the master and the slave includes:
establishing a model for switching the working state of the machine between the master machine and the slave machine, wherein the working state comprises the following steps: a host state, a slave state, an unknown state;
and the master machine and the slave machine carry out master-slave state synchronization based on the model according to the diagnosis information.
Specifically, in this embodiment, a state diagnosis and state switching model is established between the master and the slave, and state synchronization is performed on the working machine according to the diagnosis information based on the model, where the working state in the model for switching the working state of the machine includes: a host state, a slave state, an unknown state; the working states are synchronized according to the diagnosis result, for example, the machine performs a working task when the master state is set, stops working when the slave state is set, and performs a further judgment operation when the slave state is set to an unknown state, which will be described later. It should be noted that the above model and the switching condition thereof are built in the master-slave redundant service system, and the redundant service system also has the functions of process daemon, monitoring and control of the working service system.
Therefore, in the embodiment, the working state switching model is established, and the host and the slave can perform quick and accurate judgment according to the model, so that the state switching is more streamlined, specified and accurate.
On the basis of the above embodiment, as a preferred embodiment, the model for switching the operating state of the machine comprises:
when the working states of the host machine and the slave machine are both unknown states or both host machine states, the working state of the host machine or the slave machine is the host machine state, and the working state of the other machine is the slave machine state.
When the local end machine has network connection failure and cannot receive the heartbeat packet of the opposite end machine, the working state of the local end machine is unknown;
when the working state of the local end machine is unknown and normal with the heartbeat diagnosis of the opposite end machine, and the opposite end machine is a host and informs the local end machine that the data of the local end machine are synchronous, the working state of the local end machine is increased from the unknown state to the slave state;
when the network connection of the slave is normal and the heartbeat diagnosis with the opposite terminal machine is overtime, if the data is synchronous, the working state of the slave is raised to the host state;
when the network connection fails or is restarted in the operation process of the host computer, the working state of the host computer is reduced to an unknown state.
Specifically, the embodiment specifically includes a switching manner 1: switching mode 2 from unknown state to host state: switching mode 3 from master state to slave state: switching mode from slave state to unknown state 4: switching mode from unknown state to slave state 5: switching mode from slave state to master state 6: transition from the host state to the unknown state. For example, the operating state of the working machine may be referred to as a master state, and the operating state of the working machine may be referred to as a slave state. In the switching mode 1, when the working states of the two machines are unknown states, the respective redundant service systems identify that the machines are A machines or B machines according to the IP addresses, the A machines are upgraded to be the master machines, and the B machines are changed into slave machines. In the switching mode 2, when the working states of the two machines are both the master machine, the judgment method in the switching mode 1 is adopted to determine the machine A and the machine B, the machine A continues to be the master machine, and the machine B is reduced to be the slave machine. In the switching mode 3, when the network connection of the local machine fails, for example, a network card failure or a network cable disconnection fails and a heartbeat packet of the peer machine cannot be received, the working state of the peer machine cannot be determined at this time, and if the local machine is blindly upgraded to a host machine, the situation that two host machines exist at the same time may be caused, which may cause a disorder in connection and data, or even a system crash, so that the working state of the local machine is converted into an unknown state at this time. In the switching mode 4, when the working state of the redundant service system in the local machine is unknown and the heartbeat diagnosis of the opposite machine is normal, the opposite machine serves as a host to notify that the local machine has synchronized data, and the local machine is upgraded to be a slave. In the switching mode 5, when the master network and the standby network of the slave are both connected normally, if the heartbeat diagnosis of the slave and the heartbeat diagnosis of the opposite-end machine are overtime at the moment, the fault of the opposite-end machine is judged, and if the data are detected to be synchronized at the moment, the slave is upgraded to be the master. In the switching mode 6, the working state of the host after being restarted is an unknown state, and if the main network and the standby network both fail in the running process of the host, the working state of the host is reduced to the unknown working state. It should be noted that the above model and the switching condition thereof are built in the master-slave redundant service system, and in addition, the redundant service system also has the functions of process daemon, monitoring and control of the working service system.
Therefore, the working state switching model is established in the embodiment, and the host and the slave can perform quick and accurate judgment according to the model, so that the state switching is more streamlined, embodied and accurate.
On the basis of the above embodiment, as a preferred embodiment, the performing master-slave state synchronization between the master and the slave according to the diagnostic information based on the model includes:
when the host computer fails and the slave computer cannot diagnose the host computer and the slave computer needs to be upgraded to the host computer, the slave computer judges whether the slave computer can be communicated with the host computer through a network segment;
if the data can be communicated, the host is in a starting state, the slave is connected with the database of the opposite terminal machine, and whether the database exists is judged;
if not, the opposite terminal machine is not the host;
if the host exists, the opposite-end machine is still the host, and the slave stops being lifted to be the host;
if the data sharing machine cannot be connected, the host does not exist, and the slave machine detects whether the host machine is still running or not according to the configuration file in the data sharing machine.
Specifically, when the host fails and the slave cannot diagnose the host, and the slave needs to be upgraded to the host, the master and the slave AB diagnose whether the opposite side is on-line through network segments, wherein the network segments are 128, 129 and 10, for example, the slave B sends a connection signal to the opposite side machine through the original network segment, if the connection is not successful, the opposite side host is considered to be absent, and the slave detects whether the opposite side host is still running according to the configuration file of the disk array in the shared data. If the connection is available, the host is in a starting state, when the slave is to be upgraded to the host, the slave is connected with the database of the opposite terminal machine when the opposite terminal machine cannot be detected but can be connected, whether the database exists is judged, if the database does not exist, the opposite terminal is not the host, if the database exists, the opposite terminal host also exists, the situation at the moment is recorded in a log, whether the opposite terminal machine is a slave or not is confirmed, meanwhile, whether the network cable is normally connected is checked, and the master upgrading operation is stopped. In addition, because the network connection may have a fault and the like, the network between the master machine and the slave machine may be disconnected, but at this time, the master machine and the slave machine are both connected with the shared data machine through a transmission cable (SAS line), and the working state needs to be diagnosed through the configuration file, otherwise, both of the master machine and the slave machine are promoted to be the master machine, so that the critical data is damaged, even the system is paralyzed, and the situation can be avoided by reading and writing the configuration file on the shared data machine.
Therefore, under the redundant condition, when the slave machine cannot acquire the instruction to be upgraded to the master machine, whether the opposite side is on line or not is judged through the network segment between the master machine and the slave machine, whether the master machine does not exist or not can be further judged by judging whether the database exists or not, meanwhile, the working state of the master machine can be judged in more detail according to the configuration file, the normal operation of the system is ensured, and the condition of double master machines is avoided.
On the basis of the above embodiment, as a preferred embodiment, the configuration file includes:
the master machine periodically updates the working system time of the master machine, the master machine periodically updates the redundant system time of the master machine, the slave machine periodically updates the working system time of the slave machine, and the slave machine periodically updates the redundant system time of the slave machine.
Specifically, the configuration file in this embodiment includes: the method comprises the steps that a main working service system in a host periodically updates own working system time a1, a main redundancy service system in the host periodically updates own redundancy system time a2, a slave working service system in a slave periodically updates own working system time b1, and a slave redundancy service system in the slave periodically updates own redundancy system time a 2.
It can be seen that the present embodiment provides reference parameters for verifying whether the working machine is running later by setting the configuration file. Whether the working machine is in a normal working state or a normal connection state can be judged more accurately.
On the basis of the above embodiment, as a preferred embodiment, the detecting, by the slave, whether the master is still running according to the configuration file in the shared modem includes:
before the slave is upgraded to the master, the slave judges whether the slave is upgraded to the master due to the fault in the process of switching to the slave;
if yes, the slave computer is upgraded to the master computer;
if not, the slave machine cannot detect the master machine, and the slave machine judges the working state of the master machine according to the configuration file.
Specifically, in this embodiment, before the slave is upgraded to the master, before the slave redundant service system in the slave is ready to be upgraded to the master redundant service system, the slave needs to determine the reason for upgrading the master, if the slave is upgraded to the master due to a fault occurring in the process of being switched to the slave, the master upgrading operation is directly performed, if the slave does not detect the existence of the opposite-end master, the working state of the master needs to be determined according to the configuration file, so as to further determine that the connection is not to be made to the master due to a network connection problem or other problems.
Therefore, the reason for raising the master is judged before the slave is raised to the master, whether the master is to be raised or not is determined more accurately, and system faults caused by the fact that two masters exist simultaneously are avoided.
On the basis of the foregoing embodiment, as a preferred embodiment, the determining, by the slave, the operating state of the master according to the configuration file includes:
the slave machine judges whether the last writing time in the time for the master machine to periodically update the working system of the slave machine and the time for the master machine to periodically update the redundant system of the slave machine is changed;
if yes, the slave machine is disconnected from the shared data machine;
if not, the slave computer is lifted to be the master computer.
Specifically, when the slave redundancy service system in the slave is ready to connect to the database in this embodiment, a preset number of cycles, for example, 20 cycles, are read according to the last write time in the working system time and the redundant system time in the above-mentioned a1 and a2, and if the write time in the cycle is not changed, it is considered that the peer master does not exist at this time, and the master can be continued. If the write-in time in the period is changed, the host actually existing at the opposite end works normally, namely the host is normally connected with the shared data machine, at the moment, the slave does not need to be raised, the slave is disconnected from the shared data machine, and log content is recorded: and requesting whether the artificial extension network cable is normal or not, and whether the main working service system and the main redundancy service system of the host are normal or not. It will be appreciated that after the slave is raised to the master, the slave also needs to perform the operation of the master, and after the master is lowered to the slave, the master needs to perform the operation of the previous slave. In addition, it should be noted that the non-service subsystem of the batch control system can only read data from the host database; the master and the slave are in unknown states, and data cannot be read from a database in a shared disk array of the shared data machine.
Therefore, whether the host is in the working state or not is judged more accurately by judging whether the working system time and the redundant system time are changed in a certain period, and the occurrence of misjudgment is prevented.
In the above embodiments, the method for switching the machine working state is described in detail, and the present application also provides embodiments corresponding to the system for switching the machine working state. It should be noted that the present application describes embodiments of the system part from two perspectives, one from the perspective of the function module and the other from the perspective of the hardware.
Based on the angle of the function module, fig. 4 is a structural diagram of a machine working state switching system provided in the embodiment of the present application, as shown in fig. 4, the system is applied to a batch control system, and the batch control system includes: the system comprises a host, a slave and a shared data machine, and comprises:
the state synchronization module 10 is used for the master machine and the slave machine to carry out master-slave state synchronization according to the diagnostic information sending condition between the master machine and the slave machine;
the reading module 11 is used for reading the data in the shared data machine and starting working when the machine is a host;
and the stopping module 12 is used for stopping the slave when the machine is the slave.
Since the embodiments of the apparatus portion and the method portion correspond to each other, please refer to the description of the embodiments of the method portion for the embodiments of the apparatus portion, which is not repeated here.
The machine working state switching system provided by the embodiment corresponds to the method, so that the machine working state switching system has the same beneficial effects as the method.
Fig. 5 is a structural diagram of a device for switching an operating state of a machine according to an embodiment of the present application, and as shown in fig. 5, the device for switching an operating state of a machine includes: a memory 20 for storing a computer program;
the processor 21 is configured to implement the steps of the machine operation state switching method mentioned in the above embodiments when executing the computer program.
The device for switching the working state of the machine provided by the embodiment can include, but is not limited to, an upper computer, a notebook computer or a desktop computer.
The processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The Processor 21 may be implemented in at least one hardware form of a Digital Signal Processor (DSP), a Field-Programmable Gate Array (FPGA), and a Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a Graphics Processing Unit (GPU) which is responsible for rendering and drawing the content required to be displayed by the display screen. In some embodiments, the processor 21 may further include an Artificial Intelligence (AI) processor for processing computational operations related to machine learning.
The memory 20 may include one or more computer-readable storage media, which may be non-transitory. Memory 20 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used for storing the following computer program 201, wherein after being loaded and executed by the processor 21, the computer program can implement the relevant steps of the method for switching the operating state of the machine disclosed in any one of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202, data 203, and the like, and the storage manner may be a transient storage manner or a permanent storage manner. Operating system 202 may include, among others, windows, unix, linux, and the like. Data 203 may include, but is not limited to, data related to machine operating state switching methods, and the like.
In some embodiments, the device for switching the operating status of the machine may further include a display 22, an input/output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
It will be appreciated by those skilled in the art that the arrangement shown in figure 5 does not constitute a limitation of the machine operating condition switching means and may include more or fewer components than those shown.
The device for switching the working state of the machine comprises a memory and a processor, wherein the processor can realize the method when executing the program stored in the memory.
Finally, the application also provides a corresponding embodiment of the computer readable storage medium. The computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps as set forth in the above-mentioned method embodiments.
It is to be understood that if the method in the above embodiments is implemented in the form of software functional units and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, which are essential or part of the prior art, or all or part of the technical solutions may be embodied in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The method, system, device and medium for switching the working state of the machine provided by the present application are described in detail above. The embodiments are described in a progressive mode in the specification, the emphasis of each embodiment is on the difference from the other embodiments, and the same and similar parts among the embodiments can be referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It should also be noted that, in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. The machine working state switching method is applied to a batch control system, and the batch control system comprises the following steps: the method comprises the following steps:
the master machine and the slave machine carry out master-slave state synchronization according to the diagnostic information sending condition between the master machine and the slave machine;
if the machine is the host, the host reads the data in the shared data machine and starts working;
and if the machine is the slave machine, stopping the work of the slave machine.
2. The method for switching the operating status of a machine according to claim 1, wherein the master device and the slave device performing master-slave status synchronization according to the diagnostic information transmission condition therebetween comprises:
establishing a model between the master machine and the slave machine for switching an operating state of the machine, wherein the operating state comprises: a host state, a slave state, an unknown state;
and the master machine and the slave machine carry out master-slave state synchronization based on the model according to the diagnosis information.
3. The machine operating state switching method according to claim 2, wherein the model for switching the operating state of the machine comprises:
when the working states of the master machine and the slave machine are both the unknown state or both the master machine state, the working state of the master machine or the slave machine is the master machine state, and the working state of the other machine is the slave machine state;
when a network connection fault occurs in a local terminal machine and a heartbeat packet of an opposite terminal machine cannot be received, the working state of the local terminal machine is the unknown state;
when the working state of the local machine is the unknown state and normal with the heartbeat diagnosis of the opposite machine, and meanwhile, the opposite machine is the host and informs that the data of the local machine are synchronized, the working state of the local machine is increased from the unknown state to the slave state;
when the network connection of the slave machine is normal and the heartbeat diagnosis with the opposite terminal machine is overtime, if the data is synchronized, the working state of the slave machine is raised to the host machine state;
and when the network connection fails or is restarted in the running process of the host computer, the working state of the host computer is reduced to the unknown state.
4. The machine operating state switching method according to claim 3, wherein the master and the slave performing the master-slave state synchronization based on the model according to the diagnostic information comprises:
when the host fails and the slave cannot diagnose the host and the slave needs to be upgraded to the host, the slave judges whether the slave can be communicated with the host through a network segment;
if the connection is available, the host is in a starting state, the slave is connected with the database of the opposite terminal machine, and whether the database exists or not is judged;
if not, the opposite end machine is not the host;
if the slave machine exists, the opposite-end machine is still the host machine, and the slave machine stops being upgraded to the host machine;
if the data sharing machine cannot be connected, the host does not exist, and the slave machine detects whether the host is still running according to the configuration file in the data sharing machine.
5. The machine operating state switching method according to claim 4, wherein the configuration file comprises:
the master machine periodically updates the working system time of the master machine, the master machine periodically updates the redundant system time of the master machine, the slave machine periodically updates the working system time of the slave machine, and the slave machine periodically updates the redundant system time of the slave machine.
6. The machine operating state switching method according to claim 5, wherein the slave detecting whether the master is still running according to the configuration file in the shared data machine comprises:
before the slave is upgraded to the master, the slave judges whether the slave is upgraded to the master due to the fault in the process of switching to the slave;
if yes, the slave computer is upgraded to be the master computer;
if not, the slave machine cannot detect the host machine, and the slave machine judges the working state of the host machine according to the configuration file.
7. The method as claimed in claim 6, wherein said determining the operating status of the master device from the configuration file by the slave device comprises:
the slave machine judges whether the last writing time in the time for the master machine to periodically update the working system of the slave machine and the time for the master machine to periodically update the redundant system of the slave machine is changed;
if yes, the slave machine is disconnected from the shared data machine;
if not, the slave computer is upgraded to be the master computer.
8. The machine working state switching system is applied to a batch control system, and the batch control system comprises: host computer, slave computer and shared data machine, this system includes:
the state synchronization module is used for carrying out master-slave state synchronization between the master machine and the slave machine according to the diagnostic information sending condition between the master machine and the slave machine;
the reading module is used for reading the data in the shared data machine and starting to work by the host when the machine is the host;
and the stopping module is used for stopping the slave machine when the machine is the slave machine.
9. The machine working state switching device is characterized by comprising a memory, a first switching unit and a second switching unit, wherein the memory is used for storing a computer program;
a processor for implementing the steps of the machine operating state switching method of any one of claims 1 to 7 when executing said computer program.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the machine operating state switching method according to any one of claims 1 to 7.
CN202211412425.4A 2022-11-11 2022-11-11 Method, system, device and medium for switching working states of machine Pending CN115766410A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211412425.4A CN115766410A (en) 2022-11-11 2022-11-11 Method, system, device and medium for switching working states of machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211412425.4A CN115766410A (en) 2022-11-11 2022-11-11 Method, system, device and medium for switching working states of machine

Publications (1)

Publication Number Publication Date
CN115766410A true CN115766410A (en) 2023-03-07

Family

ID=85369597

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211412425.4A Pending CN115766410A (en) 2022-11-11 2022-11-11 Method, system, device and medium for switching working states of machine

Country Status (1)

Country Link
CN (1) CN115766410A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116010329A (en) * 2023-03-27 2023-04-25 厦门立林科技有限公司 USB communication synchronous control method, terminal, intelligent lock and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116010329A (en) * 2023-03-27 2023-04-25 厦门立林科技有限公司 USB communication synchronous control method, terminal, intelligent lock and medium

Similar Documents

Publication Publication Date Title
WO2018095107A1 (en) Bios program abnormal processing method and apparatus
WO2021004256A1 (en) Node switching method in node failure and related device
CN112286709A (en) Diagnosis method, diagnosis device and diagnosis equipment for server hardware faults
CN105183575A (en) Processor fault diagnosis method, device and system
CN114355760A (en) Main control station and hot standby redundancy control method thereof
CN113672306B (en) Server component self-checking abnormity recovery method, device, system and medium
CN115766410A (en) Method, system, device and medium for switching working states of machine
CN114189429A (en) System, method, device and medium for monitoring server cluster faults
CN113076210B (en) Server fault diagnosis result notification method, system, terminal and storage medium
CN114003445A (en) I2C monitoring function test method, system, terminal and storage medium of BMC
CN117707884A (en) Method, system, equipment and medium for monitoring power management chip
CN114461142B (en) Method, system, device and medium for reading and writing Flash data
CN111198832A (en) Processing method and electronic equipment
CN114461286B (en) Server starting method and device, electronic equipment and readable storage medium
CN115509333A (en) Server collaborative power-on and power-off device, method, system and medium
CN114996069A (en) Mainboard test method, device and medium
CN114884836A (en) High-availability method, device and medium for virtual machine
CN116055249A (en) Bus communication system, control method, device and medium thereof
CN116089139A (en) Method, device and medium for processing serial hard disk faults
CN115454906A (en) Data communication system, method, device and readable storage medium
CN114996055A (en) Control method, device and medium for dual-computer hot standby system
CN114265627A (en) Method, system and device for modifying BIOS parameter to adapt to intelligent network card
CN113641543A (en) Method, device and medium for detecting network card fault
CN117687821A (en) Method and device for processing bad blocks of cache memory and electronic equipment
CN115664943A (en) Method and device for determining master-slave relationship, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination