A method and system for monitoring the status of middleware nodes

Through the multi-node collaborative inspection and failover mechanism of high-availability components, the data loss and brain splitting problems caused by IO blocking in the middleware master-slave mode are solved, and the health status monitoring and fast failover of the middleware nodes are realized to ensure the service stability and data integrity.

CN118349419BActive Publication Date: 2024-08-30HANGZHOU YUXIN DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410772969.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-08-30
Estimated Expiration
2044-06-17

AI Technical Summary

Technical Problem

In the middleware master-slave mode, IO blocking causes data loss and brain splitting problems, especially in Redis and MySQL clusters. Master-slave switching may lead to data loss and service unavailability.

Method used

A middleware node status monitoring method and system is designed. Through independent deployment of high-availability components, at least three component nodes are used to determine the health status of the middleware node, achieve master node failover, avoid suspended animation and brain splitting, and reduce the risk of data loss. .

Benefits of technology

It improves the stability of the middleware master node service, quickly restores the middleware service, avoids suspended animation and brain splitting problems, reduces the risk of data loss, and ensures the health status monitoring and management of the middleware node.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118349419B
    Figure CN118349419B
Patent Text Reader

Abstract

The embodiment of the present invention provides a state monitoring method and system for middleware nodes, in which a high-availability component is set independently of the middleware, and each middleware node is deployed with a proxy service and registered in the service instance list of the high-availability component, so as to monitor and manage the health state of the middleware by using the high-availability component independent of the middleware, and at the same time, use at least three component nodes of the high-availability component to judge and determine the health state of the middleware's main node, objectively take the middleware main node offline, and make the middleware's main node service more stable. After the middleware's main node is objectively offline, only the main node of the high-availability component is used to perform the main node selection operation on the middleware. On the one hand, the efficiency of determining the main node can be improved, and it can be ensured that the middleware main node can quickly restore the middleware service. On the other hand, it can avoid the phenomenon of middleware node pseudo-death and brain split problems, and reduce the risk of data loss.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a state monitoring method and system for middleware nodes. Background Art

[0002] When most middleware is deployed in master-slave mode, there will be a large number of IO (Input / Output) operations during master-slave synchronization. When the amount of data is large, IO blocking will occur. If the IO blocking exceeds a certain time, it will cause master-slave switching. However, data that is not synchronized to the slave node during the IO blocking process will cause data loss. For example:

[0003] 1. In Redis (Remote Dictionary Server) cluster mode, all nodes are blocked due to persistence or master-slave synchronization. When the blockage is restored, if the IO blocking time is greater than the cluster node heartbeat timeout, the master node will be suspended and a large-scale retaliatory failover will occur. The failover will not only make the cluster unavailable, but also cause the slave node offset to be smaller than the master node due to IO blocking during the previous master-slave synchronization. Data loss will occur after the master-slave switch;

[0004] 2. When Redis is deployed with high availability and active-active backup in different locations, a split-brain problem will occur when the network communication between the two locations is abnormal. For example, the current master node suddenly becomes temporarily "disconnected" without actually failing. At this time, the monitoring sentinel will automatically start the master-slave switching mechanism and select a new master node. When the original master node recovers from the false failure, it starts processing requests again. In this way, the original master node and the new master node will exist at the same time. This is a split-brain problem. The split-brain problem may cause the client to not know which master node to write the data to, so that different clients will write data to different master nodes. After the sentinel synchronizes the full data between the original master node and the new master node, the data saved during the original master node switching is lost, causing data loss problems;

[0005] 3. When MySQL (relational database management system) is deployed in master-slave mode, IO blockage may occur under large amounts of data, causing master-slave switching and data loss.

[0006] In the process of implementing the present invention, the inventors found that the above problems are "common problems" of master-slave mode deployment, and there is an urgent need for a technology that monitors the health status of middleware nodes and provides master node failover functions to avoid data loss in master-slave mode deployment scenarios. Summary of the invention

[0007] In view of this, an embodiment of the present invention aims to provide a method and system for monitoring the status of middleware nodes, so as to avoid problems such as Redis brain split and pseudo-death, so as to reduce the risk of data loss during master-slave switching.

[0008] To achieve the above-mentioned purpose, in a first aspect, an embodiment of the present invention provides a state monitoring method for a middleware node, the method being applied to a high-availability component, the high-availability component being deployed independently of the middleware node and comprising at least three component nodes, the at least three component nodes comprising at least one first master node and at least two first slave nodes, the middleware node comprising a second master node and at least two second slave nodes, and each of the middleware nodes being deployed with a proxy service, all of the proxy services being registered in a service instance list of the high-availability component, the method comprising:

[0009] Determining, through the at least three component nodes of the high-availability component, that the second master node of the middleware node is in a faulty state;

[0010] When it is determined that the second master node of the middleware node is in a fault state, modifying the service state of the second master node to an offline state;

[0011] Receiving, through the first master node of the high-availability component, registration applications from the at least two second slave nodes, the registration application being an application from any of the second slave nodes requesting to become the middleware node master node;

[0012] Through the first master node of the high-availability component, according to the registration application of the at least two second slave nodes, a third master node is determined from the at least two second slave nodes, and the third master node is the latest master node of the middleware node, so as to provide middleware services through the third master node.

[0013] As an optional embodiment, determining that the second master node of the middleware node is in a faulty state through the at least three component nodes of the high-availability component includes:

[0014] Determine a responsible node from the three component nodes using a hash algorithm;

[0015] Using the responsible node to send a first health check command to the health status of the second master node to obtain a first check result;

[0016] When the first inspection result indicates that the second master node is in a faulty state, a coordinated inspection is performed on the health state of the second master node of the middleware node through two component nodes other than the responsible node to obtain a coordinated inspection result;

[0017] After the collaborative check, at least two health checks are initiated on the health status of the second master node using the responsible node to determine whether the second master node is in a faulty state.

[0018] As an optional embodiment, the method further includes:

[0019] When the first inspection result is that the second master node is in a faulty state, the first inspection result is recorded to a preset configuration center through the responsible node.

[0020] As an optional embodiment, when the first inspection result is that the second master node is in a faulty state, a collaborative inspection is performed on the health status of the second master node of the middleware node through two component nodes other than the responsible node to obtain a collaborative inspection result, including:

[0021] When the first inspection result is that the second master node is in a faulty state, using the responsible node to send a cooperative inspection request to the other two component nodes except the responsible node;

[0022] According to the cooperative check request, the second main node of the middleware node is collaboratively checked through the other two component nodes except the responsible node to obtain a cooperative check result.

[0023] As an optional embodiment, the step of performing a collaborative health check on the second master node of the middleware node through the other two component nodes except the responsible node according to the collaborative check request includes:

[0024] Using the other two component nodes except the responsible node to send a second health check command to the second master node of the middleware node respectively;

[0025] In the case that any component node other than the responsible node does not receive the response information of the second master node, the component node is used to determine that the second master node is in a fault state, and a third check result is obtained, wherein the response information is the return information of the second master node in response to the second health check command;

[0026] The component node is used to record the third inspection result to the preset configuration center.

[0027] As an optional embodiment, after the collaborative check, using the responsible node to initiate at least two health checks on the health status of the second master node to determine whether the second master node is in a fault state, including:

[0028] Using the responsible node to send a third health check command to the health status of the second master node, to obtain a first sub-result of the second check result;

[0029] When the first sub-result is that the second master node is in a fault state, using the responsible node to send a fourth health check command to the health state of the second master node, to obtain a second sub-result of the second check result;

[0030] When the second sub-result is that the second master node is in a fault state, using the responsible node to obtain the first inspection result and the third inspection result from the preset configuration center;

[0031] Determine whether the second master node is in a fault state according to the first check result and the third check result.

[0032] As an optional embodiment, determining whether the second master node is in a fault state according to the first check result and the third check result includes:

[0033] Counting the total number of records in the first inspection result and the third inspection result that the second master node is in a faulty state;

[0034] Determine whether the total number of records about the second master node being in a faulty state exceeds half of the total number of component nodes of the high-availability component;

[0035] When it is determined that the total number of records about the second master node being in a faulty state exceeds half of the total number of component nodes of the high-availability component, it is determined that the second master node is in a faulty state.

[0036] As an optional embodiment, the method further includes:

[0037] When the first sub-result is that the second master node is in a healthy state, using the responsible node to clear the first inspection result and the third inspection result stored in the preset configuration center;

[0038] When the second sub-result is that the second master node is in a healthy state, the first inspection result and the third inspection result stored in the preset configuration center are cleared by using the responsible node.

[0039] As an optional embodiment, determining that the second master node of the middleware node is in a faulty state through the at least three component nodes of the high-availability component includes:

[0040] A health check command is sent to the proxy service deployed at the second master node of the middleware node through the at least three component nodes of the high-availability component, so that the health check command is sent to the second master node through the proxy service deployed at the second master node using transparent transmission technology.

[0041] As an optional embodiment, the determining, through the first master node of the high-availability component, a third master node from the at least two second slave nodes according to the registration application of the at least two second slave nodes, includes:

[0042] Determining, by the first master node, a health status of the second slave node according to any registration application of the second slave node;

[0043] When the first master node determines that the second slave node is in a healthy state, query the preset configuration center through the first master node whether there is a master node registration record of the middleware node, and the master node registration record is the record information of the master node registration of other second slave nodes except the second slave node;

[0044] When it is determined that the preset configuration center does not have a master node registration record of the middleware node, writing the instance identification information of the proxy service of the second slave node into the memory of the high-availability component through the first master node;

[0045] If the writing is successful, the master node registration record of the second slave node is written into the preset configuration center, and the registration state corresponding to the master node registration record of the second slave node is marked as the second state;

[0046] Modify the role status of the second slave node in the preset configuration center to a master node status through the first master node, and determine whether the modification is successful;

[0047] If the modification is successful, the registration state corresponding to the master node registration record of the second slave node is modified from the second state to the first state, so as to determine the second slave node as the third master node;

[0048] The registration application success information is sent to the second slave node through the first master node.

[0049] As an optional embodiment, the method further includes:

[0050] In the event that the first master node fails to modify the second slave node's role state in the preset configuration center to the master node state, or in the event that the first master node fails to write the instance identification information of the proxy service of the second slave node into the memory of the high-availability component, the first master node sends a registration application failure message to the second slave node.

[0051] As an optional embodiment, the determining, through the first master node of the high-availability component, a third master node from the at least two second slave nodes according to the registration application of the at least two second slave nodes, further includes:

[0052] Determining, by the first master node, a health status of the second slave node according to any registration application of the second slave node;

[0053] When the first master node determines that the second slave node is in a healthy state, query the preset configuration center through the first master node whether there is a master node registration record of the middleware node, and the master node registration record is the record information of the master node registration of other second slave nodes except the second slave node;

[0054] In the case where it is determined that the preset configuration center has a master node registration record of the middleware node, determining a registration status corresponding to the master node registration record through the first master node;

[0055] When the registration state corresponding to the master node registration record is the second state, determining, by the first master node, whether the registration processing time of the master node registration record exceeds a preset processing time;

[0056] In the case where it is determined that the registration processing time of the master node registration record exceeds a preset processing time, determining, through the first master node, that the master node registration record is an invalid record;

[0057] Deleting the invalid record from the preset configuration center through the first master node;

[0058] After deleting the failure record, writing the instance identification information of the proxy service of the second slave node into the memory of the high-availability component through the first master node;

[0059] If the writing is successful, the master node registration record of the second slave node is written into the preset configuration center, and the registration state corresponding to the master node registration record of the second slave node is marked as the second state;

[0060] Modify the role status of the second slave node in the preset configuration center to a master node status through the first master node, and determine whether the modification is successful;

[0061] If the modification is successful, the registration state corresponding to the master node registration record of the second slave node is modified from the second state to the first state, so as to determine the second slave node as the third master node;

[0062] The registration application success information is sent to the second slave node through the first master node.

[0063] As an optional embodiment, the method further includes:

[0064] When the registration status corresponding to the master node registration record is the first status, or when the registration status corresponding to the master node registration record is the second status and it is determined that the registration processing time of the master node registration record does not exceed the preset processing time, the first master node sends a registration application failure message to the second slave node.

[0065] As an optional embodiment, the method further includes:

[0066] Acquire the status monitoring index of the middleware node through the first master node;

[0067] The status monitoring indicator is visualized to display the status monitoring indicator in a preset display mode.

[0068] In a second aspect, an embodiment of the present invention provides a status monitoring system for a middleware node, the system comprising a high-availability component and a middleware node;

[0069] The high-availability component is deployed independently of the middleware node and includes at least three component nodes, wherein the at least three component nodes include at least one first master node and at least two first slave nodes; the high-availability component is used to:

[0070] Determining, through the at least three component nodes of the high-availability component, that the second master node of the middleware node is in a faulty state;

[0071] When it is determined that the second master node of the middleware node is in a fault state, modifying the service state of the second master node to an offline state;

[0072] Receiving, through the first master node of the high-availability component, registration applications from the at least two second slave nodes, the registration application being an application from any of the second slave nodes requesting to become the middleware node master node;

[0073] Determine, through the first master node of the high-availability component, a third master node from the at least two second slave nodes according to the registration applications of the at least two second slave nodes, the third master node being the latest master node of the middleware node, so as to provide middleware services through the third master node;

[0074] The middleware node includes a second master node and at least two second slave nodes, and each of the middleware nodes is deployed with a proxy service, and all the proxy services are registered in the service instance list of the high-availability component; the middleware node is used to:

