CN107153680B - Method and system for on-line node expansion of distributed memory database - Google Patents

Method and system for on-line node expansion of distributed memory database Download PDF

Info

Publication number
CN107153680B
CN107153680B CN201710253625.2A CN201710253625A CN107153680B CN 107153680 B CN107153680 B CN 107153680B CN 201710253625 A CN201710253625 A CN 201710253625A CN 107153680 B CN107153680 B CN 107153680B
Authority
CN
China
Prior art keywords
node
nodes
distributed memory
memory database
routing rule
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.)
Active
Application number
CN201710253625.2A
Other languages
Chinese (zh)
Other versions
CN107153680A (en
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.)
Beijing Si Tech Information Technology Co Ltd
Original Assignee
Beijing Si Tech Information Technology 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 Beijing Si Tech Information Technology Co Ltd filed Critical Beijing Si Tech Information Technology Co Ltd
Priority to CN201710253625.2A priority Critical patent/CN107153680B/en
Publication of CN107153680A publication Critical patent/CN107153680A/en
Application granted granted Critical
Publication of CN107153680B publication Critical patent/CN107153680B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/21Design, administration or maintenance of databases
    • G06F16/214Database migration support
    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The invention relates to a method and a system for on-line node expansion of a distributed memory database, wherein the method comprises the following steps: newly adding nodes to generate a new routing rule; migrating the related data from the old node to the corresponding new node; migrating the relevant REDO log from the old node to the corresponding new node; sending a switching instruction to an application client, and after the REDO log is migrated, the application client accesses a distributed memory database under a new routing rule; the system comprises a routing rule generation module, a data migration module, an REDO log migration module and a switching access module. The invention expands the nodes on line under the condition of not stopping external service, so that the application system can smoothly transit and automatically route to a new node.

Description

