CN108647308A - The sequence number generation method and device of distributed system - Google Patents

The sequence number generation method and device of distributed system Download PDF

Info

Publication number
CN108647308A
CN108647308A CN201810439457.0A CN201810439457A CN108647308A CN 108647308 A CN108647308 A CN 108647308A CN 201810439457 A CN201810439457 A CN 201810439457A CN 108647308 A CN108647308 A CN 108647308A
Authority
CN
China
Prior art keywords
sequence number
fragment
sequence
client
generation method
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
Application number
CN201810439457.0A
Other languages
Chinese (zh)
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.)
Zhongke Sugon Information Industry Chengdu Co ltd
Original Assignee
Dawning Information Industry Beijing 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 Dawning Information Industry Beijing Co Ltd filed Critical Dawning Information Industry Beijing Co Ltd
Priority to CN201810439457.0A priority Critical patent/CN108647308A/en
Publication of CN108647308A publication Critical patent/CN108647308A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers

Abstract

The invention discloses the sequence number generation method and device of a kind of distributed system, which includes:Multiple fragments are divided, wherein the fragment number of each fragment is different;The sequence number in fragment is generated with formation sequence number, the sequence number includes the sequence number in the fragment number and the fragment;Client in the distributed system obtains the sequence number according to the fragment number.The above-mentioned technical proposal of the present invention at least good, the higher advantage of performance with versatility.

Description