[0075] After the high-availability component determines that the second master node is in a faulty state, sending a registration application to the first master node of the high-availability component through the at least two second slave nodes;

[0076] When the first master node of the high-availability component determines any one of the second slave nodes as a third master node, middleware services are provided through the second slave node, and the second slave node is the latest master node of the middleware node.

[0077] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned status monitoring method for a middleware node.

[0078] In a fourth aspect, an embodiment of the present invention provides a computer device, comprising:

[0079] one or more processors;

[0080] A storage device for storing one or more programs;

[0081] When the one or more programs are executed by the one or more processors, the one or more processors implement the aforementioned status monitoring method for a middleware node.

[0082] The above technical scheme has the following beneficial effects: the high-availability component is set independently from the middleware, and each middleware node is deployed with a proxy service, and all proxy services are registered in the service instance list of the high-availability component, so that the health status of the middleware can be monitored and managed by the high-availability component independent of the middleware, and the health status monitoring and management of all nodes of the middleware can be realized. At the same time, at least three component nodes of the high-availability component are used to judge and determine the health status of the middleware's main node (second main node), and the middleware main node is objectively offline to make the middleware main node service more stable. After the middleware main node is objectively offline, only the main node of the high-availability component is used to perform the main node selection operation on the middleware. On the one hand, the efficiency of the main node determination can be improved to ensure that the middleware main node can quickly restore the middleware service. On the other hand, the phenomenon of false death of the middleware node and the problem of brain split can be avoided, and the risk of data loss can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0084] Figure 1 is a schematic structural block diagram of a state monitoring system for a middleware node provided by an embodiment of the present invention;

[0085] Figure 2 It is one of the schematic flow charts of a method for monitoring the status of a middleware node provided by an embodiment of the present invention;

[0086] Figure 3 This is a second schematic flow chart of a method for monitoring the status of a middleware node provided in an embodiment of the present invention;

[0087] Figure 4 This is a schematic flowchart of a method for monitoring the status of a middleware node provided in an embodiment of the present invention;

[0088] Figure 5 is a schematic structural block diagram of a computer-readable storage medium provided by an embodiment of the present invention;

[0089] Figure 6 It is a schematic structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0091] Middleware is an independent system software service program. Distributed application software uses this software to share resources between different technologies. Middleware is located on the operating system of the client server, managing computing resources and network communications. It is mostly used in distributed systems, such as Redis cluster mode and MySQL master-slave mode. In most applications, middleware is a basic software applied to distributed systems. It is located between the application and the operating system and database, providing a platform for the development, operation and integration of upper-level application software. For the stability of middleware services, middleware is usually deployed in clusters to form middleware nodes in master-slave mode.

[0092] It can be understood by those skilled in the art that the management of middleware nodes can be regarded as the management of microservices. The instance registration, health status, routing weight, request forwarding health instance, etc. of the service also need to be managed for the middleware nodes. In the embodiment of the present invention, based on the service management platform, the function of the high availability mechanism (HighAvailable, referred to as HA, whose goal is to enable the system to self-repair in time when a failure or other abnormal situation occurs during operation, and to ensure that the system's services can be continuously provided to users) of the middleware nodes is extended to form a high availability component. As an optional embodiment, the service management platform of the embodiment of the present invention can be, for example, Eureka (a service discovery framework developed by Netflix), Nacos (Naming and Configuration Service, a dynamic service discovery, configuration management and service management platform that is easier to build cloud native applications), Zookeeper (a distributed, open source distributed application coordination service, an open source implementation of Google's Chubby, and an important component of Hadoop and Hbase), Consul (a service grid solution that provides a full-featured control plane with service discovery, configuration and segmentation functions), etc. Among them, Nacos and Zookeeper support configuration management in addition to service management. Zookeeper is a system of CP consistency strategy mode with strong consistency; Nacos can implement the consistency strategy mode of CP and AP data at the same time, supporting both persistent service and temporary service modes.

[0093] It should be noted that the CP and AP consistency policy modes in the embodiment of the present invention are derived from the CAP theory, which means that a distributed system can only satisfy at most two of the three items of consistency, availability, and partition tolerance at the same time. The three items are abbreviated as CAP. Specifically, consistency (abbreviated as C): refers to "all nodes see the same data at the same time", in a distributed environment, the data of all nodes at the same time are completely consistent; availability (abbreviated as A): refers to "reads and writes always succeed", that is, the service is always in an available state and can respond normally; partition tolerance (abbreviated as P): partition tolerance means "the system continues to operate despite arbitrary message loss or failure of part of the system", that is, when a distributed system encounters a node or network partition failure, it can still provide services that meet consistency or availability to the outside world. In the embodiment of the present invention, C and A in CAP can be selected to determine whether it is a CP consistency policy mode or an AP consistency policy mode: CP (Consistency and Partition Tolerance): Under the premise of partition fault tolerance, data consistency is prioritized. When a network partition occurs, in order to ensure consistency requirements, the system may reject some operations and sacrifice availability; AP (Availability and Partition Tolerance): Prioritize the availability and partition fault tolerance of the system and sacrifice consistency. When a network partition occurs, the system will continue to provide services, but may return old data or temporarily unavailable data until the system finally reaches a consistent state.

[0094] Nacos's temporary service mode uses AP mode and is only stored in memory. The service health status requires the service (such as the middleware node) to report the heartbeat. When the service does not upload the heartbeat for a certain period of time, it will be removed from the service instance list. Nacos's persistent service mode uses CP mode and will be persistently stored on the disk. The health check uses an active detection mechanism. When the permanent service is registered, the Nacos responsible node starts a detection timer task, and the cycle is a random number between 2000 and 5000 milliseconds. This task determines the detection protocol based on the cluster health check type attribute of the registered instance. Nacos now provides three built-in detection methods, namely Http (Hypertext Transfer Protocol), TCP (Transmission Control Protocol) and MySQL, which can cover most health check scenarios. The default method for instance detection is TCP. Nacos Configuration Center provides dynamic publishing, query, and monitoring functions for configuration. In addition to storing the built-in Derby database of Nacos, its configuration information also supports the configuration of external MySQL and other data sources, supporting users to select the appropriate data source according to data storage requirements and performance requirements. Derby is a lightweight relational database management system that can be embedded in Java applications. Its startup and termination are controlled by Java programs and do not require any management. In Nacos, using Derby's built-in data source, you can quickly complete Nacos deployment and data storage.

