CN105956205A - Method and apparatus for generating HBASE passkey - Google Patents
Method and apparatus for generating HBASE passkey Download PDFInfo
- Publication number
- CN105956205A CN105956205A CN201610511657.3A CN201610511657A CN105956205A CN 105956205 A CN105956205 A CN 105956205A CN 201610511657 A CN201610511657 A CN 201610511657A CN 105956205 A CN105956205 A CN 105956205A
- Authority
- CN
- China
- Prior art keywords
- hbase
- time
- row
- server
- strong
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/14—Details of searching files based on file metadata
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2471—Distributed queries
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Fuzzy Systems (AREA)
- Mathematical Physics (AREA)
- Probability & Statistics with Applications (AREA)
- Software Systems (AREA)
- Library & Information Science (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention discloses a method and an apparatus for generating an HBASE passkey, belongs to the software development technology, and aims at solving the problem of the existing HBASE passkey generation method that the passkey is repeated or the order is incorrect due to the change of a system time. The method comprises the steps of successively recording an exclusive identification of a server corresponding to HBASE in an HBASE database, and the time when the server is connected with the HBASE; according to the time when the HBASE is connected with the server and the current time, establishing first time, and determining the first time as a starting point of an HBASE passkey generated for a global static class; and when the global static class is accessed, generating a sequence number for the starting point of the HBASE passkey by adopting a method for adding 1 to an atom, and determining the exclusive identification of the server and the sequence number as the HBASE passkey.
Description
Technical field
The invention belongs to technical field of software development, more particularly relate to a kind of generate the side that HBASE row is strong
Method and device.
Background technology
HBASE be one distributed, towards row PostgreSQL database, this Technology origin is in Fay Chang
The Google paper " distributed memory system of Bigtable: one structural data " write.Just as
The Distributed Storage that Bigtable make use of Google file system (File System) to be provided is the same,
HBASE provides the ability being similar to Bigtable on Hadoop.
Under normal circumstances, the generation method that HBASE row is strong typically has following several situation: 1), by HBASE
Automatically generate row strong;2) (English is: Universally Unique Identifier, Chinese, to use UUID
It being called for short: general unique identifier) character string is strong as row;The generation method that above two HBASE row is strong,
Do not include in being good for due to row that data insert precedence information, thus cause to show according to the strong sequence of row
The successively application scenarios of data;In order to solve the problems referred to above, have employed and use custom rule to generate what row was good for
Method, but, owing to custom rule generates the strong method of row under distributed environment it is possible that repeat,
The data being saved in HBASE may be caused situation about mutually covering to occur, further, owing to using
Timestamp constructs the strong needs that can meet sequence of row, but after system time changes, it is easy to cause
Row is strong to be repeated or sorts incorrect.
In sum, existing HBASE row is good for generation method and be there is system time and change, and causes row
Strong repetition or the incorrect problem that sorts.
Summary of the invention
The embodiment of the present invention provides a kind of and generates the method and device that HBASE row is strong, is used for solving existing
The row of HBASE is good for generation method and be there is system and be susceptible to change, causing row strong repeat or sequence the most just
True problem.
The embodiment of the present invention provides a kind of and generates the method that HBASE row is strong, including:
Unique mark of the server that record is corresponding with HBASE successively in HBASE database, described
Server sets up, with described HBASE, the time being connected;
The time and current time being connected is set up with described server, when setting up first according to described HBASE
Between and the described very first time is defined as the starting point that described HBASE row that overall situation static class generates is strong;
When accessing described overall situation static class, the starting point strong to described HBASE row, use Atomic atom
The method genesis sequence number adding 1, and described server is uniquely identified be defined as HBASE with described serial number
Row is strong.
Preferably, the described time being connected with the foundation of described server according to described HBASE and current time,
Set up the very first time and that the described very first time is defined as described HBASE row that overall situation static class generates is strong
Starting point, including:
When the described time setting up connection is less than described current time, then described current time is defined as institute
State the very first time;Or
When the described time setting up connection is more than described current time, current time is increased by one and predefines
Increment after time be defined as the very first time.
The embodiment of the present invention provides a kind of and generates the device that HBASE row is strong, including:
Record unit, for recording the server corresponding with HBASE successively in HBASE database
Unique mark, described server sets up, with described HBASE, the time being connected;
Set up unit, for the time being connected according to the foundation of described HBASE and described server and current time
Between, set up the very first time and the described very first time is defined as the described HBASE row that overall situation static class generates
Strong starting point;
Determine unit, be used for when accessing described overall situation static class, the starting point strong to described HBASE row,
Use the method genesis sequence number of Atomic atom adding 1, and described server is uniquely identified suitable with described
Sequence number is defined as HBASE row and is good for.
Preferably, described set up unit specifically for:
When the described time setting up connection is less than described current time, then described current time is defined as institute
State the very first time;Or
When the described time setting up connection is more than described current time, current time is increased by one and predefines
Increment after time be defined as the very first time.
The embodiment of the present invention provides a kind of and generates the method and device that HBASE row is strong, is included in HBASE
Unique mark of the server that in data base, record is corresponding with HBASE successively, described server is with described
HBASE sets up the time connected;Time being connected and ought is set up according to described HBASE and described server
The front time, set up the very first time and the described very first time be defined as described in overall situation static class generation
The starting point that HBASE row is strong;When described overall situation static class is accessed, use the side of Atomic atom adding 1
Method, genesis sequence number, and described server is uniquely identified be defined as HBASE row with described serial number and be good for.
Strong uniquely the mark by server of the HBASE row provided in the embodiment of the present invention forms with serial number, wherein,
One unique number of configuration when being build-in services device that server uniquely identifies, uniqueness by specifying by hand, and
Serial number is to access the unique number that the application program of HBASE generates;Said method is used to determine
HBASE row be good for, relevant to server, unrelated with the time, have can sort, unduplicated feature, solution
Prior art of having determined, when system time changes, causes the strong repetition of row or the incorrect problem that sorts.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to enforcement
In example or description of the prior art, the required accompanying drawing used is briefly described, it should be apparent that, describe below
In accompanying drawing be only some embodiments of the present invention, for those of ordinary skill in the art, do not paying
On the premise of going out creative work, it is also possible to obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 a kind of generates the method flow schematic diagram that HBASE row is strong for what the embodiment of the present invention provided;
Fig. 2 a kind of generates the apparatus structure schematic diagram that HBASE row is strong for what the embodiment of the present invention provided.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clearly
Chu, be fully described by, it is clear that described embodiment be only a part of embodiment of the present invention rather than
Whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art are not making creation
The every other embodiment obtained under property work premise, broadly falls into the scope of protection of the invention.
What Fig. 1 was exemplary show, and the embodiment of the present invention provides a kind of generates the method stream that HBASE row is strong
Journey schematic diagram;The method at least can be applied in software development.
As it is shown in figure 1, the embodiment of the present invention provide a kind of generate the method that HBASE row is strong, including with
Lower step:
Step 101, unique mark of the server that record is corresponding with HBASE successively in HBASE database
Knowing, described server sets up, with described HBASE, the time being connected;
Step 102, sets up the time and current time being connected according to described HBASE with described server,
Set up the very first time and that the described very first time is defined as described HBASE row that overall situation static class generates is strong
Starting point;
Step 103, when accessing described overall situation static class, the starting point strong to described HBASE row, use
The method genesis sequence number of Atomic atom adding 1, and described server is uniquely identified true with described serial number
It is set to HBASE row to be good for.
It should be noted that the executive agent in the embodiment of the present invention is server.
In a step 101, the server corresponding with this HBASE as HBASE is set up after connecting, clothes
Business device can record unique mark of the server corresponding to this HBASE in HBASE database, and
The time that server corresponding with this HBASE for HBASE sets up connection is also recorded in HBASE data
In storehouse.
It should be noted that server can be set up even at server corresponding with this HBASE for HBASE
Before connecing, in HBASE database, record unique mark of the server corresponding with this HBASE;Also
After server foundation connection that can be corresponding with this HBASE at HBASE, in HBASE database
Unique mark of the server that interior record is corresponding with this HBASE;In embodiments of the present invention, to server
The uniquely identified time order and function recording the server corresponding with this HBASE in HBASE database is suitable
Sequence does not limits.
Further, server can set up connection at server corresponding with this HBASE for HBASE
Meanwhile, in HBASE database, record the server corresponding with this HBASE and set up the time connected;
After server foundation connection that can also be corresponding with this HBASE in cloth storage system, at HBASE
The server that in data base, record is corresponding with this HBASE sets up the time connected;In embodiments of the present invention,
Server is recorded in HBASE database the server corresponding with this HBASE and sets up the time connected
Sequencing do not limit.
In a step 102, according to described HBASE and described server set up the time being connected and current time
Between, set up the very first time and the described very first time is defined as the described HBASE row that overall situation static class generates
Strong starting point.
In actual applications, time and the current time being connected with server foundation according to HBASE is needed to enter
Row compares, and determines that time is bigger.Specifically: when HBASE sets up, with server, the time being connected
During more than current time, then the time that HBASE is connected with server foundation is defined as the very first time;Or
Person, when the time that HBASE is connected with server foundation is less than current time, on the basis of current time
Upper increase by 1000000000000, is then defined as first by the current time adding 1000000000000
Time.
In step 103, when accessing described overall situation static class, the starting point strong to described HBASE row,
Use the method genesis sequence number of Atomic atom adding 1, and described server is uniquely identified suitable with described
Sequence number is defined as HBASE row and is good for.
In embodiments of the present invention, the method provided by accessing overall situation static class generates HBASE row and is good for,
When overall situation static class is accessed, the starting point strong to HBASE row, use the operation of Atomic atom adding 1
Method, genesis sequence number, the serial number then server uniquely being identified and generating couple together as
HBASE row is good for, and returns strong for the HBASE row determined.
In sum, the HBASE row provided in the embodiment of the present invention is good for and is uniquely identified and suitable by server
Sequence number forms, wherein, and one unique number of configuration when being build-in services device that server uniquely identifies, uniquely
Property by specifying by hand, and serial number be access HBASE application program generate unique number;In employing
The HBASE row that the method for stating determines is good for, relevant to server, unrelated with the time, has and can sort, do not weighs
Multiple feature, solves prior art when system changes, and causes that row is strong to be repeated or sort incorrect
Problem.
Based on same inventive concept, embodiments provide a kind of device determining flame spread rates, by
To a kind of, the principle solving technical problem in this device determines that the method for flame spread rates is similar, therefore this device
Enforcement may refer to the enforcement of method, repeat no more in place of repetition.
Fig. 2 a kind of generates the apparatus structure schematic diagram that HBASE row is strong for what the embodiment of the present invention provided.As
Shown in Fig. 2, a kind of of embodiment of the present invention offer generates the device that HBASE row is strong, specifically includes that
Record unit 20, for recording the server corresponding with HBASE successively in HBASE database
Unique mark, the time that described server is connected with described HBASE foundation;
Set up unit 21, for setting up time being connected and currently according to described HBASE and described server
Time, set up the very first time and the described very first time is defined as the described HBASE that overall situation static class generates
The starting point that row is strong;
Determine unit 22, be used for when accessing described overall situation static class, the starting point strong to described HBASE row,
Use the method genesis sequence number of Atomic atom adding 1, and described server is uniquely identified suitable with described
Sequence number is defined as HBASE row and is good for.
Preferably, described set up unit 21 specifically for:
When the described time setting up connection is more than described current time, then the time described foundation connected is true
It is set to the described very first time;Or
When the described time setting up connection is less than described current time, will increase by the institute of 1000000000000
State current time and be defined as the very first time.
Should be appreciated that one of the above generate unit that the strong device of HBASE row includes only according to this equipment
The logical partitioning that the function that device realizes is carried out, in actual application, can carry out the superposition of said units or tear open
Point.And the function that the device that a kind of HBASE of generation row that this embodiment provides is good for is realized and above-mentioned reality
The a kind of of example offer is provided and generates the method one_to_one corresponding that HBASE row is strong, this device is realized more
Detailed handling process, is described in detail in said method embodiment one, is not described in detail herein.
Those skilled in the art are it should be appreciated that embodiments of the invention can be provided as method, system or meter
Calculation machine program product.Therefore, the present invention can use complete hardware embodiment, complete software implementation or knot
The form of the embodiment in terms of conjunction software and hardware.And, the present invention can use and wherein wrap one or more
Computer-usable storage medium containing computer usable program code (include but not limited to disk memory,
CD-ROM, optical memory etc.) form of the upper computer program implemented.
The present invention is with reference to method, equipment (system) and computer program product according to embodiments of the present invention
The flow chart of product and/or block diagram describe.It should be understood that can by computer program instructions flowchart and
/ or block diagram in each flow process and/or flow process in square frame and flow chart and/or block diagram and/
Or the combination of square frame.These computer program instructions can be provided to general purpose computer, special-purpose computer, embedding
The processor of formula datatron or other programmable data processing device is to produce a machine so that by calculating
The instruction that the processor of machine or other programmable data processing device performs produces for realizing at flow chart one
The device of the function specified in individual flow process or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions may be alternatively stored in and computer or the process of other programmable datas can be guided to set
In the standby computer-readable memory worked in a specific way so that be stored in this computer-readable memory
Instruction produce and include the manufacture of command device, this command device realizes in one flow process or multiple of flow chart
The function specified in flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, makes
Sequence of operations step must be performed to produce computer implemented place on computer or other programmable devices
Reason, thus the instruction performed on computer or other programmable devices provides for realizing flow chart one
The step of the function specified in flow process or multiple flow process and/or one square frame of block diagram or multiple square frame.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know base
This creativeness concept, then can make other change and amendment to these embodiments.So, appended right is wanted
Ask and be intended to be construed to include preferred embodiment and fall into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification without deviating from this to the present invention
Bright spirit and scope.So, if the present invention these amendment and modification belong to the claims in the present invention and
Within the scope of its equivalent technologies, then the present invention is also intended to comprise these change and modification.
Claims (4)
1. one kind generates the method that HBASE row is strong, it is characterised in that including:
Unique mark of the server that record is corresponding with HBASE successively in HBASE database, and
Described server sets up, with described HBASE, the time being connected;
The time and current time being connected is set up with described server, when setting up first according to described HBASE
Between and the described very first time is defined as the starting point that described HBASE row that overall situation static class generates is strong;
When accessing described overall situation static class, the starting point strong to described HBASE row, use Atomic atom
The method genesis sequence number adding 1, and described server is uniquely identified be defined as HBASE with described serial number
Row is strong.
2. the method for claim 1, it is characterised in that described according to described HBASE with described
Server sets up the time and current time connected, and sets up the very first time and is defined as entirely the described very first time
The starting point that the described HBASE row that office's static class generates is good for, including:
When the described time setting up connection is less than described current time, then described current time is defined as institute
State the very first time;Or
When the described time setting up connection is more than described current time, current time is increased by one and predefines
Increment after time be defined as the very first time.
3. one kind generates the device that HBASE row is strong, it is characterised in that including:
Record unit, for recording the server corresponding with HBASE successively in HBASE database
Unique mark, described server sets up, with described HBASE, the time being connected;
Set up unit, for the time being connected according to the foundation of described HBASE and described server and current time
Between, set up the very first time and the described very first time is defined as the described HBASE row that overall situation static class generates
Strong starting point;
Determine unit, be used for when accessing described overall situation static class, the starting point strong to described HBASE row,
Use the method genesis sequence number of Atomic atom adding 1, and described server is uniquely identified suitable with described
Sequence number is defined as HBASE row and is good for.
4. device as claimed in claim 3, it is characterised in that described set up unit specifically for:
When the described time setting up connection is less than described current time, then described current time is defined as institute
State the very first time;Or
When the described time setting up connection is more than described current time, current time is increased by one and predefines
Increment after time be defined as the very first time.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610511657.3A CN105956205B (en) | 2016-07-01 | 2016-07-01 | It is a kind of to generate the strong method and device of HBASE row |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610511657.3A CN105956205B (en) | 2016-07-01 | 2016-07-01 | It is a kind of to generate the strong method and device of HBASE row |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105956205A true CN105956205A (en) | 2016-09-21 |
CN105956205B CN105956205B (en) | 2019-07-02 |
Family
ID=56903044
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610511657.3A Active CN105956205B (en) | 2016-07-01 | 2016-07-01 | It is a kind of to generate the strong method and device of HBASE row |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105956205B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112835896A (en) * | 2021-01-27 | 2021-05-25 | 浙江中智达科技有限公司 | Real-time database data hotspot balancing method, device, equipment and medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150319229A1 (en) * | 2009-07-09 | 2015-11-05 | Dillon Software Services, Llc | Data store interface that facilitates distribution of application functionality across a multi-tier client-server architecture |
CN105117439A (en) * | 2015-08-11 | 2015-12-02 | 小米科技有限责任公司 | Global identifier generation method and apparatus |
-
2016
- 2016-07-01 CN CN201610511657.3A patent/CN105956205B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150319229A1 (en) * | 2009-07-09 | 2015-11-05 | Dillon Software Services, Llc | Data store interface that facilitates distribution of application functionality across a multi-tier client-server architecture |
CN105117439A (en) * | 2015-08-11 | 2015-12-02 | 小米科技有限责任公司 | Global identifier generation method and apparatus |
Non-Patent Citations (1)
Title |
---|
快乐的霖霖: "Twitter分布式自增ID算法Snowflake", 《CSDN博客HTTPS://BOLG.CSDN.NET/CHDHUST/ARTICLE/DETAIL/51759722》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112835896A (en) * | 2021-01-27 | 2021-05-25 | 浙江中智达科技有限公司 | Real-time database data hotspot balancing method, device, equipment and medium |
CN112835896B (en) * | 2021-01-27 | 2022-07-05 | 浙江中智达科技有限公司 | Real-time database data hotspot balancing method, device, equipment and medium |
Also Published As
Publication number | Publication date |
---|---|
CN105956205B (en) | 2019-07-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6045134B2 (en) | Parallel workload simulation for application performance testing | |
CN107133174A (en) | Test case code automatically generating device and method | |
CN108345485A (en) | identification method and device for interface view | |
CN105824849A (en) | Data import method and adapter | |
CN109995814A (en) | Moving method and device, communication equipment, the storage medium of cloud host resource | |
CN110022315A (en) | Weight management method, device and equipment in a kind of piece of chain type account book | |
CN108776587A (en) | Data capture method, device, computer equipment and storage medium | |
CN109558191A (en) | A kind of method, apparatus, storage medium and computer equipment configuring the page | |
CN105678625A (en) | Method and equipment for determining identity information of user | |
CN109491646B (en) | Message entry method and device, electronic equipment and readable medium | |
CN106843820A (en) | Code process method and apparatus | |
CN111327466B (en) | Alarm analysis method, system, equipment and medium | |
CN106126115A (en) | A kind of method and device of the disk of EVM(extended virtual machine) | |
CN109684033B (en) | Cloud platform bare metal management method, storage medium, electronic device and system | |
CN108427635A (en) | Quickly method, server and the computer readable storage medium of test web page | |
CN108241499A (en) | Update method, device and the computer readable storage medium of field value annotation | |
CN105956205A (en) | Method and apparatus for generating HBASE passkey | |
CN105867886A (en) | Method and device for writing table | |
CN106911634A (en) | A kind of login method and equipment | |
Park et al. | Self-adaptive middleware framework for internet of things | |
CN109656825A (en) | The method and device of fine arts resource processing, electronic equipment, storage medium | |
CN110471828A (en) | A kind of operating system testing method, apparatus and its equipment | |
CN110968888B (en) | Data processing method and device | |
CN107562420B (en) | Linux environment network interface structure memory processing method and device | |
CN105808318B (en) | Information processing method and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |