CN106712981A - Method and device for informing node change - Google Patents

Method and device for informing node change Download PDF

Info

Publication number
CN106712981A
CN106712981A CN201510438825.6A CN201510438825A CN106712981A CN 106712981 A CN106712981 A CN 106712981A CN 201510438825 A CN201510438825 A CN 201510438825A CN 106712981 A CN106712981 A CN 106712981A
Authority
CN
China
Prior art keywords
client
node
transient
transient node
distributed lock
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
CN201510438825.6A
Other languages
Chinese (zh)
Other versions
CN106712981B (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.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510438825.6A priority Critical patent/CN106712981B/en
Publication of CN106712981A publication Critical patent/CN106712981A/en
Application granted granted Critical
Publication of CN106712981B publication Critical patent/CN106712981B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention relates to the technical field of computers and particularly relates to a method and a device for informing node change, so as to solve the problem that much unnecessary system overhead is increased according to the node change mode in the existing distributed system. The method of informing the node change provided by the embodiment of the invention comprises steps: when a client in the distributed system needs to access sharing resources, a temporary node creation request is sent to a coordination server; according to information of multiple temporary nodes for waiting to acquire a distributed lock of the sharing resources currently, the client judges whether the temporary nodes of the client meet a condition of acquiring the distributed lock; and if not, a registration request for a node change event for a former temporary node is sent to the coordination server, and thus, the coordination server is requested to inform the client when the former temporary node is deleted.

Description

A kind of node alteration notification method and device
Technical field
The application is related to field of computer technology, more particularly to a kind of node alteration notification method and device.
Background technology
In a distributed system, multiple application systems can be by the shared money of computer network access identical Source.In order that each application system can correctly and efficiently be run, it is necessary to which the multiple application systems of control are to same The concurrently access of one shared resource, resource data is destroyed to prevent interfering with each other between different application systems Uniformity.
In order to control concurrently access of multiple application systems to same shared resource, it is possible to use Distributed Application The distributed lock service that Program Coordination service (namely ZooKeeper) is provided.Flow is implemented mainly to wrap Include:Client is that the client creates shared resource to be visited under one's name to ZooKeeper server requests After transient node, whether the transient node for judging the client is that shared resource to be visited under one's name all face The minimum transient node of Shi Jiedian interior joints sequence number, if, then it is assumed that client gets distributed lock, can To carry out resource access, otherwise, into wait state, and changed to ZooKeeper server registrations node Event;When node altering event arrives, then judge whether the transient node of oneself is that current correspondence is treated The minimum transient node of the sequence number of the shared resource of access.
In superincumbent flow, node altering event not only include obtain distributed lock client release lock, Delete corresponding transient node, including other also do not obtain the client of distributed lock due to ZooKeeper Server is disconnected and causes correspondence transient node passively to delete, and this results in client and can receive for no reason very Many node altering events, so as to can perform judge whether to obtain distributed lock every time, increased much not Necessary overhead.In this way, under large-scale cluster environment, it will cause very big shadow to systematic function Ring.
The content of the invention
The embodiment of the present application provides a kind of node alteration notification method and device, is used to solve existing distribution Node change mode in system increased many unnecessary overheads, cause very big to systematic function The problem of influence.
The embodiment of the present application provides a kind of node alteration notification method, including:
Client in distributed system sends interim section when needing to access shared resource to coordination service device Point request to create, is the shared resources to be obtained such as the client establishment for asking coordination service device The transient node of distributed lock;
Multiple transient nodes of the client according to the distributed lock of the shared resource to be obtained such as current Nodal information, judge whether the transient node of the client meets the condition for obtaining the distributed lock;
If it is not, then sending the note of the node altering event for previous transient node to the coordination service device Volume request, for asking coordination service device to notify the client after the previous transient node is deleted End;Wherein, the previous transient node is the multiple in the distributed lock for waiting the shared resource to be obtained In transient node, last of the distributed lock can be obtained before the transient node of the client Transient node.
Alternatively, the condition for meeting the acquisition distributed lock is specifically included:
The shared resource to be obtained such as current distributed lock multiple transient node interior joint sequence numbers most It is small.
Alternatively, the client is it is determined that the transient node of the client meets obtains the distributed lock Condition after, including:
The client accesses the shared resource using the distributed lock for obtaining, and after the completion of access, The transient node of the client is deleted to coordination service device request.
Alternatively, the client is faced according to the multiple of the distributed lock of the shared resource to be obtained such as current The nodal information of Shi Jiedian, judges whether the transient node of the client meets and obtains the distributed lock Condition, including:
The client obtains the node of the multiple transient nodes under the corresponding lock catalogue of the shared resource Information;
The client is based on the nodal information of the multiple transient nodes under the lock catalogue for obtaining, and judges institute Whether the transient node for stating client meets the condition for obtaining the distributed lock.
Alternatively, the client is faced according to the multiple of the distributed lock of the shared resource to be obtained such as current The nodal information of Shi Jiedian, judges whether the transient node of the client meets and obtains the distributed lock Condition, including:
The transient node created for the client that the client receives that the coordination service device sends Nodal information, and other etc. the transient node of the distributed lock of the shared resource to be obtained node letter Breath;
The client is based on the node letter of the transient node of the client that the coordination service device sends Breath, and it is described other etc. the transient node of the distributed lock of the shared resource to be obtained nodal information, Judge whether the transient node of the client meets the condition for obtaining the distributed lock.
Alternatively, the client sends the node change for previous transient node to the coordination service device After the registration request of more event, also include:
After node altering event is received, return judges that the transient node of the client is worked as to the client Before the step of can obtain the distributed lock.
Another embodiment of the application provides a kind of node alteration notification method, including:
Coordination service device in distributed system receives client when request shared resource is needed, and transmission is faced Shi Jiedian requests to create;
The coordination service device is the distributed lock of the shared resources to be obtained such as the client establishment Transient node;
The coordination service device receives the node change for previous transient node that the client sends The registration request of event, the registration request is used to ask coordination service device to be deleted in the previous transient node The client is notified after removing;Wherein, the previous transient node is to wait the shared resource to be obtained Distributed lock multiple transient nodes in, described point can be obtained before the transient node of the client Last transient node of cloth lock;
The coordination service device sends after it is determined that the previous transient node is deleted to the client Node altering event, is used to indicate previous transient node described in the client to be deleted.
Alternatively, the coordination service device is the distribution of the shared resources to be obtained such as the client establishment After the transient node of formula lock, also include:
The nodal information of the transient node that the coordination service device will be created for the client is added described Under the corresponding lock catalogue of shared resource.
Alternatively, the coordination service device is the distribution of the shared resources to be obtained such as the client establishment After the transient node of formula lock, also include:
The nodal information of the transient node that the coordination service device will be created for the client, and other etc. The nodal information of the transient node of the distributed lock of the shared resource to be obtained is sent to the client.
The embodiment of the present application provides a kind of node Notification of Changes device, including:
First sending module, for when client needs to access shared resource, being sent to coordination service device and being faced Shi Jiedian requests to create, are the shared resources to be obtained such as client establishment for asking coordination service device The transient node of distributed lock;
Judge module, for the interim section of multiple of the distributed lock according to the shared resource to be obtained such as current The nodal information of point, judges whether the transient node of the client meets the bar for obtaining the distributed lock Part;
Second sending module, for it is determined that the transient node of the client is unsatisfactory for obtaining the distribution After the condition of lock, the note of the node altering event for previous transient node is sent to the coordination service device Volume request, for asking coordination service device to notify the client after the previous transient node is deleted End;Wherein, the previous transient node is the multiple in the distributed lock for waiting the shared resource to be obtained In transient node, last of the distributed lock can be obtained before the transient node of the client Transient node.
Another embodiment of the application provides a kind of node Notification of Changes device, including:
First receiver module, for receive client need request shared resource when, the transient node of transmission Request to create;
Creation module, for facing for the distributed lock for shared resources to be obtained such as client establishments Shi Jiedian;
Second receiver module, becomes for receiving the node for previous transient node that the client sends The registration request of more event, the registration request is used to ask coordination service device in the previous transient node quilt The client is notified after deletion;Wherein, the previous transient node is to wait the shared money to be obtained In multiple transient nodes of the distributed lock in source, can obtain described before the transient node of the client Last transient node of distributed lock;
Sending module, for after it is determined that the previous transient node is deleted, being sent to the client Node altering event, is used to indicate previous transient node described in the client to be deleted.
In the embodiment of the present application, client in distributed system when needing to access shared resource, to coordination Server sends transient node request to create;Distributed lock according to the shared resource to be obtained such as current The nodal information of multiple transient nodes, judges whether the transient node of the client meets the acquisition distribution The condition of formula lock;If it is not, then sending the node altering event for previous transient node to coordination service device Registration request, for ask coordination service device the previous transient node be deleted after notify the visitor Family end.Using the embodiment of the present application, client only after previous transient node is deleted, can just be received To node altering event, and do not interfere with client and obtain distributed lock in time, this way it is possible to avoid receiving To many unnecessary node altering events, such that it is able to save overhead, there is provided systematic function.
Brief description of the drawings
Fig. 1 is the node alteration notification method flow chart that the embodiment of the present application one is provided;
Fig. 2 is the node alteration notification method flow chart that the embodiment of the present application two is provided;
Fig. 3 is the node Notification of Changes apparatus structure schematic diagram that the embodiment of the present application three is provided;
Fig. 4 is the node Notification of Changes apparatus structure schematic diagram that the embodiment of the present application four is provided.
Specific embodiment
In the embodiment of the present application, client in distributed system when needing to access shared resource, to coordination Server sends transient node request to create;Distributed lock according to the shared resource to be obtained such as current The nodal information of multiple transient nodes, judges whether the transient node of the client meets the acquisition distribution The condition of formula lock;If it is not, then sending the node altering event for previous transient node to coordination service device Registration request, for ask coordination service device the previous transient node be deleted after notify the visitor Family end.Using the embodiment of the present application, client only after previous transient node is deleted, can just be received To node altering event, and do not interfere with client and obtain distributed lock in time, this way it is possible to avoid receiving To many unnecessary node altering events, such that it is able to save overhead, there is provided systematic function.
The embodiment of the present application is described in further detail with reference to Figure of description.
Embodiment one
As shown in figure 1, be the node alteration notification method flow chart of the offer of the embodiment of the present application one, including with Lower step:
S101:Client in distributed system sends when needing to access shared resource to coordination service device Transient node request to create, it is to be obtained described shared for client establishment etc. for asking coordination service device The transient node of distribution of resource formula lock.
In the step, when client needs to access shared resource, first to coordination service device such as ZooKeeper Server sends transient node request to create, wherein the information of the shared resource for needing request can be included, with Just ZooKeeper servers are that it creates corresponding shared resource transient node under one's name.The transient node is used for The distributed locks to be obtained such as sequence, so that corresponding client possesses the authority for accessing shared resource.
S102:Multiple transient nodes of the client according to the distributed lock of the shared resource to be obtained such as current Nodal information, judge whether the transient node of the client meets the condition for obtaining the distributed lock, If meeting, into S103, otherwise, into S104.
In specific implementation, the distributed lock of the shared resource to be obtained such as client is obtained first it is all The nodal information of transient node, wherein can be faced according to these including node ID or nodal value count etc. The nodal information of Shi Jiedian judges that can the transient node of client currently obtain distributed lock.In specific implementation In, coordination service device can be followed successively by each interim section for successively creating according to the ascending order of node ID Point distribution node sequence number, in this case, according to the principle that first obtains first is created, client may determine that Whether the transient node of oneself is the node of wherein node ID minimum, if so, then confirming to get to need The distributed lock of the shared resource to be accessed.That is, when the transient node of client is current etc. to be obtained During the node of multiple transient node interior joint sequence numbers minimum of the distributed lock of the shared resource, it is considered as satisfaction Obtain the condition of the distributed lock.Correspondingly, if coordination service device is according to descending suitable of node ID Sequence is followed successively by each transient node distribution node sequence number for successively creating, and in this case, client then needs Judge whether the transient node of oneself is the node of wherein node ID maximum, if so, then confirming to obtain To the distributed lock of the shared resource for needing to access.
S103:Client accesses the shared resource using the distributed lock for obtaining, and after the completion of access, The transient node of the client is deleted to coordination service device request.
Here, client is to wait for obtaining the distributed lock of the shared resource confirming the transient node of oneself All transient nodes in, after the minimum node of node ID, use the distributed lock for obtaining to access shared money Source, and after the completion of access, release profile formula lock, namely indicate to delete the client to the coordination service device The transient node at end.
S104:Client sends the node altering event for previous transient node to the coordination service device Registration request, for ask coordination service device the previous transient node be deleted after notify the visitor Family end;Wherein, the previous transient node is to wait many of the distributed lock of the shared resource to be obtained In individual transient node, last of the distributed lock can be obtained before the transient node of the client Individual transient node.
Here, client only to the previous transient node of ZooKeeper server registrations node altering event, Only when previous transient node is deleted, client just can be notified, is then back to S103 execution Step is judged, because only that after previous transient node is deleted, the client can just have an opportunity to get Distributed lock.This way it is possible to avoid receive many unnecessary node altering events, can the system of saving open Pin.Here previous transient node is that distributed lock can be obtained before the transient node of the client Last transient node, if the order than coordination service device according to node ID from small to large, is followed successively by Each transient node distribution node sequence number for creating, then the previous transient node is node ID than the client Transient node node ID small 1 node;For another example, if coordination service device according to node ID from big To small order, each transient node distribution node sequence number of establishment is followed successively by, then the previous transient node is The node of node ID bigger than the node ID of the transient node of the client 1.
The thought of the embodiment of the present application is described further below by a specific embodiment.
Embodiment two
As shown in Fig. 2 be the node alteration notification method flow chart of the offer of the embodiment of the present application two, including with Lower step:
S201:Client in distributed system sends when needing to access shared resource to coordination service device Transient node request to create, it is to be obtained described shared for client establishment etc. for asking coordination service device The transient node of distribution of resource formula lock.
S202:Coordination service device is the distributed lock of the shared resources to be obtained such as the client establishment Transient node.
Here, coordination service device, can be by the transient node after transient node is created for the client Nodal information is added under the lock catalogue (/lock) of corresponding shared resource.
S203:Client judges all transient nodes in the distributed lock for waiting the shared resource to be obtained In, whether the transient node of the client is the wherein minimum node of node ID, if so, then entering S204, otherwise, into S205.
Here, client can be after transient node request to create be sent, based on precognition to coordination service device Access path, actively accesses multiple of the coordination service device storage under the corresponding lock catalogue of the shared resource and faces The nodal information of Shi Jiedian;That is, client obtains the multiple under the corresponding lock catalogue of the shared resource The nodal information of transient node;Based on the nodal information of the multiple transient nodes under the lock catalogue for obtaining, sentence Whether the transient node of the client of breaking meets the condition for obtaining the distributed lock, in this embodiment, Namely judge whether the transient node of the client is minimum the multiple transient node interior joint sequence number Node;If, it is determined that the transient node of the client can obtain the distributed lock, otherwise, it determines The transient node of the client can not obtain the distributed lock.
Or, client to coordination service device send transient node request to create after, coordination service device for After the client creates transient node, can directly by the transient node created for the client and the client The nodal information of the shared resource for accessing other transient nodes under one's name is asked to send jointly to the client. That is, after transient node request to create is sent, that receive the coordination service device transmission is the visitor to client Family end create transient node nodal information, and other etc. the shared resource to be obtained distributed lock Transient node nodal information;The node of the transient node of the client sent based on coordination service device Information, and it is described other etc. the transient node of the distributed lock of the shared resource to be obtained node letter Breath, judge whether the transient node of the client meets the condition for obtaining the distributed lock, here namely Judge the multiple of the distributed lock whether transient node of the client is to wait for obtaining the shared resource The minimum node of transient node interior joint sequence number;If, it is determined that the transient node of the client can be obtained The distributed lock, otherwise, it determines the transient node of the client can not obtain the distributed lock.
S204:Client accesses the shared resource using the distributed lock for obtaining, and after the completion of access, The transient node of the client is deleted to coordination service device request.
Here, client can send to ZooKeeper servers and delete interim after resource access is completed The order of node discharges the distributed lock of acquisition, so that other clients are used.
S205:Client sends the node altering event for previous transient node to the coordination service device Registration request, for ask coordination service device the previous transient node be deleted after notify the visitor Family end, the previous transient node is all interim section in the distributed lock for waiting the shared resource to be obtained In point, the node of node ID smaller than the node ID of the transient node of the client 1.
In the step, client is not the minimum transient node of present node sequence number in the transient node of oneself When, into wait, and previous transient node is registered to coordination service device (ZooKeeper servers) Node altering event, namely indicate ZooKeeper servers to notify to be somebody's turn to do after previous transient node is deleted Client.
Such as, the node ID of the transient node of client is n, and client is noted to ZooKeeper servers Volume node ID for n-1 transient node node altering event, now, though other transient nodes whether Have altered, client would only receive the altering event of node n-1.
S206:Coordination service device is sent out after it is determined that the previous transient node is deleted to the client Node altering event is sent, is used to indicate previous transient node described in the client to be deleted.
Here node altering event can include that previous transient node completes release profile after resource is accessed The event of formula lock (namely deleting the previous transient node), it is also possible to including previous transient node and institute State the event being deleted after coordination service device is disconnected.
S207:Client returns to S203 after node altering event is received.
A kind of and node alteration notification method pair is additionally provided based on same inventive concept, in the embodiment of the present application The node Notification of Changes device answered, because principle and the embodiment of the present application node of the device solve problem are changed Notification Method is similar, therefore the implementation of the device may refer to the implementation of method, repeats part and repeats no more.
Embodiment three
As shown in figure 3, being the node Notification of Changes apparatus structure schematic diagram of the offer of the embodiment of the present application three, bag Include:
First sending module 31, for when client needs to access shared resource, being sent to coordination service device Transient node request to create, is the shared resources to be obtained such as client establishment for asking coordination service device Distributed lock transient node;
Judge module 32, the multiple for the distributed lock according to the shared resource to be obtained such as current is interim The nodal information of node, judges whether the transient node of the client meets the bar for obtaining the distributed lock Part;
Second sending module 33, for it is determined that the transient node of the client is unsatisfactory for obtaining the distribution After the condition of formula lock, the node altering event for previous transient node is sent to the coordination service device Registration request, for asking coordination service device to notify the client after the previous transient node is deleted End;Wherein, the previous transient node is the multiple in the distributed lock for waiting the shared resource to be obtained In transient node, last of the distributed lock can be obtained before the transient node of the client Transient node.
Alternatively, the condition for meeting the acquisition distributed lock is specifically included:
The shared resource to be obtained such as current distributed lock multiple transient node interior joint sequence numbers most It is small.
Alternatively, described device also includes:
Access modules 34, the transient node satisfaction for determining the client in the judge module 32 is obtained After taking the condition of the distributed lock, using the distributed lock for obtaining, the shared resource is accessed, and After the completion of access, the transient node of the client is deleted to coordination service device request.
Alternatively, the judge module 32 specifically for:
Obtain the nodal information of the multiple transient nodes under the corresponding lock catalogue of the shared resource;Based on obtaining The nodal information of the multiple transient nodes under the lock catalogue for taking, judging the transient node of the client is It is no to meet the condition for obtaining the distributed lock.
Alternatively, the judge module 32 specifically for:
The nodal information of the transient node created for the client for receiving that the coordination service device sends, with And other wait the nodal information of the transient node of the distributed lock for obtaining the shared resource;Based on the association Adjust server send the client transient node nodal information, and it is described other etc. institute to be obtained The nodal information of the transient node of the distributed lock of shared resource is stated, judging the transient node of the client is It is no to meet the condition for obtaining the distributed lock.
Alternatively, the judge module 32 is additionally operable to, in the second sending module 33 to the coordination service device Send and be directed to after the registration request of the node altering event of previous transient node, if receiving node change Event, then return judges the step of can the transient node of the client currently obtain the distributed lock.
Example IV
As shown in figure 4, being the node Notification of Changes apparatus structure schematic diagram of the offer of the embodiment of the present application four, bag Include:
First receiver module 41, for receive client need request shared resource when, the interim section of transmission Point request to create;
Creation module 42, for the distributed lock for shared resources to be obtained such as client establishments Transient node;
Second receiver module 43, for receiving the node for previous transient node that the client sends The registration request of altering event, the registration request is used to ask coordination service device in the previous transient node The client is notified after being deleted;Wherein, the previous transient node is to wait to be obtained described shared In multiple transient nodes of distribution of resource formula lock, institute can be obtained before the transient node of the client State last transient node of distributed lock;
Sending module 44, for after it is determined that the previous transient node is deleted, being sent out to the client Node altering event is sent, is used to indicate previous transient node described in the client to be deleted.
Alternatively, the sending module 44 is additionally operable to:
The nodal information that the creation module 42 is the transient node that the client is created is added described Under the corresponding lock catalogue of shared resource.
Alternatively, the sending module 44 is additionally operable to:
By the nodal information that the creation module 42 is the transient node that the client is created, and other Nodal information etc. the transient node of the distributed lock of the shared resource to be obtained is sent to the client.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system or meter Calculation machine program product.Therefore, the application can be using complete hardware embodiment, complete software embodiment or knot Close the form of the embodiment in terms of software and hardware.And, the application can be used and wherein wrapped at one or more Containing computer usable program code computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) on implement computer program product form.
The application is produced with reference to the method according to the embodiment of the present application, device (system) and computer program The flow chart and/or block diagram of product is described.It should be understood that can by computer program instructions realize flow chart and / or block diagram in each flow and/or the flow in square frame and flow chart and/or block diagram and/ Or the combination of square frame.These computer program instructions to all-purpose computer, special-purpose computer, insertion can be provided The processor of formula processor or other programmable data processing devices is producing a machine so that by calculating The instruction of the computing device of machine or other programmable data processing devices is produced for realizing in flow chart one The device of the function of being specified in individual flow or multiple one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions may be alternatively stored in can guide computer or the treatment of other programmable datas to set In the standby computer-readable memory for working in a specific way so that storage is in the computer-readable memory Instruction produce include the manufacture of command device, the command device realization in one flow of flow chart or multiple The function of being specified in one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices, made Obtain and series of operation steps is performed on computer or other programmable devices to produce computer implemented place Reason, so as to the instruction performed on computer or other programmable devices is provided for realizing in flow chart one The step of function of being specified in flow or multiple one square frame of flow and/or block diagram or multiple square frames.
Although having been described for the preferred embodiment of the application, those skilled in the art once know base This creative concept, then can make other change and modification to these embodiments.So, appended right will Ask and be intended to be construed to include preferred embodiment and fall into having altered and changing for the application scope.
Obviously, those skilled in the art can carry out various changes and modification without deviating from this Shen to the application Spirit and scope please.So, if the application these modification and modification belong to the application claim and Within the scope of its equivalent technologies, then the application is also intended to comprising these changes and modification.

