CN108089916A - A kind of method and device for generating ID - Google Patents
A kind of method and device for generating ID Download PDFInfo
- Publication number
- CN108089916A CN108089916A CN201711346352.2A CN201711346352A CN108089916A CN 108089916 A CN108089916 A CN 108089916A CN 201711346352 A CN201711346352 A CN 201711346352A CN 108089916 A CN108089916 A CN 108089916A
- Authority
- CN
- China
- Prior art keywords
- key assignments
- machine
- unique identifier
- default
- storage system
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/465—Distributed object oriented systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5018—Thread allocation
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The present invention proposes a kind of method and device for generating ID.A kind of method for generating ID, including:By reading and writing default key assignments storage system, machine unique identifier is obtained;ID is generated according to the machine unique identifier;Wherein, the sequence number of timestamp and the ID when ID is including the machine unique identifier, the generation ID.The above method is applied to Distributed Services example, and Distributed Services example uses the ID that the above method generates as the globally unique ID of distributed system.
Description
Technical field
The present invention relates to distributed system technical field more particularly to a kind of method and devices for generating ID.
Background technology
Docker is provided mutually solely by using NameSpace (namespace) mechanism of linux kernel for application program
The process performing environment stand, do not interfere with each other, standardized so that the development deployment O&M of application program becomes more easy, different
Deployment of the application program on same physical machine it is also relatively simple.Above-mentioned mechanism while disposing application program is facilitated,
But also the need of reality cannot be met during traditional deployment physical machine come the mechanism of identification process with the ip+ ports of application program
It will.
Allow the free disposing application program of user under Docker environment, can be there are substantial amounts of Service Instance, each service is real
Between example interrelated component it is more, it is necessary to the data of transmission are carried out unique mark in order to record, track problems etc..Cause
This, in a distributed system, it is necessary to which the Service Instance in system, which can generate globally unique ID, distributes to process, component or data
Deng it is made to possess globally unique identification information.
But in current solution, still it can enable distributed Service Instance without complete frame or mechanism
Globally unique ID is enough generated, so as to constrain the performance of upper strata caller and expansion.
The content of the invention
The defects of based on the above-mentioned prior art and deficiency, the present invention propose a kind of method and device for generating ID, this method
And device is applied to Distributed Services example, and Distributed Services example can be made to generate globally unique ID.
In order to achieve the above object, the following technical solutions are proposed by the present invention:
A kind of method for generating ID, including:
By reading and writing default key assignments storage system, machine unique identifier is obtained;
ID is generated according to the machine unique identifier;Wherein, the ID includes the machine unique identifier, generation institute
The sequence number of timestamp and the ID when stating ID.
Preferably, it is described by reading and writing default key assignments storage system, machine unique identifier is obtained, including:
Obtain distributed exclusive lock;
Obtain all key assignments using preset characters as prefix in default key assignments storage system;
According to all key assignments acquired, a unappropriated machine is searched out of default machine identifier set
Identifier, as machine unique identifier;
Prefix is added for the machine unique identifier and forms key assignments, and the key assignments of formation is stored to the default key
It is worth in storage system;
Discharge the distributed exclusive lock.
Preferably, prefix formation key assignments is being added for the machine unique identifier, and the key assignments of formation is being stored to institute
When stating in default key assignments storage system, this method further includes:
Key assignments to store to the default key assignments storage system sets timestamp and overtime duration.
Preferably, this method further includes:
According to the default cycle heartbeat message is sent to the default key assignments storage system;Wherein, the default week
The duration of phase is less than the overtime duration.
Preferably, it is described that ID is generated according to the machine unique identifier, including:
According to the machine unique identifier, generation setting length integer is as ID.
A kind of device for generating ID, including:
Identifier obtaining unit reads and writes default key assignments storage system for passing through, and obtains machine unique identifier;
ID generation units, for generating ID according to the machine unique identifier;Wherein, the ID includes the machine only
The sequence number of timestamp and the ID when one identifier, the generation ID.
Preferably, the identifier obtaining unit obtains machine unique mark by reading and writing default key assignments storage system
Fu Shi is specifically used for:
Obtain distributed exclusive lock;Obtain all key assignments using preset characters as prefix in default key assignments storage system;
According to all key assignments acquired, a unappropriated machine identifier is searched out of default machine identifier set,
As machine unique identifier;Prefix is added for the machine unique identifier and forms key assignments, and the key assignments storage of formation is arrived
In the default key assignments storage system;Discharge the distributed exclusive lock.
Preferably, the identifier obtaining unit is adding prefix formation key assignments for the machine unique identifier, and will
When the key assignments of formation is stored into the default key assignments storage system, it is additionally operable to:
Key assignments to store to the default key assignments storage system sets timestamp and overtime duration.
Preferably, which further includes:
Heartbeat message transmitting element, for sending heartbeat letter to the default key assignments storage system according to the default cycle
Breath;Wherein, the duration in the default cycle is less than the overtime duration.
Preferably, when the ID generation units generate ID according to the machine unique identifier, it is specifically used for:
According to the machine unique identifier, generation setting length integer is as ID.
Using the method for generation ID proposed by the present invention, Service Instance first obtains itself machine unique identifier, Ran Houji
Comprising the machine unique identifier in machine unique identifier ID, the ID, and comprising timestamp when generating the ID with
And the sequence number of the ID.Since the machine unique identifier of different Service Instances is different, and the ID of same Service Instance generation
Timestamp or sequence number it is different, therefore can ensure Service Instance generation ID be globally unique ID.
Description of the drawings
It in order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
The embodiment of invention, for those of ordinary skill in the art, without creative efforts, can also basis
The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow diagram of method for generating ID provided in an embodiment of the present invention;
Fig. 2 is the schematic diagram of given birth to ID provided in an embodiment of the present invention;
Fig. 3 is the flow diagram of the method for another generation ID provided in an embodiment of the present invention;
Fig. 4 is a kind of structure diagram of device for generating ID provided in an embodiment of the present invention;
Fig. 5 is the structure diagram of the device of another generation ID provided in an embodiment of the present invention.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other without making creative work
Embodiment belongs to the scope of protection of the invention.
The embodiment of the invention discloses a kind of method for generating ID, this method is applied to the distributed clothes under Docker environment
Pragmatic example.
Docker is provided mutually solely by using NameSpace (namespace) mechanism of linux kernel for application program
The process performing environment stand, do not interfere with each other, standardized so that the development deployment O&M of application program becomes more easy, different
Deployment of the application program on same physical machine it is also relatively simple.Under Docker environment, user can more easily portion
Service Instance is affixed one's name to, is laid out distributed system.In a distributed system, each Service Instance can have interaction between each other, including number
According to interaction etc..For the data handled by single Service Instance, it is necessary to possess globally unique ID, in order to distinguish, record.Cause
This, for single Service Instance, it is the key that ensure entire distributed system performance to generate globally unique ID.By the present invention
The method of the disclosed generation ID of embodiment is applied to distributed Service Instance, and distributed Service Instance generation can be made global
Unique ID.
Shown in Figure 1, the method for generation ID disclosed by the embodiments of the present invention includes:
S101, by reading and writing default key assignments storage system, obtain machine unique identifier;
Specifically, above-mentioned machine unique identifier, refers to the unique identifier for implementing the Service Instance of the embodiment of the present invention.
In a distributed system, each Service Instance possesses unique identifier, and guarantee can clearly be distinguished each in distributed system
Service Instance.
Above-mentioned default key assignments storage system, is specially etcd systems, etcd systems be one increase income, be efficient, can
It is leaning on, use extensive key assignments (Key/Value) storage system.In embodiments of the present invention, etcd systems distributed storage system
Occupied machine identifier in system.Occupied machine identifier forms key assignments for prefix with " workerId " and deposits
It stores up in etcd.
The embodiment of the present invention is by reading etcd systems, it may be determined that occupied machine identifier, then in conjunction with
Optional machine identifier set, can select unappropriated machine identifier, the machine for being arranged to Service Instance is uniquely marked
Know symbol, and the machine unique identifier of setting is formed plus prefix in key assignments write-in etcd, other Service Instances is avoided to account for again
It is clashed with the machine identifier.
S102, ID is generated according to the machine unique identifier;Wherein, the ID include the machine unique identifier,
The sequence number of timestamp and the ID when generating the ID.
Specifically, after Service Instance obtains itself machine unique identifier, ID is generated according to the machine unique identifier.
Specifically, the sequence number of the timestamp and generation ID when Service Instance is by the machine unique identifier of acquisition, generation ID carries out
Combination forms an ID, the globally unique ID as generated.
According to the ID that said program generates, the machine unique identifier comprising the Service Instance for generating the ID generates the ID
Timestamp and the ID sequence number.Therefore, for different Service Instances, since its machine unique identifier is different,
Therefore in the same sequence number of synchronization, the ID of generation is different;And it is generated in the ID generated at different moments or in synchronization
Different sequence numbers ID, be even more different ID, therefore can ensure the ID generated between different Service Instances differences, i.e. difference
The ID of Service Instance generation is globally unique ID.And for same Service Instance, it can be in the ID of synchronization generation
It is distinguished with sequence number, ensures that the ID of generation is globally unique;It, can be with when all available sequence numbers of synchronization, which are allocated, to be finished
Selection waits subsequent time reselection sequence number generation ID, ensures that the timestamp of generated ID or sequence number are different, that is, ensures
Its global uniqueness.
Optionally, specifically disclose and given birth to using technical solution of the embodiment of the present invention in another embodiment of the present invention
Into globally unique ID concrete form.The embodiment discloses, described to generate ID according to the machine unique identifier, including:
According to the machine unique identifier, generation setting length integer is as ID.
Specifically, the digital ID that the integer that the ID that the embodiment of the present invention is generated is setting length is formed, that is, generated
ID be to set the Serial No. that digit integer is formed.The embodiment of the present invention carries out interval division to the Serial No., specifically
It is divided into 3 sections, the Serial No. in a section is for representing machine unique identifier, the Serial No. in a section
For representing timestamp when generating ID, the Serial No. in remaining section is used to represent the sequence number of ID.Above three section
It can flexibly sort, and it is possible to flexibly set digit shared by above-mentioned each section and flexibly set according to demand above-mentioned
The length of ID.
Such as shown in Fig. 2, the ID for setting generation is 64 integer Serial No.s.Wherein the highest order free time without using;Highest
After position 41 represent current docker Service Instances where environment system Millisecond timestamp, that is, during generation ID when
Between stab, the timestamp of 41 can represent (1<<41) 69 year;10 represent that docker Service Instances start after timestamp
When the workerId that is obtained from etcd, that is, the machine unique identifier of Service Instance, 10 Work machine id
(workerId) 1024 machines, i.e. 1024 Service Instances can be represented;12 represent ID's after machine unique identifier
Sequence number, 12 bit sequence numbers can represent 4096 sequence numbers, i.e., under same millisecond, concurrent maximum can generate 4096 ID.
By above-mentioned introduction as it can be seen that the method for the generation ID proposed using the embodiment of the present invention, Service Instance are first obtained from
Body machine unique identifier is then based in the machine unique identifier ID, the ID comprising the machine unique identifier, and wraps
The sequence number of timestamp and the ID during ID containing generation.Since the machine unique identifier of different Service Instances is different, and
And the timestamp or sequence number of the ID of same Service Instance generation are different, therefore can ensure that the ID of Service Instance generation is complete
The unique ID of office.
Optionally, in another embodiment of the present invention, it is shown in Figure 3, it is described to be deposited by reading and writing default key assignments
Storage system obtains machine unique identifier, including:
S301, distributed exclusive lock is obtained;
Specifically, above-mentioned distribution exclusive lock, for user to be allowed individually to read etcd.In embodiments of the present invention,
Service Instance on startup, by reading the v3 interfaces of etcd, obtains distributed exclusive lock mutex.Being obtained in Service Instance should
After distributed exclusive lock mutex, other Service Instances in distributed system cannot read etcd simultaneously.Can so it ensure
In synchronization, only etcd is read there are one Service Instance and then obtain machine identifier, also ensure that the machine of Service Instance
The uniqueness of device identifier.
S302, obtain in default key assignments storage system using preset characters as all key assignments of prefix;
Specifically, after Service Instance obtains distributed exclusive lock, inquiry is obtained in etcd with " workerId " as prefix
All key assignments, these key assignments are exactly the machine identifier occupied by Service Instance.
It is set in technical solution of the embodiment of the present invention, the machine identifier that Service Instance occupies itself occupies
WorkerId forms key assignments afterwards plus prefix " workerId ", stores in etcd.Therefore when Service Instance needs to obtain itself
Machine unique identifier when, by inquire about in etcd it is all with " workerId " be prefix key assignments, it may be determined which
Machine identifier is occupied.
All key assignments that S303, basis acquire, lookup one is unoccupied out of default machine identifier set
Machine identifier, as machine unique identifier;
Specifically, all key assignments inquired according to the inquiry mode in step S303, are exactly to have been accounted for by Service Instance
The key assignments that machine identifier is formed.Pass through all key assignments inquired, it is possible to determine occupied machine mark
Know symbol.It, can be therefrom with reference to default machine identifier set after the machine identifier occupied by Service Instance is confirmed
One is searched without occupied machine identifier, the machine which can be used as acquired in Service Instance is uniquely marked
Know symbol.
Above-mentioned default machine identifier set refers to the set for including all available machine identifiers.Such as [0,
1023] it is 0~1023 to represent available machine identifier.When confirming occupied machine identifier by step S303
Afterwards, the embodiment of the present invention rejects occupied machine identifier from above-mentioned default machine identifier set, then remaining
Machine identifier for optional machine identifier, a machine identifier is arbitrarily selected to can be used as the machine of Service Instance
Device unique identifier.
S304, prefix formation key assignments is added for the machine unique identifier, and the key assignments of formation is stored to described pre-
If key assignments storage system in;
Specifically, the embodiment of the present invention is set, after Service Instance gets the machine unique identifier of itself, to be obtained
The machine unique identifier addition prefix " workerId " taken forms key assignments, and the key assignments of formation is stored to default key assignments and is deposited
In storage system, i.e. etcd systems.
It, can be with when other Service Instances obtain itself machine unique identifier by reading and writing etcd by above-mentioned processing
Confirm that the machine identifier selected in above-mentioned steps S303 is occupied by inquiring about etcd, so as to prevent that different services is real
Machine identifier acquired in example has global uniqueness.
S305, the release distributed exclusive lock.
Specifically, when Service Instance gets itself machine unique identifier, and after forming key assignments storage into etcd, clothes
The acquired distributed exclusive lock of pragmatic example release, so that other Service Instances obtain the distribution exclusive lock and read-write
Etcd obtains machine unique identifier.
Step S306 in the present embodiment corresponds to the step S102 in embodiment of the method shown in FIG. 1, and particular content please
The content of embodiment of the method shown in Figure 1, details are not described herein again.
Optionally, in another embodiment of the present invention, prefix formation key is being added for the machine unique identifier
When being worth, and the key assignments of formation is stored into the default key assignments storage system, this method further includes:
Key assignments to store to the default key assignments storage system sets timestamp and overtime duration.
Specifically, the embodiment of the present invention is set, when Service Instance forms the machine unique identifier addition prefix of acquisition
Key assignments is stored into default key assignments storage system, that is, when storing in etcd systems, also sets timestamp for the key assignments of storage
With overtime duration.
Above-mentioned timestamp is Millisecond timestamp when storing the key assignments.Meanwhile the embodiment of the present invention is also set, if clothes
Pragmatic example does not have the machine unique identifier using its acquisition in the overtime duration of setting, then the machine unique identifier is received
It returns, asks to use for other Service Instances.Therefore, the embodiment of the present invention is when storing key assignments, when also setting time-out for key assignments
It is long.When Service Instance starts timing after one-off is performed, if in overtime duration, Service Instance does not use the key assignments
Comprising machine unique identifier, then etcd the key assignments is deleted, other Service Instances can obtain the key assignments and be wrapped again
The machine identifier contained.
Based on above-mentioned setting, if Service Instance wishes to occupy acquired machine unique identifier always, need
Using the machine unique identifier in the overtime duration of key assignments comprising the machine unique identifier, in case the key assignments is deleted by etcd
After removing, other Service Instances occupy the machine unique identifier that the key assignments includes again.
In another embodiment of the present invention, a kind of tool that Service Instance persistently occupies machine unique identifier is disclosed
Body mode.In this embodiment, based on it is above-mentioned for storage to the default key assignments storage system key assignments set timestamp and
After overtime duration, the method for the globally unique ID of the generation further includes:
According to the default cycle heartbeat message is sent to the default key assignments storage system;Wherein, the default week
The duration of phase is less than the overtime duration.
Specifically, the embodiment of the present invention is set, Service Instance is getting machine unique identifier, and the machine is unique
Identifier forms key assignments and stores to after etcd, according to the prior default cycle, sends heartbeat message to etcd, which uses
In the machine unique identifier informed this Service Instance of etcd and still included in the key assignments that this Service Instance is used to be stored.By
Heartbeat message is had sent in Service Instance, the key assignments that etcd will not be stored is deleted, then the machine that the key assignments is included is unique
Identifier can be occupied by the Service Instance always.When Service Instance is stopped, since heartbeat message cannot be retransmited, then
Etcd can be when reaching overtime duration, and the key assignments which is stored is deleted, the machine unique mark which is included
Symbol can be occupied by other Service Instances again.
It should be noted that in order to ensure that the key assignments of Service Instance storage to etcd are not deleted, Service Instance sends the heart
The cycle duration of hop-information should be less than for Service Instance storage to the overtime duration set by the key assignments of etcd.
The embodiment of the invention also discloses a kind of devices for generating ID, and shown in Figure 4, which includes:
Identifier obtaining unit 100 reads and writes default key assignments storage system for passing through, and obtains machine unique identifier;
ID generation units 110, for generating ID according to the machine unique identifier;Wherein, the ID includes the machine
The sequence number of timestamp and the ID when device unique identifier, the generation ID.
Specifically, in the present embodiment unit specific works content, refer to the content of above method embodiment, this
Place repeats no more.
Optionally, in another embodiment of the present invention, the identifier obtaining unit 100 is by reading and writing default key
It is worth storage system, when obtaining machine unique identifier, is specifically used for:
Obtain distributed exclusive lock;Obtain all key assignments using preset characters as prefix in default key assignments storage system;
According to all key assignments acquired, a unappropriated machine identifier is searched out of default machine identifier set,
As machine unique identifier;Prefix is added for the machine unique identifier and forms key assignments, and the key assignments storage of formation is arrived
In the default key assignments storage system;Discharge the distributed exclusive lock.
Specifically, the specific works content of the identifier obtaining unit 100 in the present embodiment, refers to above method implementation
The content of example, details are not described herein again.
Optionally, in another embodiment of the present invention, the identifier obtaining unit 100 for the machine it is unique
Identifier addition prefix forms key assignments, and when the key assignments of formation is stored into the default key assignments storage system, is additionally operable to:
Key assignments to store to the default key assignments storage system sets timestamp and overtime duration.
Specifically, the specific works content of the identifier obtaining unit 100 in the present embodiment, refers to above method implementation
The content of example, details are not described herein again.
Optionally, in another embodiment of the present invention, shown in Figure 5, which further includes:
Heartbeat message transmitting element 120, for sending the heart to the default key assignments storage system according to the default cycle
Hop-information;Wherein, the duration in the default cycle is less than the overtime duration.
Specifically, the specific works content of the heartbeat message transmitting element 120 in the present embodiment, refers to above method reality
The content of example is applied, details are not described herein again.
Optionally, in another embodiment of the present invention, the ID generation units 110 are according to the machine unique mark
During symbol generation ID, it is specifically used for:
According to the machine unique identifier, generation setting length integer is as ID.
Specifically, the specific works content of the ID generation units 110 in the present embodiment, refers to above method embodiment
Content, details are not described herein again.
The foregoing description of the disclosed embodiments enables professional and technical personnel in the field to realize or use the present invention.
A variety of modifications of these embodiments will be apparent for those skilled in the art, it is as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention
The embodiments shown herein is not intended to be limited to, and is to fit to and the principles and novel features disclosed herein phase one
The most wide scope caused.
Claims (10)
- A kind of 1. method for generating ID, which is characterized in that including:By reading and writing default key assignments storage system, machine unique identifier is obtained;ID is generated according to the machine unique identifier;Wherein, the ID includes the machine unique identifier, the generation ID When timestamp and the ID sequence number.
- 2. according to the method described in claim 1, it is characterized in that, described by reading and writing default key assignments storage system, acquisition Machine unique identifier, including:Obtain distributed exclusive lock;Obtain all key assignments using preset characters as prefix in default key assignments storage system;According to all key assignments acquired, a unappropriated machine identification is searched out of default machine identifier set Symbol, as machine unique identifier;Prefix is added for the machine unique identifier and forms key assignments, and the key assignments of formation is stored to the default key assignments and is deposited In storage system;Discharge the distributed exclusive lock.
- 3. according to the method described in claim 2, it is characterized in that, form key adding prefix for the machine unique identifier When being worth, and the key assignments of formation is stored into the default key assignments storage system, this method further includes:Key assignments to store to the default key assignments storage system sets timestamp and overtime duration.
- 4. according to the method described in claim 3, it is characterized in that, this method further includes:According to the default cycle heartbeat message is sent to the default key assignments storage system;Wherein, default cycle Duration is less than the overtime duration.
- 5. according to the method described in claim 1, it is characterized in that, described generate ID, bag according to the machine unique identifier It includes:According to the machine unique identifier, generation setting length integer is as ID.
- 6. a kind of device for generating ID, which is characterized in that including:Identifier obtaining unit reads and writes default key assignments storage system for passing through, and obtains machine unique identifier;ID generation units, for generating ID according to the machine unique identifier;Wherein, the ID is uniquely marked including the machine The sequence number of timestamp and the ID when knowing symbol, generating the ID.
- 7. device according to claim 6, which is characterized in that the identifier obtaining unit is by reading and writing default key assignments Storage system when obtaining machine unique identifier, is specifically used for:Obtain distributed exclusive lock;Obtain all key assignments using preset characters as prefix in default key assignments storage system;According to All key assignments acquired search a unappropriated machine identifier out of default machine identifier set, as Machine unique identifier;Prefix is added for the machine unique identifier and forms key assignments, and the key assignments of formation is stored to described In default key assignments storage system;Discharge the distributed exclusive lock.
- 8. device according to claim 7, which is characterized in that the identifier obtaining unit is uniquely marked for the machine When knowing symbol addition prefix and form key assignments, and the key assignments of formation is stored into the default key assignments storage system, it is additionally operable to:Key assignments to store to the default key assignments storage system sets timestamp and overtime duration.
- 9. device according to claim 8, which is characterized in that the device further includes:Heartbeat message transmitting element, for sending heartbeat message to the default key assignments storage system according to the default cycle; Wherein, the duration in the default cycle is less than the overtime duration.
- 10. device according to claim 6, which is characterized in that the ID generation units are according to the machine unique mark During symbol generation ID, it is specifically used for:According to the machine unique identifier, generation setting length integer is as ID.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711346352.2A CN108089916A (en) | 2017-12-15 | 2017-12-15 | A kind of method and device for generating ID |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711346352.2A CN108089916A (en) | 2017-12-15 | 2017-12-15 | A kind of method and device for generating ID |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108089916A true CN108089916A (en) | 2018-05-29 |
Family
ID=62176581
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711346352.2A Pending CN108089916A (en) | 2017-12-15 | 2017-12-15 | A kind of method and device for generating ID |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108089916A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109271388A (en) * | 2018-09-29 | 2019-01-25 | 北京奇虎科技有限公司 | A kind of generation method and terminal device of Identity Code |
CN109639775A (en) * | 2018-11-27 | 2019-04-16 | 湖南蚁为软件有限公司 | Global monotonic increase ID generation method, device, system and equipment |
CN109783126A (en) * | 2019-01-10 | 2019-05-21 | 珠海金山网络游戏科技有限公司 | A kind of distribution Global ID's generation method and its device |
CN109862097A (en) * | 2019-01-31 | 2019-06-07 | 上海易点时空网络有限公司 | ID generation method and device |
WO2022041280A1 (en) * | 2020-08-31 | 2022-03-03 | Oppo广东移动通信有限公司 | Method and apparatus for generating file in internet of things, computer device, and storage medium |
CN114827082A (en) * | 2022-06-29 | 2022-07-29 | 广州市玄武无线科技股份有限公司 | Method, system, device and medium for generating globally unique ID of distributed system |
CN114900497A (en) * | 2022-05-09 | 2022-08-12 | 上海极豆科技有限公司 | Identification serial number generation method and device, electronic equipment and storage medium |
CN115687367A (en) * | 2023-01-04 | 2023-02-03 | 成都精灵云科技有限公司 | ID generation method and system based on ETCD key value version number |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102123182A (en) * | 2011-04-09 | 2011-07-13 | 山东师范大学 | Method for separating host identifier (HID) mark from locator based on IPV6 (Internet Protocol Version 6) address |
CN102929696A (en) * | 2012-09-28 | 2013-02-13 | 北京搜狐新媒体信息技术有限公司 | Method and apparatus for constructing, submitting and monitoring center node of distributed system |
US20140093876A1 (en) * | 2009-04-03 | 2014-04-03 | Timothy Z. Liu | Multiplex nucleic acid detection methods and systems |
CN103823810A (en) * | 2012-11-19 | 2014-05-28 | 中国电信股份有限公司 | Method, device and system for generating unique keys in distributed system |
CN105472048A (en) * | 2014-07-14 | 2016-04-06 | 华为技术有限公司 | Address allocating method, information aggregation method and related equipment |
CN105975495A (en) * | 2016-04-26 | 2016-09-28 | 北京奇虎科技有限公司 | Big data storage and search method and apparatus |
CN106572165A (en) * | 2016-10-26 | 2017-04-19 | 宜人恒业科技发展(北京)有限公司 | Distributed global unique ID application method |
-
2017
- 2017-12-15 CN CN201711346352.2A patent/CN108089916A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140093876A1 (en) * | 2009-04-03 | 2014-04-03 | Timothy Z. Liu | Multiplex nucleic acid detection methods and systems |
CN102123182A (en) * | 2011-04-09 | 2011-07-13 | 山东师范大学 | Method for separating host identifier (HID) mark from locator based on IPV6 (Internet Protocol Version 6) address |
CN102929696A (en) * | 2012-09-28 | 2013-02-13 | 北京搜狐新媒体信息技术有限公司 | Method and apparatus for constructing, submitting and monitoring center node of distributed system |
CN103823810A (en) * | 2012-11-19 | 2014-05-28 | 中国电信股份有限公司 | Method, device and system for generating unique keys in distributed system |
CN105472048A (en) * | 2014-07-14 | 2016-04-06 | 华为技术有限公司 | Address allocating method, information aggregation method and related equipment |
CN105975495A (en) * | 2016-04-26 | 2016-09-28 | 北京奇虎科技有限公司 | Big data storage and search method and apparatus |
CN106572165A (en) * | 2016-10-26 | 2017-04-19 | 宜人恒业科技发展(北京)有限公司 | Distributed global unique ID application method |
Non-Patent Citations (1)
Title |
---|
王瑞雪: "分布式业务集成部署平台的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109271388A (en) * | 2018-09-29 | 2019-01-25 | 北京奇虎科技有限公司 | A kind of generation method and terminal device of Identity Code |
CN109639775A (en) * | 2018-11-27 | 2019-04-16 | 湖南蚁为软件有限公司 | Global monotonic increase ID generation method, device, system and equipment |
CN109783126A (en) * | 2019-01-10 | 2019-05-21 | 珠海金山网络游戏科技有限公司 | A kind of distribution Global ID's generation method and its device |
CN109862097A (en) * | 2019-01-31 | 2019-06-07 | 上海易点时空网络有限公司 | ID generation method and device |
WO2022041280A1 (en) * | 2020-08-31 | 2022-03-03 | Oppo广东移动通信有限公司 | Method and apparatus for generating file in internet of things, computer device, and storage medium |
CN115803736A (en) * | 2020-08-31 | 2023-03-14 | Oppo广东移动通信有限公司 | File generation method and device in Internet of things, computer equipment and storage medium |
CN114900497A (en) * | 2022-05-09 | 2022-08-12 | 上海极豆科技有限公司 | Identification serial number generation method and device, electronic equipment and storage medium |
CN114900497B (en) * | 2022-05-09 | 2023-09-26 | 上海极豆科技有限公司 | Identification sequence number generation method and device, electronic equipment and storage medium |
CN114827082A (en) * | 2022-06-29 | 2022-07-29 | 广州市玄武无线科技股份有限公司 | Method, system, device and medium for generating globally unique ID of distributed system |
CN115687367A (en) * | 2023-01-04 | 2023-02-03 | 成都精灵云科技有限公司 | ID generation method and system based on ETCD key value version number |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108089916A (en) | A kind of method and device for generating ID | |
KR101750429B1 (en) | Document editing system and method for collaborative editing | |
CN102769667A (en) | Method, equipment and system for generating ID | |
CN108920116A (en) | Control method, device and equipment of screen projection equipment and storage medium | |
EP2648114A1 (en) | Method, system, token conreoller and memory database for implementing distribute-type main memory database system | |
CN101446972B (en) | Method and system for dynamic data synchronization | |
CN103164525B (en) | WEB application dissemination method and device | |
JP2021518021A (en) | Data processing methods, equipment and computer readable storage media | |
CN109684273A (en) | A kind of snapshot management method, apparatus, equipment and readable storage medium storing program for executing | |
CN109558065A (en) | Data-erasure method and distributed memory system | |
CN104182283B (en) | A kind of task synchronization method | |
CN111182251B (en) | Video backup method and device applied to online patrol synchronous transcoding and with hot-pluggable storage medium | |
CN111177021A (en) | Java card fragment management method and storage device thereof | |
CN100380868C (en) | Network management systm, appts. need to be managed, managing device and program thereof | |
CN107249050A (en) | The management method and device of resource in cloud platform | |
CN109284174A (en) | A kind of multi-service process performance statistical method, device and system | |
CN110069309A (en) | A kind of page configuration method, system and client | |
CN113760538B (en) | Acceleration card type management and control method, system and device based on AI platform | |
CN107659643A (en) | Cloud platform construction method and device | |
CN102255753B (en) | A kind of business configuration synchronous method and system | |
CN115709666A (en) | Battery replacement control method and device for charging cabinet | |
CN106372165A (en) | Leader selection method and device for cluster based on totem protocol | |
JPH08307451A (en) | Data transfer system and method | |
CN110515907A (en) | Data synchronization method and related device for distributed storage nodes | |
JP3449274B2 (en) | Network device, setting information management terminal, and network device automatic setting method |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180529 |