[0095] In an embodiment of the present invention, as a preferred solution, the persistent service mode of Nacos is embedded in the high-availability component, and on this basis, a robust cooperative investigation method is expanded to confirm faults, so as to realize the confirmation of the health status of the middleware master node. Among them, the health check (status monitoring) of the Nacos persistent service mode can only check whether the agent service of the middleware node is healthy by default TCP mode, and cannot check the status of the middleware node. In addition, the Nacos persistent service health check has a disadvantage. The health check of a certain persistent service is only initiated by one node in the cluster. If three consecutive checks fail, the service is considered to be offline. On the basis of the above, the high-availability component of the embodiment of the present invention customizes a unified process for status monitoring of middleware nodes, which makes up for the shortcomings of the health check (status monitoring) of the Nacos persistent service mode and realizes the status monitoring management of the middleware nodes. For details, see Figure 1 .

[0096] Figure 1 1 is a schematic structural diagram of a state monitoring system for a middleware node provided by an embodiment of the present invention. Figure 1As shown, a status monitoring system 100 for a middleware node may include a high availability component 101 and a middleware node 102 , and is used to implement health status monitoring and management of the middleware node 102 .

[0097] Among them, the high-availability component 101 is a third-party detection center independent of the middleware, which needs to be deployed in cluster mode, with at least three nodes deployed. Its embedded Nacos persistent service mode includes at least five modules, including a configuration center (hereinafter referred to as a preset configuration center), service management, health check, master election rules, and monitoring indicator data collection, so as to realize the state monitoring function of the middleware node 102 in the embodiment of the present invention. Specifically:

[0098] (1) Configuration center: used for storage and query management of data such as high-availability component 101 configuration, health check failure records, and master election records; the configuration center is a basic service component specifically used for centralized management and distribution of application configurations, which can be understood as a component for editing, storing, distributing, changing, and managing historical versions of configurations. Nacos is an open source configuration center. The high-availability component of the embodiment of the present invention is expanded on the basis of the Nacos service, and uses the configuration center function of Nacos to store and query health check failure records.

[0099] (2) Service management: used to store the list of middleware nodes 102 proxy services that require health checks. The proxy service of each middleware node 102 is registered in the service list of the high-availability component 101, and the high-availability component 101 determines the middleware node 102 that needs to be monitored through the service list.

[0100] (3) Health check: Perform health check on the middleware node 102 managed by the high-availability component 101, and manage the health status of the middleware node 102; illustratively, in order to realize the status monitoring of the middleware node by the high-availability component 101, the middleware node status monitoring class diagram is expanded in the high-availability component 101. First, "HealthCheckProcessorV2" is defined, which is the interface definition of the health check processing class, and is a customized health check processing class of the embodiment of the present invention. Only when this interface is implemented can it be recognized by Nacos. Then Nacos declares the status monitoring check method by implementing HealthCheckProcessorV2, and opens the process() method to define the status monitoring process; secondly, "CustomHealthCheckCommonProcessor" is also defined, which is a public abstract processing class for health checks customized by the high-availability component 101. This class defines the health check process of the high-availability component 101, the process() method defines the overall process of the middleware status monitoring, and opens the abstract method instanceHealthCheck() to implement a specific status monitoring method for the middleware node 102. Finally, a specific middleware status monitoring class is defined. Taking Redis as an example, its status monitoring class is defined as "RedisHealthCheckProcessor", which implements the public abstract processing class for the customized health check of the high-availability component 101, and compiles the status monitoring communication mode, health check command and monitoring index collection of the Redis middleware. Through the definition of the specific middleware status monitoring class, the high-availability component 101 of the embodiment of the present invention expands the original status monitoring communication mode of Nacos (only supporting TCP). Specifically, the communication mode of the status monitoring of the high-availability component 101 is not limited to TCP, but can also be Http, Redis command, MySQL command, etc., which can be customized according to the specific middleware. That is, when monitoring the status of a specific middleware, what communication mode to use and what health check command to send need to be determined according to different middlewares, for example: the Redis communication protocol that the Redis middleware needs to send, such as the INFO command (a key tool for Redis to obtain server information); the MySQL middleware sends the MySQL communication protocol, for example, the SHOW STATUS command (to view the real-time status of MySQL operation) or other MySQL commands can be sent, which is subject to the specific implementation. Taking Redis as an example, it is necessary to inherit CustomHealthCheckCommonProcessor and implement the check method instanceHealthCheck() to define the health check method type, which is used to configure the service's health check method and route usage type.

[0101] (4) Master election rules: High-availability component 101 implements a set of master election processes for the middleware cluster. The middleware slave node's proxy service initiates a master election request to the high-availability component 101. The high-availability component 101 selects the first slave node that successfully completes the master node registration as the new master node of the middleware.

[0102] (5) Monitoring indicator data collection: Through the health check mechanism of the middleware node 102, the status monitoring indicators can be collected regularly. For different middleware nodes 102, different health check commands are sent to their proxy services. After receiving the health check command, the proxy service sends it to the corresponding middleware node 102 through transparent transmission technology, and responds to the status monitoring indicators. In other embodiments, the collection of status monitoring indicators of the middleware node 102 can also be expanded on the proxy service, and returned to the high availability component 101 through the health check. Furthermore, the status monitoring indicators can be visualized.

[0103] like Figure 1 As shown in , all middleware nodes 102 managed by the high-availability component 101 need to deploy proxy services and register their proxy services in the service instance list of the high-availability component 101. In some embodiments, the high-availability component 101 will periodically and proactively initiate health detection and indicator collection to the proxy service. When an abnormality is detected in the middleware master node, it will determine whether the middleware master node has failed through a custom coordination method. After determining that the middleware master node has failed through the voting mechanism of multiple nodes in the high-availability component 101 cluster, the middleware master node will be objectively offline, and the health status of the middleware master node proxy service instance will be modified, for example, to offline, and the master node role in the service metadata will be deleted. At the same time, after the proxy services of other slave nodes of the middleware discover that the master node is offline, they will assume the obligation of fault recovery and actively initiate the election of the master node. The high-availability component 101 provides the function of selecting the master.

[0104] As an optional embodiment of the present invention, the high-availability component 101 may include at least three component nodes, wherein the at least three component nodes include a master node and two slave nodes. Specifically, the high-availability component 101 of the embodiment of the present invention is expanded on Nacos, and the high-availability component 101 cluster follows the master-slave relationship of the Nacos cluster. In order to ensure data consistency, the configuration center of the Nacos cluster is responsible for the read and write operations of the configuration center. When the slave node receives the read and write operation request from the configuration center, it will also forward the read and write operation request to the master node internally, and return the read and write result after the master node responds to the read and write result. The middleware node 102 may include three nodes, such as a master node and two slave nodes.

[0105] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the subsequent method embodiment, which will not be repeated here.

[0106] exist Figure 1 Based on the system structure shown, an embodiment of the present invention provides a state monitoring method for middleware nodes, which is used to uniformly and comprehensively monitor and manage the monitoring state of the middleware nodes, avoid the phenomenon of false death of the middleware nodes and avoid the problem of brain split, and reduce the risk of data loss. A state monitoring method for middleware nodes provided by an embodiment of the present invention is described in detail below in conjunction with the accompanying drawings.

