CN113660339A - Method and apparatus for decentralized clustering - Google Patents

Method and apparatus for decentralized clustering Download PDF

Info

Publication number
CN113660339A
CN113660339A CN202110949191.6A CN202110949191A CN113660339A CN 113660339 A CN113660339 A CN 113660339A CN 202110949191 A CN202110949191 A CN 202110949191A CN 113660339 A CN113660339 A CN 113660339A
Authority
CN
China
Prior art keywords
node
cluster
service
response
access
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.)
Granted
Application number
CN202110949191.6A
Other languages
Chinese (zh)
Other versions
CN113660339B (en
Inventor
钟原
马飞
郝郁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110949191.6A priority Critical patent/CN113660339B/en
Publication of CN113660339A publication Critical patent/CN113660339A/en
Application granted granted Critical
Publication of CN113660339B publication Critical patent/CN113660339B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • H04L67/1046Joining mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Hardware Redundancy (AREA)

Abstract

A method and a device for decentralized clustering are provided, which relate to the technical field of computers, in particular to the technical field of cluster deployment. The implementation scheme is as follows: receiving, through a port of a cluster service, an access of at least one node, each of the at least one node configured to perform an operation of joining a cluster based on the access; and in response to determining that the operation of a first node of the at least one node is successful, mounting an access interface of the first node to a backend of the cluster service to map a port of the cluster service to a port of the access interface of the first node, wherein the access interface is configured to join a second node to a first cluster containing the first node based on an operation of a second node of the at least one node that is distinct from the first node.

Description

Method and apparatus for decentralized clustering
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to the field of cluster deployment technologies, and in particular, to a method and an apparatus for decentralized clustering, an electronic device, a computer-readable storage medium, and a computer program product.
Background
In the initial starting process of the cluster, the decentralized cluster is often started through the seed node, and subsequent nodes to be added are added into the cluster through the started seed node based on the starting of the seed node.
The approaches described in this section are not necessarily approaches that have been previously conceived or pursued. Unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section. Similarly, unless otherwise indicated, the problems mentioned in this section should not be considered as having been acknowledged in any prior art.
Disclosure of Invention
The present disclosure provides a method, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product for decentralized clustering.
According to an aspect of the present disclosure, there is provided a method for decentralized clustering, comprising: receiving, through a port of a cluster service, an access of at least one node, each of the at least one node configured to perform an operation of joining a cluster based on the access; and in response to determining that the operation of a first node of the at least one node is successful, mount an access interface of the first node to a backend of the cluster service to map a port of the cluster service to a port of an access interface of the first node, wherein the access interface is configured to cause a second node of the at least one node, distinct from the first node, to join a first cluster including the first node based on the operation of the second node.
According to another aspect of the present disclosure, there is provided an apparatus for decentralized clustering, comprising: a receiving unit configured to receive an access of at least one node through a port of a cluster service, each of the at least one node configured to perform an operation of joining a cluster based on the access; and in response to determining that the operation of a first node of the at least one node is successful, mounting an access interface of the first node to a backend of the cluster service to map a port of the cluster service to a port of an access interface of the first node, wherein the access interface is configured to join a second node of the at least one node to a first cluster including the first node based on the operation of the second node, the second node being distinct from the first node.
According to another aspect of the present disclosure, there is provided an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to implement a method according to the above.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to implement the method according to the above.
According to another aspect of the present disclosure, an electronic device, a computer program product, comprising a computer program, wherein the computer program realizes the method according to the above when executed by a processor.
According to one or more embodiments of the present disclosure, a port of a cluster service is accessed, and the port of the cluster service is mapped to a port of an access interface of a first node that successfully joins a cluster by accessing the cluster service, so that other nodes that subsequently perform operations of joining a cluster by accessing the cluster service can access the port of the access interface of the first node to which the port of the cluster service is mapped when accessing the cluster service. The access interface of the first node is configured to perform cluster joining operation based on the cluster service accessed by other nodes, so that the other nodes join the first cluster which the first node has joined; thus, other nodes subsequently accessing the port of the access interface to the first node by accessing the cluster service can join the first cluster.
The first node is not limited to be a seed node or a service node distinct from the seed node, and therefore the first cluster is a decentralized cluster, and during the startup of the decentralized cluster, a newly joined node does not need to join the cluster through the access interface of the seed node. In the cluster comprising a plurality of nodes, when the seed node fails, the cluster can still be added through any other started node in the cluster, and the problem of split brain possibly caused by restarting the seed node is effectively avoided.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the embodiments and, together with the description, serve to explain the exemplary implementations of the embodiments. The illustrated embodiments are for purposes of illustration only and do not limit the scope of the claims. Throughout the drawings, identical reference numbers designate similar, but not necessarily identical, elements.
FIG. 1 illustrates a flow diagram of a method for decentralized clustering, according to some embodiments of the present disclosure;
FIG. 2 shows a flow diagram of a process of receiving access of at least one node through a port of a cluster service in the method for decentralized clustering according to FIG. 1;
FIG. 3 illustrates a flow chart of a process for making a second connection of a business node with a cluster service in response to determining that the operation corresponding to the first access failed in a method for decentralized clustering according to some embodiments of the present disclosure;
FIG. 4 illustrates a flow diagram of a process for establishing a first cluster by a seed node in a method for decentralized clustering according to some embodiments of the present disclosure;
FIG. 5 illustrates a flow diagram of a process for receiving a first node joining a first cluster through an access interface of a seed node in a method for decentralized clustering in accordance with some embodiments of the present disclosure;
FIG. 6 illustrates a flow diagram of a process in a method for decentralized clustering according to some embodiments of the present disclosure for receiving a second node joining a first cluster through an access interface of each of a plurality of nodes in the first cluster;
FIG. 7 illustrates a flow diagram of a process for mounting an access interface of a first node to a backend of a cluster service in response to determining that the first node successfully joined the cluster in a method for decentralized clustering according to some embodiments of the present disclosure;
FIG. 8 illustrates a flow chart of a process for sequentially launching a seed node and each of at least one replica in a method for decentralized clustering according to some embodiments of the present disclosure;
FIG. 9 illustrates a block diagram of an apparatus for decentralized clustering, according to the present disclosure; and
FIG. 10 illustrates a block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, the timing relationship, or the importance relationship of the elements, and such terms are used only to distinguish one element from another. In some examples, a first element and a second element may refer to the same instance of the element, and in some cases, based on the context, they may also refer to different instances.
The terminology used in the description of the various described examples in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the elements may be one or more. Furthermore, the term "and/or" as used in this disclosure is intended to encompass any and all possible combinations of the listed items.
Embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
In the related art, after the decentralized cluster is started, the configuration is manually modified, so that the subsequently joined nodes join the cluster by accessing other normal joining points in the cluster. However, in the cluster deployed based on K8s (fully known as kubernets), the container arrangement system automatically deploys, expands, contracts and manages the containerized application, and the nodes are added into the cluster by manually modifying the configuration, so that the adding process of the nodes is complicated.
One aspect of the present disclosure provides a method for decentralized clustering.
Referring to fig. 1, a method 100 for decentralized clustering according to some embodiments of the present disclosure includes:
step S110: receiving, through a port of a cluster service, an access of at least one node, each of the at least one node configured to perform an operation of joining a cluster based on the access; and
step S120: in response to determining that the operation of a first node of the at least one node is successful, mount an access interface of the first node to a backend of the cluster service to map a port of the cluster service to a port of the access interface of the first node.
Wherein the access interface is configured to cause a second node of the at least one node, distinct from the first node, to join a first cluster containing the first node based on the operation of the second node.
According to one or more embodiments of the present disclosure, a port of a cluster service is accessed, and the port of the cluster service is mapped to a port of an access interface of a first node that successfully joins a cluster by accessing the cluster service, so that other nodes that subsequently perform operations of joining a cluster by accessing the cluster service can access the port of the access interface of the first node to which the port of the cluster service is mapped when accessing the cluster service. The access interface of the first node is configured to perform cluster joining operation based on the cluster service accessed by other nodes, so that the other nodes join the first cluster which the first node has joined; thus, other nodes subsequently accessing the port of the access interface to the first node by accessing the cluster service can join the first cluster.
The first node is not limited to be a seed node or a service node distinct from the seed node, and therefore the first cluster is a decentralized cluster, and during the startup of the decentralized cluster, a newly joined node does not need to join the cluster through the access interface of the seed node. In the cluster comprising a plurality of nodes, when the seed node fails, the cluster can still be added through any other started node in the cluster, and the problem of split brain possibly caused by restarting the seed node is effectively avoided.
It should be noted that the term "seed node" in this disclosure refers to a node that is the first node when a cluster is established, and a "service node" includes any node that is used to implement a service discovery function, such as a data node, a client node, and a machine learning node; at the same time, "seed node" and "service node"
The method can be used in K8 s-based clusters, and is matched with a container arrangement system to automatically deploy, expand, contract and manage containerized applications, and the nodes are added into the clusters without manually controlling the starting sequence of the nodes in the clusters.
According to some embodiments, in step S110, a cluster service (cluster service) is created in K8S, and its cluster ip (cluster ip) serves as an entry for each of the at least one node to join the cluster. According to some embodiments, the cluster IP (cluster IP) is a virtual IP. According to some embodiments, each of the at least one node joins the cluster by accessing the cluster ip (cluster ip).
According to some embodiments, in step S120, after the joining node of the first node of the at least one node succeeds in operation, the load-in interface of the first node is mounted to the back end of the cluster service, so that the cluster ip (cluster ip) of the cluster service is mapped to a port of the access interface of the first node. According to some embodiments, the access interface of each of the at least one node is configured as a Remote Procedure Call (RPC) interface, and may receive a join request requesting a node joining the cluster, and receive the node joining the cluster to join the cluster.
In some embodiments, through a uniformly designed development kit (SDK), each node in the at least one node is enabled to join the cluster by accessing the cluster ip (cluster ip); and an access interface implementing each of the at least one node is configured as a Remote Procedure Call (RPC) interface to receive a join request from a node requesting to join the cluster and to cause it to join the cluster.
In some embodiments, it is further implemented through a uniformly designed development kit that at least one node, after joining a cluster, implements a relevant protocol through heartbeat and broadcast, and completes the functions of node information synchronization and service discovery in the cluster.
In the method according to the present disclosure, the deployment process of the cluster is implemented by a uniformly designed development kit (SDK), so that in the deployment of the cluster, once the seed node, which is the initial (first) starting point of cluster startup, is started first, its specificity is lost. The seed node is not required to always bear the special function of the entrance of the node added into the group, and the seed node is not required to have additional function. That is, the seed node only needs to integrate a development kit (SDK) and provide an access interface with the above-described interface configured as a Remote Procedure Call (RPC). After cluster startup, even if the seed node fails, for other started nodes within the cluster, due to the access interface configured as a Remote Procedure Call (RPC) interface as described above, a join request of a node requesting to join the cluster can be accepted, and the node is received to join the cluster. The method further optimizes the automation attributes of the deployment, management and maintenance processes of the K8 s-based cluster, and improves the efficiency of cluster deployment and management.
In some embodiments, the at least one node includes a service node, and as shown in fig. 2, the step S110 of receiving access of the at least one node through a port of the cluster service includes:
step S210: responding to a request for starting service of the service node, and enabling the service node to be in first connection with the cluster service so as to access a port of the cluster service for the first time; and
step S220: and in response to determining that the operation corresponding to the first access fails, making a second connection between the service node and the cluster service to make a second access to a port of the cluster service.
Since the cluster is in the process of deployment, the seed node is required to be used as the initial (first) node to establish the cluster. When the cluster is not established, when the operation that the service node accesses the port of the cluster service to join the cluster fails, the service node repeatedly accesses the port of the cluster service. In the process, the service node continuously executes the operation of joining the cluster through the port which can be continuously and repeatedly accessed, once the cluster is established, the service node can join the cluster through accessing the port of the cluster service, and the automatic joining of the service node through the cluster service is realized. And the service node waits for the seed node to establish the cluster through continuously accessing the port of the cluster service. In the process, the starting sequence of the nodes in the cluster does not need to be set, the deployment and the service discovery of the cluster can be realized through the automatic waiting and joining process based on the attributes of the nodes, and the automatic attributes of the deployment, management and maintenance process of the cluster based on K8s are further improved.
In some embodiments, the client makes a service request through a load balancer, the load balancer sends a request to start service based on the received service request of the client by forwarding the request to a service node to make a first connection with the cluster service.
In some embodiments, as shown in fig. 3, the step S220, in response to determining that the operation corresponding to the first access fails, making the second connection between the service node and the cluster service includes:
step S310: in response to determining that the operation corresponding to the first access failed, obtaining a first point in time; and
step S320: and responding to the fact that the time interval between the current time point and the first time point is smaller than a preset value, and enabling the service node to carry out the second connection.
When the cluster is not established, when the operation that the service node accesses the port of the cluster service to join the cluster fails, the service node is repeatedly connected with the cluster service within a preset time period to repeatedly access the port of the cluster service, so that continuous reconnection and resource occupation are avoided.
In some embodiments, the step S220, in response to determining that the operation corresponding to the first access fails, making the second connection between the service node and the cluster service further includes:
and in response to that the time interval from the current time point to the first time point is greater than or equal to a preset value, the service node is enabled to resend the service starting request.
When the cluster is not established, when the operation that the service node accesses the port of the cluster service to join the cluster fails, and the time period for the service node to repeatedly connect the cluster service exceeds the preset value, the service node still does not join the cluster, the service starting of the service node fails. After the cluster is started, the service node sends a request for starting the service again, so that the service node accesses the port of the cluster service again to join the cluster, and finally the service starting of the service node is realized.
In some embodiments, the service state of the service node is detected by the container probe, and when the service state of the service node is detected to be abnormal, the service node is caused to resend the request for starting the service.
In some embodiments, the service node is finally enabled by continuously repeating the steps S310 and S320 and the above-mentioned process of causing the service node to resend the request for service initiation.
The following is an exemplary description of the process of establishing a cluster based on a seed node as an initial (first) node in the method according to the present disclosure.
In some embodiments, the at least one node comprises a seed node, and as shown in fig. 4, the method 100 further comprises:
step S410: in response to determining that the operation of the seed node failed, establishing the first cluster, the first cluster including the seed node; and
step S420: determining that the operation of the seed node is successful in response to establishment of the first cluster.
When the cluster is not established, the initial (first) node of the cluster start is served as the seed node to establish the cluster. After the cluster service is accessed through the seed node, when the operation that the seed node joins the cluster fails, which indicates that the cluster is not started currently, the seed node is used as a first node to establish a first cluster containing the seed node. Based on the establishment of the first cluster, determining that the seed node joins the first cluster, that is, the operation of joining the seed node into the cluster is successful, and mapping the port of the cluster service to be the access interface of the seed node, so that the node which subsequently accesses the port of the cluster service to perform the operation of joining the cluster can access the port of the access interface of the seed node to join the cluster. When the access interface of the seed node receives a join request of a node which performs an operation of joining a cluster by accessing a port of the cluster service, the node is received to join the cluster.
In the process, the initial establishment of the cluster is realized, the starting sequence of the nodes does not need to be manually set, the initial establishment of the cluster can be realized through the automatic access of the seed nodes, and the automatic starting of the cluster is realized.
The following is an exemplary description of a process in which after a cluster is established based on a seed node as an initial (first) node, other nodes (including a service node and a seed node) join the cluster according to the method of the present disclosure.
In some embodiments, as shown in fig. 5, the method 100 further comprises:
step S510: enabling the first cluster to comprise the first node based on an access interface of the seed node receiving a join request corresponding to the operation of the first node; and
step S520: determining that the operation of the first node is successful in response to the first cluster including the first node.
After the seed node establishes the first cluster, a joining request of a first node in the at least one node is received through an interface of the seed node, and the first node is admitted to join the first cluster. Because the first cluster comprises the first node, the success of the operation of joining the cluster of the first node is determined, so that the access interface of the first node can be mounted to the back end of the cluster service, and the port of the cluster service is mapped to the port of the access interface of the first node. Thus, a node subsequently accessing a port of the cluster service may access a port of the access interface to the first node by accessing a port of the cluster service, and may join the first cluster by sending a join request to the access interface of the first node.
In the above process, the first node is a second node (a node immediately after the seed node) joining the first cluster after the first cluster is established based on the seed node as an initial (first) node, and joins the first cluster through an access interface of the seed node as the initial (first) node. In other embodiments according to the present disclosure, the first node may be a third node (a node immediately after the second node), a fourth node (a node immediately after the third node), and the like, which join the first cluster, and is not limited herein.
In some embodiments, as shown in fig. 6, the method 100 further comprises:
step S610: enabling the first cluster to comprise the second node based on the fact that an access interface of any one of one or more nodes in the first cluster receives a joining request corresponding to the operation of the second node; and
step S610: determining that the operation of the second node is successful in response to the first cluster including the second node.
After the seed node establishes the first cluster and receives the nodes through the access interface of the seed node, the first cluster includes a plurality of nodes therein, and the access interface of each of the plurality of nodes may be configured to receive a join request of the node to join the node to the first cluster. And receiving a joining request of a second node based on an access interface of any one of the plurality of nodes so that the first cluster comprises the second node, thereby realizing that the second node joins the first cluster.
In some embodiments, when a second node performs a join operation by accessing a port of a cluster service, an access interface of one of a plurality of nodes in a first cluster is made to receive a join request of the second node through load balancer deployment.
In some embodiments, as shown in fig. 7, the mounting, at step S120, the access interface of the first node to the back end of the cluster service in response to determining that the first node successfully joins the cluster includes:
step S710: in response to determining that the operation of the first node is successful, obtaining a service state of the first node; and
step S720: in response to determining that the service status of the first node is service-normal, mounting an access interface of the first node to a backend of the cluster service.
The specific service function of the node is pulled up after the node is successfully accessed into the cluster, so that after the node is added into the cluster through the cluster service, the service of the node is started, the service state of the node is obtained to be normal, the node is ensured to be successfully added into the cluster, meanwhile, the function of the access interface is ready, the access interface of the node can be mounted to the rear end of the cluster service, and therefore the node which is subsequently added through accessing the cluster service and the cluster can access the access interface of the node which is successfully added into the cluster, and the node can be added into the cluster.
In some embodiments, the service status of a node is probed by a probe within the container. In some embodiments, the probe of the container includes a readinessProbe corresponding to the seed node, and a readinessProbe and a livenessProbe corresponding to the service node, and the like, which are not limited herein.
In the related art, multiple copies of a seed node are declared at cluster deployment. At cluster startup, these copies may each form a cluster due to simultaneous startup, causing a split brain. To address the above, according to some embodiments of the present disclosure, the at least one node includes a seed node and at least one replica corresponding to the seed node; and wherein the step S210, in response to determining that the operation of a first node of the at least one node is successful, mounting an access interface of the first node to a backend of the cluster service further comprises:
in response to the seed node and the operation with each of the at least one replica being successful, sequentially initiating the seed node and each of the at least one replica such that a service state of only one replica of the seed node or the at least one portion at the same time is normal.
By sequentially starting the seed nodes and at least one copy of the seed nodes, only one seed node (or copy) is operated at the same time, and split brains caused by the fact that a plurality of copies are started simultaneously and form initial clusters respectively are avoided.
In some embodiments, the start-up sequence of the services of the nodes is controlled by a stateful or like component.
In some embodiments, sequentially launching the seed node and each of the at least one replica, as shown in fig. 8, comprises:
step S810: responsive to determining that the service state of the seed node is service-up, invalidating the service state of each of the at least one replica as service; and
step S820: and in response to determining that the service state of the seed node is service failure, starting a first copy of the at least one copy, and enabling the service state of the first copy to be service normal.
When the service of the seed node is started, other copies of the seed node are all subjected to service failure, so that only one seed node (or copy) is operated at the same time, and meanwhile, when the seed node is failed, one copy of the other copies is started, and the split brain caused by the fact that a plurality of copies are started at the same time to form an initial cluster respectively is avoided.
It should be understood that the seed node and each of the at least one copy corresponding to the seed node in the present disclosure refer to nodes having a function as an initial (first) node established in a cluster, and serve as backup and disaster prevention for each other.
According to another aspect of the present disclosure, as shown in fig. 9, there is also provided an apparatus 900 for decentralized clustering, comprising: a receiving unit 910 configured to receive, through a port of a cluster service, an access of at least one node, each of the at least one node being configured to perform an operation of joining a cluster based on the access; and a mounting unit 920 configured to mount, in response to determining that the operation of a first node of the at least one node is successful, an access interface of the first node to a backend of the cluster service to map a port of the cluster service to a port of an access interface of the first node, wherein the access interface is configured to join a second node of the at least one node to a first cluster including the first node based on the operation of the second node different from the first node.
In some embodiments, the at least one node comprises a service node, and the receiving unit 910 comprises: the first connection unit is used for responding to the received service starting request of the service node, enabling the service node to be in first connection with the cluster service, and enabling a port of the cluster service to be accessed for the first time; and a second connection unit, configured to, in response to determining that the operation corresponding to the first access fails, make a second connection between the service node and the cluster service, so as to perform a second access to a port of the cluster service.
In some embodiments, the second connection unit includes: an acquisition unit configured to acquire a first time point in response to determining that the operation corresponding to the first access fails; and the second connection subunit is configured to enable the service node to perform the second connection in response to that a time interval between the current time point and the first time point is smaller than a preset value.
In some embodiments, the receiving unit comprises: and the control unit responds to the condition that the time interval between the current time point and the first time point is greater than a preset value, so that the service node retransmits the corresponding service starting request.
In some embodiments, the at least one node comprises a seed node, the apparatus further comprising: a construction unit to establish the first cluster in response to determining that the operation of the seed node failed, the first cluster including the seed node; and a first determining unit configured to determine that the operation of the seed node is successful in response to establishment of the first cluster.
In some embodiments, the apparatus 900 further comprises: a receiving subunit configured to cause the first cluster to include the first node based on receipt of a join request corresponding to the operation by the first node of an access interface of the seed node; and a second determining unit configured to determine that the operation of the first node is successful in response to the first cluster including the first node.
In some embodiments, the receiving subunit is further configured to cause the first cluster to include the second node based on an access interface of any one of a plurality of nodes in the first cluster receiving a join request corresponding to the operation by the second node; and wherein the second determining unit is further configured to determine that the operation of the second node is successful in response to the first cluster including the second node.
According to another aspect of the present disclosure, there is also provided an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores a computer program which, when executed by the at least one processor, implements a method according to the above.
According to another aspect of the present disclosure, there is also provided a non-transitory computer readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method according to the above.
According to another aspect of the present disclosure, a computer program product is also provided.
Referring to fig. 10, a block diagram of a structure of an electronic device 1000, which may be a server or a client of the present disclosure, which is an example of a hardware device that may be applied to aspects of the present disclosure, will now be described. Electronic device is intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 10, the apparatus 1000 includes a computing unit 1001 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)1002 or a computer program loaded from a storage unit 1008 into a Random Access Memory (RAM) 1003. In the RAM1003, various programs and data necessary for the operation of the device 1000 can also be stored. The calculation unit 1001, the ROM1002, and the RAM1003 are connected to each other by a bus 1004. An input/output (I/O) access interface 1005 is also connected to bus 1004.
A number of components in the device 1000 are connected to the I/O access interface 1005, including: input section 1006, output section 1007, storage section 1008, and communication section 1009. Input unit 1006 may be any type of device capable of inputting information to device 1000, and input unit 1006 may receive input numeric or character information and generate key signal inputs related to user settings and/or function controls of the electronic device, and may include, but is not limited to, a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and/or a remote control. Output unit 1007 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, a video/audio output terminal, a vibrator, and/or a printer. The storage unit 1008 may include, but is not limited to, a magnetic disk, an optical disk. The communications unit 1009 allows the device 1000 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and/or chipsets, such as bluetooth (TM) devices, 1302.11 devices, WiFi devices, WiMax devices, cellular communication devices, and/or the like.
Computing unit 1001 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The computing unit 1201 performs the various methods and processes described above, such as the method 100. For example, in some embodiments, the method 100 may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 1008. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 1000 via ROM1002 and/or communications unit 1009. When the computer program is loaded into RAM1003 and executed by the computing unit 1101, one or more steps of the method 200 described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to perform the method 100 in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server with a combined blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be performed in parallel, sequentially or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
Although embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it is to be understood that the above-described methods, systems and apparatus are merely exemplary embodiments or examples and that the scope of the present invention is not limited by these embodiments or examples, but only by the claims as issued and their equivalents. Various elements in the embodiments or examples may be omitted or may be replaced with equivalents thereof. Further, the steps may be performed in an order different from that described in the present disclosure. Further, various elements in the embodiments or examples may be combined in various ways. It is important that as technology evolves, many of the elements described herein may be replaced with equivalent elements that appear after the present disclosure.