Claims (18)

1. a kind of node alteration notification method, it is characterised in that the method includes:
Client in distributed system sends interim section when needing to access shared resource to coordination service device Point request to create, is the shared resources to be obtained such as the client establishment for asking coordination service device The transient node of distributed lock;
Multiple transient nodes of the client according to the distributed lock of the shared resource to be obtained such as current Nodal information, judge whether the transient node of the client meets the condition for obtaining the distributed lock;
If it is not, then sending the note of the node altering event for previous transient node to the coordination service device Volume request, for asking coordination service device to notify the client after the previous transient node is deleted End;Wherein, the previous transient node is the multiple in the distributed lock for waiting the shared resource to be obtained In transient node, last for obtaining the distributed lock before the transient node of the client is interim Node.
2. the method for claim 1, it is characterised in that the satisfaction obtains the distributed lock Condition specifically include:
The shared resource to be obtained such as current distributed lock multiple transient node interior joint sequence numbers most It is small.
3. the method for claim 1, it is characterised in that the client is it is determined that the client The transient node at end is met after the condition for obtaining the distributed lock, including:
The client accesses the shared resource using the distributed lock for obtaining, and after the completion of access, The transient node of the client is deleted to coordination service device request.
4. the method as described in claims 1 to 3 is any, it is characterised in that the client is according to current Etc. the nodal information of multiple transient nodes of the distributed lock of the shared resource to be obtained, the client is judged Whether the transient node at end meets the condition for obtaining the distributed lock, including:
The client obtains the node of the multiple transient nodes under the corresponding lock catalogue of the shared resource Information;
The client is based on the nodal information of the multiple transient nodes under the lock catalogue for obtaining, and judges institute Whether the transient node for stating client meets the condition for obtaining the distributed lock.
5. the method as described in claims 1 to 3 is any, it is characterised in that the client is according to current Etc. the nodal information of multiple transient nodes of the distributed lock of the shared resource to be obtained, the client is judged Whether the transient node at end meets the condition for obtaining the distributed lock, including:
The transient node created for the client that the client receives that the coordination service device sends Nodal information, and other etc. the transient node of the distributed lock of the shared resource to be obtained node letter Breath;
The client is based on the node letter of the transient node of the client that the coordination service device sends Breath, and it is described other etc. the transient node of the distributed lock of the shared resource to be obtained nodal information, Judge whether the transient node of the client meets the condition for obtaining the distributed lock.
6. the method as described in Claims 1 to 5 is any, it is characterised in that the client is to the association Adjust server to send to be directed to after the registration request of the node altering event of previous transient node, also include:
After node altering event is received, return judges that the transient node of the client is worked as to the client Before the step of can obtain the distributed lock.
7. a kind of node alteration notification method, it is characterised in that the method includes:
Coordination service device in distributed system receives client when request shared resource is needed, and transmission is faced Shi Jiedian requests to create;
The coordination service device is the distributed lock of the shared resources to be obtained such as the client establishment Transient node;
The coordination service device receives the node change for previous transient node that the client sends The registration request of event, the registration request is used to ask coordination service device to be deleted in the previous transient node The client is notified after removing;Wherein, the previous transient node is to wait the shared resource to be obtained Distributed lock multiple transient nodes in, described point can be obtained before the transient node of the client Last transient node of cloth lock;
The coordination service device sends after it is determined that the previous transient node is deleted to the client Node altering event, is used to indicate previous transient node described in the client to be deleted.
8. method as claimed in claim 7, it is characterised in that the coordination service device is the client After the transient nodes of the distributed lock of the shared resource to be obtained such as end establishment, also include:
The nodal information of the transient node that the coordination service device will be created for the client is added described Under the corresponding lock catalogue of shared resource.
9. method as claimed in claim 7, it is characterised in that the coordination service device is the client After the transient nodes of the distributed lock of the shared resource to be obtained such as end establishment, also include:
The nodal information of the transient node that the coordination service device will be created for the client, and other etc. The nodal information of the transient node of the distributed lock of the shared resource to be obtained is sent to the client.
10. a kind of node Notification of Changes device, it is characterised in that the device includes:
First sending module, for when client needs to access shared resource, being sent to coordination service device and being faced Shi Jiedian requests to create, are the shared resources to be obtained such as client establishment for asking coordination service device The transient node of distributed lock;
Judge module, for the interim section of multiple of the distributed lock according to the shared resource to be obtained such as current The nodal information of point, judges whether the transient node of the client meets the bar for obtaining the distributed lock Part;
Second sending module, for it is determined that the transient node of the client is unsatisfactory for obtaining the distribution After the condition of lock, the note of the node altering event for previous transient node is sent to the coordination service device Volume request, for asking coordination service device to notify the client after the previous transient node is deleted End;Wherein, the previous transient node is the multiple in the distributed lock for waiting the shared resource to be obtained In transient node, last of the distributed lock can be obtained before the transient node of the client Transient node.
11. devices as claimed in claim 10, it is characterised in that the satisfaction obtains the distribution The condition of lock is specifically included:
The shared resource to be obtained such as current distributed lock multiple transient node interior joint sequence numbers most It is small.
12. devices as claimed in claim 10, it is characterised in that described device also includes:
Access modules, it is described that the transient node for determining the client in the judge module meets acquisition After the condition of distributed lock, using the distributed lock for obtaining, the shared resource is accessed, and accessing Cheng Hou, the transient node of the client is deleted to coordination service device request.
13. device as described in claim 10~12 is any, it is characterised in that the judge module is specific For:
Obtain the nodal information of the multiple transient nodes under the corresponding lock catalogue of the shared resource;Based on obtaining The nodal information of the multiple transient nodes under the lock catalogue for taking, judging the transient node of the client is It is no to meet the condition for obtaining the distributed lock.
14. device as described in claim 10~12 is any, it is characterised in that the judge module is specific For:
The nodal information of the transient node created for the client for receiving that the coordination service device sends, with And other wait the nodal information of the transient node of the distributed lock for obtaining the shared resource;Based on the association Adjust server send the client transient node nodal information, and it is described other etc. institute to be obtained The nodal information of the transient node of the distributed lock of shared resource is stated, judging the transient node of the client is It is no to meet the condition for obtaining the distributed lock.
15. device as described in claim 10~14 is any, it is characterised in that the judge module is also used In experienced for the node change of previous transient node to coordination service device transmission in the second sending module After the registration request of part, if receiving node altering event, return judges the interim section of the client The step of can point currently obtain the distributed lock.
16. a kind of node Notification of Changes devices, it is characterised in that the device includes:
First receiver module, for receive client need request shared resource when, the transient node of transmission Request to create;
Creation module, for facing for the distributed lock for shared resources to be obtained such as client establishments Shi Jiedian;
Second receiver module, becomes for receiving the node for previous transient node that the client sends The registration request of more event, the registration request is used to ask coordination service device in the previous transient node quilt The client is notified after deletion;Wherein, the previous transient node is to wait the shared money to be obtained In multiple transient nodes of the distributed lock in source, can obtain described before the transient node of the client Last transient node of distributed lock;
Sending module, for after it is determined that the previous transient node is deleted, being sent to the client Node altering event, is used to indicate previous transient node described in the client to be deleted.
17. devices as claimed in claim 16, it is characterised in that the sending module is additionally operable to:
The nodal information that the creation module is the transient node that the client is created is added described common Enjoy under the corresponding lock catalogue of resource.
18. devices as claimed in claim 16, it is characterised in that the sending module is additionally operable to:
By the nodal information that the creation module is the transient node that the client is created, and other waits The nodal information for obtaining the transient node of the distributed lock of the shared resource is sent to the client.
CN201510438825.6A 2015-07-23 2015-07-23 Node change notification method and device Active CN106712981B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510438825.6A CN106712981B (en) 2015-07-23 2015-07-23 Node change notification method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510438825.6A CN106712981B (en) 2015-07-23 2015-07-23 Node change notification method and device

Publications (2)

Publication Number Publication Date
CN106712981A true CN106712981A (en) 2017-05-24
CN106712981B CN106712981B (en) 2020-03-06

Family

ID=58894635

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510438825.6A Active CN106712981B (en) 2015-07-23 2015-07-23 Node change notification method and device

Country Status (1)

Country Link
CN (1) CN106712981B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107832159A (en) * 2017-11-10 2018-03-23 郑州云海信息技术有限公司 Manage the method and computer-readable recording medium of distributed lock
CN108038005A (en) * 2017-12-28 2018-05-15 广东蜂助手网络技术股份有限公司 Shared resource access method, client, server-side, system based on zookeeper
CN109753540A (en) * 2018-12-03 2019-05-14 新华三云计算技术有限公司 Shared resource access method, device and computer-readable storage medium
CN110166528A (en) * 2019-04-16 2019-08-23 平安科技(深圳)有限公司 The method, apparatus and computer equipment for preventing node Notification of Changes from losing
CN110266779A (en) * 2019-06-10 2019-09-20 南威软件股份有限公司 A kind of principal and subordinate local timed task processing method and system based on zookeeper
CN110661637A (en) * 2018-06-30 2020-01-07 华为技术有限公司 Distributed system member changing method and distributed system
CN110677453A (en) * 2019-08-15 2020-01-10 平安普惠企业管理有限公司 ZooKeeper-based distributed lock service implementation method, device, equipment and storage medium
CN112099962A (en) * 2020-11-06 2020-12-18 成都新希望金融信息有限公司 Distributed lock implementation method and device and electronic equipment
CN112486695A (en) * 2020-12-07 2021-03-12 浪潮云信息技术股份公司 Distributed lock implementation method under high concurrency service
CN114661742A (en) * 2022-03-28 2022-06-24 浪潮卓数大数据产业发展有限公司 Zookeeper-based distributed lock acquisition method and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1945539A (en) * 2006-10-19 2007-04-11 华为技术有限公司 Method for distributing shared resource lock in computer cluster system and cluster system
CN103744724A (en) * 2014-02-19 2014-04-23 互联网域名系统北京市工程研究中心有限公司 Timed task clustering method and device thereof
CN104702655A (en) * 2014-03-21 2015-06-10 杭州海康威视系统技术有限公司 Cloud storage resource distribution method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1945539A (en) * 2006-10-19 2007-04-11 华为技术有限公司 Method for distributing shared resource lock in computer cluster system and cluster system
CN103744724A (en) * 2014-02-19 2014-04-23 互联网域名系统北京市工程研究中心有限公司 Timed task clustering method and device thereof
CN104702655A (en) * 2014-03-21 2015-06-10 杭州海康威视系统技术有限公司 Cloud storage resource distribution method and system

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107832159A (en) * 2017-11-10 2018-03-23 郑州云海信息技术有限公司 Manage the method and computer-readable recording medium of distributed lock
CN108038005A (en) * 2017-12-28 2018-05-15 广东蜂助手网络技术股份有限公司 Shared resource access method, client, server-side, system based on zookeeper
CN110661637A (en) * 2018-06-30 2020-01-07 华为技术有限公司 Distributed system member changing method and distributed system
US11445013B2 (en) 2018-06-30 2022-09-13 Huawei Technologies Co., Ltd. Method for changing member in distributed system and distributed system
CN109753540A (en) * 2018-12-03 2019-05-14 新华三云计算技术有限公司 Shared resource access method, device and computer-readable storage medium
CN110166528B (en) * 2019-04-16 2022-03-18 平安科技(深圳)有限公司 Method and device for preventing node change notification from being lost and computer equipment
CN110166528A (en) * 2019-04-16 2019-08-23 平安科技(深圳)有限公司 The method, apparatus and computer equipment for preventing node Notification of Changes from losing
CN110266779A (en) * 2019-06-10 2019-09-20 南威软件股份有限公司 A kind of principal and subordinate local timed task processing method and system based on zookeeper
CN110677453A (en) * 2019-08-15 2020-01-10 平安普惠企业管理有限公司 ZooKeeper-based distributed lock service implementation method, device, equipment and storage medium
CN112099962B (en) * 2020-11-06 2021-02-19 成都新希望金融信息有限公司 Distributed lock implementation method and device and electronic equipment
CN112099962A (en) * 2020-11-06 2020-12-18 成都新希望金融信息有限公司 Distributed lock implementation method and device and electronic equipment
CN112486695A (en) * 2020-12-07 2021-03-12 浪潮云信息技术股份公司 Distributed lock implementation method under high concurrency service
CN114661742A (en) * 2022-03-28 2022-06-24 浪潮卓数大数据产业发展有限公司 Zookeeper-based distributed lock acquisition method and system

