CN111694845A - Redis-based identifier generation method and device - Google Patents

Redis-based identifier generation method and device Download PDF

Info

Publication number
CN111694845A
CN111694845A CN202010474466.0A CN202010474466A CN111694845A CN 111694845 A CN111694845 A CN 111694845A CN 202010474466 A CN202010474466 A CN 202010474466A CN 111694845 A CN111694845 A CN 111694845A
Authority
CN
China
Prior art keywords
bit
identifier
database
numerical value
bits
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
CN202010474466.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.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202010474466.0A priority Critical patent/CN111694845A/en
Publication of CN111694845A publication Critical patent/CN111694845A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2272Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases

Abstract

The invention discloses an identification generation method and device based on Redis, and relates to the technical field of computers. One embodiment of the method comprises: receiving an identifier generation request, and detecting whether a current master database operates normally; if the switching is normal, setting the main/standby switching flag bit as a first numerical value, and generating an identifier by using the main database based on the sign bit, the first numerical value and the serial number; if the operation is abnormal, the main/standby switching flag bit is set to be a second numerical value, the main database and a normally-operated standby database are subjected to main/standby switching, and then the standby database is used for generating an identifier based on the sign bit, the second numerical value and the serial number. The main-standby switching mark bit values are different when the main database or the standby database is used, so that the uniqueness and the high availability of the mark generation are ensured, the disaster tolerance capability is strong, and the single-point fault is avoided; the idle bit is set, so that the ID length can be shortened, the occupation amount of the storage space is reduced, and the dynamic expansion of other subsequent identification bits is facilitated.

Description