[0107] Figure 2 FIG. 1 is a schematic flow chart of a method for monitoring the status of a middleware node provided by an embodiment of the present invention. Figure 2 As shown, a method for monitoring the status of a middleware node may include steps 301 to 304, specifically:

[0108] Step 301: determine, through at least three component nodes of a high-availability component, that a second master node of a middleware node is in a fault state.

[0109] In an embodiment of the present invention, the middleware is, for example, any one or more of Redis, MySQL, etc. According to different middleware, the high-availability component sends different health check commands to determine the status of the middleware master node (second master node) (for example, determine whether it is in a healthy state or a faulty state). As an optional embodiment, the component node of the high-availability component is a proxy service that sends the health check command to the middleware master node, and the proxy service then sends the health check command to the middleware master node through transparent transmission technology. In the related art, the health check of a persistent service is initiated by only one node in the cluster, and the service is considered offline if three consecutive checks fail. If the network communication between the health check initiating node and the check service is abnormal, and the determination that the middleware master node is offline is not comprehensive enough, in an embodiment of the present invention, other nodes in the high-availability component cluster conduct a joint check. Only when more than half of the nodes in the high-availability component node health check determine that the master node has failed, can the master node be determined to be offline. Specifically, it can be implemented as follows:

[0110] Step A1, using a hash algorithm to determine a responsible node from three component nodes.

[0111] In an embodiment of the present invention, any component node of a high-availability component can be used to initiate a health check on the main node (second main node) of the middleware to confirm whether the main node of the middleware is in a faulty state. As an optional embodiment, when the proxy service of each middleware node is registered with the high-availability component, a hash algorithm can be used to perform a hash calculation based on the IP (Internet Protocol, a protocol for interconnection between networks) and the port of the middleware node corresponding to any proxy service and the number of component nodes of the high-availability component to obtain a hash value, and then determine a component node of a high-availability component based on the hash value, and use the component node as the responsible node of the middleware node to be responsible for managing the health status check of the middleware node, etc. That is, a responsible node is determined from the component nodes of the three high-availability components, and the responsible node may be a component node of any high-availability component.

[0112] For example, the high-availability component includes three component nodes A, B and C. The IP and port of the intermediate node D corresponding to any proxy server are 172.168.107.1 and 8080 respectively. The hash value 2 is calculated using the HASH remainder algorithm, and the high-availability component node B is determined to be the responsible node of the middleware node D.

[0113] Step B1, using the responsible node to send a first health check command to the health status of the second master node to obtain a first check result. The second master node is the master node of the middleware.

[0114] Step C1, when the first check result is that the second master node is in a faulty state, a collaborative check is performed on the health status of the second master node of the middleware node through the other two component nodes except the responsible node to obtain a collaborative check result.

[0115] Furthermore, when the first inspection result shows that the second master node is in a faulty state, the responsible node is used to send a cooperative inspection request to the other two component nodes except the responsible node. According to the cooperative inspection request, the other two component nodes except the responsible node perform a cooperative health inspection on the second master node of the middleware node to obtain a cooperative inspection result. Optionally, the other two component nodes except the responsible node can be used to send a second health inspection command to the second master node of the middleware node respectively. When any component node except the responsible node does not receive the response information of the second master node, the component node is used to determine that the second master node is in a faulty state to obtain a third inspection result, wherein the response information is the return information of the second master node in response to the second health inspection command; the component node is used to record the third inspection result to the preset configuration center.

[0116] Step D1, after the collaborative check, use the responsible node to initiate at least two health checks on the health status of the second master node to determine whether the second master node is in a faulty state. Specifically, use the responsible node to send a third health check command to the health status of the second master node to obtain the first sub-result of the second check result; when the first sub-result is that the second master node is in a faulty state, use the responsible node to send a fourth health check command to the health status of the second master node to obtain the second sub-result of the second check result; when the second sub-result is that the second master node is in a faulty state, use the responsible node to obtain the first check result and the third check result from the preset configuration center; determine whether the second master node is in a faulty state based on the first check result and the third check result.

[0117] In some embodiments, the total number of records about the second master node being in a faulty state in the first inspection result and the third inspection result can be counted, and then it can be determined whether the total number of records about the second master node being in a faulty state exceeds half of the total number of component nodes of the high-availability component. When it is determined that the total number of records about the second master node being in a faulty state exceeds half of the total number of component nodes of the high-availability component, it is determined that the second master node is in a faulty state. Exemplarily, for example, a high-availability component includes three component nodes A, B, and C, and a middleware master node D. Node D is offline, that is, node D is identified as being in a faulty state, and at least two of the three nodes A, B, and C need to determine that node D is in a faulty state.

[0118] As another optional embodiment, when the first sub-result is that the second main node is in a healthy state, the responsible node is used to clear the first inspection result and the third inspection result stored in the preset configuration center; or, when the second sub-result is that the second main node is in a healthy state, the responsible node is used to clear the first inspection result and the third inspection result stored in the preset configuration center.

[0119] Step 302: When it is determined that the second master node of the middleware node is in a fault state, modify the service state of the second master node to an offline state.

[0120] In order for those skilled in the art to accurately understand the embodiments of the present invention, Figure 3 The technical solution for determining the health status of the middleware master node is described in detail. Figure 3 As shown, the following steps may be specifically included:

[0121] In the first step, the responsible node of the high-availability component initiates the first health check to the middleware master node;

[0122] In the second step, if a communication anomaly or failure occurs, the responsible node of the high-availability component initiates a request for a coordinated task to the other two component nodes (component node 1 and component node 2);

[0123] In the third step, component node 1 and component node 2 will respond to the cooperative inquiry task to receive the result;

[0124] Step 4: The responsible node of the high-availability component records the failure record (the record of the failure of the middleware master node) to the configuration center;

[0125] Step 5: Component nodes 1 and 2 of the high-availability component initiate health check coordination with the middleware master node;

[0126] In the sixth step, the middleware master node will respond to the health check query;

[0127] In the seventh step, component node 1 and component node 2 of the high-availability component respectively determine the result of the joint investigation based on the response information received from the middleware master node. If the joint investigation fails (middleware master node failure), the failure record is also recorded in the configuration center.

[0128] Step 8: The responsible node of the high-availability component initiates a second health check on the middleware master node. If a communication abnormality or failure occurs, no action will be taken for the time being.

[0129] In the ninth step, the responsible node of the high-availability component continues to initiate a third health check to the middleware master node;

[0130] Step 10. If a communication anomaly or failure occurs, query the failure records stored in the configuration center to determine whether the failure records here exceed half of the high-availability component nodes. If so, determine that the middleware master node is in a faulty state, and modify the metadata of the proxy service instance of the middleware master node to be offline.