Method and system for on-line node expansion of distributed memory database
Technical Field
The invention relates to the field of distributed memory databases, in particular to a method and a system for expanding nodes of a distributed memory database on line.
Background
The distributed memory database has wide application in systems such as telecommunication charging, real-time online transaction and the like by virtue of the ultrahigh memory access speed, and the memory data are uniformly distributed on each single-machine memory database node in a slicing mode to provide uniform data service for the outside.
As traffic changes, the distributed in-memory database may require dynamically adding nodes to meet the increasing demand for data volume.
In the conventional technology, the distributed memory database service is generally temporarily stopped, the routing rule is recalculated for the original data of each node according to a new HASH algorithm, and the routing rule is uniformly re-distributed on a new node, and then the distributed memory database service is restarted. Due to the fact that redistribution of mass data is involved, time consumption is long, and the distributed memory database cannot provide services for the outside for a long time.
The system using the memory database service is generally an online real-time system, has high requirements on real-time performance and transaction consistency, and cannot accept long-time interruption of the memory database service.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: when the distributed memory database dynamically expands nodes, the redistribution of mass data is involved, the distributed memory database service is temporarily stopped, the time consumption is long, and the distributed memory database service is interrupted for a long time.
The technical scheme for solving the technical problems is as follows: a method for on-line node expansion of a distributed memory database comprises the following steps:
step 1: newly adding nodes, and generating a new routing rule according to the newly added nodes to re-plan the routing corresponding relation;
step 2: reading data of the old node, and migrating the data belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
and step 3: reading the REDO log of the old node, and migrating the REDO log belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
and 4, step 4: and sending a switching instruction to the application client, and after the REDO log is migrated, the application client accesses the distributed memory database under the new routing rule.
The invention has the beneficial effects that: the invention adopts the routing comparison table rule to redistribute the data, so that the transferred data volume is reduced to the minimum degree; the invention adopts a routing comparison table mode, and only migrates partial data from the old node to the new node, so that the data can be uniformly distributed again, the data migration scale is reduced, and the migration speed is accelerated.
On the basis of the technical scheme, the invention can be further improved as follows.
Further, the step 1 comprises the following steps:
step 1.1: newly adding nodes;
step 1.2: creating a new routing rule comparison table;
step 1.3: and re-planning the routing corresponding relation according to the newly added node.
Further, the step 2 comprises the following steps:
step 2.1: recording a data migration starting time point T;
step 2.2: adding the newly added nodes into a distributed memory database cluster;
step 2.3: and reading all the data of the old nodes, and migrating the data of all the old nodes belonging to the newly added nodes under the new routing rule from the old nodes to the corresponding newly added nodes.
Further, the step 3 comprises the following steps:
step 3.1: reading the REDO log of the old node from the time point T;
step 3.2: and all the old nodes simultaneously migrate the REDO logs belonging to the newly added nodes under the new routing rule from the old nodes to the corresponding newly added nodes.
Further, the step 4 comprises the following steps:
step 4.1: judging whether backlog exists in the REDO log to be migrated, if yes, continuing to execute the step 3, and if not, executing the step 4.2;
step 4.2: setting the distributed memory database to be in an intermediate state, and hiding an REDO log which is not in accordance with the new routing rule on an old node by the distributed memory database service;
step 4.3: and sending a switching instruction to the application client, and after the REDO log is migrated, the application client accesses the distributed memory database under the new routing rule.
The beneficial effect of adopting the further technical scheme is that: after the data migration is finished, because redundant data also exists on the original old node, the invention hides the records on the node which are not in accordance with the routing rule according to the new routing rule, and can ensure the accuracy of the externally provided data.
Further, the method also comprises the step 5: and deleting the redundant data of the old node.
Further, the method further comprises the step 6: and changing the distributed memory database from the intermediate state to the normal state.
Further, the redundant data is data that does not comply with the new routing rule.
The other technical scheme provided by the invention is as follows: a distributed memory database online extension node system comprises a routing rule generation module, a data migration module, an REDO log migration module and a switching access module;
the routing rule generating module is used for adding nodes, replanning routing corresponding relation according to the added nodes and generating a new routing rule;
the data migration module is used for reading the data of the old node and migrating the data belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
the REDO log migration module is used for reading the REDO log of the old node and migrating the REDO log belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
and the switching access module is used for sending a switching instruction to the application client, and the application client accesses the distributed memory database under the new routing rule after the REDO log migration is completed.
Further, the system also comprises a deleting module and a state switching module;
the deleting module is used for deleting the redundant data of the old node;
the state switching module is used for changing the distributed memory database from the intermediate state to the normal state.
Drawings
Fig. 1 is a schematic flow chart of a method for online node expansion of a distributed memory database according to the present invention;
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
As shown in fig. 1, a method for online node expansion of a distributed memory database according to an embodiment of the present invention includes the following steps:
step 1: newly adding nodes, and generating a new routing rule according to the newly added nodes to re-plan the routing corresponding relation;
step 2: reading data of the old node, and migrating the data belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
and step 3: reading the REDO log of the old node, and migrating the REDO log belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
and 4, step 4: and sending a switching instruction to the application client, and after the REDO log is migrated, the application client accesses the distributed memory database under the new routing rule.
Wherein, step 1 includes the following steps:
step 1.1: newly adding nodes;
step 1.2: creating a new routing rule comparison table: the _T _ HASH _ RULES _ NEW table replans the routing corresponding relation according to the newly added nodes, and the principle is as uniform as possible and the migration quantity is minimum.
Wherein, step 2 includes the following steps:
step 2.1: recording a data migration starting time point T;
step 2.2: adding the newly added nodes into a distributed memory database cluster;
step 2.3: and reading all the data of the old nodes, and migrating the data of all the old nodes belonging to the newly added nodes under the new routing rule from the old nodes to the corresponding newly added nodes.
Wherein, step 3 comprises the following steps:
step 3.1: reading the REDO log of the old node from the time point T;
step 3.2: and all the old nodes simultaneously migrate the REDO logs belonging to the newly added nodes under the new routing rule from the old nodes to the corresponding newly added nodes.
Wherein, step 4 comprises the following steps:
step 4.1: judging whether backlog exists in the REDO log to be migrated, if yes, continuing to execute the step 3, and if not, executing the step 4.2;
step 4.2: updating a routing rule comparison table, and setting the distributed memory database to be in an intermediate state, wherein the intermediate state is that the distributed memory database service hides an REDO log which is inconsistent with the new routing rule on an old node;
step 4.3: and sending a switching instruction to the application client to prompt the application to reload the routing rule, wherein at the moment, if the application accesses the old node, the application is still normal, if the application accesses the new node, the application client only waits, and after the backlog migration of the application client is completed, the application client accesses the distributed memory database under the new routing rule.
In the process, data related to migration and REDO log records are all recorded on old and new nodes, so that when a multi-node concurrent query is carried out, the query result is incorrect (the data is redundant).
And deleting these records takes a long time, and the application cannot wait for a long time. Therefore, it is necessary to hide these redundant data in advance, and the method is as follows:
a new table is created-T ALTER NODE into which the newly added NODE is inserted before updating the routing rule lookup table.
When the distributed memory database provides data service to the outside, whether the table has data is checked, and if not, the distributed memory database is executed according to normal logic. If the data exist, checking whether the record to be checked accords with the new rule, and if not, hiding.
Then, the redundant data of the old node is deleted one by one. After the deletion is completed, the _ T _ ALTER _ NODE table is cleared.
And when the dynamic migration quantity of the REDO log is changed into 0, changing the intermediate state of the distributed memory database into a normal state.
At this time, when the distributed memory database provides data service to the outside, the distributed memory database naturally recovers to normal logic, and the expansion is finished.
The redundant data is data that does not comply with the new routing rule.
The embodiment of the invention provides a distributed memory database online node expansion system, which comprises a routing rule generation module, a data migration module, an REDO log migration module and a switching access module;
the routing rule generating module is used for adding nodes, replanning routing corresponding relation according to the added nodes and generating a new routing rule;
the data migration module is used for reading the data of the old node and migrating the data belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
the REDO log migration module is used for reading the REDO log of the old node and migrating the REDO log belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
and the switching access module is used for sending a switching instruction to the application client, and the application client accesses the distributed memory database under the new routing rule after the REDO log migration is completed.
The system also comprises a deleting module and a state switching module;
the deleting module is used for deleting the redundant data of the old node;
and the state switching module is used for changing the distributed memory database from the intermediate state to the normal state.
Assuming that the HASH bucket value is 12 (actually configurable, for example, 1024, which is required to be much larger than the number of nodes), there are initially 3 (M) nodes, and 1 (N) node needs to be added during subsequent expansion:
Figure BDA0001272765110000071
Figure BDA0001272765110000081
table 1 example of route comparison
After the nodes are added, records with hash values of 3, 7 and 11 are required to be migrated to the newly added nodes. The total migration data volume is N/(M + N), and the method can minimize the migration volume, thereby shortening the migration time and reducing the influence on an application system.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (9)

