CN109951508A - Request coordination approach and device, computer equipment and storage medium based on Zookeeper - Google Patents

Request coordination approach and device, computer equipment and storage medium based on Zookeeper Download PDF

Info

Publication number
CN109951508A
CN109951508A CN201711392683.XA CN201711392683A CN109951508A CN 109951508 A CN109951508 A CN 109951508A CN 201711392683 A CN201711392683 A CN 201711392683A CN 109951508 A CN109951508 A CN 109951508A
Authority
CN
China
Prior art keywords
node
zookeeper
request
transient
leader
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
CN201711392683.XA
Other languages
Chinese (zh)
Other versions
CN109951508B (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.)
China Mobile Communications Group Co Ltd
China Mobile Group Chongqing Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Chongqing 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 China Mobile Communications Group Co Ltd, China Mobile Group Chongqing Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201711392683.XA priority Critical patent/CN109951508B/en
Publication of CN109951508A publication Critical patent/CN109951508A/en
Application granted granted Critical
Publication of CN109951508B publication Critical patent/CN109951508B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of request coordination approach and device, computer equipment and storage medium based on Zookeeper.Wherein, the request coordination approach based on Zookeeper includes: the write request for receiving client;All service nodes in Zookeeper cluster are mapped on node cycle;By the distance of every two adjacent node on agent node calculate node ring, leader node is obtained according to distance;By agent node table of query and routing, write request is committed to leader node and is handled.According to embodiments of the present invention, it compensates in existing ZooKeeper cluster Leader election to Server quantitative requirement, improves ZooKeeper cluster ability extending transversely and fault-tolerance;Agent node table of query and routing is introduced to client request through street by avoiding existing customer end and writing low efficiency problem caused by holotype or write Data Consistency caused by arbitrary patterns.

Description

Request coordination approach and device, computer equipment and storage based on Zookeeper Medium
Technical field
The invention belongs to distributed system Clustering field more particularly to a kind of request coordinations based on Zookeeper Method, request conditioning unit, computer equipment and computer storage medium based on Zookeeper.
Background technique
ZooKeeper is one and provides the software of Consistency service for Distributed Application, and distributed application program can be with base The functions such as configuration management, name Service, distributed lock, cluster management, queue management are realized in it.
ZooKeeper technology in the related technology has following defects that one side, the leader node of ZooKeeper (Leader) election is based on message transmission consistency algorithm (paxos algorithm), and paxos algorithm is in some service node (Server) Leader can be just proposed as by getting in the case that most of Server are supported, therefore, which is a weight Multiple recursive process, prevent the Server quantity of election is participated in from too many, meanwhile, the sum of Server must be odd number 2n+ 1, and the number for the Server survived must not be less than n+1, which limits the scalability of ZooKeeper and fault-tolerant abilitys.Or The only only selection m platform server operation ZooKeeper service from n platform server, guaranteeing when entire cluster reboot or The data of ZooKeeper service do not migrate when server delay machine more than half where ZooKeeper service, but this situation meeting There is the server of n-m for standby mode, causes the processing capacity of entire server cluster there was only whole m/n, cause resource Waste.Or select the smallest node of number as Leader node every time, but this situation does not account for the negative of node It carries situation and realizes load balancing.
On the other hand, the read and write access of client, which is write to advocate peace, writes any both of which, when writing holotype, by client Leader submitted to the modification of data, all write requests being submitted in follower (Follower) client need from Follower hands to Leader processing, and treatment effeciency is not high;When writing arbitrary patterns, client can propose the modification of data Any Server node is given, there are the consistency of data and deadlock risks.
Therefore, Leader section how can be rapidly completed when ZooKeeper cluster increases newly or deletes server node Point election, and optimize existing ZooKeeper cluster service presentation mode as urgent problem to be solved.
Summary of the invention
The embodiment of the present invention provides a kind of request coordination approach based on Zookeeper, a kind of asking based on Zookeeper Conditioning unit, a kind of computer equipment and a kind of computer storage medium are asked, can make up for it ZooKeeper cluster Leader choosing To the limitation requirement of Server quantity in act, the ability and fault-tolerance extending transversely of ZooKeeper cluster are improved, is introduced simultaneously Agent node realize to the through street of client request by, avoid existing customer end write low efficiency problem caused by holotype or Write Data Consistency caused by arbitrary patterns.
On the one hand, the embodiment of the present invention provides a kind of request coordination approach based on Zookeeper, and method includes:
Receive the write request of client;All service nodes in Zookeeper cluster are mapped on node cycle;Pass through The distance of every two adjacent node, obtains leader node according to distance on agent node calculate node ring;It is looked by agent node Routing table is ask, write request is committed to leader node and is handled.In the above-mentioned technical solutions, it is preferable that by Zookeeper collection All service nodes in group map to the step on node cycle, specifically include: for all service sections in Zookeeper cluster Point creation transient node, and calculate the cryptographic Hash of the absolute path of each transient node;The cryptographic Hash of each transient node is reflected It is incident upon on node cycle, makes the node on the equal corresponding node ring of each transient node.
In any of the above-described technical solution, it is preferable that pass through every two adjacent node on agent node calculate node ring Distance, specifically includes: by agent node according to clockwise direction calculate node ring the step of obtaining leader node according to distance The distance of upper every two adjacent node;When interim with the last one for first transient node apart from the smallest two adjacent nodes When node, using first transient node as leader node;It is temporarily saved when not being first apart from the smallest two adjacent nodes When point and the last one transient node, using the big transient node of cryptographic Hash in two nodes as leader node.
In any of the above-described technical solution, it is preferable that further include: by agent node save node cycle on nodal information and The information of routing table.
In any of the above-described technical solution, it is preferable that further include: when Zookeeper cluster increases service node newly, pass through Agent node is that newly-increased service node creates newly-increased transient node;Newly-increased transient node is mapped on node cycle, is recalculated Leader node, and update the nodal information on node cycle and routing table information.
In any of the above-described technical solution, it is preferable that further include: when Zookeeper cluster deletes any service node, Any transient node is deleted on node cycle, recalculates leader node, and updates the nodal information on node cycle and routing table Information.
In any of the above-described technical solution, it is preferable that further include: receive the read request of client and the Hash of read request Value;The cryptographic Hash of read request is mapped to the corresponding position on node cycle by agent node;Obtain the cryptographic Hash with read request Processing node of the adjacent transient node as read request clockwise, and read request is handled by handling node.
On the other hand, the embodiment of the invention provides a kind of request conditioning unit based on Zookeeper, device include:
Receiving module, for receiving the write request of client;And all service nodes in Zookeeper cluster are reflected It is incident upon on node cycle;Computing module, for the distance by every two adjacent node on agent node calculate node ring, according to away from From obtaining leader node;Processing module, for write request being committed to leader node and is carried out by agent node table of query and routing Processing.
In another aspect, the embodiment of the invention provides a kind of computer equipment, equipment includes:
Processor and the memory for being stored with computer program instructions;Processor is realized when executing computer program instructions Such as the request coordination approach based on Zookeeper in any of the above-described technical solution.
In another aspect, the embodiment of the invention provides a kind of computer storage medium,
Computer program instructions are stored in computer storage medium, realization when computer program instructions are executed by processor The request coordination approach based on Zookeeper in any of the above-described technical solution.
Dress is coordinated in the request coordination approach based on Zookeeper of the embodiment of the present invention, the request based on Zookeeper It sets, computer equipment and computer storage medium, on the one hand, according to the distance for mapping to every two adjacent node on node cycle Leader node is obtained, the limitation requirement in existing ZooKeeper cluster Leader election to Server quantity is compensated for, improves The ability and fault-tolerance extending transversely of ZooKeeper cluster;On the other hand, the processing node of read request is the Kazakhstan with read request The adjacent transient node of uncommon value clockwise direction, so that the read request that Leader node undertakes is less, remaining node passes through Hash Mode select processing read request, thus the load of balanced Servers-all node;In another aspect, introducing agent node saves section The information of nodal information and routing table on point ring, safeguards the routing table of a server node, when newly-increased or one clothes of deletion Be engaged in device node, agent node updates nodal information and routing table information on node cycle, realize the through street of client request by, Existing customer end is avoided to write low efficiency problem caused by holotype or write Data Consistency caused by arbitrary patterns.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, will make below to required in the embodiment of the present invention Attached drawing is briefly described, for those of ordinary skill in the art, without creative efforts, also Other drawings may be obtained according to these drawings without any creative labor.
Fig. 1 shows the process signal of the request coordination approach provided by one embodiment of the present invention based on Zookeeper Figure;
Fig. 2 shows another embodiment of the present invention provides the request coordination approach based on Zookeeper process Schematic diagram;
Fig. 3 shows the corresponding EPHEMERAL catalogue section of Server node that a specific embodiment of the invention provides Point tree schematic diagram;
Fig. 4 shows the Server node cycle schematic diagram that a specific embodiment of the invention provides;
Fig. 5 shows the process of the request coordination approach based on Zookeeper of yet another embodiment of the present invention offer Schematic diagram;
Fig. 6 shows the process for the request coordination approach based on Zookeeper that another embodiment of the invention provides Schematic diagram;
Fig. 7 shows the newly-increased server node schematic diagram that a specific embodiment of the invention provides;
Fig. 8 shows the process for the request coordination approach based on Zookeeper that another embodiment of the invention provides Schematic diagram;
Fig. 9 shows the corresponding processing node schematic diagram of client request that a specific embodiment of the invention provides;
Figure 10 shows the structural representation of the request conditioning unit provided by one embodiment of the present invention based on Zookeeper Figure;
Figure 11 shows the schematic diagram of the request coordination system provided by one embodiment of the present invention based on Zookeeper;
Figure 12 shows computer equipment structural schematic diagram provided by one embodiment of the present invention;
Figure 13 shows the computer equipment structural schematic diagram of another embodiment of the present invention offer.
Specific embodiment
The feature and exemplary embodiment of various aspects of the invention is described more fully below, in order to make mesh of the invention , technical solution and advantage be more clearly understood, below in conjunction with drawings and the specific embodiments, the present invention is carried out further detailed Description.It should be understood that specific embodiment described herein is only configured to explain the present invention, it is not configured as limiting this hair It is bright.To those skilled in the art, the present invention can be in the case where not needing some details in these details Implement.The description of embodiment is preferably managed just for the sake of being provided by showing example of the invention of the invention below Solution.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence " including ... ", it is not excluded that including There is also other identical elements in the process, method, article or equipment of the element.
In order to solve prior art problem, the embodiment of the invention provides a kind of request coordination side based on Zookeeper Method, a kind of request conditioning unit based on Zookeeper, a kind of computer equipment and a kind of storage of computer are situated between.Lower kept man of a noblewoman The request coordination approach based on Zookeeper is first provided for the embodiments of the invention to be introduced.
Fig. 1 shows the process signal of the request coordination approach provided by one embodiment of the present invention based on Zookeeper Figure.As shown in Figure 1, this method comprises:
Step 102, the write request of client is received;
Step 104, all service nodes in Zookeeper cluster are mapped on node cycle;
Step 106, it by the distance of every two adjacent node on agent node calculate node ring, is led according to distance Node;
Step 108, by agent node table of query and routing, write request is committed to leader node and is handled.
Request coordination approach provided by the invention based on Zookeeper will in the write request for receiving client All service nodes in Zookeeper cluster map on node cycle, and each service node is with regard to one on corresponding node ring Point, the distance of every two adjacent node, obtains leader node according to distance, and then pass through agency on agent node calculate node ring Write request is committed to leader node and is handled by querying node routing table.The present invention passes through every two phase on calculate node ring The distance of neighbors obtains leader node, compensates in existing ZooKeeper cluster Leader election to Server quantity Limitation requires, and improves the ability and fault-tolerance extending transversely of ZooKeeper cluster;Agent node table of query and routing is introduced, it is real Now to the through street of client request by avoiding existing customer end and writing low efficiency problem caused by holotype or write arbitrary patterns Caused Data Consistency.
Fig. 2 shows another embodiment of the present invention provides the request coordination approach based on Zookeeper process Schematic diagram.Wherein, this method comprises:
Step 202, the write request of client is received;
Step 204, transient node is created for all service nodes in Zookeeper cluster, and calculates each interim section The cryptographic Hash of the absolute path of point;
Step 206, the cryptographic Hash of each transient node is mapped on node cycle, makes the equal corresponding node of each transient node Node on ring;
Step 208, it by the distance of every two adjacent node on agent node calculate node ring, is led according to distance Node;
Step 210, by agent node table of query and routing, write request is committed to leader node and is handled.
In this embodiment, unique interim (EPHEMERAL) node is created for each Server node, then counted The corresponding absolute path cryptographic Hash of each EPHEMERAL is calculated, obtained cryptographic Hash is mapped on node cycle, wherein cryptographic Hash It can be 32 cryptographic Hash, 64 cryptographic Hash etc., realize and all service nodes in Zookeeper cluster are mapped into node cycle On.
When it is implemented, being created to a ZooKeeper cluster with n Server node for each Server node A unique EPHEMERAL node is built, it is corresponding that Fig. 3 shows the Server node that a specific embodiment of the invention provides EPHEMERAL directory node tree schematic diagram, wherein the Server node from/name1 to/name n is corresponding unique EPHEMERAL node (node 1 to node n).Then 32 Hash are calculated to the corresponding absolute path of each EPHEMERAL node Obtained cryptographic Hash is mapped to as shown in Figure 4 one with 2 by value32On the annulus of a node, wherein each Server section Point just corresponds to a point on annulus.
Fig. 5 shows the process of the request coordination approach based on Zookeeper of yet another embodiment of the present invention offer Schematic diagram.Wherein, this method comprises:
Step 502, the write request of client is received;
Step 504, transient node is created for all service nodes in Zookeeper cluster, and calculates each interim section The cryptographic Hash of the absolute path of point;
Step 506, the cryptographic Hash of each transient node is mapped on node cycle, makes the equal corresponding node of each transient node Node on ring;
Step 508, by agent node according to the distance of every two adjacent node on clockwise direction calculate node ring;
Step 510, when being first transient node and the last one transient node apart from the smallest two adjacent nodes, Using first transient node as leader node;
Step 512, when not being first transient node and the last one transient node apart from the smallest two adjacent nodes When, using the big transient node of cryptographic Hash in two nodes as leader node;
Step 514, by agent node table of query and routing, write request is committed to leader node and is handled.
In this embodiment, according to the distance of every two adjacent node on clockwise direction calculate node ring, selected distance The smallest two adjacent nodes, when the two adjacent nodes are first transient node and the last one transient node, by the One transient node is as Leader node, when not being first transient node and the last one transient node, by two nodes The big transient node of middle cryptographic Hash realizes the selection that Leader node is carried out according to the distance of two nodes as Leader node, The limitation requirement in existing ZooKeeper cluster Leader node election to Server quantity is compensated for, is improved The ability and fault-tolerance extending transversely of ZooKeeper cluster.
When it is implemented, calculating the distance of two neighboring node on annulus in the direction of the clock, take apart from two the smallest The biggish node of cryptographic Hash in node is as Leader node, as shown in Figure 4, wherein m-1 node and m-th The distance between node minimum, then taking m-th of node is Leader node.But if the distance of n-th of node and the 1st node It is minimum then take the 1st node be Leader node.
In any of the above-described embodiment, it is preferable that save the nodal information and routing table on node cycle by agent node Information.
In this embodiment, agent node saves server node ring information and Leader nodal information, and safeguards one The routing table of server node, when client is initiated to request, agent node is committed to request accordingly by table of query and routing Node is handled, thus realize the through street of client request by.
Fig. 6 shows the process for the request coordination approach based on Zookeeper that another embodiment of the invention provides Schematic diagram.Wherein, this method comprises:
Step 602, the write request of client is received;
Step 604, transient node is created for all service nodes in Zookeeper cluster, and calculates each interim section The cryptographic Hash of the absolute path of point;
Step 606, the cryptographic Hash of each transient node is mapped on node cycle, makes the equal corresponding node of each transient node Node on ring;
Step 608, by agent node according to the distance of every two adjacent node on clockwise direction calculate node ring;When When apart from the smallest two adjacent nodes being first transient node and the last one transient node, first transient node is made For leader node;It, will when not being first transient node and the last one transient node apart from the smallest two adjacent nodes The big transient node of cryptographic Hash is as leader node in two nodes;
Step 610, by agent node table of query and routing, write request is committed to leader node and is handled;
It step 612, is newly-increased service node creation by agent node when Zookeeper cluster increases service node newly Newly-increased transient node;
Step 614, newly-increased transient node is mapped on node cycle, recalculates leader node, and update on node cycle Nodal information and routing table information;
Step 616, when Zookeeper cluster deletes any service node, any transient node is deleted on node cycle, Leader node is recalculated, and updates the nodal information on node cycle and routing table information.
In this embodiment, on the one hand, for a server node that is arbitrarily newly-increased or deleting, can all be mapped in node On one node of ring, the election of Leader node can be rapidly completed when server cluster is extending transversely for realization, avoid existing There is the drawbacks of bigger convergence of the Paxos algorithm cluster of ZooKeeper cluster is slower and server number of nodes is necessary for odd number, separately On the one hand, the EPHEMERAL node state of agent node real time monitoring ZooKeeper cluster, when newly-increased or one service of deletion Device node, then update nodal information and routing table information on node cycle, so realize the through street of client request by.
When it is implemented, agent node recalculates ZooKeeper cluster when increasing a server node newly Leader node, while updating node cycle information and routing table information.A newly-increased node only will affect newly-increased node to increasing newly Node prolongs the read request between the anticlockwise upper node of node cycle, and Fig. 7 shows a specific implementation of the invention Example provide newly-increased server node schematic diagram, wherein between m and n node increase newly a node k, then only will affect node m and Read request between node k, the part read request are handled by the node k of node n transfer till now before.Write request is by updating Leader node afterwards undertakes.
When deleting a server node, agent node recalculates ZooKeeper cluster Leader node, while more New node ring information and routing table information.Deleting a node only will affect deletion of node to deletion of node to prolong node cycle counterclockwise Read request between a upper node, as shown in fig. 7, then only will affect node such as the node k between deletion of node m and node n Read request between m and node k, the part read request are handled by the node n of node k transfer till now before.Write request by Updated Leader node undertakes.
Fig. 8 shows the process for the request coordination approach based on Zookeeper that another embodiment of the invention provides Schematic diagram.Wherein, this method comprises:
Step 802, the write request of client is received;
Step 804, transient node is created for all service nodes in Zookeeper cluster, and calculates each interim section The cryptographic Hash of the absolute path of point;
Step 806, the cryptographic Hash of each transient node is mapped on node cycle, makes the equal corresponding node of each transient node Node on ring;
Step 808, by agent node according to the distance of every two adjacent node on clockwise direction calculate node ring;When When apart from the smallest two adjacent nodes being first transient node and the last one transient node, first transient node is made For leader node;It, will when not being first transient node and the last one transient node apart from the smallest two adjacent nodes The big transient node of cryptographic Hash is as leader node in two nodes;
Step 810, by agent node table of query and routing, write request is committed to leader node and is handled;
It step 812, is newly-increased service node creation by agent node when Zookeeper cluster increases service node newly Newly-increased transient node;Newly-increased transient node is mapped on node cycle, leader node is recalculated, and updates the section on node cycle Point information and routing table information;When Zookeeper cluster deletes any service node, any interim section is deleted on node cycle Point recalculates leader node, and updates the nodal information on node cycle and routing table information;
Step 814, the read request of client and the cryptographic Hash of read request are received;
Step 816, the cryptographic Hash of read request is mapped to by agent node by the corresponding position on node cycle;
Step 818, processing of the transient node adjacent with the cryptographic Hash of read request clockwise direction as read request is obtained Node, and read request is handled by handling node.
In this embodiment, in the read request for receiving client, the processing node of read request is the Kazakhstan with read request The adjacent transient node of uncommon value clockwise direction, due between the Leader node and an anticlockwise upper node of selection Distance is minimum, and the cryptographic Hash for mapping to the read request between Leader node and its anticlockwise upper node is less, because This, the read request undertaken is less, remaining node selects processing read request by way of Hash, thus balanced Servers-all The load of node;Meanwhile realizing that Servers-all runs ZooKeeper service, it can make full use of server resource, avoid The idle waste of server.
When it is implemented, client carries the read request while issuing read request for the read request of client Corresponding 32 cryptographic Hash, which is mapped on node cycle by agent node according to consistency hash algorithm, and takes side clockwise To first Server node as the processing node of the read request, Fig. 9 shows one specific embodiment of the present invention and provides The corresponding processing node schematic diagram of client request.As shown in example in figure, the read request 1 of client is reflected by hash algorithm It being mapped on the node cycle between node 1 and node 2, a clockwise direction node of hinting obliquely at for the read request 1 of client is node 2, Therefore, processing node of the node 2 as read request.
Figure 10 shows the structure of the request conditioning unit 100 provided by one embodiment of the present invention based on Zookeeper Schematic diagram.
Wherein, the request conditioning unit 100 based on Zookeeper includes:
Receiving module 112, for receiving the write request of client;And by all service sections in Zookeeper cluster Point maps on node cycle;
Computing module 114, for the distance by every two adjacent node on agent node calculate node ring, according to distance Obtain leader node;
Processing module 116, for by agent node table of query and routing, write request to be committed at leader node Reason.
Request conditioning unit provided by the invention based on Zookeeper will in the write request for receiving client All service nodes in Zookeeper cluster map on node cycle, and each service node is with regard to one on corresponding node ring Point, the distance of every two adjacent node, obtains leader node according to distance, and then pass through agency on agent node calculate node ring Write request is committed to leader node and is handled by querying node routing table.The present invention passes through every two phase on calculate node ring The distance of neighbors obtains leader node, compensates in existing ZooKeeper cluster Leader election to Server quantity Limitation requires, and improves the ability and fault-tolerance extending transversely of ZooKeeper cluster;Agent node table of query and routing is introduced, it is real Now to the through street of client request by avoiding existing customer end and writing low efficiency problem caused by holotype or write arbitrary patterns Caused Data Consistency.
Figure 11 shows the schematic diagram of the request coordination system provided by one embodiment of the present invention based on Zookeeper. Wherein, which includes ZooKeeper cluster, agent node, multiple client, by agent node calculate node node on the ring it Between distance obtain the leader node in ZooKeeper cluster, act on behalf of querying node routing table client after obtaining leader node The write request at end is committed to leader node and is handled.Or the value is mapped to section according to consistency hash algorithm by agent node Put on ring and take the processing node for the read request that first node sends clockwise as client.
Figure 12 shows 120 structural schematic diagram of computer equipment provided in an embodiment of the present invention.
It may include processor 122 and the memory 124 for being stored with computer program instructions in computer equipment 120.
Specifically, above-mentioned processor 122 may include central processing unit (CPU) or specific integrated circuit (Application Specific Integrated Circuit, ASIC), or may be configured to implement implementation of the present invention One or more integrated circuits of example.
Memory 124 may include the mass storage for data or instruction.For example it rather than limits, memory 124 may include hard disk drive (Hard Disk Drive, HDD), floppy disk drive, flash memory, CD, magneto-optic disk, tape or logical With the combination of universal serial bus (Universal Serial Bus, USB) driver or two or more the above.It is closing In the case where suitable, memory 124 may include the medium of removable or non-removable (or fixed).In a suitable case, it stores Device 124 can be inside or outside synthesized gateway disaster tolerance equipment.In a particular embodiment, memory 124 is nonvolatile solid state Memory.In a particular embodiment, memory 124 includes read-only memory (ROM).In a suitable case, which can be ROM, programming ROM (PROM), erasable PROM (EPROM), the electric erasable PROM (EEPROM), electrically rewritable of masked edit program The combination of ROM (EAROM) or flash memory or two or more the above.
Processor 122 is by reading and executing the computer program instructions stored in memory 124, to realize above-mentioned implementation Any one request coordination approach based on Zookeeper in example.
In one example, computer equipment may also include communication interface 136 and bus 138.Wherein, as shown in figure 13, Processor 132, memory 134, communication interface 136 connect by bus 138 and complete mutual communication.
Communication interface 136 is mainly used for realizing in the embodiment of the present invention between each module, device, unit and/or equipment Communication.
Bus 138 includes hardware, software or both, and the component of online data charge on traffic equipment is coupled to each other one It rises.For example it rather than limits, bus may include accelerated graphics port (AGP) or other graphics bus, enhancing industrial standard frame Structure (EISA) bus, front side bus (FSB), super transmission (HT) interconnection, Industry Standard Architecture (ISA) bus, infinite bandwidth interconnection, Low pin count (LPC) bus, memory bus, micro- channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI- Express (PCI-X) bus, Serial Advanced Technology Attachment (SATA) bus, Video Electronics Standards Association part (VLB) bus or The combination of other suitable buses or two or more the above.In a suitable case, bus 138 may include one Or multiple buses.Although specific bus has been described and illustrated in the embodiment of the present invention, the present invention considers any suitable bus Or interconnection.
The computer equipment executes the request coordination approach based on Zookeeper in the embodiment of the present invention, to realize The request coordination approach and device based on Zookeeper described in conjunction with Fig. 1 and Figure 11.
In addition, in conjunction with the request coordination approach based on Zookeeper in above-described embodiment, the embodiment of the present invention be can provide A kind of computer storage medium is realized.Computer program instructions are stored in the computer storage medium;The computer program Any one request coordination approach based on Zookeeper in above-described embodiment is realized in instruction when being executed by processor.
It should be clear that the invention is not limited to specific configuration described above and shown in figure and processing. For brevity, it is omitted here the detailed description to known method.In the above-described embodiments, several tools have been described and illustrated The step of body, is as example.But method process of the invention is not limited to described and illustrated specific steps, this field Technical staff can be variously modified, modification and addition after understanding spirit of the invention, or suitable between changing the step Sequence.
Functional block shown in structures described above block diagram can be implemented as hardware, software, firmware or their group It closes.When realizing in hardware, it may, for example, be electronic circuit, specific integrated circuit (ASIC), firmware appropriate, insert Part, function card etc..When being realized with software mode, element of the invention is used to execute program or the generation of required task Code section.Perhaps code segment can store in machine readable media program or the data-signal by carrying in carrier wave is passing Defeated medium or communication links are sent." machine readable media " may include any medium for capableing of storage or transmission information. The example of machine readable media includes electronic circuit, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), soft Disk, CD-ROM, CD, hard disk, fiber medium, radio frequency (RF) link, etc..Code segment can be via such as internet, inline The computer network of net etc. is downloaded.
It should also be noted that, the exemplary embodiment referred in the present invention, is retouched based on a series of step or device State certain methods or system.But the present invention is not limited to the sequence of above-mentioned steps, that is to say, that can be according in embodiment The sequence referred to executes step, may also be distinct from that the sequence in embodiment or several steps are performed simultaneously.
The above description is merely a specific embodiment, it is apparent to those skilled in the art that, For convenience of description and succinctly, the system, module of foregoing description and the specific work process of unit can refer to preceding method Corresponding process in embodiment, details are not described herein.It should be understood that scope of protection of the present invention is not limited thereto, it is any to be familiar with Those skilled in the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or substitutions, These modifications or substitutions should be covered by the protection scope of the present invention.

Claims (10)

1. a kind of request coordination approach based on Zookeeper characterized by comprising
Receive the write request of client;
All service nodes in the Zookeeper cluster are mapped on node cycle;
The distance that every two adjacent node on the node cycle is calculated by agent node obtains leader's section according to the distance Point;
By the agent node table of query and routing, the write request is committed to the leader node and is handled.
2. the request coordination approach according to claim 1 based on Zookeeper, which is characterized in that will be described All service nodes in Zookeeper cluster map to the step on the node cycle, specifically include:
Transient node is created for all service nodes in the Zookeeper cluster, and calculates each transient node The cryptographic Hash of absolute path;
The cryptographic Hash of each transient node is mapped on node cycle, make each transient node it is corresponding described in Node on node cycle.
3. the request coordination approach according to claim 2 based on Zookeeper, which is characterized in that pass through the agency The step of node calculates the distance of every two adjacent node on the node cycle, obtains the leader node according to the distance, It specifically includes:
By the agent node according to the distance for calculating every two adjacent node on the node cycle clockwise;
When being first transient node and the last one transient node apart from the smallest two adjacent nodes, by described first Transient node is as leader node;
It, will be in two nodes when not being first transient node and the last one transient node apart from the smallest two adjacent nodes The big transient node of cryptographic Hash is as leader node.
4. the request coordination approach according to claim 1 based on Zookeeper, which is characterized in that further include:
The information of the nodal information and the routing table on the node cycle is saved by the agent node.
5. the request coordination approach according to claim 4 based on Zookeeper, which is characterized in that further include:
It is that the newly-increased service node creates by the agent node when the Zookeeper cluster increases service node newly Newly-increased transient node;
The newly-increased transient node is mapped on the node cycle, the leader node is recalculated, and updates the node Nodal information and the routing table information on ring.
6. the request coordination approach according to claim 4 based on Zookeeper, which is characterized in that further include:
When the Zookeeper cluster deletes any service node, any transient node is deleted on the node cycle, The leader node is recalculated, and updates the nodal information on the node cycle and the routing table information.
7. the request coordination approach as claimed in any of claims 1 to 6 based on Zookeeper, which is characterized in that Further include:
Receive the read request of the client and the cryptographic Hash of the read request;
The cryptographic Hash of the read request is mapped to the corresponding position on the node cycle by the agent node;
Processing node of the transient node adjacent with the cryptographic Hash of read request clockwise direction as the read request is obtained, And the read request is handled by the processing node.
8. a kind of request conditioning unit based on Zookeeper characterized by comprising
Receiving module, for receiving the write request of client;And all service nodes in the Zookeeper cluster are reflected It is incident upon on node cycle;
Computing module, for calculating the distance of every two adjacent node on the node cycle by agent node, according to it is described away from From obtaining leader node;
Processing module, for by the agent node table of query and routing, the write request be committed to the leader node into Row processing.
9. a kind of computer equipment, which is characterized in that the equipment includes: processor and is stored with computer program instructions Memory;
It realizes when the processor executes the computer program instructions and is based on as claimed in any of claims 1 to 7 in one of claims The request coordination approach of Zookeeper.
10. a kind of computer storage medium, which is characterized in that be stored with computer program in the computer storage medium and refer to It enables, realizes when the computer program instructions are executed by processor and be based on as claimed in any of claims 1 to 7 in one of claims The request coordination approach of Zookeeper.
CN201711392683.XA 2017-12-21 2017-12-21 Zookeeper-based request coordination method and device, computer equipment and storage medium Active CN109951508B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711392683.XA CN109951508B (en) 2017-12-21 2017-12-21 Zookeeper-based request coordination method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711392683.XA CN109951508B (en) 2017-12-21 2017-12-21 Zookeeper-based request coordination method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109951508A true CN109951508A (en) 2019-06-28
CN109951508B CN109951508B (en) 2022-02-25

Family

ID=67004649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711392683.XA Active CN109951508B (en) 2017-12-21 2017-12-21 Zookeeper-based request coordination method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109951508B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597809A (en) * 2019-08-21 2019-12-20 中山大学 Consistency algorithm system supporting tree-shaped data structure and implementation method thereof
CN111212123A (en) * 2019-12-26 2020-05-29 天津中科曙光存储科技有限公司 ZooKeeper-based Lunmap management method
CN111447097A (en) * 2020-04-20 2020-07-24 国网甘肃省电力公司信息通信公司 Cloud platform resource scheduling management method and system
CN113518116A (en) * 2021-05-18 2021-10-19 广州泳泳信息科技有限公司 Leader server election method and device based on Fast Paxos algorithm

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468379A (en) * 2013-09-16 2015-03-25 浙江大学 Virtual Hadoop cluster node selection method and device based on shortest logical distance
CN104852934A (en) * 2014-02-13 2015-08-19 阿里巴巴集团控股有限公司 Method for realizing flow distribution based on front-end scheduling, device and system thereof
US20160132518A1 (en) * 2012-12-31 2016-05-12 Facebook, Inc. Placement policy
CN106572153A (en) * 2016-10-21 2017-04-19 乐视控股(北京)有限公司 Data storage method and device of cluster
CN106936899A (en) * 2017-02-25 2017-07-07 九次方大数据信息集团有限公司 The collocation method of distributed statistical analysis system and distributed statistical analysis system
CN107016039A (en) * 2017-01-06 2017-08-04 阿里巴巴集团控股有限公司 The method and Database Systems of database write-in

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160132518A1 (en) * 2012-12-31 2016-05-12 Facebook, Inc. Placement policy
CN104468379A (en) * 2013-09-16 2015-03-25 浙江大学 Virtual Hadoop cluster node selection method and device based on shortest logical distance
CN104852934A (en) * 2014-02-13 2015-08-19 阿里巴巴集团控股有限公司 Method for realizing flow distribution based on front-end scheduling, device and system thereof
CN106572153A (en) * 2016-10-21 2017-04-19 乐视控股(北京)有限公司 Data storage method and device of cluster
CN107016039A (en) * 2017-01-06 2017-08-04 阿里巴巴集团控股有限公司 The method and Database Systems of database write-in
CN106936899A (en) * 2017-02-25 2017-07-07 九次方大数据信息集团有限公司 The collocation method of distributed statistical analysis system and distributed statistical analysis system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597809A (en) * 2019-08-21 2019-12-20 中山大学 Consistency algorithm system supporting tree-shaped data structure and implementation method thereof
CN110597809B (en) * 2019-08-21 2023-05-23 中山大学 Consistency algorithm system supporting tree-like data structure and implementation method thereof
CN111212123A (en) * 2019-12-26 2020-05-29 天津中科曙光存储科技有限公司 ZooKeeper-based Lunmap management method
CN111447097A (en) * 2020-04-20 2020-07-24 国网甘肃省电力公司信息通信公司 Cloud platform resource scheduling management method and system
CN113518116A (en) * 2021-05-18 2021-10-19 广州泳泳信息科技有限公司 Leader server election method and device based on Fast Paxos algorithm
CN113518116B (en) * 2021-05-18 2022-04-01 广州泳泳信息科技有限公司 Leader server election method and device based on Fast Paxos algorithm

Also Published As

Publication number Publication date
CN109951508B (en) 2022-02-25

Similar Documents

Publication Publication Date Title
CN107819829B (en) Method and system for accessing block chain, block chain node point equipment and user terminal
CN109951508A (en) Request coordination approach and device, computer equipment and storage medium based on Zookeeper
CN110019211A (en) The methods, devices and systems of association index
CN108769111A (en) A kind of server connection method, computer readable storage medium and terminal device
CN109522314B (en) Block chain-based data archiving method and terminal equipment
CN109508326B (en) Method, device and system for processing data
CN106575251B (en) Speculative data processing of streaming data
CN104636286A (en) Data access method and equipment
WO2021051782A1 (en) Consensus method, apparatus and device of block chain
CN109561151A (en) Date storage method, device, server and storage medium
CN114185678A (en) Data storage method, device, equipment and storage medium
US20160041925A1 (en) Balanced cache for recently frequently used data
CN109739433A (en) The method and terminal device of data processing
CN110019093A (en) Method for writing data, device, equipment and medium
US10853370B2 (en) Devices and/or methods to provide a query response based on ephemeral data
CN115048254A (en) Simulation test method, system, equipment and readable medium of data distribution strategy
CN110674082B (en) Method and device for removing online document, electronic equipment and computer readable medium
CN108810130B (en) Method and device for planning distribution request
CN106686141A (en) Resource download method and resource download device
CN110427394A (en) Data manipulation method and device
CN116303246A (en) Storage increment statistical method, device, computer equipment and storage medium
US10146902B2 (en) Sharing global route topologies in detailed routing
CN115061947A (en) Resource management method, device, equipment and storage medium
CN116107801A (en) Transaction processing method and related product
CN108011735A (en) Community discovery method and device

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