Redis-based identifier generation method and device
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for generating an identifier based on Redis.
Background
In a complex distributed system, a large amount of data and messages are required to be uniquely identified, such as a contract number in a contract system, a core, mortgage, loan number in an acceptance system or a serial number of a bank card number, and the like, and the unique identifiers are distributed IDs.
At present, a method for generating a distributed ID based on Redis generally obtains an ID by using a single thread characteristic of the Redis and an expiration policy, where the generated distributed ID is 64 bits, and the specific steps are as follows: using 41bit storage time to be accurate to millisecond; storing a logic fragment ID by using 12 bits, wherein the maximum fragment ID is 4095; with 10 bits to deposit the self-growing ID, each node can generate up to 1024 IDs per millisecond.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
1. because the master-slave mode of Redis has the problem of master and slave synchronization, once the master is abnormal, when the slave is switched by failover, the ID may be repeated due to the master-slave consistency problem;
2. the time stamp is generated based on the local clock of the working equipment, so when the clock dial-back condition occurs to the working equipment, the time stamp for generating the ID can also be backed, and if the ID is generated according to the time stamp after the clock dial-back, the ID repetition problem can occur;
3. the 64-bit ID is redundant for most software systems, takes up too much memory space, and cannot be properly extended depending on the application scenario.
Disclosure of Invention
In view of this, embodiments of the present invention provide an identifier generating method and apparatus based on Redis, which can at least solve the problem in the prior art that ID duplication and extension are not easy.
To achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a method for generating an identifier based on Redis, where the identifier includes a sign bit, a master/slave switching flag bit, and a sequence number, and the sequence number is a self-increment sequence number, including:
receiving an identifier generation request, and detecting whether a current master database operates normally;
if the master-slave switching flag bit is normal, setting the master-slave switching flag bit to be a first numerical value, and generating an identifier by using the master database based on the sign bit, the first numerical value and the serial number;
and if the sign bit is abnormal, setting the main/standby switching flag bit as a second numerical value, switching the main database and a normally-operated standby database, and generating an identifier by using the standby database based on the sign bit, the second numerical value and the serial number.
Optionally, the identifier further includes a data center bit and an equipment identifier bit, the data center bit corresponds to a serial number of a data center, and the master database and the backup database are associated with the data center; the device identification bit corresponds to the number of the device issuing the serial number, and the device is located in the data center;
generating, by the master database, an identification based on the sign bit, the first value, and the sequence number, including: generating, with the master database, a tag based on the sign bit, the first value, the data center bit, the device identification bit, and the serial number;
generating, by the database, an identifier based on the sign bit, the second value, and the serial number, including: and generating an identifier based on the sign bit, the second numerical value, the data center bit, the equipment identification bit and the serial number by using the standby database.
Optionally, the detecting whether the current master database operates normally further includes:
and acquiring geographic information corresponding to the IP address in the identifier generation request, determining a data center corresponding to the geographic information, and further detecting whether a main database in the data center is normally operated at present.
Optionally, the identifier further includes a timestamp and a clock dial-back prevention flag bit, where the timestamp corresponds to a difference between the current time and the base time;
the method comprises the following steps:
when the clock callback does not occur, setting the clock callback prevention flag bit as a third numerical value;
generating, with the master database, an identification based on the sign bit, the first value, the third value, the timestamp, and the sequence number; or
Generating, with the backup database, an identifier based on the sign bit, the second value, the third value, the timestamp, and the sequence number;
when the clock is dialed back, determining a first timestamp after the clock is dialed back, acquiring a first identifier corresponding to the first timestamp, and then converting a clock dial-back prevention mark bit in the first identifier from a third value to a fourth value to obtain an identifier.
Optionally, the identifier further includes a data center bit, a device identification bit, a timestamp, and a clock callback prevention flag bit;
the method comprises the following steps:
when the clock callback does not occur, setting the clock callback prevention flag bit as a fifth numerical value;
generating, with the master database, an identifier based on the sign bit, the first numerical value, the data center bit, the device identification bit, the fifth numerical value, the timestamp, and the serial number; or
Generating, by the backup database, a flag based on the sign bit, the second numerical value, the data center bit, the device identification bit, the fifth numerical value, the timestamp, and the serial number;
when the clock is dialed back, determining a second timestamp after the clock is dialed back, acquiring a second identifier corresponding to the second timestamp, and further turning the clock dial-back prevention mark bit in the second identifier from the fifth numerical value to a sixth numerical value to obtain the identifier.
Optionally, the identifier further includes an idle bit;
the method further comprises the following steps: setting each of the free bits to a seventh value; and
and after one or more of the idle bits are moved to other identification bits, obtaining an eighth numerical value according to the bit number of the rest idle bits.
Optionally, the flag is a 64-bit integer, and to avoid generating a negative number, the sign bit of the 1 st bit is set to zero, and only the remaining 63 bits are used.
Optionally, the identifier is an integer of 64 bits minus the number of idle bits;
the method further comprises the following steps: removing the free bits from the 64-bit identification; and
and adding one or more bits in the idle bits to other identification bits to carry out bit number expansion on the other identification bits.
In order to achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an identifier generating apparatus based on Redis, where the identifier includes a sign bit, a main/standby switching flag bit, and a sequence number, and the sequence number is a self-increment sequence number, and includes:
the detection module is used for receiving the identifier generation request and detecting whether the current master database operates normally;
a first generating module, configured to set the active/standby switching flag bit to a first value if the flag bit is normal, and generate an identifier based on the sign bit, the first value, and the serial number by using the master database;
and the second generation module is used for setting the main/standby switching flag bit as a second numerical value if the main/standby switching flag bit is abnormal, performing main/standby switching on the main database and a normally-operated standby database, and further generating an identifier based on the sign bit, the second numerical value and the serial number by using the standby database.
Optionally, the identifier further includes a data center bit and an equipment identifier bit, the data center bit corresponds to a serial number of a data center, and the master database and the backup database are associated with the data center; the device identification bit corresponds to the number of the device issuing the serial number, and the device is located in the data center;
the first generating module is configured to: generating, with the master database, a tag based on the sign bit, the first value, the data center bit, the device identification bit, and the serial number;
the second generating module is configured to: and generating an identifier based on the sign bit, the second numerical value, the data center bit, the equipment identification bit and the serial number by using the standby database.
Optionally, the detection module is further configured to: and acquiring geographic information corresponding to the IP address in the identifier generation request, determining a data center corresponding to the geographic information, and further detecting whether a main database in the data center is normally operated at present.
Optionally, the identifier further includes a timestamp and a clock dial-back prevention flag bit, where the timestamp corresponds to a difference between the current time and the base time;
the device comprises a first clock dial-back module used for:
when the clock callback does not occur, setting the clock callback prevention flag bit as a third numerical value;
generating, with the master database, an identification based on the sign bit, the first value, the third value, the timestamp, and the sequence number; or
Generating, with the backup database, an identifier based on the sign bit, the second value, the third value, the timestamp, and the sequence number;
when the clock is dialed back, determining a first timestamp after the clock is dialed back, acquiring a first identifier corresponding to the first timestamp, and then converting a clock dial-back prevention mark bit in the first identifier from a third value to a fourth value to obtain an identifier.
Optionally, the identifier further includes a data center bit, a device identification bit, a timestamp, and a clock callback prevention flag bit;
the apparatus comprises a second clock callback module configured to:
when the clock callback does not occur, setting the clock callback prevention flag bit as a fifth numerical value;
generating, with the master database, an identifier based on the sign bit, the first numerical value, the data center bit, the device identification bit, the fifth numerical value, the timestamp, and the serial number; or
Generating, by the backup database, a flag based on the sign bit, the second numerical value, the data center bit, the device identification bit, the fifth numerical value, the timestamp, and the serial number;
when the clock is dialed back, determining a second timestamp after the clock is dialed back, acquiring a second identifier corresponding to the second timestamp, and further turning the clock dial-back prevention mark bit in the second identifier from the fifth numerical value to a sixth numerical value to obtain the identifier.
Optionally, the identifier further includes an idle bit;
the device further comprises: setting each of the free bits to a seventh value; and
and after one or more of the idle bits are moved to other identification bits, obtaining an eighth numerical value according to the bit number of the rest idle bits.
Optionally, the flag is a 64-bit integer, and to avoid generating a negative number, the sign bit of the 9 th bit is set to zero, and only the remaining 63 bits are used.
Optionally, the identifier is an integer of 64 bits minus the number of idle bits;
the device further comprises: removing the free bits from the 64-bit identification; and
and adding one or more bits in the idle bits to other identification bits to carry out bit number expansion on the other identification bits.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an identification generation electronic device based on Redis.
The electronic device of the embodiment of the invention comprises: one or more processors; a storage device, configured to store one or more programs that, when executed by the one or more processors, cause the one or more processors to implement any of the above-described methods for Redis-based identity generation.
To achieve the above object, according to a further aspect of the embodiments of the present invention, there is provided a computer readable medium having stored thereon a computer program, which when executed by a processor, implements any of the above-described Redis-based id generation methods.
According to the scheme provided by the invention, one embodiment of the invention has the following advantages or beneficial effects: the main database and the standby database can be switched between the main database and the standby database to generate identifiers, and the main-standby switching mark bit values are different when the main database or the standby database is used, so that the uniqueness and the high availability of the identifier generation are ensured, the disaster tolerance capability is strong, and the single-point fault is avoided; the idle bit is set, so that the ID length can be shortened, the occupation amount of the storage space is reduced, and the dynamic expansion of other subsequent identification bits is facilitated.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic main flow diagram of a method for generating an identifier based on Redis according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an alternative Redis-based identity generation method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a data center processing request provided by an embodiment of the invention;
FIG. 4 is a flowchart illustrating an alternative Redis-based identity generation method according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating a further alternative Redis-based identity generation method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of the main modules of a Redis-based ID generation apparatus according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 8 is a schematic block diagram of a computer system suitable for use with a mobile device or server implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Referring to fig. 1, a schematic flow chart of an identifier generation method based on Redis according to an embodiment of the present invention is shown, including the following steps:
s101: receiving an identifier generation request, and detecting whether a current master database operates normally;
s102: if the master-slave switching flag bit is normal, setting the master-slave switching flag bit as a first numerical value, and generating an identifier by using the master database based on the sign bit, the first numerical value and the serial number;
s103: if the operation is abnormal, the main/standby switching flag bit is set to be a second numerical value, the main database and a standby database which operates normally are subjected to main/standby switching, and then the standby database is used for generating an identifier based on the sign bit, the second numerical value and the serial number.
In the above embodiment, for steps S101 to S103, to solve the problem of ID duplication caused by master-slave consistency when Redis switches between master and slave, the scheme adds a master-slave switching flag bit to obtain a 64-bit distributed ID combination mode of "sign bit + master-slave switching bit + self-incremented sequence number:
TABLE 1
1bit 1bit 62bit
Sign bit Master-slave switch flag bit Self-increment serial number
A sign bit, located at the head, to avoid generating a negative number, typically set to zero;
the master-slave switching flag bit is used for turning over the bit when the master-slave switching of Redis occurs, wherein the bit can be turned from 0 to 1 or from 1 to 0, and is specifically set by a worker;
the sequence number is kept increasing at a single node, and the generation mode is the prior one, which is not described herein again.
The Redis has a master-slave mode, when a master is abnormal, a slave is switched to be processed as a new master, but when the slave is also abnormal, another slave is switched to be processed as a new master, so that one master generally corresponds to a plurality of slaves and all the masters are in the same data center.
When the master running state is normal, the master-slave switching flag bit is a first numerical value (for example, 0), the sign bit, the first numerical value and the serial number are combined to generate an identifier based on the master according to the sequence shown in table 1, but if the master running state is abnormal, the master running state is a second numerical value (for example, 1), the master running state needs to be switched to slave to process the identifier generation request, and then the sign bit, the second numerical value and the serial number are combined to generate the identifier according to the sequence shown in table 1.
In practice, sequence numbers that may not be 62 bits can be used, and can be reduced appropriately, for example, by setting idle bits, as shown in table 2:
TABLE 2
1bit 4bit (for example only) 1bit 62bit
Sign bit Free bit Master-slave switch flag bit Self-increment serial number
The distributed ID may or may not contain the free bits:
1) if the idle bit of 4 bits is deleted, the length of the generated distributed ID is 60 bits;
2) if not deleted, the length of the generated ID is still 64 bits, but the values of the free bits following the sign bit may all be 0 (for example only).
Another purpose of setting the free bit is to facilitate expansion. Subsequently, if the sequence number bit needs to be expanded, one or more of the idle bits can be moved to the sequence number bit. If the ID length is still 64 bits, other identification bits need to be moved forward, for example, the active/standby switch flag bit is moved forward by one bit.
However, if the length is 64 bits minus the idle bit, one or more bits need to be added to the desired position, and the ID length changes, for example, from 60 bits to 61 bits. Similarly, if the number of bits of the serial number bits needs to be punctured, the punctured number of bits is adaptively added to the spare bits.
In the method provided by the embodiment, the primary database and the standby database can be switched between the primary database and the standby database to generate the identifiers, and the primary and standby switching mark bit values are different when the primary database or the standby database is used, so that the uniqueness and the high availability of the identifier generation are ensured, the disaster tolerance capability is strong, and the single-point fault is avoided; the idle bit is set, so that the ID length can be shortened, the occupation amount of the storage space is reduced, and the dynamic expansion of other subsequent identification bits is facilitated.
Referring to fig. 2, a schematic flow chart of an optional identifier generation method based on Redis according to an embodiment of the present invention is shown, including the following steps:
s201: receiving an identifier generation request, and detecting whether a current master database operates normally;
s202: if the switching is normal, setting the main/standby switching flag bit as a first numerical value;
s203: generating an identifier based on the sign bit, the first numerical value, the data center bit, the equipment identification bit and the serial number by using the master database; the data center is corresponding to the serial number of the data center, and the main database and the standby database are associated with the data center; the equipment identification position corresponds to the serial number of the equipment for issuing the serial number, and the equipment is positioned in the data center;
s204: if the master-slave switching flag bit is abnormal, setting the master-slave switching flag bit as a second numerical value, and carrying out master-slave switching on the master database and a normal-operation master database;
s205: and generating an identifier based on the sign bit, the second numerical value, the data center bit, the equipment identification bit and the serial number by utilizing the standby database.
In the above embodiment, for steps S202 and S204, reference may be made to the description of steps S102 and S103 shown in fig. 1, and details are not repeated here.
In the above embodiment, for steps S201, S203 and S205, compared to that shown in fig. 1, data center bits and device identification bits are added, and the obtained 64-bit distributed ID generation method is:
TABLE 3
Figure BDA0002515407460000101
The master-slave switching mark bit is used for turning over the bit when the Redis is subjected to master-slave switching;
data center bit: the number of occupied bits is related to the number of data centers (or servers) owned by the enterprise, and if there are 3 data centers, the corresponding binary numbers can be expressed as 000, 001, 010;
equipment identification position: the number of the equipment worker for issuing the serial number is shown, the equipment is positioned in the data center, and 256 different pieces of equipment can be shown in table 2;
sequence numbers, which remain self-increasing at a single node.
It should be noted that the data center may be deployed in different places, and generally processes the identifier generation request of the local area, specifically determined by the IP address in the identifier generation request.
Referring to fig. 3, a service request generates an identifier, and an IDC (internet data center) is determined according to a region where the service is located. The IDC comprises workers issuing serial numbers, the number of the workers can be multiple, and the IDs are generated by using a master or a slave in the IDC.
When multiple IDCs are involved, each component is provided with a Redis cluster by deploying a set of distributed ID components for each IDC. The IDs stored in different IDCs are different, so that the generated complete sequences are different, different IDCs are dependent and separated without mutual influence, and globally unique distributed IDs can be generated.
In practice, the ID may not be 64 bits, and to reduce the ID length, the length may be reduced, for example, setting idle bits, as shown in table 4:
TABLE 4
Figure BDA0002515407460000111
If the 4-bit idle bit is deleted, the length of the generated distributed ID is 60 bits, and if the idle bit is not deleted, the length of the generated ID is still 64 bits, but the values of the idle bits after the sign bit may all be 0 (for example only).
Subsequently, if the data center bit, the device identification bit, or the serial number bit needs to be extended, one or more of the idle bits may be moved to a desired position, for example, the data center bit is increased by 1bit to 11 bits. If the ID length is still 64 bits, other identification bits need to be moved forward, for example, the active/standby switching flag bit is moved forward by one bit; however, if the integer is 64 bits minus the spare bits, one or more bits need to be added to the desired position. Similarly, if the number of bits of the data center bit, the device identification bit or the serial number bit needs to be deleted, the deleted number of bits is adaptively added to the idle bits.
In the method provided by the embodiment, the data center position and the equipment identification position are added into the identification, so that a plurality of data centers can be deployed in different places, and the different-place multi-activity capability of the service is realized; the client can preferentially access the data center in the same region to complete the ID generation service, so that the network delay is reduced; the ID length can be shortened by setting the idle bit, and the dynamic expansion of other subsequent identification bits is facilitated.
Referring to fig. 4, a flowchart of another optional identifier generation method based on Redis according to an embodiment of the present invention is shown, including the following steps:
s401: receiving an identifier generation request, and detecting whether a current master database operates normally;
s402: if the master-slave switching flag bit is normal, setting the master-slave switching flag bit to be a first numerical value;
s403: if the master-slave switching flag bit is abnormal, setting the master-slave switching flag bit to be a second numerical value, and carrying out master-slave switching on the master database and a master-slave database which normally operates;
s404: when the clock callback does not occur, setting the clock callback prevention flag bit as a third numerical value;
s405: generating an identifier based on the sign bit, the first value, the third value, the timestamp and the serial number by using a master database; wherein the timestamp corresponds to a difference between the current time and the base time;
s406: generating an identifier based on the sign bit, the second numerical value, the third numerical value, the timestamp and the serial number by using a standby database;
s407: when the clock is dialed back, a first timestamp after the clock is dialed back is determined, a first identifier corresponding to the first timestamp is obtained, and then the clock dial-back prevention mark bit in the first identifier is turned from a third value to a fourth value to obtain the identifier.
In the above embodiment, the descriptions of steps S101 to S103 shown in fig. 1 can be referred to for steps S401 to S403, and are not repeated herein.
In the above embodiment, the clock-back prevention flag bit and the timestamp are added to steps S404 to S407, as compared to those shown in fig. 1, and the 64-bit distributed ID generation scheme is obtained by:
TABLE 5
Figure BDA0002515407460000121
Master-slave switching flag bit: when the main database is offline or fails, switching to the standby database, and turning over the mark to prevent the ID repetition problem caused by the main-standby consistency problem;
clock callback prevention flag bit: when the clock is dialed back, the bit is turned over to prevent the generation of repeated ID, the ID can be turned from 0 to 1, and also can be turned from 1 to 0, and the ID respectively represents a third numerical value and a fourth numerical value which are specifically set by a worker;
time stamping: represents the difference between the current time and a base time, which may be the operating device start-up time. Set to 40 bits, can be used for about 35 years;
sequence numbers, which remain self-increasing at a single node.
When the clock dial-back does not occur, the clock dial-back prevention flag bit is set to be a third numerical value, for example, 0, at this time, if the master is normal, the IDs are generated based on the master according to the sequence shown in table 5, otherwise, the master and standby are switched to the slave, and the IDs are generated based on the slave according to the sequence shown in table 5.
However, if the clock callback occurs, the clock callback bit in the ID corresponding to the first timestamp after the clock callback may be directly flipped without considering the active/standby switching, for example, from 0 to 1 or from 1 to 0, which has a difference of the value of the clock callback prevention flag bit compared to the ID corresponding to the first timestamp.
Also, in practical operation, 64-bit ID may not be used, so that the ID length can be adaptively reduced according to practical requirements, and referring to table 6, 7-bit idle bits are reserved:
TABLE 6
Figure BDA0002515407460000131
If 7-bit idle bits are deleted, the length of the generated distributed ID is 57 bits, and if the idle bits are not deleted, the length of the generated ID is still 64 bits, but the values of the idle bits after the sign bit may all be 0 (for example only).
Subsequently, if the time stamp or the sequence number bits need to be extended, one or more of the idle bits may be moved to the desired position, for example, the time stamp is increased by 1bit to 41 bits, if the ID length is still 64 bits, other identification bits need to be moved forward, but if the ID length is an integer obtained by subtracting the idle bits from 64 bits, one or more bits need to be added to the desired position. Similarly, if the number of bits of the timestamp or the serial number needs to be punctured, the punctured number of bits is adaptively added to the idle bits.
According to the method provided by the lock, the clock callback condition can occur when the timestamp is used, and different IDs can be generated aiming at the same timestamp by adding the clock callback prevention mark bit capable of realizing numerical value inversion, so that the problem of ID repetition is solved; the ID length can be shortened by setting the idle bit, and the dynamic expansion of other subsequent identification bits is facilitated.
Referring to fig. 5, a schematic flow chart of another optional identifier generation method based on Redis according to an embodiment of the present invention is shown, including the following steps:
s501: receiving an identifier generation request, and detecting whether a current master database operates normally;
s502: if the master-slave switching flag bit is normal, setting the master-slave switching flag bit to be a first numerical value;
s503: if the master-slave switching flag bit is abnormal, setting the master-slave switching flag bit to be a second numerical value, and carrying out master-slave switching on the master database and a master-slave database which normally operates;
s504: when the clock callback does not occur, setting the clock callback prevention flag bit as a fifth numerical value;
s505: generating an identifier by using a master database based on the sign bit, the first numerical value, the data center bit, the equipment identification bit, the fifth numerical value, the timestamp and the serial number;
s506: generating an identifier based on the sign bit, the second numerical value, the data center bit, the equipment identification bit, the fifth numerical value, the timestamp and the serial number by using a standby database;
s507: when the clock is dialed back, a second timestamp after the clock is dialed back is determined, a second identifier corresponding to the second timestamp is obtained, and then the clock dial-back prevention mark bit in the second identifier is turned from a fifth numerical value to a sixth numerical value to obtain the identifier.
In the above embodiment, for steps S501 to S503, reference may be made to the description of steps S101 to S103 shown in fig. 1, and details are not repeated here.
In the above embodiment, the data center bit, the device identification bit, the clock callback prevention flag bit, and the timestamp are added to steps S504 to S507, as compared to those shown in fig. 1, and the 64-bit distributed ID generation method obtained is:
TABLE 7
Figure BDA0002515407460000141
Sign bit: 1bit, typically set to 0;
master-slave switching flag bit: when the main database is offline or fails, switching to the standby database, and turning over the mark to prevent the ID repetition problem caused by the main-standby consistency problem;
data center bit: a number that may represent 3 data centers;
equipment identification position: can represent 8 devices which issue serial numbers;
clock callback prevention flag bit: when a clock callback occurs, flipping this bit to prevent the generation of duplicate IDs; the fifth numerical value at this time may be the same as the third numerical value shown in fig. 4, for example, both are 0, or may be opposite, for example, 1, specifically set by the operator.
Time stamping: represents the difference between the current time and a base time, which may be the operating device start-up time. The timestamp is set to 40 bits, which can be used for about 35 years;
sequence numbers, which remain self-increasing at a single node.
1) When clock callback does not occur and the master database is normal, the master-slave switching flag bit is a first numerical value, the clock callback prevention flag bit is set to a third numerical value, for example, 0, and the IDs are generated based on the master in the sequence shown in table 7;
2) and when the clock callback does not occur and the master database is abnormal, switching the master and slave to the slave, setting the master and slave switching flag bit as a second numerical value, setting the clock callback prevention flag bit as a third numerical value, and generating the ID based on the slave according to the sequence shown in the table 7.
3) If the clock callback occurs, the clock callback bit in the ID corresponding to the first timestamp after the clock callback may be directly flipped without considering the active/standby switching, for example, from 0 to 1 or from 1 to 0.
Also, in practical operation, 64-bit ID may not be used, so that the ID length can be adaptively reduced according to practical requirements, and referring to table 8, 5-bit idle bits are reserved:
TABLE 8
Figure BDA0002515407460000151
If 5-bit idle bits are deleted, the length of the generated distributed ID is 59 bits, and if the idle bits are not deleted, the length of the generated ID is still 64 bits, but the values of the idle bits after the sign bit may all be 0 (for example only).
Subsequently, if the data center bit, the device identification bit, the timestamp and the serial number need to be extended, one or more of the free bits may be moved to a desired position, for example, the timestamp is increased by 1bit to 41 bits. If the ID length is still 64 bits, then other identification bits need to be shifted forward, but if it is an integer of 64 bits minus the spare bits, then one or more bits need to be added to the desired location. Similarly, if the number of bits of the data center bit, the device identification bit, the timestamp and the serial number needs to be deleted, the deleted bits are adaptively added to the idle bits.
The method provided by the embodiment sufficiently considers the primary and standby switching, the data center and the clock callback scenes, and performs segmented processing on the distributed ID on the basis of traditional Redis-based distributed ID generation so as to solve the problems of primary and standby consistency and ID repetition caused by clock callback.
Compared with the prior art, the method provided by the embodiment of the invention has the following beneficial effects that on the basis of the traditional generation of the distributed ID based on Redis, the distributed ID is processed in a segmented manner:
1) the main/standby switching flag bit is used for carrying out numerical value inversion when the main/standby switching occurs, so that the problem of ID repetition caused by the consistency of the main/standby is solved;
2) and adding a data center position and an equipment identification position to realize remote deployment, wherein different data centers and equipment use different Redis clusters, are not influenced mutually and can operate independently. The client preferentially accesses the data center in the same region, and when the main database of the data center is unavailable, the client can be switched to the standby database for processing;
3) the clock dial-back mark bit only considers the mark of the time stamp corresponding to the clock dial-back when the clock dial-back occurs, and the clock dial-back mark bit in the mark is inverted from a third value to a fourth value so as to obtain a new mark different from the third value, and the ID repetition problem is also solved;
4) and reserving idle bits to adaptively adjust the distribution setting of bits in the Redis lua script function according to actual service requirements, thereby realizing the dynamic expansion of each domain.
Referring to fig. 6, a schematic diagram of main modules of an identifier generating apparatus 600 based on Redis according to an embodiment of the present invention is shown, where the identifier includes a sign bit, a primary/secondary switching flag bit, and a serial number, and the serial number is a self-increment serial number, and includes:
the detection module 601 is configured to receive an identifier generation request and detect whether a current master database operates normally;
a first generating module 602, configured to set the active/standby switching flag bit to a first value if the flag bit is normal, and generate an identifier based on the sign bit, the first value, and the serial number by using the master database;
a second generating module 603, configured to set the active/standby switching flag bit to a second value if the flag bit is abnormal, perform active/standby switching between the primary database and a normally operating standby database, and further generate an identifier based on the sign bit, the second value, and the serial number by using the standby database.
In the implementation device of the invention, the identifier further comprises a data center bit and an equipment identifier bit, the data center bit corresponds to the serial number of the data center, and the main database and the standby database are associated with the data center; the device identification bit corresponds to the number of the device issuing the serial number, and the device is located in the data center;
the first generating module 602 is configured to: generating, with the master database, a tag based on the sign bit, the first value, the data center bit, the device identification bit, and the serial number;
the second generating module 603 is configured to: and generating an identifier based on the sign bit, the second numerical value, the data center bit, the equipment identification bit and the serial number by using the standby database.
In the implementation apparatus of the present invention, the detecting module 601 is further configured to:
and acquiring geographic information corresponding to the IP address in the identifier generation request, determining a data center corresponding to the geographic information, and further detecting whether a main database in the data center is normally operated at present.
In the implementation device of the invention, the identifier further comprises a timestamp and a clock callback prevention flag bit, wherein the timestamp corresponds to the difference value between the current time and the basic time;
the apparatus includes a first clock dial-back module 604 (not shown) for:
when the clock callback does not occur, setting the clock callback prevention flag bit as a third numerical value;
generating, with the master database, an identification based on the sign bit, the first value, the third value, the timestamp, and the sequence number; or
Generating, with the backup database, an identifier based on the sign bit, the second value, the third value, the timestamp, and the sequence number;
when the clock is dialed back, determining a first timestamp after the clock is dialed back, acquiring a first identifier corresponding to the first timestamp, and then converting a clock dial-back prevention mark bit in the first identifier from a third value to a fourth value to obtain an identifier.
In the implementation device of the invention, the identifier further comprises a data center bit, an equipment identifier bit, a timestamp and a clock callback prevention mark bit;
the apparatus includes a second clock back-dialing module 605 (not shown) for:
when the clock callback does not occur, setting the clock callback prevention flag bit as a fifth numerical value;
generating, with the master database, an identifier based on the sign bit, the first numerical value, the data center bit, the device identification bit, the fifth numerical value, the timestamp, and the serial number; or
Generating, by the backup database, a flag based on the sign bit, the second numerical value, the data center bit, the device identification bit, the fifth numerical value, the timestamp, and the serial number;
when the clock is dialed back, determining a second timestamp after the clock is dialed back, acquiring a second identifier corresponding to the second timestamp, and further turning the clock dial-back prevention mark bit in the second identifier from the fifth numerical value to a sixth numerical value to obtain the identifier.
In the device for implementing the invention, the identifier further comprises an idle bit;
the device further comprises: setting each of the free bits to a seventh value; and
and after one or more of the idle bits are moved to other identification bits, obtaining an eighth numerical value according to the bit number of the rest idle bits.
In the device for implementing the invention, the mark is a 64-bit integer, and in order to avoid generating negative numbers, the 9 th bit sign bit is set to be zero, and only the remaining 63 bits are used.
In the implementation device of the invention, the identifier is an integer obtained by subtracting the idle bit number from 64 bits;
the device further comprises: removing the free bits from the 64-bit identification; and
and adding one or more bits in the idle bits to other identification bits to carry out bit number expansion on the other identification bits.
In addition, the detailed implementation of the device in the embodiment of the present invention has been described in detail in the above method, so that the repeated description is not repeated here.
FIG. 7 illustrates an exemplary system architecture 700 to which embodiments of the invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704 and a server 705 (by way of example only). The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. Various communication client applications may be installed on the terminal devices 701, 702, 703.
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 701, 702, 703.
It should be noted that the method provided by the embodiment of the present invention is generally executed by the server 705, and accordingly, the apparatus is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a detection module, a first generation module, and a second generation module. The names of these modules do not in some cases constitute a limitation on the module itself, and for example, a detection module may also be described as a "module that detects the state of a master database".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
receiving an identifier generation request, and detecting whether a current master database operates normally;
if the master-slave switching flag bit is normal, setting the master-slave switching flag bit to be a first numerical value, and generating an identifier by using the master database based on the sign bit, the first numerical value and the serial number;
and if the sign bit is abnormal, setting the main/standby switching flag bit as a second numerical value, switching the main database and a normally-operated standby database, and generating an identifier by using the standby database based on the sign bit, the second numerical value and the serial number.
According to the technical scheme of the embodiment of the invention, the main database and the standby database can be switched between the main database and the standby database to generate the identifiers, and the main-standby switching mark bit values are different when the main database or the standby database is used, so that the uniqueness and the high availability of the identifier generation are ensured, the disaster tolerance capability is strong, and the single-point fault is avoided; the idle bit is set, so that the ID length can be shortened, the occupation amount of the storage space is reduced, and the dynamic expansion of other subsequent identification bits is facilitated.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (11)

