CN116566910A - A method and device for detecting the state of a node itself - Google Patents
A method and device for detecting the state of a node itself Download PDFInfo
- Publication number
- CN116566910A CN116566910A CN202310531989.8A CN202310531989A CN116566910A CN 116566910 A CN116566910 A CN 116566910A CN 202310531989 A CN202310531989 A CN 202310531989A CN 116566910 A CN116566910 A CN 116566910A
- Authority
- CN
- China
- Prior art keywords
- node
- detected
- identification information
- master
- load balancing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/12—Avoiding congestion; Recovering from congestion
- H04L47/125—Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/20—Traffic policing
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Telephonic Communication Services (AREA)
Abstract
Description
技术领域technical field
本申请涉及计算机领域,尤其涉及一种检测节点自身状态的方法及设备。The present application relates to the field of computers, in particular to a method and device for detecting the state of a node itself.
背景技术Background technique
在高可用集群中,往往采用的是主从方式搭建集群,当主节点压力较大或出现问题时,来自客户端的请求被负载均衡切换至从节点。这时从节点变成主节点,之前的主节点问题修复后变成从节点。而该切换本身由负载均衡处理,主从节点并不知道自己处于主身份或是从身份。但是节点中程序有些排他性操作,只能由主节点或者从节点进行操作。这种方式需要增加额外的调度中心,服务开销增大,在主从切换频繁的情况下无法实时更新自身数据,从而调度失误,节点需要知晓自身身份时询问调度中心。In a high-availability cluster, the master-slave method is often used to build the cluster. When the pressure on the master node is high or there is a problem, the request from the client is switched to the slave node by load balancing. At this time, the slave node becomes the master node, and the previous master node becomes the slave node after the problem is fixed. The switch itself is handled by load balancing, and the master-slave node does not know whether it is the master or the slave. However, the program in the node has some exclusive operations, which can only be operated by the master node or the slave node. This method needs to add an additional dispatch center, and the service overhead increases. In the case of frequent master-slave switching, it cannot update its own data in real time, resulting in scheduling errors. When nodes need to know their own identities, they will ask the dispatch center.
发明内容Contents of the invention
本申请的一个目的是提供一种检测节点自身状态的方法及设备,解决现有技术中额外服务开销增大以及在主从切换频繁的情况下无法实时更新自身数据,从而调度失误的问题。One purpose of the present application is to provide a method and device for detecting the status of a node itself, so as to solve the problems in the prior art that the additional service overhead increases and the self-data cannot be updated in real time in the case of frequent master-slave switching, resulting in scheduling errors.
根据本申请的一个方面,提供了一种检测节点自身状态的方法,该方法包括:According to one aspect of the present application, a method for detecting the state of a node itself is provided, the method comprising:
为集群中的每一节点提供对应的数据接口,该数据接口被请求时返回的响应内容为节点本身的唯一标识;Provide a corresponding data interface for each node in the cluster, and the response content returned when the data interface is requested is the unique identifier of the node itself;
待检测节点从负载均衡中获取主节点返回的主节点标识信息;The node to be detected obtains the master node identification information returned by the master node from the load balancer;
将所述主节点标识信息与待检测节点自身的标识信息进行比对,得到比对结果;Comparing the identification information of the master node with the identification information of the node to be detected to obtain a comparison result;
根据比对结果判断所述待检测节点是否为主节点。Whether the node to be detected is the master node is judged according to the comparison result.
可选地,所述方法包括:Optionally, the method includes:
在集群中每一节点启动时为节点生成标识信息,将所述标识信息存储在该节点上。When each node in the cluster starts, identification information is generated for the node, and the identification information is stored on the node.
可选地,待检测节点从负载均衡中获取主节点返回的主节点标识信息之前,包括:Optionally, before the node to be detected obtains the master node identification information returned by the master node from the load balancer, it includes:
判断待检测节点在所述集群中是否需要操作资源,若是,则待检测节点获取自身的标识信息时向负载均衡发送目标请求;Judging whether the node to be detected needs to operate resources in the cluster, if so, sending the target request to the load balancer when the node to be detected obtains its own identification information;
通过所述负载均衡将所述目标请求分配至主节点上以得到主节点返回的主节点标识信息。The target request is distributed to the master node through the load balancing to obtain the master node identification information returned by the master node.
可选地,根据比对结果判断所述待检测节点是否为主节点,包括:Optionally, judging whether the node to be detected is a master node according to the comparison result includes:
若比对结果为获取的主节点标识信息与自身的标识信息一致,则所述待检测节点为主节点,否则为从节点。If the comparison result shows that the obtained identification information of the master node is consistent with its own identification information, the node to be detected is the master node, otherwise it is the slave node.
可选地,判断待检测节点在所述集群中是否需要操作资源,包括:Optionally, determining whether the node to be detected needs operating resources in the cluster includes:
确定负载均衡将用户请求流量分配至的第一主节点;Determine the first master node to which load balancing distributes user request traffic;
判断负载均衡对所述第一主节点发送的健康检查请求是否返回失败,若是,则确定所述待检测节点在所述集群中需要操作资源。Judging whether the health check request sent by the load balancer to the first master node returns a failure, and if so, determining that the node to be checked needs operating resources in the cluster.
可选地,所述方法包括:Optionally, the method includes:
当所述待检测节点确定为主节点时,更新待检测节点自身的数据信息,并接收负载均衡发送的用户流量请求,其中,所述自身的数据信息包括自身的节点状态信息。When the node to be detected is determined to be the master node, update the data information of the node to be detected, and receive the user flow request sent by load balancing, wherein the data information of the node includes its own node status information.
根据本申请又一个方面,还提供了一种检测节点自身状态的设备,所述设备包括:According to still another aspect of the present application, a device for detecting the state of a node itself is also provided, and the device includes:
一个或多个处理器;以及one or more processors; and
存储有计算机可读指令的存储器,所述计算机可读指令在被执行时使所述处理器执行如前述所述方法的操作。A memory storing computer readable instructions which, when executed, cause the processor to perform operations as described above.
根据本申请再一个方面,还提供了一种计算机可读介质,其上存储有计算机可读指令,所述计算机可读指令可被处理器执行以实现如前述所述的方法。According to still another aspect of the present application, there is also provided a computer-readable medium, on which computer-readable instructions are stored, and the computer-readable instructions can be executed by a processor to implement the aforementioned method.
与现有技术相比,本申请通过为集群中的每一节点提供对应的数据接口,该数据接口被请求时返回的响应内容为节点本身的唯一标识;待检测节点从负载均衡中获取主节点返回的主节点标识信息;将所述主节点标识信息与待检测节点自身的标识信息进行比对,得到比对结果;根据比对结果判断所述待检测节点是否为主节点。从而节点可以判断自身为主节点还是从节点,是否被负载均衡分配用户流量,而不需要从调度中心获得自身的身份,保证调度的正常进行,减小服务开销。Compared with the existing technology, this application provides each node in the cluster with a corresponding data interface, and the response content returned when the data interface is requested is the unique identifier of the node itself; the node to be detected obtains the master node from load balancing Returning the identification information of the master node; comparing the identification information of the master node with the identification information of the node to be detected to obtain a comparison result; judging whether the node to be detected is a master node according to the comparison result. In this way, the node can determine whether it is a master node or a slave node, and whether user traffic is distributed by load balancing, without obtaining its own identity from the dispatch center, ensuring normal scheduling and reducing service overhead.
附图说明Description of drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other characteristics, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
图1示出根据本申请的一个方面提供的一种检测节点自身状态的方法流程示意图;FIG. 1 shows a schematic flowchart of a method for detecting the state of a node itself according to an aspect of the present application;
图2示出本申请一实施例中集群中各节点的数据传输的示意图。Fig. 2 shows a schematic diagram of data transmission of each node in the cluster in an embodiment of the present application.
附图中相同或相似的附图标记代表相同或相似的部件。The same or similar reference numerals in the drawings represent the same or similar components.
具体实施方式Detailed ways
下面结合附图对本申请作进一步详细描述。The application will be described in further detail below in conjunction with the accompanying drawings.
在本申请一个典型的配置中,终端、服务网络的设备和可信方均包括一个或多个处理器(例如中央处理器(Central Processing Unit,CPU))、输入/输出接口、网络接口和内存。In a typical configuration of this application, the terminal, the device serving the network, and the trusted party all include one or more processors (such as a central processing unit (Central Processing Unit, CPU)), an input/output interface, a network interface, and a memory .
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RandomAccess Memory,RAM)和/或非易失性内存等形式,如只读存储器(Read Only Memory,ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent memory in computer-readable media, random access memory (Random Access Memory, RAM) and/or non-volatile memory, such as read-only memory (Read Only Memory, ROM) or flash memory (flash RAM). Memory is an example of computer readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(Phase-Change RAM,PRAM)、静态随机存取存储器(Static Random Access Memory,SRAM)、动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、数字多功能光盘(Digital Versatile Disk,DVD)或其他光学存储、磁盒式磁带,磁带磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitorymedia),如调制的数据信号和载波。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (Phase-Change RAM, PRAM), static random access memory (Static Random Access Memory, SRAM), dynamic random access memory (Dynamic Random Access Memory, DRAM), Other types of random access memory (RAM), read-only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), flash memory or other memory technologies, read-only Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disk (DVD) or other optical storage, magnetic tape cassette, tape disk storage or other magnetic storage device or any other non- Transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media excludes non-transitory computer-readable media, such as modulated data signals and carrier waves.
图1示出根据本申请的一个方面提供的一种检测节点自身状态的方法流程示意图,该方法包括:步骤S11~步骤S14,其中,步骤S11,为集群中的每一节点提供对应的数据接口,该数据接口被请求时返回的响应内容为节点本身的唯一标识;步骤S12,待检测节点从负载均衡中获取主节点返回的主节点标识信息;步骤S13,将所述主节点标识信息与待检测节点自身的标识信息进行比对,得到比对结果;步骤S14,根据比对结果判断所述待检测节点是否为主节点。从而节点可以判断自身为主节点还是从节点,是否被负载均衡分配用户流量,而不需要从调度中心获得自身的身份,保证调度的正常进行,减小服务开销。Fig. 1 shows a schematic flowchart of a method for detecting the state of a node itself provided according to one aspect of the present application, the method includes: step S11 to step S14, wherein, step S11 provides a corresponding data interface for each node in the cluster , the response content returned when the data interface is requested is the unique identifier of the node itself; step S12, the node to be detected obtains the master node identification information returned by the master node from the load balance; step S13, combines the master node identification information with the The identification information of the detection node itself is compared to obtain a comparison result; step S14 , judging whether the node to be detected is a master node according to the comparison result. In this way, the node can determine whether it is a master node or a slave node, and whether user traffic is distributed by load balancing, without obtaining its own identity from the dispatch center, ensuring normal scheduling and reducing service overhead.
具体地,在步骤S11中,为集群中的每一节点提供对应的数据接口,该数据接口被请求时返回的响应内容为节点本身的唯一标识;在此,集群为高可用集群,为每一个节点提供一个数据接口,比如图2中示出的示意图,提供http接口(例如命名为/a),该接口返回存储在该节点上,如节点A的http接口为/a,则接口/a返回存储在节点A上,节点B的http接口为/b,该接口返回存储在节点B上;从而利用提供的接口使得节点可以自身更新接收到的数据。http接口被请求时响应为节点自身生成的标识信息,即返回uuid,将uuid存储在本节点上,如节点A的http接口返回节点A的uuid,该uuid存储在节点A上。Specifically, in step S11, a corresponding data interface is provided for each node in the cluster, and the response content returned when the data interface is requested is the unique identifier of the node itself; here, the cluster is a high-availability cluster, and each A node provides a data interface, such as the schematic diagram shown in Figure 2, providing an http interface (named /a for example), which returns the data stored on the node. For example, the http interface of node A is /a, and the interface /a returns It is stored on node A, and the http interface of node B is /b, which returns and is stored on node B; thus, using the interface provided, the node can update the received data by itself. When the http interface is requested, the response is the identification information generated by the node itself, that is, the uuid is returned, and the uuid is stored on the node. For example, the http interface of node A returns the uuid of node A, and the uuid is stored on node A.
具体地,在步骤S12中,待检测节点从负载均衡中获取主节点返回的主节点标识信息;在此,待检测节点为集群中需要检测自身状态是否为主节点的节点,该待检测节点从负载均衡那获取主节点返回的主节点标识信息,这里的主节点为负载均衡已确定的将用户流量分配至的节点,比如负载均衡那确定的主节点为节点XX,待检测节点为节点2,则节点2获取到节点XX的标识信息。Specifically, in step S12, the node to be detected obtains the master node identification information returned by the master node from the load balancer; here, the node to be detected is a node in the cluster that needs to detect whether its own state is the master node, and the node to be detected is obtained from Load balancing obtains the primary node identification information returned by the primary node. The primary node here is the node that load balancing has determined to distribute user traffic to. For example, the primary node determined by load balancing is node XX, and the node to be detected is node 2. Then node 2 obtains the identification information of node XX.
具体地,在步骤S13中,将所述主节点标识信息与待检测节点自身的标识信息进行比对,得到比对结果;随后,在步骤S14中,根据比对结果判断所述待检测节点是否为主节点。在此,将获取的节点X的标识信息与节点2自身的标识信息进行比对,进而根据比对结果判断节点2的自身身份,自身状态是否为主节点,比如负载均衡的IP是192.168.0.5,则192.168.0.5/a的返回结果就是主节点的UUID,负载均衡会把请求分配到主节点上,如果是从节点发送的192.168.0.5/a,则获取的主节点的UUID和自身UUID不一致。通过请求经由负载均衡的接口返回的UUID与自身生成的UUID对比,无需再向调度中心发送获取自身身份的请求并接收调度中心发送的自身身份的数据,减小服务开销。Specifically, in step S13, the identification information of the master node is compared with the identification information of the node to be detected to obtain the comparison result; then, in step S14, it is judged whether the node to be detected is as the master node. Here, compare the obtained identification information of node X with the identification information of node 2 itself, and then judge the identity of node 2 and whether its own status is the master node according to the comparison result. For example, the IP of the load balancer is 192.168.0.5 , then the returned result of 192.168.0.5/a is the UUID of the master node, and load balancing will distribute the request to the master node. If 192.168.0.5/a is sent from the slave node, the obtained UUID of the master node is inconsistent with its own UUID . By comparing the UUID returned by the request through the load balancing interface with the UUID generated by itself, it is no longer necessary to send a request to the dispatch center to obtain its own identity and receive the data of its own identity sent by the dispatch center, reducing service overhead.
在本申请一实施例中,在集群中每一节点启动时为节点生成标识信息,将所述标识信息存储在该节点上。在此,在集群中每一节点启动时自身都生成一个唯一字符串作为本节点在集群中的标识,该字符串存储在本节点上,如图2中的,节点1称为uuid1,节点2称为uuid2,在具体实施例中比如uuid1的字符串可以为:322923be20d34c73aee7091e3bdfbdd1。将字符串存储在本节点上,从而后续进行比对时直接从本节点存储的信息中获取自身的标识信息。In an embodiment of the present application, when each node in the cluster is started, identification information is generated for the node, and the identification information is stored on the node. Here, each node in the cluster generates a unique string as its identifier in the cluster when it starts, and the string is stored on the node. As shown in Figure 2, node 1 is called uuid1 and node 2 It is called uuid2. In a specific embodiment, the string of uuid1 may be: 322923be20d34c73aee7091e3bdfbdd1. The character string is stored on this node, so that the identification information of itself can be obtained directly from the information stored on this node when subsequent comparison is performed.
在本申请一实施例中,判断待检测节点在所述集群中是否需要操作资源,若是,则待检测节点获取自身的标识信息时向负载均衡发送目标请求;通过所述负载均衡将所述目标请求分配至主节点上以得到主节点返回的主节点标识信息。在此,节点需要操作资源时是指该节点被负载均衡分配用户流量需要对用户流量进行资源处理,当节点需要操作资源时,需要判断自身是否为主节点,因有些资源操作只能是主节点操作,比如用户输入的资源。此时获取自身的标识信息,并向负载均衡发送目标请求,目标请求为负载均衡分配的用户流量请求,通过负载均衡分配用户流量请求确定主节点,从而获取到主节点的标识信息,将主节点的标识信息返回给待检测节点;比如在图2中需要操作资源的节点为节点2,则需要操作资源的节点2将请求获取的uuid(比如为uuid1),将uuid1与自身的uuid2进行比较。In an embodiment of the present application, it is judged whether the node to be detected needs to operate resources in the cluster, and if so, the node to be detected sends a target request to the load balancer when obtaining its own identification information; Request to be assigned to the master node to obtain the master node identification information returned by the master node. Here, when a node needs to operate resources, it means that the node is load-balanced to distribute user traffic and needs to perform resource processing on user traffic. When a node needs to operate resources, it needs to determine whether it is the master node, because some resource operations can only be the master node Actions, such as resources entered by the user. At this time, obtain its own identification information and send a target request to the load balancer. The target request is the user traffic request allocated by the load balancer. The user traffic request is allocated through the load balancer to determine the master node, thereby obtaining the identity information of the master node, and the master node The identification information of the node is returned to the node to be detected; for example, in Figure 2, the node that needs to operate the resource is node 2, then the node 2 that needs to operate the resource will request the obtained uuid (for example, uuid1), and compare uuid1 with its own uuid2.
接上述实施例,确定负载均衡将用户请求流量分配至的第一主节点;判断负载均衡对所述第一主节点发送的健康检查请求是否返回失败,若是,则确定所述待检测节点在所述集群中需要操作资源。在此,用户流量请求先达到负载均衡,通过负载均衡被分配至集群中的某一节点上,比如在待检测节点检测自身状态前,负载均衡分配的主节点为节点1,则节点1为第一主节点,当用户流量请求并发过高时,节点1响应缓慢,负载均衡会每隔一段时间对各个节点发送健康检查请求以检查各节点是否可使用,当节点1响应缓慢时,健康检查失败,此时负载均衡会将用户流量请求分配至其他节点,则待检测节点可以需要操作资源,即负载均衡可能会将节点1切换至待检测节点进行处理用户流量请求,节点2会进行排他资源操作。Following the above embodiment, determine the first master node to which the load balancer distributes user request traffic; determine whether the health check request sent by the load balancer to the first master node returns a failure, and if so, determine that the node to be detected is in the Operational resources are required in the cluster described above. Here, user traffic requests first reach load balancing, and are distributed to a node in the cluster through load balancing. For example, before the node to be detected detects its own state, the master node assigned by load balancing is node 1, and node 1 is the second node. One master node, when user traffic requests are too concurrent, node 1 responds slowly, load balancing will send health check requests to each node at regular intervals to check whether each node is available, when node 1 responds slowly, the health check fails , at this time, the load balancer will distribute user traffic requests to other nodes, and the node to be detected may need to operate resources, that is, the load balancer may switch node 1 to the node to be detected to process user traffic requests, and node 2 will perform exclusive resource operations .
在本申请一实施例中,在步骤S14中,若比对结果为获取的主节点标识信息与自身的标识信息一致,则所述待检测节点为主节点,否则为从节点。在此,如果从负载均衡获得的主节点标识信息与自身存储的标识信息相同,则待检测节点为主节点,如果不同则待检测节点为从节点,比如节点2进行比对uuid时,若一致则节点2为主节点,否则为从节点。In an embodiment of the present application, in step S14, if the comparison result shows that the obtained identification information of the master node is consistent with its own identification information, the node to be detected is the master node, otherwise it is the slave node. Here, if the identity information of the master node obtained from load balancing is the same as the identity information stored by itself, the node to be detected is the master node. If it is different, the node to be detected is the slave node. For example, when node 2 compares uuid, if Then node 2 is the master node, otherwise it is the slave node.
接上述实施例,当所述待检测节点确定为主节点时,更新待检测节点自身的数据信息,并接收负载均衡发送的用户流量请求,其中,所述自身的数据信息包括自身的节点状态信息。在此,当节点检测出自身状态为主节点时,需要更新自身的数据信息,即更新自身的节点状态信息,更新为主节点状态,也包括更新自身接收用户流量请求进行处理的配置信息。并将接收负载均衡分配来的用户流量请求,以对用户流量请求进行处理。Following the above embodiment, when the node to be detected is determined to be the master node, update the data information of the node to be detected itself, and receive the user traffic request sent by load balancing, wherein the data information of the node itself includes its own node status information . Here, when a node detects that its own status is a master node, it needs to update its own data information, that is, update its own node status information, update its master node status, and also update its own configuration information for receiving user traffic requests for processing. And it will receive the user traffic requests assigned by the load balancer to process the user traffic requests.
此外,本申请实施例还提供了一种计算机可读介质,其上存储有计算机可读指令,所述计算机可读指令可被处理器执行以实现前述一种检测节点自身状态的方法。In addition, an embodiment of the present application further provides a computer-readable medium, on which computer-readable instructions are stored, and the computer-readable instructions can be executed by a processor to implement the aforementioned method for detecting the state of a node itself.
与上文所述的方法相对应的,本申请还提供一种终端,其包括能够执行上述图1或图2或各个实施例所述的方法步骤的模块或单元,这些模块或单元可以通过硬件、软件或软硬结合的方式来实现,本申请并不限定。例如,在本申请一实施例中,还提供了一种检测节点自身状态的设备,所述设备包括:Corresponding to the method described above, the present application also provides a terminal, which includes modules or units capable of performing the method steps described above in FIG. 1 or FIG. 2 or in various embodiments. These modules or units can , software, or a combination of hardware and software, which is not limited in this application. For example, in an embodiment of the present application, a device for detecting the state of a node itself is also provided, and the device includes:
一个或多个处理器;以及one or more processors; and
存储有计算机可读指令的存储器,所述计算机可读指令在被执行时使所述处理器执行如前述所述方法的操作。A memory storing computer readable instructions which, when executed, cause the processor to perform operations as described above.
例如,计算机可读指令在被执行时使所述一个或多个处理器:For example, computer readable instructions, when executed, cause the one or more processors to:
为集群中的每一节点提供对应的数据接口,该数据接口被请求时返回的响应内容为节点本身的唯一标识;Provide a corresponding data interface for each node in the cluster, and the response content returned when the data interface is requested is the unique identifier of the node itself;
待检测节点从负载均衡中获取主节点返回的主节点标识信息;The node to be detected obtains the master node identification information returned by the master node from the load balancer;
将所述主节点标识信息与待检测节点自身的标识信息进行比对,得到比对结果;Comparing the identification information of the master node with the identification information of the node to be detected to obtain a comparison result;
根据比对结果判断所述待检测节点是否为主节点。Whether the node to be detected is the master node is judged according to the comparison result.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the application without departing from the spirit and scope of the application. In this way, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.
需要注意的是,本申请可在软件和/或软件与硬件的组合体中被实施,例如,可采用专用集成电路(ASIC)、通用目的计算机或任何其他类似硬件设备来实现。在一个实施例中,本申请的软件程序可以通过处理器执行以实现上文所述步骤或功能。同样地,本申请的软件程序(包括相关的数据结构)可以被存储到计算机可读记录介质中,例如,RAM存储器,磁或光驱动器或软磁盘及类似设备。另外,本申请的一些步骤或功能可采用硬件来实现,例如,作为与处理器配合从而执行各个步骤或功能的电路。It should be noted that the present application can be implemented in software and/or a combination of software and hardware, for example, it can be implemented by using an application specific integrated circuit (ASIC), a general-purpose computer or any other similar hardware devices. In one embodiment, the software program of the present application can be executed by a processor to realize the steps or functions described above. Likewise, the software program (including associated data structures) of the present application can be stored in a computer-readable recording medium such as RAM memory, magnetic or optical drive or floppy disk and the like. In addition, some steps or functions of the present application may be implemented by hardware, for example, as a circuit that cooperates with a processor to execute each step or function.
另外,本申请的一部分可被应用为计算机程序产品,例如计算机程序指令,当其被计算机执行时,通过该计算机的操作,可以调用或提供根据本申请的方法和/或技术方案。而调用本申请的方法的程序指令,可能被存储在固定的或可移动的记录介质中,和/或通过广播或其他信号承载媒体中的数据流而被传输,和/或被存储在根据所述程序指令运行的计算机设备的工作存储器中。在此,根据本申请的一个实施例包括一个装置,该装置包括用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被该处理器执行时,触发该装置运行基于前述根据本申请的多个实施例的方法和/或技术方案。In addition, a part of the present application can be applied as a computer program product, such as a computer program instruction. When it is executed by a computer, the method and/or technical solution according to the present application can be invoked or provided through the operation of the computer. The program instructions for invoking the method of the present application may be stored in a fixed or removable recording medium, and/or transmitted through a data stream in a broadcast or other signal-carrying medium, and/or stored in a in the working memory of the computer device on which the program instructions described above are executed. Here, an embodiment according to the present application includes an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, triggering The operation of the device is based on the foregoing methods and/or technical solutions according to multiple embodiments of the present application.
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above, but that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be regarded as exemplary and not restrictive in all points of view, and the scope of the application is defined by the appended claims rather than the foregoing description, and it is intended that the scope of the present application be defined by the appended claims rather than by the foregoing description. All changes within the meaning and range of equivalents of the elements are embraced in this application. Any reference sign in a claim should not be construed as limiting the claim concerned. In addition, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. The words first, second, etc. are used to denote names and do not imply any particular order.
Claims (8)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310531989.8A CN116566910A (en) | 2023-05-11 | 2023-05-11 | A method and device for detecting the state of a node itself |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310531989.8A CN116566910A (en) | 2023-05-11 | 2023-05-11 | A method and device for detecting the state of a node itself |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116566910A true CN116566910A (en) | 2023-08-08 |
Family
ID=87485680
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310531989.8A Pending CN116566910A (en) | 2023-05-11 | 2023-05-11 | A method and device for detecting the state of a node itself |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116566910A (en) |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130007505A1 (en) * | 2011-06-30 | 2013-01-03 | Spear Thomas D | Automatically Performing Failover Operations With A Load Balancer |
| CN106911728A (en) * | 2015-12-22 | 2017-06-30 | 华为技术服务有限公司 | The choosing method and device of host node in distributed system |
| CN108964948A (en) * | 2017-05-19 | 2018-12-07 | 北京金山云网络技术有限公司 | Principal and subordinate's service system, host node fault recovery method and device |
| CN109639794A (en) * | 2018-12-10 | 2019-04-16 | 杭州数梦工场科技有限公司 | A kind of stateful cluster recovery method, apparatus, equipment and readable storage medium storing program for executing |
-
2023
- 2023-05-11 CN CN202310531989.8A patent/CN116566910A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20130007505A1 (en) * | 2011-06-30 | 2013-01-03 | Spear Thomas D | Automatically Performing Failover Operations With A Load Balancer |
| CN106911728A (en) * | 2015-12-22 | 2017-06-30 | 华为技术服务有限公司 | The choosing method and device of host node in distributed system |
| CN108964948A (en) * | 2017-05-19 | 2018-12-07 | 北京金山云网络技术有限公司 | Principal and subordinate's service system, host node fault recovery method and device |
| CN109639794A (en) * | 2018-12-10 | 2019-04-16 | 杭州数梦工场科技有限公司 | A kind of stateful cluster recovery method, apparatus, equipment and readable storage medium storing program for executing |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11159411B2 (en) | Distributed testing service | |
| US9723110B2 (en) | System and method for supporting a proxy model for across-domain messaging in a transactional middleware machine environment | |
| US11018944B2 (en) | Method and apparatus for virtualized network function scaling that is initiated by network management and/or element management | |
| CN113259479B (en) | Data processing method and equipment | |
| US8874739B2 (en) | Selectively monitoring a service endpoint of an information technology system | |
| CN105893133A (en) | Application service seamless migration method and system based on container technology | |
| CN115516840A (en) | Information processing method, device, system, medium, chip and program | |
| CN114172966A (en) | Service calling method and device and service processing method and device under unitized architecture | |
| CN112612595A (en) | Method and device for establishing micro-service calling relationship, computer equipment and storage medium | |
| CN114089917A (en) | Distributed object storage cluster, capacity expansion method and device thereof, and electronic equipment | |
| CN104503768B (en) | A kind of application programming interface call method and equipment | |
| CN109104368B (en) | A method, device, server and computer-readable storage medium for requesting connection | |
| WO2023165226A1 (en) | Application resource backup method and apparatus, electronic device, and storage medium | |
| CN111385255B (en) | Asynchronous call implementation method, device, server and server cluster | |
| CN111831402B (en) | Method, apparatus and computer program product for managing software functions | |
| US10402252B1 (en) | Alternative event reporting for peripheral devices | |
| CN108600008A (en) | Server management method, server management device and distributed system | |
| CN111865896A (en) | Cloud system and cloud service consumption method | |
| CN112738181B (en) | Method, device and server for cluster external IP access | |
| CN115687294A (en) | Database deployment method, domain name resolution method and related device | |
| CN115174649A (en) | Cross-machine-room RPC calling method, device and medium | |
| US11307912B1 (en) | Forward message compatibility safety in producer-consumer systems | |
| CN116566910A (en) | A method and device for detecting the state of a node itself | |
| CN119814786A (en) | Edge node access method, device, equipment and medium | |
| US20210133043A1 (en) | System and method for resilient data protection |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information |
Country or region after: China Address after: Room 502A, dinglou, 555 Dongchuan Road, Minhang District, Shanghai, 200241 Applicant after: Shanghai Yunzhou Technology Co.,Ltd. Address before: Room 502A, dinglou, 555 Dongchuan Road, Minhang District, Shanghai, 200241 Applicant before: SHANGHAI YUNZHOU INFORMATION TECHNOLOGY CO.,LTD. Country or region before: China |
|
| CB02 | Change of applicant information |