Claims (20)

1. A method for decentralized clustering, comprising:
receiving, through a port of a cluster service, an access of at least one node, each of the at least one node configured to perform an operation of joining a cluster based on the access; and
in response to determining that the operation of a first node of the at least one node is successful, mount an access interface of the first node to a backend of the cluster service to map a port of the cluster service to a port of the access interface of the first node, wherein,
the access interface is configured to cause a second node of the at least one node, distinct from the first node, to join a first cluster containing the first node based on the operation of the second node.
2. The method of claim 1, wherein the at least one node comprises a traffic node, and the receiving access of the at least one node through a port of a cluster service comprises:
responding to a request for starting service of the service node, and enabling the service node to be in first connection with the cluster service so as to access a port of the cluster service for the first time; and
and in response to determining that the operation corresponding to the first access fails, making a second connection between the service node and the cluster service to make a second access to a port of the cluster service.
3. The method of claim 2, wherein the causing the traffic node to make a second connection with the cluster service in response to determining that the operation corresponding to the first access failed comprises:
in response to determining that the operation corresponding to the first access failed, obtaining a first point in time; and
and responding to the fact that the time interval between the current time point and the first time point is smaller than a preset value, and enabling the service node to carry out the second connection.
4. The method of claim 3, wherein the receiving access of at least one node through a port of a cluster service further comprises:
and in response to that the time interval from the current time point to the first time point is greater than or equal to a preset value, the service node is enabled to resend the service starting request.
5. The method of claim 1, wherein the at least one node comprises a seed node, the method further comprising:
in response to determining that the operation of the seed node failed, establishing the first cluster, the first cluster including the seed node; and
determining that the operation of the seed node is successful in response to establishment of the first cluster.
6. The method of claim 5, further comprising:
enabling the first cluster to comprise the first node based on an access interface of the seed node receiving a join request corresponding to the operation of the first node; and
determining that the operation of the first node is successful in response to the first cluster including the first node.
7. The method of claim 6, further comprising:
enabling the first cluster to comprise the second node based on the fact that an access interface of any one of a plurality of nodes in the first cluster receives a joining request corresponding to the operation of the second node; and
determining that the operation of the second node is successful in response to the first cluster including the second node.
8. The method of claim 1, wherein the mounting the access interface of the first node to a backend of the cluster service in response to determining that the first node successfully joined the cluster comprises:
in response to determining that the operation of the first node is successful, obtaining a service state of the first node; and
in response to determining that the service status of the first node is service-normal, mounting an access interface of the first node to a backend of the cluster service.
9. The method of claim 8, wherein the at least one node comprises a seed node and at least one copy corresponding to the seed node; and wherein said mounting an access interface of a first node of the at least one node to a backend of the cluster service in response to determining that the operation of the first node was successful further comprises:
in response to the seed node and the operation with each of the at least one replica being successful, sequentially initiating the seed node and each of the at least one replica such that a service state of only one replica of the seed node or the at least one portion at the same time is normal.
10. The method of claim 9, wherein the sequentially launching the seed node and each of the at least one replica comprises:
responsive to determining that the service state of the seed node is service-up, invalidating the service state of each of the at least one replica as service; and
and in response to determining that the service state of the seed node is service failure, starting a first copy of the at least one copy, and enabling the service state of the first copy to be service normal.
11. An apparatus for decentralized clustering, comprising:
a receiving unit configured to receive an access of at least one node through a port of a cluster service, each of the at least one node configured to perform an operation of joining a cluster based on the access; and
a mounting unit configured to mount, in response to determining that the operation of a first node of the at least one node is successful, an access interface of the first node to a backend of the cluster service such that a port of the cluster service is mapped to a port of the access interface of the first node, wherein,
the access interface is configured to cause a second node of the at least one node, distinct from the first node, to join a first cluster containing the first node based on the operation of the second node.
12. The apparatus of claim 11, wherein the at least one node comprises a traffic node, the receiving unit comprises:
the first connection unit is used for responding to the received service starting request of the service node, enabling the service node to be in first connection with the cluster service, and enabling a port of the cluster service to be accessed for the first time; and
a second connection unit, configured to, in response to determining that the operation corresponding to the first access fails, make a second connection between the service node and the cluster service, so as to perform a second access to a port of the cluster service.
13. The apparatus of claim 12, wherein the second connection unit comprises:
an acquisition unit configured to acquire a first time point in response to determining that the operation corresponding to the first access fails; and
and the second connection subunit is configured to enable the service node to perform the second connection in response to that a time interval between the current time point and the first time point is smaller than a preset value.
14. The apparatus of claim 12, wherein the receiving unit further comprises:
and the control unit responds to the condition that the time interval between the current time point and the first time point is greater than a preset value, so that the service node retransmits the corresponding service starting request.
15. The apparatus of claim 11, wherein the at least one node comprises a seed node, the apparatus further comprising:
a construction unit to establish the first cluster in response to determining that the operation of the seed node failed, the first cluster including the seed node; and
a first determination unit configured to determine that the operation of the seed node is successful in response to establishment of the first cluster.
16. The apparatus of claim 15, further comprising:
a receiving subunit configured to cause the first cluster to include the first node based on receipt of a join request corresponding to the operation by the first node of an access interface of the seed node; and
a second determination unit configured to determine that the operation of the first node is successful in response to the first cluster including the first node.
17. The apparatus of claim 16, wherein the receiving subunit is further configured to cause the first cluster to include the second node based on an access interface of any of a plurality of nodes in the first cluster receiving a join request corresponding to the operation by the second node; and wherein
The second determining unit is further configured to determine that the operation of the second node is successful in response to the first cluster including the second node.
18. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-10.
19. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-10.
20. A computer program product comprising a computer program, wherein the computer program realizes the method of any one of claims 1-10 when executed by a processor.
CN202110949191.6A 2021-08-18 2021-08-18 Method and apparatus for decentralizing clusters Active CN113660339B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110949191.6A CN113660339B (en) 2021-08-18 2021-08-18 Method and apparatus for decentralizing clusters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110949191.6A CN113660339B (en) 2021-08-18 2021-08-18 Method and apparatus for decentralizing clusters