1. A method for generating an identifier based on Redis, wherein the identifier comprises a sign bit, a main/standby switching flag bit and a serial number, and the serial number is a self-increment serial number, and the method is characterized by comprising the following steps:
receiving an identifier generation request, and detecting whether a current master database operates normally;
if the master-slave switching flag bit is normal, setting the master-slave switching flag bit to be a first numerical value, and generating an identifier by using the master database based on the sign bit, the first numerical value and the serial number;
and if the sign bit is abnormal, setting the main/standby switching flag bit as a second numerical value, switching the main database and a normally-operated standby database, and generating an identifier by using the standby database based on the sign bit, the second numerical value and the serial number.
2. The method of claim 1, wherein the identifier further comprises a data center bit and a device identification bit, the data center bit corresponding to a number of a data center with which the primary database and the secondary database are associated; the device identification bit corresponds to the number of the device issuing the serial number, and the device is located in the data center;
generating, by the master database, an identification based on the sign bit, the first value, and the sequence number, including: generating, with the master database, a tag based on the sign bit, the first value, the data center bit, the device identification bit, and the serial number;
generating, by the database, an identifier based on the sign bit, the second value, and the serial number, including: and generating an identifier based on the sign bit, the second numerical value, the data center bit, the equipment identification bit and the serial number by using the standby database.
3. The method of claim 2, wherein detecting whether the current master database is functioning properly further comprises:
and acquiring geographic information corresponding to the IP address in the identifier generation request, determining a data center corresponding to the geographic information, and further detecting whether a main database in the data center is normally operated at present.
4. The method of claim 1, wherein the identification further comprises a timestamp and a clock-callback-prevention flag bit, the timestamp corresponding to a difference between the current time and the base time;
the method comprises the following steps:
when the clock callback does not occur, setting the clock callback prevention flag bit as a third numerical value;
generating, with the master database, an identification based on the sign bit, the first value, the third value, the timestamp, and the sequence number; or
Generating, with the backup database, an identifier based on the sign bit, the second value, the third value, the timestamp, and the sequence number;
when the clock is dialed back, determining a first timestamp after the clock is dialed back, acquiring a first identifier corresponding to the first timestamp, and then converting a clock dial-back prevention mark bit in the first identifier from a third value to a fourth value to obtain an identifier.
5. The method of claim 1, wherein the identification further comprises a data center bit, a device identification bit, a timestamp, and a clock callback prevention flag bit;
the method comprises the following steps:
when the clock callback does not occur, setting the clock callback prevention flag bit as a fifth numerical value;
generating, with the master database, an identifier based on the sign bit, the first numerical value, the data center bit, the device identification bit, the fifth numerical value, the timestamp, and the serial number; or
Generating, by the backup database, a flag based on the sign bit, the second numerical value, the data center bit, the device identification bit, the fifth numerical value, the timestamp, and the serial number;
when the clock is dialed back, determining a second timestamp after the clock is dialed back, acquiring a second identifier corresponding to the second timestamp, and further turning the clock dial-back prevention mark bit in the second identifier from the fifth numerical value to a sixth numerical value to obtain the identifier.
6. The method of claim 1, wherein the identification further comprises a free bit;
the method further comprises the following steps: setting each of the free bits to a seventh value; and
and after one or more of the idle bits are moved to other identification bits, obtaining an eighth numerical value according to the bit number of the rest idle bits.
7. The method of claim 6, wherein the flag is a 64-bit integer, and wherein to avoid generating a negative number, the sign bit of the 1 st bit is set to zero and only the remaining 63 bits are used.
8. The method of claim 1, wherein the identification is an integer of 64 bits minus a number of idle bits;
the method further comprises the following steps: removing the free bits from the 64-bit identification; and
and adding one or more bits in the idle bits to other identification bits to carry out bit number expansion on the other identification bits.
9. An identifier generating device based on Redis, wherein the identifier comprises a sign bit, a master/slave switching flag bit and a serial number, and the serial number is a self-increment serial number, and the identifier generating device is characterized by comprising:
the detection module is used for receiving the identifier generation request and detecting whether the current master database operates normally;
a first generating module, configured to set the active/standby switching flag bit to a first value if the flag bit is normal, and generate an identifier based on the sign bit, the first value, and the serial number by using the master database;
and the second generation module is used for setting the main/standby switching flag bit as a second numerical value if the main/standby switching flag bit is abnormal, performing main/standby switching on the main database and a normally-operated standby database, and further generating an identifier based on the sign bit, the second numerical value and the serial number by using the standby database.
10. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8.
11. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-8.
CN202010474466.0A 2020-05-29 2020-05-29 Redis-based identifier generation method and device Pending CN111694845A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010474466.0A CN111694845A (en) 2020-05-29 2020-05-29 Redis-based identifier generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010474466.0A CN111694845A (en) 2020-05-29 2020-05-29 Redis-based identifier generation method and device