1. A method for on-line node expansion of a distributed memory database is characterized by comprising the following steps:
step 1: newly adding nodes, and generating a new routing rule according to the newly added nodes to re-plan the routing corresponding relation;
step 2: reading data of the old node, and migrating the data belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
and step 3: reading the REDO log of the old node, and migrating the REDO log belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
and 4, step 4: sending a switching instruction to an application client, and after the REDO log is migrated, the application client accesses a distributed memory database under a new routing rule;
wherein, the step 4 specifically comprises: step 4.1: judging whether backlog exists in the REDO log to be migrated, if yes, continuing to execute the step 3, and if not, executing the step 4.2;
step 4.2: setting the distributed memory database to be in an intermediate state, wherein the intermediate state is an REDO log which is in service hiding of the distributed memory database and is not in accordance with the new routing rule on an old node;
step 4.3: and sending a switching instruction to the application client, and accessing the distributed memory database under the new routing rule after the backlog migration of the application client is completed.
2. The method for online expanding nodes of the distributed memory database according to claim 1, wherein the step 1 comprises the following steps:
step 1.1: newly adding nodes;
step 1.2: creating a new routing rule comparison table;
step 1.3: and re-planning the routing corresponding relation according to the newly added node.
3. The method for online expanding nodes of the distributed memory database according to claim 1 or 2, wherein the step 2 comprises the following steps:
step 2.1: recording a data migration starting time point T;
step 2.2: adding the newly added nodes into a distributed memory database cluster;
step 2.3: and reading all the data of the old nodes, and migrating the data of all the old nodes belonging to the newly added nodes under the new routing rule from the old nodes to the corresponding newly added nodes.
4. The method for online expanding nodes of the distributed memory database according to claim 3, wherein the step 3 comprises the following steps:
step 3.1: reading the REDO log of the old node from the time point T;
step 3.2: and all the old nodes simultaneously migrate the REDO logs belonging to the newly added nodes under the new routing rule from the old nodes to the corresponding newly added nodes.
5. The method for online expanding nodes of a distributed memory database according to claim 1, wherein the method further comprises the step 5: and deleting the redundant data of the old node.
6. The method for online expanding nodes of distributed memory databases according to claim 5, further comprising the step 6: and changing the distributed memory database from the intermediate state to the normal state.
7. The method according to claim 5, wherein the redundant data is data that does not comply with a new routing rule.
8. A distributed memory database online extension node system is characterized by comprising a routing rule generation module, a data migration module, an REDO log migration module and a switching access module;
the routing rule generating module is used for adding nodes, replanning routing corresponding relation according to the added nodes and generating a new routing rule;
the data migration module is used for reading the data of the old node and migrating the data belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
the REDO log migration module is used for reading the REDO log of the old node and migrating the REDO log belonging to the newly added node under the new routing rule from the old node to the corresponding newly added node;
the switching access module is used for sending a switching instruction to the application client, and the application client accesses the distributed memory database under a new routing rule after the backlog migration is completed;
the switching access module is specifically configured to determine whether backlog exists in the REDO log to be migrated, if yes, continue to migrate the REDO log to be migrated, and if not, set the distributed memory database in an intermediate state, where the intermediate state is that the REDO log on the old node is hidden by the distributed memory database service and does not conform to the new routing rule, send a switching instruction to the application client, and after migration of the backlog to be backlogged by the application client is completed, access the distributed memory database under the new routing rule.
9. The system according to claim 8, wherein the system further comprises a deletion module and a status switching module;
the deleting module is used for deleting the redundant data of the old node;
the state switching module is used for changing the distributed memory database from the intermediate state to the normal state.
CN201710253625.2A 2017-04-18 2017-04-18 Method and system for on-line node expansion of distributed memory database Active CN107153680B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710253625.2A CN107153680B (en) 2017-04-18 2017-04-18 Method and system for on-line node expansion of distributed memory database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710253625.2A CN107153680B (en) 2017-04-18 2017-04-18 Method and system for on-line node expansion of distributed memory database