Publications (2)

Publication Number Publication Date
CN113660339A true CN113660339A (en) 2021-11-16
CN113660339B CN113660339B (en) 2023-08-04

Family

ID=78480959

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110949191.6A Active CN113660339B (en) 2021-08-18 2021-08-18 Method and apparatus for decentralizing clusters

Country Status (1)

Country Link
CN (1) CN113660339B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140301404A1 (en) * 2011-12-26 2014-10-09 Hangzhou H3C Technologies Co., Ltd. Expanding member ports of a link aggregation group between clusters
US8892689B1 (en) * 2008-04-30 2014-11-18 Netapp, Inc. Method and apparatus for a storage server to automatically discover and join a network storage cluster
CN107087032A (en) * 2017-05-11 2017-08-22 腾讯科技(深圳)有限公司 Realize the method and apparatus that cluster is set up
CN107222342A (en) * 2017-05-27 2017-09-29 郑州云海信息技术有限公司 A kind of cluster management network collocation method
CN109257195A (en) * 2017-07-12 2019-01-22 华为技术有限公司 The fault handling method and equipment of cluster interior joint
CN111090537A (en) * 2019-12-16 2020-05-01 无锡华云数据技术服务有限公司 Cluster starting method and device, electronic equipment and readable storage medium
CN111277460A (en) * 2020-01-17 2020-06-12 江苏满运软件科技有限公司 ZooKeeper containerization control method and device, storage medium and electronic equipment
CN111478953A (en) * 2020-03-27 2020-07-31 北京金山云网络技术有限公司 Self-construction method, device, system, equipment and storage medium of server cluster
CN111857963A (en) * 2020-07-28 2020-10-30 山东超越数控电子股份有限公司 Container arrangement implementation method, device, equipment and medium for Proxmox VE
CN112311596A (en) * 2020-10-22 2021-02-02 深圳前海微众银行股份有限公司 Data management method, device, equipment and computer storage medium
CN112910796A (en) * 2021-01-27 2021-06-04 北京百度网讯科技有限公司 Traffic management method, apparatus, device, storage medium, and program product

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8892689B1 (en) * 2008-04-30 2014-11-18 Netapp, Inc. Method and apparatus for a storage server to automatically discover and join a network storage cluster
US20140301404A1 (en) * 2011-12-26 2014-10-09 Hangzhou H3C Technologies Co., Ltd. Expanding member ports of a link aggregation group between clusters
CN107087032A (en) * 2017-05-11 2017-08-22 腾讯科技(深圳)有限公司 Realize the method and apparatus that cluster is set up
CN107222342A (en) * 2017-05-27 2017-09-29 郑州云海信息技术有限公司 A kind of cluster management network collocation method
CN109257195A (en) * 2017-07-12 2019-01-22 华为技术有限公司 The fault handling method and equipment of cluster interior joint
CN111090537A (en) * 2019-12-16 2020-05-01 无锡华云数据技术服务有限公司 Cluster starting method and device, electronic equipment and readable storage medium
CN111277460A (en) * 2020-01-17 2020-06-12 江苏满运软件科技有限公司 ZooKeeper containerization control method and device, storage medium and electronic equipment
CN111478953A (en) * 2020-03-27 2020-07-31 北京金山云网络技术有限公司 Self-construction method, device, system, equipment and storage medium of server cluster
CN111857963A (en) * 2020-07-28 2020-10-30 山东超越数控电子股份有限公司 Container arrangement implementation method, device, equipment and medium for Proxmox VE
CN112311596A (en) * 2020-10-22 2021-02-02 深圳前海微众银行股份有限公司 Data management method, device, equipment and computer storage medium
CN112910796A (en) * 2021-01-27 2021-06-04 北京百度网讯科技有限公司 Traffic management method, apparatus, device, storage medium, and program product

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
王毅睿;邢少华;罗亚男;孙芳;: "基于EJB/CORBA的分布计算系统的研究" *
黄哲煌,王美清: "EDCS:基于EJB的分布计算系统" *

