CN109783126A - A kind of distribution Global ID's generation method and its device - Google Patents
A kind of distribution Global ID's generation method and its device Download PDFInfo
- Publication number
- CN109783126A CN109783126A CN201910022807.8A CN201910022807A CN109783126A CN 109783126 A CN109783126 A CN 109783126A CN 201910022807 A CN201910022807 A CN 201910022807A CN 109783126 A CN109783126 A CN 109783126A
- Authority
- CN
- China
- Prior art keywords
- global
- module
- local
- generation method
- distribution
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
The present invention relates to a kind of distributed Global ID generation methods, comprising the following steps: S1, receives instruction;S2, local time stamp is extracted;S3, determine whether existing corresponding node;S4, local code sequence is obtained;S5, acquisition request side's IP address and port code;S6, it generates request sequence information and is determined;S7, Global ID is generated;S8, Global ID is uploaded to backstage;A kind of distribution Global ID generating means, including receiving module, extraction module, the first determination module, the first acquisition module, the second acquisition module, the second determination module, generation module and uploading module.The present invention may be implemented unified management and generate distributed Global ID, it ensure that the advantages such as efficient, readable, orderly and single, external service system can be quickly accessed by HTTP interface, suitable for different business scenarios, operation system can be made to be absorbed in own service work, effectively increase working efficiency.
Description
Technical field
The present invention relates to a kind of distributed Global ID's generation method and its devices, belong to field of computer technology.
Background technique
With the development of internet technology, the process of generation of the people under different business scene is more and more frequent how
Carrying out effective management to these processes is urgent problem.There are two types of the solutions mainly used at present, the first
It is using database from increasing sequence, this mode has data continuity, uniqueness, code invasion less and using simple etc. excellent
It puts but there is the disadvantages of needing to dispose self contained data base example, visible performance bottleneck and Single Point of Faliure easily occurs;It is for second
Using UUID, its advantage is that ID is generated by locally completing, and performance is good, but that there is also ID is too long, storage redundancy, ID are unordered not
It is readable and the disadvantages of as major key index degraded performance.
Summary of the invention
In view of the deficiencies of the prior art, the present invention provides a kind of distributed Global ID generation methods, comprising the following steps:
S1, Global ID's generation instruction is received;
Local time stamp when S2, extract equipment application Global ID;
S3, determine the whether existing corresponding node of device id;
S4, corresponded manner is taken to obtain local code sequence based on judgement result;
S5, acquisition request side's IP address and port code;
S6, request sequence information is generated based on requesting party's IP address and port code and is determined;
S7, Global ID is generated based on local time stamp, device id and local code sequence;
S8, Global ID is uploaded to backstage.
Further, the Global ID is stored using 64 modes, and wherein highest order does not use and is always 0.
Further, the device id is made of 10bit, and distribution is managed by Zookeeper, described
Zookeeper is a kind of distributed application program coordination service of open source.
Further, the local time stamp is made of 41 bit, and minimum unit is millisecond.
Further, the judgement result in step S4 include it is existing, not there is no corresponding node;If it is determined that result is existing
Corresponding node, system obtain the corresponding local code sequence of device id automatically;If it is determined that result is not the presence of corresponding node, at the beginning of system
Beginningization present node simultaneously obtains local code sequence.
Further, if same equipment accesses more than one node in same time, different nodes successively it is generated most
The sequence code that big local code sequence numerically adds a generation new.
Further, the corresponding process of a node, system support that same equipment is at most 4096 corresponding in same time
Process.
Further, the local code sequence is made of 12bit.
Further, the judgement in step S6 includes if it is determined that result then terminates this instruction and generate operation not pass through;If
Determine that result is to pass through, then carries out in next step.
A kind of distribution Global ID generating means, comprising:
Receiving module generates instruction for receiving Global ID;
Extraction module, local time stamp when for extract equipment application Global ID;
First determination module, for determining the whether existing corresponding node of device id;
First obtains module, for by determining that result takes corresponded manner to obtain local code sequence;
Second obtains module, for acquisition request side's IP address and port code;
Second determination module, for generating request sequence information by requesting party's IP address and port code and determining;
Generation module, for generating Global ID by local time stamp, device id and local code sequence;And
Uploading module, for uploading Global ID to backstage.
The invention has the benefit that unified management generates distributed Global ID, ensure that efficient, readable, orderly and single
First-class advantage, external service system can be quickly accessed by HTTP interface, suitable for different business scenarios, can make business
System is absorbed in own service work, effectively increases working efficiency.
Detailed description of the invention
Fig. 1 show overview flow chart according to the present invention;
Fig. 2 show apparatus according to the invention connection figure;
Fig. 3 show A according to a particular embodiment of the invention;
Fig. 4 show B according to a particular embodiment of the invention.
Specific embodiment
It should be appreciated that the embodiment of the present invention can be by computer hardware, the combination of hardware and software or by depositing
The computer instruction in non-transitory computer-readable memory is stored up to be effected or carried out.Standard volume can be used in the method
Journey technology-includes that the non-transitory computer-readable storage media configured with computer program is realized in computer program,
In configured in this way storage medium computer is operated in a manner of specific and is predefined --- according in a particular embodiment
The method and attached drawing of description.Each program can with the programming language of level process or object-oriented come realize with department of computer science
System communication.However, if desired, the program can be realized with compilation or machine language.Under any circumstance, which can be volume
The language translated or explained.In addition, the program can be run on the specific integrated circuit of programming for this purpose.
In addition, the operation of process described herein can be performed in any suitable order, unless herein in addition instruction or
Otherwise significantly with contradicted by context.Process described herein (or modification and/or combination thereof) can be held being configured with
It executes, and is can be used as jointly on the one or more processors under the control of one or more computer systems of row instruction
The code (for example, executable instruction, one or more computer program or one or more application) of execution, by hardware or its group
It closes to realize.The computer program includes the multiple instruction that can be performed by one or more processors.
Further, the method can be realized in being operably coupled to suitable any kind of computing platform, wrap
Include but be not limited to PC, mini-computer, main frame, work station, network or distributed computing environment, individual or integrated
Computer platform or communicated with charged particle tool or other imaging devices etc..Each aspect of the present invention can be to deposit
The machine readable code on non-transitory storage medium or equipment is stored up to realize no matter be moveable or be integrated to calculating
Platform, such as hard disk, optical reading and/or write-in storage medium, RAM, ROM, so that it can be read by programmable calculator, when
Storage medium or equipment can be used for configuration and operation computer to execute process described herein when being read by computer.This
Outside, machine readable code, or part thereof can be transmitted by wired or wireless network.When such media include combining microprocessor
Or other data processors realize steps described above instruction or program when, invention as described herein including these and other not
The non-transitory computer-readable storage media of same type.When methods and techniques according to the present invention programming, the present invention
It further include computer itself.
Computer program can be applied to input data to execute function as described herein, to convert input data with life
At storing to the output data of nonvolatile memory.Output information can also be applied to one or more output equipments as shown
Device.In the preferred embodiment of the invention, the data of conversion indicate physics and tangible object, including the object generated on display
Reason and the particular visual of physical objects are described.
It should be noted that such as without Special Statement, in the disclosure used in the "an" of singular, " described " and
"the" is also intended to including most forms, unless the context clearly indicates other meaning.In addition, unless otherwise defined, this paper institute
All technical and scientific terms used are identical as the normally understood meaning of those skilled in the art.This paper specification
Used in term be intended merely to description specific embodiment, be not intended to be limiting of the invention.Term as used herein
"and/or" includes the arbitrary combination of one or more listed items.
(" such as ", " such as ") makes it should be appreciated that provided in this article any and all example or exemplary language
With being intended merely to that the embodiment of the present invention is better described, and unless the context requires otherwise, otherwise the scope of the present invention will not be applied
Limitation.
Next specific embodiments of the present invention are described further in conjunction with attached drawing:
It show overview flow chart according to the present invention referring to Fig.1, specifically includes the following steps:
S1, Global ID's generation instruction is received;The Global ID is stored using 64 modes, and wherein highest order does not use and begins
It is eventually 0;
Local time stamp when S2, extract equipment application Global ID;The device id is made of 10bit, and distribution passes through
Zookeeper is managed, and the Zookeeper is a kind of distributed application program coordination service of open source;When described local
Between stab and be made of 41 bit, minimum unit is millisecond;
S3, determine the whether existing corresponding node of device id;
S4, corresponded manner is taken to obtain local code sequence by judgement result;The judgement result include it is existing, do not deposit
In corresponding node;If it is determined that result is existing corresponding node, system obtains the corresponding local code sequence of device id automatically;If sentencing
Determining result is not the presence of corresponding node, and system initialization present node simultaneously obtains local code sequence;If same equipment is when identical
Between access more than one node, the sequence that different nodes successively numerically add a generation new in generated maximum local code sequence
Code;The corresponding process of one node, system support same equipment at most to correspond to 4096 processes in same time;The local
Sequence code is made of 12bit;
S5, acquisition request side's IP address and port code;
S6, request sequence information is generated by requesting party's IP address and port code and is determined;If the judgement result
Not pass through, then terminates this and generate operation;If it is determined that result is to pass through, then carry out in next step;
S7, Global ID is generated by local time stamp, device id and local code sequence;
S8, Global ID is uploaded to backstage.
Apparatus according to the invention connection figure is shown referring to Fig. 2, comprising:
Receiving module connect realization interaction with extraction module, generates instruction for receiving Global ID;
Extraction module connect realization interaction with the first determination module, the second acquisition module respectively, is used for extract equipment application
Local time stamp when Global ID;
First determination module connect realization interaction with the first acquisition module, for determining the whether existing correspondence of device id
Node;
First obtains module, and realization interaction is connect with the second determination module, for by determining that result takes corresponded manner
Obtain local code sequence;
Second obtains module, and realization interaction is connect with the second determination module, for acquisition request side's IP address and port code;
Second determination module connect realization interaction with generation module, for being generated by requesting party's IP address and port code
Request sequence information is simultaneously determined;
Generation module connect realization interaction with uploading module, for passing through local time stamp, device id and local sequence
Code generates Global ID;And
Uploading module, for uploading Global ID to backstage.
A according to a particular embodiment of the invention is shown referring to Fig. 3, comprising:
Global ID is stored in a manner of 64 bit, is made of respectively 4 parts;
Highest order is sign bit, is always 0;
Local time stamp is shown that minimum unit is accurate to millisecond by 41 bit, and memory range reaches 69 years;
Device id is shown by 10 bit, could support up 1024 nodes of system deployment;
Local code sequence is shown that highest supports each every millisecond of node to generate 4096 processes simultaneously by 12 bit.
B according to a particular embodiment of the invention is shown referring to Fig. 4, comprising:
Embodiment B illustrates the practical application of the invention under scene of game, and game client is to game background request
Transaction;Game backstage sends Global ID's application instruction to KD-SEQ after completing own service logic, and KD-SEQ herein is to make
The rear end that game backstage is arranged for stand-alone assembly is only used for generating Global ID;The device id of record request equipment, i.e. request machine
Coding;Record requesting party's IP address and port code;Global ID is generated based on device id, local time stamp and local code sequence;
Global ID is sent to game backstage;Game backstage sends Global ID to game client;Instruction is completed.
The above, only presently preferred embodiments of the present invention, the invention is not limited to above embodiment, as long as
It reaches technical effect of the invention with identical means, all should belong to protection scope of the present invention.In protection model of the invention
Its technical solution and/or embodiment can have a variety of different modifications and variations in enclosing.
Claims (10)
1. a kind of distribution Global ID generation method, comprising the following steps:
S1, Global ID's generation instruction is received;
Local time stamp when S2, extract equipment application Global ID;
S3, determine the whether existing corresponding node of device id;
S4, corresponded manner is taken to obtain local code sequence by judgement result;
S5, acquisition request side's IP address and port code;
S6, request sequence information is generated by requesting party's IP address and port code and is determined;
S7, Global ID is generated by local time stamp, device id and local code sequence;
S8, Global ID is uploaded to backstage.
2. distribution Global ID according to claim 1 generation method, which is characterized in that the Global ID uses 64 sides
Formula storage, wherein highest order does not use and is always 0.
3. distribution Global ID according to claim 1 generation method, which is characterized in that the device id is by 10bit group
At distribution is managed by Zookeeper, and the Zookeeper is that a kind of distributed application program of open source coordinates clothes
Business.
4. distribution Global ID according to claim 1 generation method, which is characterized in that the local time stamp is by 41
Bit composition, minimum unit is millisecond.
5. distribution Global ID according to claim 1 generation method, which is characterized in that the judgement result packet in step S4
Include it is existing, not there is no corresponding node;If it is determined that result is existing corresponding node, system obtains device id corresponding automatically
Ground sequence code;If it is determined that result is not the presence of corresponding node, system initialization present node simultaneously obtains local code sequence.
6. distribution Global ID according to claim 5 generation method, which is characterized in that if same equipment is in same time
Access more than one node, the sequence that different nodes successively numerically add a generation new in generated maximum local code sequence
Code.
7. distribution Global ID generation method according to claim 5, which is characterized in that corresponding one an of node into
Journey, system support same equipment at most to correspond to 4096 processes in same time.
8. distribution Global ID generation method according to claim 1, which is characterized in that the local code sequence by
12bit composition.
9. distribution Global ID according to claim 1 generation method, which is characterized in that if the judgement in step S6 includes
Determine that result is not pass through, then terminates this instruction and generate operation;If it is determined that result is to pass through, then carry out in next step.
10. a kind of distribution Global ID generating means, comprising:
Receiving module generates instruction for receiving Global ID;
Extraction module, local time stamp when for extract equipment application Global ID;
First determination module, for determining the whether existing corresponding node of device id;
First obtains module, for by determining that result takes corresponded manner to obtain local code sequence;
Second obtains module, for acquisition request side's IP address and port code;
Second determination module, for generating request sequence information by requesting party's IP address and port code and determining;
Generation module, for generating Global ID by local time stamp, device id and local code sequence;And
Uploading module, for uploading Global ID to backstage.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910022807.8A CN109783126A (en) | 2019-01-10 | 2019-01-10 | A kind of distribution Global ID's generation method and its device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910022807.8A CN109783126A (en) | 2019-01-10 | 2019-01-10 | A kind of distribution Global ID's generation method and its device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109783126A true CN109783126A (en) | 2019-05-21 |
Family
ID=66499302
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910022807.8A Pending CN109783126A (en) | 2019-01-10 | 2019-01-10 | A kind of distribution Global ID's generation method and its device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109783126A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111126004A (en) * | 2019-12-30 | 2020-05-08 | 深圳佰维存储科技股份有限公司 | Method, device and equipment for generating product sequence code and computer readable storage medium |
CN113420029A (en) * | 2021-06-25 | 2021-09-21 | 陕西浪潮英信科技有限公司 | Global ID generation method, device, equipment and medium for distributed system |
CN113626410A (en) * | 2021-08-11 | 2021-11-09 | 北京神州数字科技有限公司 | Distributed decentralized sequence generation method, device and system |
CN113656491A (en) * | 2021-06-30 | 2021-11-16 | 紫光云技术有限公司 | Distributed ID generation method of multi-Region cloud architecture |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130204948A1 (en) * | 2012-02-07 | 2013-08-08 | Cloudera, Inc. | Centralized configuration and monitoring of a distributed computing cluster |
CN104113435A (en) * | 2014-07-04 | 2014-10-22 | 广州华多网络科技有限公司 | Method and device for generating identifier |
CN104361065A (en) * | 2014-11-04 | 2015-02-18 | 福建亿榕信息技术有限公司 | Orderly sequence number generating method of Zookeeper-based distributed system |
CN107864233A (en) * | 2017-11-08 | 2018-03-30 | 千寻位置网络有限公司 | Globally unique ID structures and generation method |
CN108089916A (en) * | 2017-12-15 | 2018-05-29 | 北京搜狐新媒体信息技术有限公司 | A kind of method and device for generating ID |
-
2019
- 2019-01-10 CN CN201910022807.8A patent/CN109783126A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130204948A1 (en) * | 2012-02-07 | 2013-08-08 | Cloudera, Inc. | Centralized configuration and monitoring of a distributed computing cluster |
CN104113435A (en) * | 2014-07-04 | 2014-10-22 | 广州华多网络科技有限公司 | Method and device for generating identifier |
CN104361065A (en) * | 2014-11-04 | 2015-02-18 | 福建亿榕信息技术有限公司 | Orderly sequence number generating method of Zookeeper-based distributed system |
CN107864233A (en) * | 2017-11-08 | 2018-03-30 | 千寻位置网络有限公司 | Globally unique ID structures and generation method |
CN108089916A (en) * | 2017-12-15 | 2018-05-29 | 北京搜狐新媒体信息技术有限公司 | A kind of method and device for generating ID |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111126004A (en) * | 2019-12-30 | 2020-05-08 | 深圳佰维存储科技股份有限公司 | Method, device and equipment for generating product sequence code and computer readable storage medium |
CN113420029A (en) * | 2021-06-25 | 2021-09-21 | 陕西浪潮英信科技有限公司 | Global ID generation method, device, equipment and medium for distributed system |
CN113420029B (en) * | 2021-06-25 | 2024-04-12 | 陕西浪潮英信科技有限公司 | Global ID generation method, device, equipment and medium for distributed system |
CN113656491A (en) * | 2021-06-30 | 2021-11-16 | 紫光云技术有限公司 | Distributed ID generation method of multi-Region cloud architecture |
CN113626410A (en) * | 2021-08-11 | 2021-11-09 | 北京神州数字科技有限公司 | Distributed decentralized sequence generation method, device and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109783126A (en) | A kind of distribution Global ID's generation method and its device | |
CN109697133A (en) | ID generation method, apparatus and system | |
CN105447046A (en) | Distributed system data consistency processing method, device and system | |
CN105306557A (en) | Bridge health monitoring system based on cloud platform | |
CN113900810A (en) | Distributed graph processing method, system and storage medium | |
CN108600163A (en) | A kind of cloud environment distributed hash chain framework and cloud data integrity verification method | |
CN109800842A (en) | A kind of assets unique identification code generating method and system | |
CN107133231B (en) | Data acquisition method and device | |
CN110149377A (en) | A kind of video service node resource allocation methods, system, device and storage medium | |
CN110866265A (en) | Data storage method, device and storage medium based on block chain | |
CN102402616B (en) | Method and system for realizing database cluster | |
CN109560940B (en) | Charging method and device for content delivery network CDN service | |
CN106951225B (en) | Data processing method and device based on service configuration template | |
CN106802865A (en) | For the response analogue means and method of software test | |
CN111651522B (en) | Data synchronization method and device | |
CN110134381A (en) | A kind of system and method intelligently generating source code configuration for alarm host machine | |
CN105554181A (en) | DNS log compression method and device | |
CN105227532A (en) | A kind of blocking-up method of malicious act and device | |
CN106557530B (en) | Operation system, data recovery method and device | |
CN112528327A (en) | Data desensitization method and device and data restoration method and device | |
CN106888264A (en) | A kind of method for interchanging data and device | |
CN106709060B (en) | Data sharing method and system | |
CN106598983A (en) | Information display method and device | |
CN112073554B (en) | Global unique identifier generation method, device and computer readable storage medium | |
CN106294457A (en) | Network information push 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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190521 |
|
RJ01 | Rejection of invention patent application after publication |