[0131] As an optional embodiment of the present invention, if the middleware master node communicates normally during the second health check, or if the middleware master node communicates normally during the third health check, the responsible node of the high-availability component will clean up the failure records stored in the configuration center and will not determine that the middleware master node is in a faulty state.

[0132] The three component nodes of the high-availability component jointly determine and confirm the health status of the middleware master node, making the determination of the middleware master node being offline more comprehensive and objective, and avoiding the phenomenon of pseudo-death of the middleware master node.

[0133] Step 303: receiving registration applications from at least two second slave nodes through the first master node of the high-availability component, wherein the registration application is an application from any second slave node requesting to become a middleware node master node.

[0134] Step 304, through the first master node of the high-availability component, based on the registration application of at least two second slave nodes, a third master node is determined from at least two second slave nodes, wherein the third master node is the latest master node of the middleware node, so as to provide middleware services through the third master node.

[0135] In the embodiment of the present invention, when the high-availability component determines that the master node of the middleware is offline, the proxy services of other slave nodes of the middleware will monitor the high-availability component's offline action on the master node, and initiate an application to register as a master node to the high-availability component, trying to register themselves as the master node. The high-availability component will select the first node that completes the registration process as the master node, write the new master node to the configuration center, and notify the proxy services of other slave nodes to complete the master election.

[0136] As an optional embodiment, the specific process of selecting a master includes, for example:

[0137] Step A2: determining the health status of any second slave node according to the registration application of the second slave node through the first master node.

[0138] Step B2, when the first master node determines that the second slave node is in a healthy state, the first master node queries the preset configuration center through the first master node whether there is a master node registration record of the middleware node, wherein the master node registration record is the record information of the master node registration of other second slave nodes except the second slave node.

[0139] Step C2, when it is determined that the preset configuration center does not have the master node registration record of the middleware node, write the instance identification information of the proxy service of the second slave node into the memory of the available component through the first master node.

[0140] Step D2, if the writing is successful, the master node registration record of the second slave node is written into the preset configuration center, and the registration state corresponding to the master node registration record of the second slave node is marked as the second state. The second state is, for example, a processing state.

[0141] Step E2, modifying the role status of the second slave node in the preset configuration center to a master node status through the first master node, and determining whether the modification is successful.

[0142] Step F2, if the modification is successful, modify the registration state corresponding to the master node registration record of the second slave node from the second state to the first state, so as to determine the second slave node as the third master node. The first state is, for example, a completed state.

[0143] Step G2: Sending registration application success information to the second slave node through the first master node.

[0144] In some embodiments, in the case where the first master node fails to modify the second slave node's role status in the preset configuration center to the master node status, or in the case where the first master node fails to write the instance identification information of the proxy service of the second slave node into the memory of the available component (in the embodiment of the present invention, concurrent lock control can be used to ensure that only one instance identification information of the middleware node in the same middleware cluster is successfully written into the memory to avoid brain split), the first master node sends a registration application failure message to the second slave node. Optionally, if the first master node fails to modify the second slave node's role status in the preset configuration center to the master node status, the master node registration application record of the middleware slave node is deleted from the memory.

[0145] As another optional embodiment, the specific process of selecting a master may be, for example, as follows:

[0146] Step A3: determining the health status of any second slave node according to the registration application of the second slave node through the first master node.

[0147] Step B3, when the first master node determines that the second slave node is in a healthy state, the first master node queries the preset configuration center to see whether there is a master node registration record of the middleware node. The master node registration record is the record information of the master node registration of other second slave nodes except the second slave node.

[0148] Step C3, when it is determined that the preset configuration center has a master node registration record of the middleware node, the registration status corresponding to the master node registration record is determined through the first master node.

[0149] Step D3, when the registration state corresponding to the master node registration record is the second state, determine through the first master node whether the registration processing time of the master node registration record exceeds the preset processing time.

[0150] Step E3: When it is determined that the registration processing time of the master node registration record exceeds the preset processing time, the master node registration record is determined as an invalid record through the first master node.

[0151] Step F3, deleting the invalid record from the preset configuration center through the first master node.

[0152] Step G3, after deleting the invalid record, write the instance identification information of the proxy service of the second slave node into the memory of the available component through the first master node.

[0153] Step H3, if the writing is successful, the master node registration record of the second slave node is written into the preset configuration center, and the registration status corresponding to the master node registration record of the second slave node is marked as the second status.

[0154] Step I3, modifying the role status of the second slave node in the preset configuration center to the master node status through the first master node, and determining whether the modification is successful.

[0155] Step J3: If the modification is successful, the registration state corresponding to the master node registration record of the second slave node is modified from the second state to the first state, so as to determine the second slave node as the third master node.

[0156] Step K3: Sending registration application success information to the second slave node through the first master node.

[0157] In some embodiments, when the registration status corresponding to the master node registration record is the first status (i.e., the other slave nodes have successfully elected a master and become the new middleware master node), or, when the registration status corresponding to the master node registration record is the second status, and it is determined that the registration processing time of the master node registration record does not exceed the preset processing time (i.e., the other slave nodes are currently undergoing the master election process), the first master node sends a registration application failure message to the second slave node.

[0158] In the embodiment of the present invention, the master node of the high-availability component first monitors the status of the middleware slave node that applies to become the master node to confirm the health status of the middleware slave node. Specifically, the master node of the high-availability component can send a health check command three times to any middleware slave node that applies to become the master node. If there is no communication anomaly or failure, it can be confirmed that the middleware slave node is in a healthy state, so that the subsequent master selection process of the middleware slave node can continue.

[0159] In order for those skilled in the art to accurately and completely understand the technical solution of the middleware slave node selection in the embodiment of the present invention, the following will be combined with the attached Figure 4 The process is described in detail. Figure 4 As shown:

[0160] The first step is to forward the registration application of the middleware slave node to the master node of the high-availability component through the proxy service of the middleware slave node;

[0161] In the second step, the master node of the high-availability component determines the health status of any middleware slave node. If it is in an unhealthy state or a faulty state, it is determined that the registration of the middleware slave node has failed and cannot become the middleware master node, and a registration failure is returned; if it is in a healthy state, it proceeds to the third step;

[0162] The third step is to query the master node registration record in the configuration center. Determine whether there is a master node registration record. If there is a master node registration record, continue to determine the registration status of the master node registration record. If the registration status is the completed status (first status), it is determined that other middleware slave nodes have successfully elected a master, and the registration of this middleware slave node has failed, and the master selection process cannot continue; if the registration status is in the processing status (second status), continue to determine whether the registration processing time exceeds the preset processing time (for example, 10 seconds). If it does not exceed, it is determined that other middleware slave nodes are in the process of selecting a master, and the registration of this middleware slave node has failed, and the master selection process cannot continue; and if the preset processing time has been exceeded, proceed to the fourth step, or if there is no master node registration record in the configuration center, proceed to the fourth step;