The sequence number generation method and device of distributed system
Technical field
The present invention relates to a kind of sequence number generation method of distributed system and sequence number generating means.
Background technology
In operation system, a sequence number is usually needed to uniquely determine a data the new data of dynamic generation, It shows in relevant database, usually independent id field, but the application of sequence number is not limited to database ID.Wherein, ID is also referred to as sequence number or account number, is relatively unique coding in some system.Be the equal of a kind of " identity card " in a certain tool In the things of body, identity number is usually constant, can be determined by the self-ordained rule of designer.
Sequence number is there are many generation strategy, increasing ID, the UUID certainly provided such as database or third square bearer (Universally Unique Identifier, Universally Unique Identifier, the purpose is to allow all members in distributed system Element can have unique identification information), or by the customized sequence number generation strategy of operation system, it is such as special with timestamp or business The fixed character string that will not be repeated is sequence number etc..
It is existing from increase sequence number is simple, performance is good, but if there is particular/special requirement that cannot use in business, for example make Oneself portfolio can be exposed for order number, or has been principal and subordinate each other, may be repeated from increasing with database.
UUID is natural to be suitble to distribution because will not repeat, but it is not numeric type, and length is again very long, establishes index Performance is poor.
Sometimes because of business demand, the relevant custom list number of business is needed, such as certain order numbers, it be in flow after sale Middle use, needs operating personnel to input, cannot be too long, and customer service is facilitated quickly to divide field again, just there is custom rule sequence Row number, limited length, while which being provided and what meaning is indicated.But this strategy can be used only in specific business system System, does not accomplish generally to be applicable in.
Invention content
For problem present in the relevant technologies, the present invention proposes a kind of the sequence number generation method and sequence of distributed system Row number generating means, at least good, the higher advantage of performance with versatility.
The technical proposal of the invention is realized in this way:
According to an aspect of the invention, there is provided a kind of sequence number generation method of distributed system, including:
Multiple fragments are divided, wherein the fragment number of each fragment is different;
The sequence number in fragment is generated with formation sequence number, sequence number includes the sequence number in fragment number and fragment;
Client in distributed system obtains sequence number according to fragment number.
In one embodiment, obtaining sequence number according to fragment number includes:Client is reflected according to the characteristic information of client It is mapped to corresponding fragment number, and obtains sequence number.
In one embodiment, sequence number generation method further includes:By write-back after sequence number plus 1 to indicate that sequence number is occupied With.
In one embodiment, characteristic information is MAC Address or host name.
In one embodiment, pass through shared storage system records series number;Shared storage system is caching system Or database.
According to another aspect of the present invention, a kind of sequence number generating means of distributed system, distributed system are provided Including client, sequence number generating means include:
Shared storage system, including:
First generation module, for dividing multiple fragments, wherein the fragment number of each fragment is different;
Second generation module, for generating the sequence number in fragment with formation sequence number, sequence number includes fragment number and divides Sequence number in piece;
The acquisition module of client, for obtaining sequence number according to fragment number.
In one embodiment, acquisition module includes:Mapping submodule, for being mapped to according to the characteristic information of client Corresponding fragment number simultaneously obtains sequence number.
In one embodiment, acquisition module includes:Write-back submodule, for adding write-back after 1 is shared to deposit sequence number Storage system is to indicate that sequence number is occupied.
In one embodiment, characteristic information is MAC Address or host name.
In one embodiment, shared storage system is caching system or database.
The above-mentioned technical proposal of the present invention, has the advantage that:Versatility is good, unrelated with operation system;It can be by rationally setting Score piece number, to cover all available sequence numbers, therefore does not waste, the sequence number range of covering is wide;Performance is higher, different The most recent sequence number of fragment is independent, plays the role of load balancing;In addition, due to being superimposed fragment number, even if in piece Sequence number is very short, and final sequence number is also very long string number, and external staff does not see rule.
Description of the drawings
It in order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, below will be to institute in embodiment Attached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the present invention Example, for those of ordinary skill in the art, without creative efforts, can also obtain according to these attached drawings Obtain other attached drawings.
Fig. 1 is the flow chart of the sequence number generation method of distributed system according to the ... of the embodiment of the present invention;
Fig. 2 is the flow diagram according to the sequence number generation method of the distributed system of the specific embodiment of the invention.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, the every other embodiment that those of ordinary skill in the art are obtained belong to what the present invention protected Range.
As shown in Figure 1, a kind of sequence number generation method 100 of distributed system is provided according to an embodiment of the invention, The sequence number generation method 100 includes the following steps:
S102 divides multiple fragments, wherein the fragment number of each fragment is different;
S104 generates the sequence number in fragment with formation sequence number, and sequence number includes the sequence number in fragment number and fragment;
S106, the client in distributed system obtain sequence number according to fragment number.
The above-mentioned technical proposal of the present invention, divides multiple fragments first, and each fragment has unique number (i.e. fragment Number), the sequence number in fragment can be incremental.Final sequence number is generated by the sequence number in fragment number and piece again, to Provide it is a kind of generating general, not duplicate serial numbers methods in distributed system, and has the following advantages:Versatility It is good, it is unrelated with operation system;It to cover all available sequence numbers, therefore can not be wasted by reasonably designing fragment number, The sequence number range of covering is wide;Performance is higher, and the most recent sequence number of different fragments is independent, plays the role of load balancing; In addition, due to being superimposed fragment number, even if the sequence number in piece is very short, final sequence number is also very long string number, outside Portion personnel do not see rule.
Wherein, sequence number is obtained according to fragment number in step S106 may particularly include:Client is according to the feature of client Information MAP obtains sequence number to corresponding fragment number.Since fragment number is directly mapped by the characteristic information of client itself, Therefore the step of eliminating inquiry fragment.Internal staff can be known that its fragment number according to sequence number, and then counter release is What which client generated.But the external staff to not knowing about digit shared by fragment number can not learn.
In one embodiment, features described above information can be MAC Address or features described above information can also be host Name.
The sequence number generation method of the application can also include the following steps:By write-back after sequence number plus 1 to indicate sequence It is number occupied.
Wherein it is possible to pass through shared storage system records series number;Shared storage system can be caching system or Person's database.Shared storage system is used for recording newest sequence number in each fragment.The sequence number generation method of the present invention Realization only need an independent shared memory systems, can be provided with software mode, therefore build at low cost.
As shown in Fig. 2, being shown according to the flow of the sequence number generation method of the distributed system of the specific embodiment of the invention It is intended to.Specifically, each need the client of sequence number in distributed system, according to unique characteristics (such as MAC Address or host Name) it is automatically mapped to affiliated fragment number, and access shared storage system and obtain latest sequence number in fragment, by latest sequence number Shared memory systems are write back after adding one, expression occupies this sequence number, and has updated the newest sequence recorded in shared memory systems Row number.
According to another aspect of the present invention, a kind of sequence number generating means of distributed system are additionally provided, wherein dividing Cloth system includes client, and sequence number generating means include:
Shared storage system, shared storage system include:First generation module, for dividing multiple fragments, wherein The fragment number of each fragment is different;Second generation module, for generating the sequence number in fragment with formation sequence number, sequence It number include the sequence number in fragment number and fragment;
Sequence number generating means further include:The acquisition module of client, for obtaining sequence number according to fragment number.
In one embodiment, acquisition module includes:Mapping submodule, for being mapped to according to the characteristic information of client Corresponding fragment number simultaneously obtains sequence number.
In one embodiment, acquisition module includes:Write-back submodule, for adding write-back after 1 is shared to deposit sequence number Storage system is to indicate that sequence number is occupied.
In one embodiment, characteristic information is MAC Address.
In one embodiment, the shared storage system is caching system or database.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention With within principle, any modification, equivalent replacement, improvement and so on should all be included in the protection scope of the present invention god.