Publications (1)

Publication Number Publication Date
CN111694845A true CN111694845A (en) 2020-09-22

Family

ID=72478842

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010474466.0A Pending CN111694845A (en) 2020-05-29 2020-05-29 Redis-based identifier generation method and device

Country Status (1)

Country Link
CN (1) CN111694845A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112199923A (en) * 2020-10-20 2021-01-08 重庆紫光华山智安科技有限公司 Identification generation method, system, device and medium based on distributed system
CN113342803A (en) * 2021-03-03 2021-09-03 中国工商银行股份有限公司 Database updating method, device, equipment and medium
CN113810216A (en) * 2020-12-31 2021-12-17 京东科技控股股份有限公司 Cluster fault switching method and device and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107968847A (en) * 2017-11-13 2018-04-27 深圳市华阅文化传媒有限公司 High Availabitity ID makers and its ID generation methods and device
CN109740120A (en) * 2018-12-14 2019-05-10 深圳壹账通智能科技有限公司 The generation method of unique identification, device, computer equipment under distributed environment
CN109902077A (en) * 2018-12-29 2019-06-18 阿里巴巴集团控股有限公司 A kind of service request processing method, device and equipment
CN110417863A (en) * 2019-06-27 2019-11-05 华为技术有限公司 Generate method and apparatus, identity authentication method and the device of identity code
CN110554732A (en) * 2019-08-22 2019-12-10 北京奇艺世纪科技有限公司 identification number generation method and device, electronic equipment and storage medium
CN110909378A (en) * 2019-10-30 2020-03-24 网联清算有限公司 Automatic detection method and device, storage medium and electronic equipment
CN111046057A (en) * 2019-12-26 2020-04-21 京东数字科技控股有限公司 Data processing method and device for server cluster, computer equipment and medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107968847A (en) * 2017-11-13 2018-04-27 深圳市华阅文化传媒有限公司 High Availabitity ID makers and its ID generation methods and device
CN109740120A (en) * 2018-12-14 2019-05-10 深圳壹账通智能科技有限公司 The generation method of unique identification, device, computer equipment under distributed environment
CN109902077A (en) * 2018-12-29 2019-06-18 阿里巴巴集团控股有限公司 A kind of service request processing method, device and equipment
CN110417863A (en) * 2019-06-27 2019-11-05 华为技术有限公司 Generate method and apparatus, identity authentication method and the device of identity code
CN110554732A (en) * 2019-08-22 2019-12-10 北京奇艺世纪科技有限公司 identification number generation method and device, electronic equipment and storage medium
CN110909378A (en) * 2019-10-30 2020-03-24 网联清算有限公司 Automatic detection method and device, storage medium and electronic equipment
CN111046057A (en) * 2019-12-26 2020-04-21 京东数字科技控股有限公司 Data processing method and device for server cluster, computer equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
安能: "分布式唯一ID的生成方案" *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112199923A (en) * 2020-10-20 2021-01-08 重庆紫光华山智安科技有限公司 Identification generation method, system, device and medium based on distributed system
CN113810216A (en) * 2020-12-31 2021-12-17 京东科技控股股份有限公司 Cluster fault switching method and device and electronic equipment
CN113342803A (en) * 2021-03-03 2021-09-03 中国工商银行股份有限公司 Database updating method, device, equipment and medium
CN113342803B (en) * 2021-03-03 2024-03-12 中国工商银行股份有限公司 Database updating method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN111091429B (en) Electronic bill identification distribution method and device and electronic bill generation system
CN111694845A (en) Redis-based identifier generation method and device
CN108712332B (en) Communication method, system and device
CN109492013B (en) Data processing method, device and system applied to database cluster
US20140108358A1 (en) System and method for supporting transient partition consistency in a distributed data grid
CN111460129B (en) Method, device, electronic equipment and storage medium for generating identification
CN111694792A (en) Identification generation method and device based on snowfly
CN111541762B (en) Data processing method, management server, device and storage medium
CN106993022B (en) Identification management method for cluster, identification server and corresponding system
CN111104250B (en) Method, apparatus and computer readable medium for data processing
CN110659124A (en) Message processing method and device
US10877994B2 (en) Identifier based data replication
CN107547605B (en) message reading and writing method based on node queue and node equipment
CN112231399A (en) Method and device applied to graph database
CN110798358A (en) Distributed service identification method and device, computer readable medium and electronic equipment
CN111198756A (en) Application scheduling method and device of kubernets cluster
US20090132716A1 (en) Fault-tolerant distributed services methods and systems
CN113760469A (en) Distributed computing method and device
CN110935168B (en) Distributed ID generation method, device and equipment for global uniform architecture
CN109325057B (en) Middleware management method, device, computer equipment and storage medium
CN113556370A (en) Service calling method and device
CN112948430B (en) Date data query method and device
CN114547678A (en) Risk control method and device
CN116015676A (en) ID generation method, medium, device and computing equipment
CN114490128A (en) Data storage method and device under remote multi-active architecture

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: 20220930

Address after: 25 Financial Street, Xicheng District, Beijing 100033

Applicant after: CHINA CONSTRUCTION BANK Corp.

Address before: 25 Financial Street, Xicheng District, Beijing 100033

Applicant before: CHINA CONSTRUCTION BANK Corp.

Applicant before: Jianxin Financial Science and Technology Co.,Ltd.