[0163] The fourth step is to write the instance identification information of the proxy service of the second slave node into the memory of the high-availability component, so as to write the current instance identification information into the map of the currently registered master node, and determine whether the writing is successful. If the writing fails, it means that other middleware slave nodes are in the process of selecting a master, and the registration of the middleware slave node fails, and the master selection process cannot continue, and the registration failure indication information is returned accordingly; if the writing is successful, the fifth step is entered;

[0164] Step 5: Write the master node registration record of the second slave node to the configuration center. Determine whether the writing is successful. If the writing fails, return that the middleware slave node registration failed and cannot continue to select the master process; if the writing is successful, go to step 6;

[0165] Step 6: Change the role status of the second slave node in the preset configuration center to the master node status. That is, update the role of the second slave node in the current instance metadata to the master node, and determine whether the update is successful. If the update fails, the registration of the middleware slave node fails and the master selection process cannot continue; if the update is successful, the middleware slave node is successfully registered as the new master node of the middleware, and enter the seventh step;

[0166] Step 7: Update the registration status of the master node registration record of the second slave node in the configuration center to the completed status (first status), that is, it successfully registers to become the new master node of the middleware.

[0167] As an optional embodiment, the state monitoring indicators of the middleware node can also be obtained through the first master node, and the state monitoring indicators can be visualized to display the state monitoring indicators in a preset display mode. By visualizing the state monitoring indicators, maintenance personnel can clearly view the status of the state monitoring indicators, locate problems in time, and perform efficient maintenance.

[0168] To summarize, the high-availability component is set up independently of the middleware, and each middleware node is deployed with a proxy service. All proxy services are registered in the service instance list of the high-availability component, so that the health status of the middleware can be monitored and managed by the high-availability component independent of the middleware, and the health status monitoring and management of all middleware nodes can be realized. At the same time, at least three component nodes of the high-availability component are used to determine the health status of the middleware's master node (second master node), and the middleware master node is objectively offline to make the middleware master node service more stable. After the middleware master node is objectively offline, only the master node of the high-availability component is used to perform the master node selection operation on the middleware. On the one hand, the efficiency of master node determination can be improved to ensure that the middleware master node can quickly restore the middleware service. On the other hand, it can avoid the phenomenon of middleware node pseudo-death and brain split problems, and reduce the risk of data loss.

[0169] The embodiment of the present invention further provides a computer readable storage medium 600, such as Figure 5 As shown, a computer program is stored in the computer-readable storage medium 600, i.e., a program code 601 for executing each step in the method embodiment of the present invention. When the computer program is executed by the processor, each step of the above-mentioned method for monitoring the status of a middleware node is implemented. For example, when the computer program is executed by the processor, the following steps are implemented:

[0170] Determining, through the at least three component nodes of the high-availability component, that the second master node of the middleware node is in a faulty state;

[0171] When it is determined that the second master node of the middleware node is in a fault state, modifying the service state of the second master node to an offline state;

[0172] Receiving, through the first master node of the high-availability component, registration applications from the at least two second slave nodes, the registration application being an application from any of the second slave nodes requesting to become the master node of the middleware node;

[0173] Through the first master node of the high-availability component, according to the registration application of the at least two second slave nodes, a third master node is determined from the at least two second slave nodes, and the third master node is the latest master node of the middleware node, so as to provide middleware services through the third master node.

[0174] In some embodiments, the computer readable storage medium 600 is further configured to store program code 601 for performing the following steps:

[0175] Determining, through the at least three component nodes of the high-availability component, that the second master node of the middleware node is in a faulty state;

[0176] When it is determined that the second master node of the middleware node is in a fault state, modifying the service state of the second master node to a first state;

[0177] Receiving, through the first master node of the high-availability component, registration applications from the at least two second slave nodes, the registration application being an application from any of the second slave nodes requesting to become the master node of the middleware node;

[0178] Through the first master node of the high-availability component, according to the registration application of the at least two second slave nodes, a third master node is determined from the at least two second slave nodes, and the third master node is the latest master node of the middleware node, so as to provide middleware services through the third master node.

[0179] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. Of course, there are other forms of readable storage media, such as quantum memory, graphene memory, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media does not include electrical carrier signals and telecommunication signals.

[0180] The embodiment of the present invention further provides an electronic device 700, such as Figure 6 As shown, it includes one or more processors 701 , a communication interface 702 , a memory 703 and a communication bus 704 , wherein the processor 701 , the communication interface 702 , and the memory 703 communicate with each other via the communication bus 704 .

[0181] Memory 703, used for storing computer programs;

[0182] The processor 701 is used to implement the steps of the above-mentioned method for monitoring the status of a middleware node when executing the program stored in the memory 703. For example, the processor 701 implements the following steps when executing the program stored in the memory 703:

[0183] Determining, through the at least three component nodes of the high-availability component, that the second master node of the middleware node is in a faulty state;

[0184] When it is determined that the second master node of the middleware node is in a fault state, modifying the service state of the second master node to a first state;

[0185] Receiving, through the first master node of the high-availability component, registration applications from the at least two second slave nodes, the registration application being an application from any of the second slave nodes requesting to become the middleware node master node;

[0186] Through the first master node of the high-availability component, according to the registration application of the at least two second slave nodes, a third master node is determined from the at least two second slave nodes, and the third master node is the latest master node of the middleware node, so as to provide middleware services through the third master node.

[0187] Processor 701 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0188] The memory 703 may include a large capacity memory for data or instructions. For example, but not limitation, the memory 703 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 703 may include a removable or non-removable (or fixed) medium. In a specific embodiment, the memory 703 is a non-volatile solid-state memory. In a specific embodiment, the memory 703 includes a read-only memory (ROM). In appropriate cases, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.

[0189] Communication bus 704 includes hardware, software or both, for coupling the above-mentioned components to each other. For example, the bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industry standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industry standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, the bus may include one or more buses. Although the embodiment of the present invention describes and shows a specific bus, the present invention considers any suitable bus or interconnection.

[0190] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0191] Although the present invention provides method operation steps such as embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the device or client product in practice is executed, it can be executed in the order of the method shown in the embodiments or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).