Also Published As

Publication number Publication date
CN113660339B (en) 2023-08-04

Similar Documents

Publication Publication Date Title
CN113742031A (en) Node state information acquisition method and device, electronic equipment and readable storage medium
EP3817338B1 (en) Method and apparatus for acquiring rpc member information, electronic device and storage medium
CN111770176B (en) Traffic scheduling method and device
CN111181765A (en) Task processing method and device
CN112003943A (en) Voice data synchronization method and device
CN107818027B (en) Method and device for switching main name node and standby name node and distributed system
JP2010086137A (en) Message queuing method and program
CN114070889B (en) Configuration method, traffic forwarding device, storage medium, and program product
CN113660339B (en) Method and apparatus for decentralizing clusters
CN113326192B (en) Application testing method, device, equipment and storage medium for mobile terminal
CN113726881B (en) Communication connection establishment method, related device and computer readable storage medium
CN113596197B (en) Address switching method and device, electronic equipment and storage medium
CN113747423B (en) Cloud mobile phone state synchronization method, device, equipment, storage medium and program product
CN113420275B (en) Data connection processing method, related device and computer program product
CN114221985A (en) Device control method, device, electronic device and computer-readable storage medium
CN113596172B (en) Method and device for updating nodes in distributed cluster
CN113992690B (en) Message transmission method, device, equipment and storage medium
CN114513524B (en) Resource synchronization method and device, electronic equipment and storage medium
CN112769824B (en) Information transmission state updating method, terminal, device and storage medium
CN109495560B (en) Link establishment method, device, equipment and storage medium
CN112583614B (en) Host cluster management method, device and computer readable medium
CN114567540B (en) Master-slave node switching method, device, equipment, medium and program product
CN117201483A (en) File transmission method, device, electronic equipment and storage medium
CN117978849A (en) Communication connection construction method and device, electronic equipment and storage medium
CN117938928A (en) Distributed service management method, device, server and storage medium

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
GR01 Patent grant
GR01 Patent grant