Publications (2)

Publication Number Publication Date
CN107153680A CN107153680A (en) 2017-09-12
CN107153680B true CN107153680B (en) 2021-02-02

Family

ID=59793963

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710253625.2A Active CN107153680B (en) 2017-04-18 2017-04-18 Method and system for on-line node expansion of distributed memory database

Country Status (1)

Country Link
CN (1) CN107153680B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111459896B (en) * 2019-01-18 2023-05-02 阿里云计算有限公司 Data recovery system and method, electronic device, and computer-readable storage medium
CN110502582B (en) * 2019-08-27 2022-06-10 江苏华库数据技术有限公司 Online capacity expansion method of distributed database
CN113760858B (en) * 2020-06-05 2024-03-19 中国移动通信集团湖北有限公司 Dynamic migration method and device for memory database data, computing equipment and storage equipment
CN116821148A (en) * 2022-03-22 2023-09-29 华为云计算技术有限公司 Node switching method and related system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105340322A (en) * 2013-04-16 2016-02-17 爱立信(中国)通信有限公司 Method and nodes for handling a failure in a communications network

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101997911B (en) * 2010-10-21 2015-07-22 中兴通讯股份有限公司 Data migration method and system
US9576020B1 (en) * 2012-10-18 2017-02-21 Proofpoint, Inc. Methods, systems, and computer program products for storing graph-oriented data on a column-oriented database
CN104239417B (en) * 2014-08-19 2017-06-09 天津南大通用数据技术股份有限公司 Dynamic adjusting method and device after a kind of distributed data base data fragmentation
CN104572809B (en) * 2014-11-17 2017-11-07 杭州斯凯网络科技有限公司 A kind of distributed relational database spread method
CN106843745A (en) * 2015-12-03 2017-06-13 南京中兴新软件有限责任公司 Capacity expansion method and device
CN105589936A (en) * 2015-12-11 2016-05-18 航天恒星科技有限公司 Data query method and system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105340322A (en) * 2013-04-16 2016-02-17 爱立信(中国)通信有限公司 Method and nodes for handling a failure in a communications network

Also Published As

Publication number Publication date
CN107153680A (en) 2017-09-12

Similar Documents

Publication Publication Date Title
CN108810041B (en) Data writing and capacity expansion method and device for distributed cache system
CN107153680B (en) Method and system for on-line node expansion of distributed memory database
CN110147407B (en) Data processing method and device and database management server
CN106933823B (en) Data synchronization method and device
WO2017050064A1 (en) Memory management method and device for shared memory database
CN105989015B (en) Database capacity expansion method and device and method and device for accessing database
CN109739684B (en) Vector clock-based copy repair method and device for distributed key value database
CN112256433B (en) Partition migration method and device based on Kafka cluster
CN111680019B (en) Block chain data expansion method and device
CN111522811B (en) Database processing method and device, storage medium and terminal
CN111459913B (en) Capacity expansion method and device of distributed database and electronic equipment
CN111400273B (en) Database capacity expansion method and device, electronic equipment and machine-readable storage medium
CN110298031B (en) Dictionary service system and model version consistency distribution method
US20230132117A1 (en) Handling system-characteristics drift in machine learning applications
JP6189266B2 (en) Data processing apparatus, data processing method, and data processing program
CN114840488B (en) Distributed storage method, system and storage medium based on super fusion structure
CN115481103A (en) Database capacity expansion and reduction method and device and computer readable storage medium
US11372832B1 (en) Efficient hashing of data objects
CN114969206A (en) Data processing method, device, equipment and storage medium
CN115391337A (en) Database partitioning method and device, storage medium and electronic equipment
CN112699129A (en) Data processing system, method and device
CN113986878A (en) Data writing method, data migration device and electronic equipment
US10712959B2 (en) Method, device and computer program product for storing data
CN102004761A (en) Data storage method and system
WO2017188929A1 (en) Method and apparatus for replicating data between storage systems

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
GR01 Patent grant
GR01 Patent grant