[0192] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0193] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0194] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0195] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for monitoring the status of a middleware node, characterized in that: The method is applied to a high-availability component, the high-availability component is deployed independently of the middleware node and includes three component nodes, the three component nodes include a first master node and two first slave nodes, the middleware node includes a second master node and at least two second slave nodes, and each of the middleware nodes is deployed with a proxy service, and all the proxy services are registered in a service instance list of the high-availability component, the method includes: Determine a responsible node from the three component nodes using a hash algorithm; Using the responsible node to send a first health check command to the health status of the second master node of the middleware node to obtain a first check result; In the case where the first inspection result is that the second master node is in a faulty state, the first inspection result is recorded in a preset configuration center through the responsible node, and a cooperative inquiry request is sent to the other two component nodes except the responsible node, so as to use the other two component nodes to send a second health check command to the second master node of the middleware node respectively; In the case that any component node other than the responsible node does not receive the response information of the second master node, the component node is used to determine that the second master node is in a faulty state, obtain a third check result, and record it in the preset configuration center, wherein the response information is the return information of the second master node in response to the second health check command; Using the responsible node to send a third health check command to the health status of the second master node, to obtain a first sub-result of the second check result; When the first sub-result is that the second master node is in a fault state, using the responsible node to send a fourth health check command to the health state of the second master node, to obtain a second sub-result of the second check result; When the second sub-result is that the second master node is in a fault state, using the responsible node to obtain the first inspection result and the third inspection result from the preset configuration center; Determine whether the second master node is in a fault state according to the first check result and the third check result; When it is determined that the second master node is in a fault state, modifying the service state of the second master node to an offline state; Receiving, through the first master node of the high-availability component, registration applications from the at least two second slave nodes, the registration application being an application from any of the second slave nodes requesting to become the master node of the middleware node; Through the first master node of the high-availability component, according to the registration application of the at least two second slave nodes, a third master node is determined from the at least two second slave nodes, and the third master node is the latest master node of the middleware node, so as to provide middleware services through the third master node.

2. The method according to claim 1, characterized in that: The determining, through the at least three component nodes of the high-availability component, that the second master node of the middleware node is in a faulty state comprises: A health check command is sent to the proxy service deployed at the second master node of the middleware node through the at least three component nodes of the high-availability component, so that the health check command is sent to the second master node through the proxy service deployed at the second master node using transparent transmission technology.

3. The method according to claim 1, characterized in that: The first master node of the high-availability component determines a third master node from the at least two second slave nodes according to the registration applications of the at least two second slave nodes, including: Determining, by the first master node, a health status of the second slave node according to any registration application of the second slave node; When the first master node determines that the second slave node is in a healthy state, query the preset configuration center through the first master node whether there is a master node registration record of the middleware node, and the master node registration record is the record information of the master node registration of other second slave nodes except the second slave node; When it is determined that the preset configuration center does not have a master node registration record of the middleware node, writing the instance identification information of the proxy service of the second slave node into the memory of the high-availability component through the first master node; If the writing is successful, the master node registration record of the second slave node is written into the preset configuration center, and the registration state corresponding to the master node registration record of the second slave node is marked as the second state; Modify the role status of the second slave node in the preset configuration center to a master node status through the first master node, and determine whether the modification is successful; If the modification is successful, the registration state corresponding to the master node registration record of the second slave node is modified from the second state to the first state, so as to determine the second slave node as the third master node; The registration application success information is sent to the second slave node through the first master node.

4. The method according to claim 1, characterized in that: The method of determining a third master node from the at least two second slave nodes through the first master node of the high availability component according to the registration applications of the at least two second slave nodes further includes: Determining, by the first master node, a health status of the second slave node according to any registration application of the second slave node; When the first master node determines that the second slave node is in a healthy state, query the preset configuration center through the first master node whether there is a master node registration record of the middleware node, and the master node registration record is the record information of the master node registration of other second slave nodes except the second slave node; In the case where it is determined that the preset configuration center has a master node registration record of the middleware node, determining a registration status corresponding to the master node registration record through the first master node; When the registration state corresponding to the master node registration record is the second state, determining, by the first master node, whether the registration processing time of the master node registration record exceeds a preset processing time; In the case where it is determined that the registration processing time of the master node registration record exceeds a preset processing time, determining, through the first master node, that the master node registration record is an invalid record; Deleting the invalid record from the preset configuration center through the first master node; After deleting the failure record, writing the instance identification information of the proxy service of the second slave node into the memory of the high-availability component through the first master node; If the writing is successful, the master node registration record of the second slave node is written into the preset configuration center, and the registration state corresponding to the master node registration record of the second slave node is marked as the second state; Modify the role status of the second slave node in the preset configuration center to a master node status through the first master node, and determine whether the modification is successful; If the modification is successful, the registration state corresponding to the master node registration record of the second slave node is modified from the second state to the first state, so as to determine the second slave node as the third master node; The registration application success information is sent to the second slave node through the first master node.

5. A status monitoring system for a middleware node, characterized in that: The system includes high availability components and middleware nodes; The high-availability component is deployed independently of the middleware node and includes three component nodes, the three component nodes include a first master node and two first slave nodes; the middleware node includes a second master node and at least two second slave nodes, and each of the middleware nodes is deployed with a proxy service, and all the proxy services are registered in the service instance list of the high-availability component; The high availability component is used to: Determine a responsible node from the three component nodes using a hash algorithm; Using the responsible node to send a first health check command to the health status of the second master node of the middleware node to obtain a first check result; In the case where the first inspection result is that the second master node is in a faulty state, the first inspection result is recorded in a preset configuration center through the responsible node, and a cooperative inquiry request is sent to the other two component nodes except the responsible node, so as to use the other two component nodes to send a second health check command to the second master node of the middleware node respectively; In the case that any component node other than the responsible node does not receive the response information of the second master node, the component node is used to determine that the second master node is in a faulty state, obtain a third check result, and record it in the preset configuration center, wherein the response information is the return information of the second master node in response to the second health check command; Using the responsible node to send a third health check command to the health status of the second master node, to obtain a first sub-result of the second check result; When the first sub-result is that the second master node is in a fault state, using the responsible node to send a fourth health check command to the health state of the second master node, to obtain a second sub-result of the second check result; When the second sub-result is that the second master node is in a fault state, using the responsible node to obtain the first inspection result and the third inspection result from the preset configuration center; Determine whether the second master node is in a fault state according to the first check result and the third check result; When it is determined that the second master node is in a fault state, modifying the service state of the second master node to an offline state; Receiving, through the first master node of the high-availability component, registration applications from the at least two second slave nodes, the registration application being an application from any of the second slave nodes requesting to become the master node of the middleware node; Determine, through the first master node of the high-availability component, a third master node from the at least two second slave nodes according to the registration applications of the at least two second slave nodes, the third master node being the latest master node of the middleware node, so as to provide middleware services through the third master node; The middleware node is used to: After the high-availability component determines that the second master node is in a faulty state, sending a registration application to the first master node of the high-availability component through the at least two second slave nodes; When the first master node of the high-availability component determines any one of the second slave nodes as a third master node, middleware services are provided through the second slave node, and the second slave node is the latest master node of the middleware node.

Citation Information

Patent Citations

  • High-availability cluster detection method and system and controlled terminal

    CN110912780A

  • Data migration method, device, system and medium capable of dynamically expanding and shrinking capacity

    CN115118604A