Claims (10)

1. a kind of sequence number generation method of distributed system, which is characterized in that including:
Multiple fragments are divided, wherein the fragment number of each fragment is different;
The sequence number in fragment is generated with formation sequence number, the sequence number includes the sequence in the fragment number and the fragment Number;
Client in the distributed system obtains the sequence number according to the fragment number.
2. sequence number generation method according to claim 1, which is characterized in that obtain the sequence according to the fragment number Number include:
The client is mapped to corresponding fragment number according to the characteristic information of client, and obtains the sequence number.
3. sequence number generation method according to claim 1, which is characterized in that further include:
Write-back is occupied to indicate the sequence number after the sequence number is added 1.
4. sequence number generation method according to claim 2, which is characterized in that the characteristic information is MAC Address or master Machine name.
5. sequence number generation method according to claim 1, which is characterized in that
The sequence number is recorded by shared storage system;
The shared storage system is caching system or database.
6. a kind of sequence number generating means of distributed system, the distributed system include client, which is characterized in that described Sequence number generating means include:
Shared storage system, including:
First generation module, for dividing multiple fragments, wherein the fragment number of each fragment is different;
Second generation module, for generating the sequence number in fragment with formation sequence number, the sequence number includes the fragment number With the sequence number in the fragment;
The acquisition module of client, for obtaining the sequence number according to the fragment number.
7. sequence number generating means according to claim 6, which is characterized in that acquisition module includes:
Mapping submodule, for being mapped to corresponding fragment number according to the characteristic information of client and obtaining the sequence number.
8. sequence number generating means according to claim 6, which is characterized in that acquisition module includes:
Write-back submodule, for adding the storage system shared described in write-back after 1 to indicate the sequence number quilt sequence number It occupies.
9. sequence number generating means according to claim 7, which is characterized in that the characteristic information is MAC Address or master Machine name.
10. sequence number generating means according to claim 1, which is characterized in that
The shared storage system is caching system or database.
CN201810439457.0A 2018-05-09 2018-05-09 The sequence number generation method and device of distributed system Pending CN108647308A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810439457.0A CN108647308A (en) 2018-05-09 2018-05-09 The sequence number generation method and device of distributed system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810439457.0A CN108647308A (en) 2018-05-09 2018-05-09 The sequence number generation method and device of distributed system

Publications (1)

Publication Number Publication Date
CN108647308A true CN108647308A (en) 2018-10-12

Family

ID=63753822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810439457.0A Pending CN108647308A (en) 2018-05-09 2018-05-09 The sequence number generation method and device of distributed system

Country Status (1)