Also Published As

Publication number Publication date
CN106712981B (en) 2020-03-06

Similar Documents

Publication Publication Date Title
CN106712981A (en) Method and device for informing node change
US9544288B2 (en) Messaging gateway
US10638306B2 (en) Methods and apparatus for use in reducing signal latency in a mobile network with use of localized unified data management (UDM) entities
US11632247B2 (en) User security token invalidation
CN109388626B (en) Method and apparatus for assigning numbers to services
CN106657314A (en) Cross-data center data synchronization system and method
JP2017509936A (en) Facilitating third-party execution of batch processing of requests that require authorization from resource owners for repeated access to resources
WO2014116527A1 (en) Method and system for using a recursive event listener on a node in hierarchical data structure
CN110909521A (en) Synchronous processing method and device for online document information and electronic equipment
EP3629522A1 (en) Systems and methods for testing resilience of a distributed network
CN112751847A (en) Interface call request processing method and device, electronic equipment and storage medium
CN111752939A (en) Data processing method, device, computer system and medium for multiple systems
CN110609707B (en) Online data processing system generation method, device and equipment
US10764204B2 (en) Cloud extensibility framework
CN110401709A (en) Processing method, device and the storage medium of session in a kind of instant messaging application
CN108833147B (en) Configuration information updating method and device
CN110661857A (en) Data synchronization method and device
US20190155790A1 (en) Event-based synchronization in a file sharing environment
CN106487561A (en) The method and system that a kind of server service updates
CN111124635A (en) Task processing method and device, electronic equipment and storage medium
CN110768855A (en) Method and device for testing linkmzation performance
CN111984686A (en) Data processing method and device
CN116347467B (en) Method and system for managing user data by UDR in 5G network
CN110262756B (en) Method and device for caching data
CN116450725A (en) Method, apparatus, electronic device, and medium for performing database operations

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200922

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200922

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: Cayman Islands Grand Cayman capital building, a four storey No. 847 mailbox

Patentee before: Alibaba Group Holding Ltd.