CN115604088A - Main/standby switching method, device, equipment and storage medium of component cluster system - Google Patents

Main/standby switching method, device, equipment and storage medium of component cluster system Download PDF

Info

Publication number
CN115604088A
CN115604088A CN202211271241.0A CN202211271241A CN115604088A CN 115604088 A CN115604088 A CN 115604088A CN 202211271241 A CN202211271241 A CN 202211271241A CN 115604088 A CN115604088 A CN 115604088A
Authority
CN
China
Prior art keywords
state
component cluster
cluster system
standby
main
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
CN202211271241.0A
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.)
Kangjian Information Technology Shenzhen Co Ltd
Original Assignee
Kangjian Information Technology Shenzhen 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 Kangjian Information Technology Shenzhen Co Ltd filed Critical Kangjian Information Technology Shenzhen Co Ltd
Priority to CN202211271241.0A priority Critical patent/CN115604088A/en
Publication of CN115604088A publication Critical patent/CN115604088A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Hardware Redundancy (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for switching a main component and a standby component of a component cluster system, and relates to the technical field of digital medical treatment. The method comprises the following steps: receiving a state normal report signal sent by a first component cluster system according to a first preset cycle time length; updating the validity period of the first component cluster system as a main system according to the second preset period duration; detecting whether the validity period is updated within a preset duration, and determining whether the working state of the first component cluster system reaches a preset main-standby switching condition; and if the preset master-slave switching condition is met, changing the working state of the first component cluster system from the master system state to the slave system state, and changing the working state of the second component cluster system from the slave system state to the master system state. The method can automatically realize the main-standby switching of the component cluster system when the main system is abnormally operated, improve the working efficiency, improve the switching timeliness and reduce the labor cost.

Description

Main-standby switching method, device, equipment and storage medium of component cluster system
Technical Field
The present application relates to the field of digital medical technology, and in particular, to a method, an apparatus, a device, and a storage medium for switching between a master and a slave in a component cluster system.
Background
In the field of digital medical technology, the development of an online medical platform system is extremely rapid, and the application is more and more extensive. The servers of the online medical platform system are placed in a special machine room, so that a component cluster system of the machine room server can continuously operate when a single machine room is prevented from having network faults and irresistible disasters (fire, earthquake, flood and the like), and a double-machine room system, a main system and a standby system are generally required to be deployed. The main system can be used for providing service for users, the working state of the standby system is the standby system state, and the standby system can be used for changing the working state into the main system state under the condition that the main system is abnormal in operation so as to replace the original main system to continue providing service for the users.
However, in the related art, the main/standby state switching between the main system and the standby system needs to be performed manually, so that the working efficiency is low, the switching is not timely enough, and the labor cost is high.
Disclosure of Invention
The application aims to provide a main-standby switching method, device, equipment and storage medium of a component cluster system, which can automatically realize the main-standby switching of the component cluster system when a main system is abnormally operated, improve the working efficiency, improve the switching timeliness and reduce the labor cost. The following presents a simplified summary in order to provide a basic understanding of some aspects of the disclosed embodiments. This summary is not an extensive overview and is intended to neither identify key/critical elements nor delineate the scope of such embodiments. Its sole purpose is to present some concepts in a simplified form as a prelude to the more detailed description that is presented later.
According to an aspect of an embodiment of the present application, a method for switching between a master device and a slave device in a component cluster system is provided, where the method is applied to a monitoring server, and the method includes:
receiving a normal state report signal sent by a first component cluster system according to a first preset period duration;
updating the validity period of the first component cluster system as a main system according to a second preset period duration;
detecting whether the validity period is updated within a preset duration, and determining whether the working state of the first component cluster system reaches a preset main/standby switching condition;
if the preset main/standby switching condition is met, changing the working state of the first component cluster system from a main system state to a standby system state, and changing the working state of the second component cluster system from the standby system state to the main system state;
the validity period is determined based on a timestamp and a preset duration, the timestamp is used for representing the starting moment of the validity period, and the preset duration is larger than the second preset period duration.
In some embodiments, the determining whether the working state of the first component cluster system reaches a preset active/standby switching condition includes:
if the validity period is not updated within the preset duration, determining that the working state of the first component cluster system reaches a preset main/standby switching condition;
otherwise, determining that the preset main/standby switching condition is not met.
In some embodiments, the changing the working state of the first component cluster system from a main system state to a standby system state and the changing the working state of the second component cluster system from the standby system state to the main system state includes:
setting the first component cluster system to a read-only state through a distributed application coordination service;
changing the working state of the first component cluster system in the distributed application program coordination service into a standby system state;
and setting the second component cluster system to be in a main system state through the distributed application program coordination service according to the fact that the working state of the second component cluster system is in a ready state.
In some embodiments, the changing the operating state of the first component cluster system from a main system state to a standby system state and the changing the operating state of the second component cluster system from the standby system state to the main system state further includes:
storing, by the distributed application coordination service, state change data for the first component cluster system and the second component cluster system.
In some embodiments, the changing the operating state of the first component cluster system from the primary system state to the standby system state includes:
acquiring a verification timestamp, wherein the verification timestamp is updated at the time when the validity period is successfully updated within the preset duration based on the validity period, and an initial value of the verification timestamp is the timestamp when the validity period is successfully updated for the first time by the first component cluster system;
and switching the service state of the first component cluster system from the main system to the standby system in response to the fact that the difference value between the check timestamp and the actual time is greater than the preset duration.
In some embodiments, the method further comprises:
and if the working state of the first component cluster system is determined to reach a preset main/standby switching condition, sending a corresponding prompt signal.
In some embodiments, the method further comprises:
and sending a master-slave system state switching completion signal of the first component cluster system and the second component cluster system.
According to an aspect of an embodiment of the present application, a device for switching between active and standby devices of a component cluster system is provided, where the device is applied to a monitoring server, and the device includes:
the receiving and sending module is used for receiving a normal state report signal sent by the first component cluster system according to a first preset period duration;
the updating module is used for updating the validity period of the first component cluster system as a main system according to a second preset period duration;
the detection module is used for detecting whether the validity period is updated within a preset duration and determining whether the working state of the first component cluster system reaches a preset main/standby switching condition;
the switching module is used for changing the working state of the first component cluster system from a main system state to a standby system state and changing the working state of the second component cluster system from the standby system state to the main system state if the preset main/standby switching condition is met;
the validity period is determined based on a timestamp and a preset duration, the timestamp is used for representing the starting moment of the validity period, and the preset duration is larger than the second preset period duration.
According to an aspect of the embodiments of the present application, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the program to implement the method for switching between active and standby components of a component cluster system according to any one of the foregoing embodiments.
According to an aspect of the embodiments of the present application, a computer-readable storage medium is provided, where a computer program is stored, where the computer program is executed by a processor to implement a method for active/standby switching of a component cluster system according to any one of the foregoing descriptions.
The technical scheme provided by one aspect of the embodiment of the application can have the following beneficial effects:
the method for switching between the main component and the standby component of the component cluster system, provided by the embodiment of the application, includes receiving a normal state reporting signal sent by a first component cluster system according to a first preset period duration, forwarding the reporting signal to a second component cluster system, updating a validity period of the first component cluster system as a main system according to a second preset period duration, detecting whether the validity period is updated within the preset duration, determining whether a working state of the first component cluster system reaches a preset main/standby switching condition, changing the working state of the first component cluster system from the main system state to a standby system state if the preset main/standby switching condition is reached, and changing the working state of the second component cluster system from the standby system state to the main system state, so that the main/standby switching of the component cluster system can be automatically realized when the main system runs abnormally, the working efficiency is improved, the switching degree is improved, and the labor cost is reduced.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the description below are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 shows an application scenario diagram of a main/standby switching method of a component cluster system according to an embodiment of the present application.
Fig. 2 shows a flowchart of a main/standby switching method of a component cluster system according to an embodiment of the present application.
Fig. 3 shows a flow chart of some embodiments of step S40 in fig. 2.
Fig. 4 is a flowchart illustrating a main/standby switching method of a component cluster system according to a specific example of the present application.
Fig. 5 shows a block diagram of a main/standby switching device of a component cluster system according to an embodiment of the present application.
Fig. 6 shows a block diagram of an electronic device according to an embodiment of the present application.
FIG. 7 shows a schematic diagram of a computer-readable storage medium of an embodiment of the present application.
The implementation, functional features and advantages of the objects of the present application will be further explained with reference to the accompanying drawings in conjunction with the embodiments.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is further described with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
Online medical treatment is a new application of online in the medical field, and can be divided into data integration stages in the development process of medical informatization according to the characteristic of covering a 'surface'. Online medical treatment includes a variety of items such as health education, medical information inquiry, electronic health archives, disease risk assessment, online disease consultation, electronic prescription, remote consultation, remote medical treatment, and rehabilitation. In order to ensure safe operation of the system, the online medical platform system usually adopts double machine rooms. In a dual-computer room application scenario in the field of digital medical treatment, some component clusters need to sense the active/standby information of the current computer room, and can perform the active/standby switching function for the component clusters. Although some components such as distributed scheduling service, tair cache and the like can be distributed in the dual computer rooms, the service itself needs to know whether the currently running computer room is a main system or a standby system (for example, tair needs to write into a main reading computer room because of real-time performance and data consistency), and when abnormal maintenance and other reasons occur, main-standby switching of a single component cluster system is needed, and dirty data can be avoided in the switching process. Therefore, a unified double-machine-room switching platform is needed for management and support. In order to solve the problems in the related art, an embodiment of the present application provides a method for switching between active and standby components of a component cluster system.
An application scenario of the method according to the embodiment of the present application is shown in fig. 1, where the application scenario includes a first server 110, a second server 120, and a monitoring server 130, a first component cluster system and a second component cluster system are respectively deployed in the first server 110 and the second server 120, and interaction data between the first component cluster system and the second component cluster system is relayed through the monitoring server 130. The monitoring server 130 receives a normal state reporting signal sent by the first component cluster system according to a first preset period duration, and forwards the reporting signal to the second component cluster system; the monitoring server 130 updates the validity period of the first component cluster system as a main system according to the second preset period duration; the monitoring server 130 detects whether the validity period is updated within a preset duration, and determines whether the working state of the first component cluster system reaches a preset main/standby switching condition; the monitoring server 130 changes the working state of the first component cluster system from the main system state to the standby system state and changes the working state of the second component cluster system from the standby system state to the main system state according to the preset main/standby switching condition. The method of the embodiment of the application can automatically realize the main-standby switching of the component cluster system when the main system is abnormally operated, so that the working efficiency is improved, the switching timeliness is improved, and the labor cost is reduced.
In the embodiment of the application, ZK, namely zookeeper, is a distributed coordination service, and can store the states of the main component, the standby component, each node and the like. ZooKeeper is a distributed, open source distributed application coordination service, is an open source implementation of Chubby by Google, and is an important component of Hadoop and Hbase. The software is used for providing a consistency service for distributed application, and the provided functions comprise: configuration maintenance, domain name service, distributed synchronization, group service, etc. The ZooKeeper aims to package complex key services which are easy to make mistakes, and provides a simple and easy-to-use interface and a system with high performance and stable functions for a user. GMS is short for a dual-computer-room master-standby switching platform. The GMS is mainly divided into a GMS-client module (in a two-party library jar packet form) and a GMS-server module, and the module can perform active-standby switching on the GMS only after the client module is integrated.
The Client contains the following two functions: 1. and (3) reporting the state: reporting the upper and lower line states of each node of the component; 2. monitoring the main and standby states: and monitoring the state of the component and responding to the change in time. If the monitored component is changed to the read-only state, the write-forbidden operation of the component can be executed.
The Server module comprises the following functions: 1. managing the information of the machine room; 2. managing the state of the component; 3. managing the components; and 4, IDC active/standby switching function.
Referring to fig. 2, an embodiment of the present application provides a main/standby switching method of a component cluster system, which is applied to a monitoring server, where the main/standby switching method may include steps S10 to S40:
s10, receiving a normal state report signal sent by the first component cluster system according to a first preset period duration.
The state normal report signal is used for indicating that the first component cluster system is in a normal state of the main system. The first component cluster system is a main system of the target service, and the second component cluster system is a standby system of the target service.
Specifically, the first component cluster system sends a normal state report signal to the monitoring server to indicate that the current working state is normal to the monitoring server. The first preset period duration may be preset according to actual needs, and may be set to 1 second, 2 seconds, 3 seconds, or the like, for example.
And S20, updating the validity period of the first component cluster system as a main system according to a second preset period.
And if the monitoring server receives the report signal within the second preset period duration, the monitoring server indicates that the working state of the first component cluster system is not abnormal. If the monitoring server does not receive the state normal backup signal within the second preset period duration, it indicates that the working state of the first component cluster system is abnormal, and the monitoring server may further detect whether the master/slave switching is required.
S30, detecting whether the validity period is updated within the preset duration, and determining whether the working state of the first component cluster system reaches a preset main/standby switching condition.
Specifically, if the validity period is not updated within the preset duration, it is determined that the working state of the first component cluster system reaches the preset primary/secondary switching condition, and if the validity period is updated within the preset duration, it is determined that the working state of the first component cluster system does not reach the preset primary/secondary switching condition.
In some embodiments, determining whether the working state of the first component cluster system reaches a preset active/standby switching condition includes: if the validity period is not updated within the preset duration, determining that the working state of the first component cluster system reaches a preset main/standby switching condition; otherwise, determining that the preset main/standby switching condition is not met.
And S40, if the preset main-standby switching condition is met, changing the working state of the first component cluster system from a main system state to a standby system state, and changing the working state of the second component cluster system from the standby system state to the main system state.
The state normal report signal is used for indicating that the first component cluster system is in a normal state of a main system state, the validity period is determined based on a timestamp and a preset duration, the timestamp is used for indicating the starting time of the validity period, and the preset duration is longer than the second preset period.
Specifically, the second preset period duration is set to be less than the preset duration, so that the updating operation of the validity period within the preset duration can be ensured when the first component cluster system is in a normal working state.
For example, assuming that the preset duration is 50 seconds, the second preset period duration may be set to 10 seconds, that is, the first component cluster system sends the validity period update instruction to the monitoring server every 10 seconds. If the initial timestamp of the current validity period is 32 minutes and 45 seconds at 10 hours and the preset duration is 50 seconds, the current validity period is 32 minutes and 45 seconds to 10 minutes and 32 minutes and 35 seconds at 10 hours, and if a first validity period updating instruction is received after 10 seconds, the validity period is updated to 10 minutes and 32 minutes and 55 seconds to 10 minutes and 32 minutes and 45 seconds.
As shown in fig. 3, in some embodiments, the changing the operating state of the first component cluster system from a main system state to a standby system state and the changing the operating state of the second component cluster system from the standby system state to the main system state includes:
s401, setting the first component cluster system to be in a read-only state through a distributed application program coordination service;
s402, changing the working state of the first component cluster system in the distributed application program coordination service into a standby system state;
and S403, setting the second component cluster system to be in a main system state through the distributed application program coordination service according to the working state of the second component cluster system as a ready state.
In the process of switching the main and standby, a read-only (readonly) state is an intermediate state in the process of switching the main and standby, and when a corresponding component monitors the state change, the component node integrated with the GMS-client can execute write-forbidding operation of each component, namely, enter the read-only state, so that dirty data is prevented from being generated in the process of switching the main and standby, and then the state of the node on zk can be automatically changed into a ready-to-standby state.
Ready state means that the node state of a component becomes ready after it enters the read-only state and writes the state back to zk; when all nodes of a component enter the read-only state and write back to zk, the state of the component changes to the ready-to-use state.
In some embodiments, the changing the operating state of the first component cluster system from a main system state to a standby system state and the changing the operating state of the second component cluster system from the standby system state to the main system state further includes:
s404, storing state change data of the first component cluster system and the second component cluster system through the distributed application program coordination service.
In some embodiments, the changing the operating state of the first component cluster system from a primary system state to a standby system state includes:
determining the moment when the validity period finishes updating within the preset duration; updating a verification timestamp by using the updating completion time, wherein an initial value of the verification timestamp is the time when the first component cluster system successfully updates the validity period for the first time; and responding to the fact that the difference value between the checking timestamp and the actual time is larger than the preset duration, and switching the service state of the first component cluster system from the main system to the standby system.
In the operation process of the first component cluster system, each time the first component cluster system receives a notification that the validity period is updated successfully, the timestamp of the notification is updated into the verification timestamp, and the duration of the notification that the update is not successfully received is determined based on the difference between the verification timestamp and the actual time. For example, if the time when the validity period is successfully updated for the first time by the first component cluster system is 9 hours 38 minutes 36 seconds, the initial value of the check timestamp is 9 hours 38 minutes 36 seconds. For example, the timestamp of when the update success notification is received for the first time is 38 minutes and 36 seconds at time 9, and if no other update success notification is received at time 39 minutes and 26 seconds at time 9, it may be determined that the time length during which the update success notification is not received is 50 seconds, and if the preset duration is 50 seconds, it may be determined that the update success notification is not received within the preset duration, and thus it may be determined that the update of the validity period is not completed within the preset duration.
The monitoring server may have integrated thereon GMS and ZK. In a specific example shown in fig. 4, GMS and ZK cooperate with each other to implement active/standby switching. The monitoring server selects the corresponding component to start the switching process. GMS changes the state of the component in zookeeper: main- > read-only state. And each node of the component respectively monitors that the corresponding write-forbidding logic is executed after the state is changed (main- > read-only), and writes back the state of the node from ready to ZK after the state is finished. When all nodes under the module are in the ready state, the GMS changes the overall state of the module to the ready state, which indicates that the active/standby switching is possible. GMS makes the state of the assembly from ready-to-standby, and the original main computer room assembly of the assembly monitors the state change and adjusts the main computer room assembly into a standby cluster. GMS makes the component original backup-master, the component original backup component monitors the state change and adjusts the component to be a master component cluster, and the master-slave switching is finished. According to the method, dirty data can be prevented from being generated through write-inhibit read-only operation in the active-standby switching process of the components, one-key active-standby switching can be realized for a certain component through a state machine mechanism, and unified management can be realized on component clusters needing to be distinguished from active-standby components.
In some embodiments, the method may further comprise: and if the working state of the first component cluster system is determined to reach the preset main/standby switching condition, sending a corresponding prompt signal. The prompt signal is used for reminding a worker that the current working state of the first component cluster system reaches a preset main/standby switching condition.
In some embodiments, the method may further comprise: and sending a master-slave system state switching completion signal of the first component cluster system and the second component cluster system. The master-slave system state switching completion signal is used for reminding a worker that the master-slave system state switching of the first component cluster system and the second component cluster system is completed.
The master-slave switching method of the component cluster system provided by the embodiment of the application receives a normal state reporting signal sent by a first preset period time of a first component cluster system, forwards the reporting signal to a second component cluster system, updates the validity period of the first component cluster system as a master system according to a second preset period time, detects whether the validity period is updated within the preset duration time, determines whether the working state of the first component cluster system reaches a preset master-slave switching condition, changes the working state of the first component cluster system from the master system state to a slave system state if the preset master-slave switching condition is met, and changes the working state of the second component cluster system from the slave system state to the master system state, so that the master-slave switching of the component cluster system can be automatically realized when the master system is abnormally operated, the working efficiency is improved, the switching degree is improved, and the labor cost is reduced.
As shown in fig. 5, another embodiment of the present application provides a device for switching between active and standby devices of a component cluster system, which is applied to a monitoring server, where the device includes:
the receiving and sending module is used for receiving a normal state reporting signal sent by the first component cluster system according to a first preset period duration;
the updating module is used for updating the validity period of the first component cluster system as a main system according to a second preset period duration;
the detection module is used for detecting whether the validity period is updated within the preset duration and determining whether the working state of the first component cluster system reaches a preset main-standby switching condition;
the switching module is used for changing the working state of the first component cluster system from a main system state to a standby system state and changing the working state of the second component cluster system from the standby system state to the main system state if the preset main/standby switching condition is met;
the state normal report signal is used for indicating that the first component cluster system is in a normal state of a main system state, the validity period is determined based on a timestamp and a preset duration, the timestamp is used for indicating the starting time of the validity period, and the preset duration is longer than the second preset period.
In some embodiments, the determining whether the working state of the first component cluster system reaches a preset active/standby switching condition includes: if the validity period is not updated within the preset duration, determining that the working state of the first component cluster system reaches a preset main/standby switching condition; otherwise, determining that the preset main/standby switching condition is not met.
In some embodiments, the changing, by the switching module, the working state of the first component cluster system from the main system state to the standby system state, and the working state of the second component cluster system from the standby system state to the main system state includes:
setting the first component cluster system to a read-only state through a distributed application coordination service;
changing the working state of the first component cluster system in the distributed application program coordination service into a standby system state;
and setting the second component cluster system to be in a main system state through the distributed application program coordination service according to the working state of the second component cluster system as a ready state.
In some embodiments, the changing, by the switching module, the working state of the first component cluster system from a main system state to a standby system state, and the working state of the second component cluster system from the standby system state to the main system state further includes:
storing, by the distributed application coordination service, state change data for the first component cluster system and the second component cluster system.
In some embodiments, the changing the operating state of the first component cluster system from the primary system state to the standby system state includes:
determining the moment when the validity period finishes updating within the preset duration; updating a check timestamp by using the updating completion time, wherein an initial value of the check timestamp is the time when the first component cluster system successfully updates the validity period for the first time; and switching the service state of the first component cluster system from the main system to the standby system in response to the fact that the difference value between the check timestamp and the actual time is greater than the preset duration.
In some embodiments, the apparatus further comprises:
and the signal sending module is used for sending a corresponding prompt signal if the working state of the first component cluster system is determined to reach a preset main/standby switching condition.
In some embodiments, the signal transmitting module is further configured to: and sending a master-slave system state switching completion signal of the first component cluster system and the second component cluster system.
The active-standby switching device of the component cluster system provided in the embodiment of the application receives a normal state reporting signal sent by a first component cluster system according to a first preset period duration, forwards the reporting signal to a second component cluster system, updates the validity period of the first component cluster system as a main system according to a second preset period duration, detects whether the validity period is updated within the preset duration, determines whether the working state of the first component cluster system reaches a preset active-standby switching condition, changes the working state of the first component cluster system from the main system state to a standby system state if the preset active-standby switching condition is reached, and changes the working state of the second component cluster system from the standby system state to the main system state, so that the active-standby switching of the component cluster system can be automatically realized when the main system runs abnormally, the working efficiency is improved, the switching degree is improved, and the labor cost is reduced.
Another embodiment of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the program to implement the method according to any of the above embodiments.
As shown in fig. 6, the electronic device 10 may include: the system comprises a processor 100, a memory 101, a bus 102 and a communication interface 103, wherein the processor 100, the communication interface 103 and the memory 101 are connected through the bus 102; the memory 101 stores a computer program that can be executed on the processor 100, and the processor 100 executes the computer program to perform the method provided by any of the foregoing embodiments of the present application.
The Memory 101 may include a high-speed Random Access Memory (RAM), and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used.
The bus 102 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 101 is used for storing a program, and the processor 100 executes the program after receiving an execution instruction, where the method disclosed in any embodiment of the present application may be applied to the processor 100, or implemented by the processor 100.
Processor 100 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 100. The Processor 100 may be a general-purpose Processor, and may include a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method in combination with the hardware.
The electronic device provided by the embodiment of the application and the method provided by the embodiment of the application have the same inventive concept and have the same beneficial effects as the method adopted, operated or realized by the electronic device.
Another embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, the program being executed by a processor to implement the method of any of the above embodiments.
The present embodiment also provides a computer-readable storage medium corresponding to the method provided in the foregoing embodiment, and referring to fig. 7, the computer-readable storage medium is shown as an optical disc 20, on which a computer program (i.e., a program product) is stored, and when the computer program is executed by a processor, the computer program will execute the method provided in any of the foregoing embodiments.
It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory, or other optical and magnetic storage media, which are not described in detail herein.
The computer-readable storage medium provided by the above-mentioned embodiments of the present application and the method provided by the embodiments of the present application have the same advantages as the method adopted, executed or implemented by the application program stored in the computer-readable storage medium.
It should be noted that:
the term "module" is not intended to be limited to a particular physical form. Depending on the particular application, a module may be implemented as hardware, firmware, software, and/or combinations thereof. Furthermore, different modules may share common components or even be implemented by the same component. There may or may not be clear boundaries between the various modules.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose devices may also be used with the examples based on this disclosure. The required structure for constructing such a device will be apparent from the description above. Moreover, this application is not intended to refer to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present application as described herein, and any descriptions of specific languages are provided above to disclose the best mode of use of the present application.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless otherwise indicated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The above-mentioned embodiments only express the embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims (10)

1. A method for switching between main and standby of a component cluster system is applied to a monitoring server, and comprises the following steps:
receiving a normal state report signal sent by a first component cluster system according to a first preset period duration;
updating the validity period of the first component cluster system as a main system according to a second preset period duration;
detecting whether the validity period is updated within a preset duration, and determining whether the working state of the first component cluster system reaches a preset main/standby switching condition;
if the preset main/standby switching condition is met, changing the working state of the first component cluster system from a main system state to a standby system state, and changing the working state of the second component cluster system from the standby system state to the main system state;
the validity period is determined based on a timestamp and a preset duration, the timestamp is used for representing the starting moment of the validity period, and the preset duration is larger than the second preset period duration.
2. The method according to claim 1, wherein the determining whether the operating state of the first component cluster system reaches a preset master-slave switching condition includes:
if the validity period is not updated within the preset duration, determining that the working state of the first component cluster system reaches a preset main/standby switching condition;
otherwise, determining that the preset main/standby switching condition is not met.
3. The method according to claim 1, wherein the changing the operating state of the first component cluster system from a main system state to a standby system state and the changing the operating state of the second component cluster system from the standby system state to the main system state comprises:
setting the first component cluster system to a read-only state through a distributed application coordination service;
changing the working state of the first component cluster system in the distributed application program coordination service into a standby system state;
and setting the second component cluster system to be in a main system state through the distributed application program coordination service according to the working state of the second component cluster system as a ready state.
4. The method of claim 3, wherein the changing the operating state of the first component cluster system from a primary system state to a standby system state and the changing the operating state of the second component cluster system from the standby system state to the primary system state further comprises:
storing, by the distributed application coordination service, state change data for the first component cluster system and the second component cluster system.
5. The method of claim 1, wherein the changing the operating state of the first component cluster system from a primary system state to a standby system state comprises:
determining the moment when the validity period finishes updating within the preset duration;
updating a check timestamp by using the updating completion time, wherein an initial value of the check timestamp is the time when the first component cluster system successfully updates the validity period for the first time;
and switching the service state of the first component cluster system from the main system to the standby system in response to the fact that the difference value between the check timestamp and the actual time is larger than the preset duration.
6. The method of claim 1, wherein after the changing the operating state of the first component cluster system from the primary system state to the standby system state and the changing the operating state of the second component cluster system from the standby system state to the primary system state, the method further comprises:
and if the working state of the first component cluster system is determined to reach a preset main/standby switching condition, sending a corresponding prompt signal.
7. The method according to claim 1, wherein after the operating state of the first component cluster system is changed from a main system state to a standby system state and the operating state of the second component cluster system is changed from the standby system state to the main system state, the method further comprises:
and sending a master-slave system state switching completion signal of the first component cluster system and the second component cluster system.
8. A master spare auto-change over device of subassembly cluster system, its characterized in that is applied to the monitoring server, the device includes:
the receiving and sending module is used for receiving a normal state report signal sent by the first component cluster system according to a first preset period duration;
the updating module is used for updating the validity period of the first component cluster system as a main system according to a second preset period duration;
the detection module is used for detecting whether the validity period is updated within a preset duration and determining whether the working state of the first component cluster system reaches a preset main/standby switching condition;
the switching module is used for changing the working state of the first component cluster system from a main system state to a standby system state and changing the working state of the second component cluster system from the standby system state to the main system state if the preset main/standby switching condition is met;
the validity period is determined based on a timestamp and a preset duration, the timestamp is used for representing the starting moment of the validity period, and the preset duration is larger than the second preset period duration.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor executing the program to implement the method for master-slave switching of a component cluster system according to any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, the program being executable by a processor to implement a method for master/slave switching of a component cluster system according to any of claims 1 to 7.
CN202211271241.0A 2022-10-18 2022-10-18 Main/standby switching method, device, equipment and storage medium of component cluster system Pending CN115604088A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211271241.0A CN115604088A (en) 2022-10-18 2022-10-18 Main/standby switching method, device, equipment and storage medium of component cluster system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211271241.0A CN115604088A (en) 2022-10-18 2022-10-18 Main/standby switching method, device, equipment and storage medium of component cluster system

Publications (1)

Publication Number Publication Date
CN115604088A true CN115604088A (en) 2023-01-13

Family

ID=84847637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211271241.0A Pending CN115604088A (en) 2022-10-18 2022-10-18 Main/standby switching method, device, equipment and storage medium of component cluster system

Country Status (1)

Country Link
CN (1) CN115604088A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115903451A (en) * 2023-03-08 2023-04-04 北京全路通信信号研究设计院集团有限公司 Component working mode switching method, device, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115903451A (en) * 2023-03-08 2023-04-04 北京全路通信信号研究设计院集团有限公司 Component working mode switching method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110535692B (en) Fault processing method and device, computer equipment, storage medium and storage system
CN110825420A (en) Configuration parameter updating method, device, equipment and storage medium for distributed cluster
CN112463448B (en) Distributed cluster database synchronization method, device, equipment and storage medium
US8694835B2 (en) System health monitoring
CN111092865B (en) Security event analysis method and system
CN111796959B (en) Self-healing method, device and system for host container
CN115604088A (en) Main/standby switching method, device, equipment and storage medium of component cluster system
CN107508700B (en) Disaster recovery method, device, equipment and storage medium
CN108243031B (en) Method and device for realizing dual-computer hot standby
CN113220540A (en) Service management method, device, computer equipment and storage medium
CN110209526A (en) A kind of accumulation layer synchronization system and storage medium
CN111342986B (en) Distributed node management method and device, distributed system and storage medium
TWI518680B (en) Method for maintaining file system of computer system
US20240061754A1 (en) Management of logs and cache for a graph database
CN113765690A (en) Cluster switching method, system, device, terminal, server and storage medium
CN112561506A (en) Live broadcast data processing method, system, device and medium based on virtual currency
CN117336135A (en) Data transmission method, device, storage medium and electronic equipment
CN111162938A (en) Data processing system and method
CN116541461A (en) Data processing method, device, equipment and storage medium applied to database
CN111935337B (en) MAC address keep-alive method, equipment and storage medium of aggregation link
CN114780565A (en) Cache updating method and device, storage medium and electronic device
CN110489208B (en) Virtual machine configuration parameter checking method, system, computer equipment and storage medium
CN110502460B (en) Data processing method and node
CN114036129A (en) Database switching method for reducing data loss
CN115686951A (en) Fault processing method and device for database server

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