Country Link
CN (1) CN108647308A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124635A (en) * 2019-12-06 2020-05-08 北京达佳互联信息技术有限公司 Task processing method and device, electronic equipment and storage medium
CN111126537A (en) * 2019-12-17 2020-05-08 北京达佳互联信息技术有限公司 Identification code ID generation method and related product

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103823810A (en) * 2012-11-19 2014-05-28 中国电信股份有限公司 Method, device and system for generating unique keys in distributed system
CN104361065A (en) * 2014-11-04 2015-02-18 福建亿榕信息技术有限公司 Orderly sequence number generating method of Zookeeper-based distributed system
US20160179663A1 (en) * 2014-12-17 2016-06-23 Schneider Electric It Corporation Systems and methods for generating a unique device id
CN106570097A (en) * 2016-10-31 2017-04-19 华为技术有限公司 Sequence generating method and device
CN107360224A (en) * 2017-07-07 2017-11-17 携程旅游信息技术(上海)有限公司 Sequence number generation method, system, equipment and storage medium in distributed system
CN107454203A (en) * 2017-07-19 2017-12-08 成都数联铭品科技有限公司 The method for generating unique ID in a distributed system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103823810A (en) * 2012-11-19 2014-05-28 中国电信股份有限公司 Method, device and system for generating unique keys in distributed system
CN104361065A (en) * 2014-11-04 2015-02-18 福建亿榕信息技术有限公司 Orderly sequence number generating method of Zookeeper-based distributed system
US20160179663A1 (en) * 2014-12-17 2016-06-23 Schneider Electric It Corporation Systems and methods for generating a unique device id
CN106570097A (en) * 2016-10-31 2017-04-19 华为技术有限公司 Sequence generating method and device
CN107360224A (en) * 2017-07-07 2017-11-17 携程旅游信息技术(上海)有限公司 Sequence number generation method, system, equipment and storage medium in distributed system
CN107454203A (en) * 2017-07-19 2017-12-08 成都数联铭品科技有限公司 The method for generating unique ID in a distributed system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张林等: "基于椭圆曲线数字签名算法的序列号软件保护方案", 《中国电子科学研究院学报》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124635A (en) * 2019-12-06 2020-05-08 北京达佳互联信息技术有限公司 Task processing method and device, electronic equipment and storage medium
CN111126537A (en) * 2019-12-17 2020-05-08 北京达佳互联信息技术有限公司 Identification code ID generation method and related product
CN111126537B (en) * 2019-12-17 2024-03-12 北京达佳互联信息技术有限公司 Identification code ID generation method and related product

Similar Documents

Publication Publication Date Title
CN111240763B (en) Configuration updating method, device, equipment and storage medium
US7664829B2 (en) Document managing system, document managing apparatus and document managing method
CN109597853B (en) Business scene element serial number generation method, device, medium and computer equipment
US20070282782A1 (en) Method, system, and program product for managing information for a network topology change
CN101227465B (en) Method and system for administrating IP address
JP2021503676A (en) Room inventory management system based on blockchain
EP2710477B1 (en) Distributed caching and cache analysis
CN106708968A (en) Distributed database system and data processing method in distributed database system
CN100378731C (en) Automatic data consolidation
CN103095687A (en) Method and device of metadata processing
CN103530332A (en) System and method for querying data of patient
CN103294610A (en) Reusable content addressable stores
CN108647308A (en) The sequence number generation method and device of distributed system
US9380127B2 (en) Distributed caching and cache analysis
CN103577483A (en) Data storage method, data storage system, data access method and data access system
CN100429622C (en) Dynamic reassignment of data ownership
CN111090803A (en) Data processing method and device, electronic equipment and storage medium
US20130318626A1 (en) Securing access to distributed data in an unsecure data network
JP5972472B2 (en) Data processing apparatus, data processing method, and program
CN101387962A (en) Method and system for establishing mapping relationship in system integration
JP6494997B2 (en) Information processing apparatus, personal number identification method, and personal number identification program
US11240333B2 (en) ID space conversion system and method for the same
JP5608239B2 (en) Area specifying server, area specifying method, area specifying program, and computer-readable recording medium storing the program
CN105516344A (en) Data management system and service-processing method
JP2009100477A5 (en)

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190724

Address after: 100193 Beijing, Haidian District, northeast Wang West Road, building 8, No. 36

Applicant after: Dawning Information Industry (Beijing) Co.,Ltd.

Applicant after: ZHONGKE SUGON INFORMATION INDUSTRY CHENGDU Co.,Ltd.

Address before: 100193 Beijing, Haidian District, northeast Wang West Road, building 8, No. 36

Applicant before: Dawning Information Industry (Beijing) Co.,Ltd.

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190906

Address after: 610213 Sichuan city of Chengdu province Tianfu Tianfu Avenue South Huayang Street No. 846

Applicant after: ZHONGKE SUGON INFORMATION INDUSTRY CHENGDU Co.,Ltd.

Applicant after: Dawning Information Industry (Beijing) Co.,Ltd.

Address before: 100193 Beijing, Haidian District, northeast Wang West Road, building 8, No. 36

Applicant before: Dawning Information Industry (Beijing) Co.,Ltd.

Applicant before: ZHONGKE SUGON INFORMATION INDUSTRY CHENGDU Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20181012