CN110874354A - Database migration method and device, electronic equipment and storage medium - Google Patents

Database migration method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110874354A
CN110874354A CN201911012959.6A CN201911012959A CN110874354A CN 110874354 A CN110874354 A CN 110874354A CN 201911012959 A CN201911012959 A CN 201911012959A CN 110874354 A CN110874354 A CN 110874354A
Authority
CN
China
Prior art keywords
database
request
data
write
destination
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
CN201911012959.6A
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.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou 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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN201911012959.6A priority Critical patent/CN110874354A/en
Publication of CN110874354A publication Critical patent/CN110874354A/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/21Design, administration or maintenance of databases
    • G06F16/214Database migration support

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

One or more embodiments of the present specification provide a database migration method and apparatus, an electronic device, and a storage medium; the method is applied to a business system and can comprise the following steps: identifying the type of a received service request, wherein the service request is received in the process of transferring the data of an original database to a target database; when the service request is a write request, routing the write request to the destination database so as to write the data indicated by the write request in the destination database; when the service request is a reading request, determining a target database corresponding to the reading request, and routing the reading request to the target database so that the target database returns data indicated by the reading request; the target database is the original database or the target database.

Description

Database migration method and device, electronic equipment and storage medium
Technical Field
One or more embodiments of the present disclosure relate to the field of database technologies, and in particular, to a database migration method and apparatus, an electronic device, and a storage medium.
Background
In the related art, due to problems of performance, storage space, service life, and the like of a database server, database migration is often required. However, during the process of migrating the database, the online service is easily affected, and even normal service cannot be provided to the outside. For example, when data in an original database is migrated to a new database, shutdown maintenance needs to be performed on the original database, and services such as reading data and writing data cannot be provided to the outside during a period of the shutdown maintenance.
Disclosure of Invention
In view of this, one or more embodiments of the present disclosure provide a database migration method and apparatus, an electronic device, and a storage medium.
To achieve the above object, one or more embodiments of the present disclosure provide the following technical solutions:
according to a first aspect of one or more embodiments of the present specification, a database migration method applied to a business system is provided, where the method includes:
identifying the type of a received service request, wherein the service request is received in the process of transferring the data of an original database to a target database;
when the service request is a write request, routing the write request to the destination database so as to write the data indicated by the write request in the destination database;
when the service request is a reading request, determining a target database corresponding to the reading request, and routing the reading request to the target database so that the target database returns data indicated by the reading request; the target database is the original database or the target database.
Optionally, the service system generates a database identifier for indicating a database to which the data belongs, for the data written in the original database or the destination database; the determining a target database corresponding to the read request comprises:
reading the database identification recorded in the reading request;
and determining a target database corresponding to the read request according to the read database identification.
Optionally, the method further includes:
before the data of the original database starts to be migrated to the destination database, when any read request is received, routing any read request to the original database so that the original database returns the data indicated by any read request;
and when any write request is received, routing the write request to the original database so as to write the data indicated by the write request in the original database.
Optionally, the method further includes:
after the data of the original database is completely migrated to the destination database, when any read request is received, routing any read request to the destination database so that the destination database returns the data indicated by any read request;
and when any write request is received, routing the write request to the destination database so as to write the data indicated by the write request in the destination database.
Optionally, after all the data in the original database are migrated to the destination database, the data in the original database are deleted.
According to a second aspect of one or more embodiments of the present specification, there is provided a database migration apparatus applied to a business system, the apparatus including:
the identification unit is used for identifying the type of the received service request, and the service request is received in the process of transferring the data of the original database to the target database;
the first routing unit is used for routing the write request to the destination database when the service request is the write request so as to write the data indicated by the write request in the destination database;
the second routing unit is used for determining a target database corresponding to the reading request when the service request is the reading request, and routing the reading request to the target database so as to enable the target database to return the data indicated by the reading request; the target database is the original database or the target database.
Optionally, the service system generates a database identifier for indicating a database to which the data belongs, for the data written in the original database or the destination database; the second routing unit is specifically configured to:
reading the database identification recorded in the reading request;
and determining a target database corresponding to the read request according to the read database identification.
Optionally, the method further includes:
a third routing unit, configured to route any read request to the original database when receiving any read request before data in the original database starts to be migrated to the destination database, so that the original database returns data indicated by any read request;
and when any write request is received, routing the write request to the original database so as to write the data indicated by the write request in the original database.
Optionally, the method further includes:
a fourth routing unit, configured to route any read request to the destination database when any read request is received after all data in the original database is migrated to the destination database, so that the destination database returns data indicated by any read request;
and when any write request is received, routing the write request to the destination database so as to write the data indicated by the write request in the destination database.
Optionally, after all the data in the original database are migrated to the destination database, the data in the original database are deleted.
According to a third aspect of one or more embodiments of the present specification, there is provided an electronic apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor executes the executable instructions to implement the database migration method as described in any of the above embodiments.
According to a fourth aspect of one or more embodiments of the present specification, there is provided a computer-readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the steps of the database migration method as described in any of the above embodiments.
In the process of migrating the data of the original database to the target database, on one hand, the service system can normally provide the service of writing the data outwards by importing the data requested to be written into the target database; on the other hand, the original database and the target database both provide the service of reading data to the outside normally, and then when a reading request is received, the requested reading data is determined to be stored in the original database or the target database, so that the reading data is further requested from the determined database. Therefore, the data reading and writing service can be normally provided in the database migration process without stopping the database for maintenance, so that the influence on the online service caused by the database migration can be avoided, and the user experience can be improved.
Drawings
FIG. 1 is a flow chart of a database migration method provided by an exemplary embodiment.
Fig. 2 is a block diagram of a business system according to an exemplary embodiment.
FIG. 3 is a flow diagram of database state transitions in a business system provided by an exemplary embodiment.
FIG. 4 is a flowchart of a business system processing a business request during a new instance period or a migration period as provided by an exemplary embodiment.
FIG. 5 is a flowchart of a business system processing read requests during a new and old data compatibility period, according to an example embodiment.
Fig. 6 is a schematic structural diagram of an apparatus according to an exemplary embodiment.
FIG. 7 is a block diagram of a database migration apparatus according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of one or more embodiments of the specification, as detailed in the claims which follow.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the method may include more or fewer steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
Referring to fig. 1, fig. 1 is a flowchart illustrating a database migration method according to an exemplary embodiment. As shown in fig. 1, the method applied to a business system may include the following steps:
step 102, identifying the type of the received service request, wherein the service request is received in the process of transferring the data of the original database to the target database.
In one embodiment, the purpose of migrating the data of the original database to the destination database is: and replacing the original database by the destination database to provide services of reading data and writing data. Therefore, the data of the original database needs to be copied to the destination database.
The types of the service requests comprise writing requests and reading requests; the write request is used to write data into the database and the read request is used to read data stored in the database.
And step 104, when the service request is a write request, routing the write request to the destination database so as to write the data indicated by the write request in the destination database.
In one embodiment, during the process of migrating the data of the original database to the destination database, when a write request from an upstream system is received, the original database is replaced by the destination database due to the migration, and the data requested to be written by the write request is new data relative to the data stored in the original database. Accordingly, the write request may be routed to the destination database to write the data indicated by the write request in the destination database.
In one embodiment, during the migration of the data in the original database to the destination database, the original database may still provide the service of reading data to the outside (e.g., to an upstream system). Meanwhile, the data requested to be written in the migration process is stored in the destination database. Therefore, when a read request from an upstream system is received in the migration process, it can be determined first whether the target database corresponding to the read request, that is, the data required to be read by the read request is the data newly written into the destination database in the migration process, or the data already stored in the original database before the migration; after the target database is determined, the read request may be further routed to the target database, so that the target database returns the data indicated by the read request.
In one embodiment, the business system may generate a database identification corresponding to the original database for data written to the original database (prior to migrating the data); similarly, for data written to the destination database (during migration), a database identification corresponding to the destination database may also be generated. Based on the mechanism for generating the database identifier, the database identifier may be used to determine whether the data to be read is stored in the original database or the destination database when the read request is received. For example, after data is successfully written and a corresponding database identifier is generated, the generated database identifier may be returned to a write requester of the data or the corresponding relationship between the database identifier and the data may be broadcasted to various nodes of an upstream system. Then, subsequently when the write requester or any other node has an actual need to read the data, a read request containing the database identifier may be sent to the service system to obtain the data.
Therefore, in the process of migrating the data of the original database to the destination database, when the service request received by the service system is a read request, the database identifier recorded in the read request can be read first, and then the target database corresponding to the read request is determined according to the read database identifier.
Step 106, when the service request is a read request, determining a target database corresponding to the read request, and routing the read request to the target database, so that the target database returns data indicated by the read request; the target database is the original database or the target database.
In one embodiment, the original database still responds to the received read and write requests before the migration of the data of the original database to the destination database is initiated. Therefore, when any read request is received, the read request is routed to the original database, so that the original database returns the data indicated by the read request; and when any write request is received, routing the write request to the original database so as to write the data indicated by the write request in the original database.
In an embodiment, since the newly written data is stored in the destination database during the migration process, and all the data stored in the original database is also completely imported into the destination database after the migration process, the data in the destination database after the migration process is completed can be regarded as the full data.
Then the received read and write requests are responded to by the destination database after the migration is complete. That is, after all the data of the original database are migrated to the destination database, when any read request is received, any read request is routed to the destination database, so that the destination database returns the data indicated by any read request; and when any write request is received, routing the write request to a destination database so as to write the data indicated by the write request in the destination database.
In one embodiment, after all data in the original database is migrated to the destination database, the destination database responds to the received read request and write request. Therefore, resources of the original database can be released, occupation of storage space is reduced, and utilization rate of the storage space is improved.
In one case, the service system may issue an instruction to release the resource to the original database, so that the original database deletes the locally stored data after receiving the instruction. In another case, a trigger condition for deleting the local data may be configured in the original database, where the trigger condition is that all data in the original database is migrated to the destination database. Then, when the original database judges that the trigger condition is currently met, the operation of deleting the locally stored data is automatically executed.
In the process of migrating the data of the original database to the target database, on one hand, the service system can normally provide the service of writing the data outwards by importing the data requested to be written into the target database; on the other hand, the original database and the target database both provide the service of reading data to the outside normally, and then when a reading request is received, the requested reading data is determined to be stored in the original database or the target database, so that the reading data is further requested from the determined database. Therefore, the data reading and writing service can be normally provided in the database migration process without stopping the database for maintenance, so that the influence on the online service caused by the database migration can be avoided, and the user experience can be improved.
For the convenience of understanding, the following takes a streaming reservoir (a database for storing information of a transaction number) as an example, and the database migration scheme of the present specification is described in detail with reference to the accompanying drawings.
Referring to fig. 2, fig. 2 is a schematic block diagram of a service system according to an exemplary embodiment. As shown in fig. 2, the business system may include a traffic entry module, a traffic type identification module, a database read offload module, a database write offload module, an old database instance, and a new database instance.
A flow inlet module: an entry steering module, configured to receive an upstream system request by a service system, for example, to receive a read request or a write request issued by the upstream system; in other words, the traffic of the service system comes from the traffic inlet module.
A flow type identification module: for identifying the type of service request received; there are different processing modes for read requests and write requests, so the type of service request needs to be dynamically identified.
The database reading and shunting module: for a read request, the database to which the data corresponding to the read request belongs is identified according to the data identification, and the read request is routed to the identified database.
The database write distribution module: and for the write request, identifying the current database state according to the dynamic switch, and generating a corresponding data identifier for the written data. The dynamic switch is used for controlling the migration process of the database.
Old database instance: the database that needs to be replaced, i.e., the original database.
New database example: the destination database is used to replace the original database.
Referring to fig. 3, fig. 3 is a flowchart illustrating a database state transition in a business system according to an exemplary embodiment. As shown in fig. 3, the old and new database instances in the business system contain the following database states:
and (3) a stabilization period: the business system has configured a new database instance during the stabilization period, but still has the old database instance responding to received read requests and write requests.
New example period: the writing request received by the business system is responded by the new database instance, namely the writing request is routed to the new database instance; and for the read request, identifying whether the data requested to be read is stored in the old database instance or the new database instance according to the single number, and routing the read request to the identified database instance.
A migration period: and triggering the migration operation by a manager of the service system through the dynamic switch, and migrating the data stored in the old database instance to the new database instance. Responding to the write request received by the business system by the new database instance; and for the read request, identifying whether the data requested to be read is stored in the old database instance or the new database instance according to the single number, and routing the read request to the identified database instance for response.
New and old data compatible period: all data stored in the old database instance has been migrated to the new database instance, and the management personnel of the business system opens the compatible state through the dynamic switch. Because the newly written data in the migration process is stored in the new database instance, the data stored in the old database instance is not dynamically increased during the new instance, and all the data stored in the old database instance is completely imported into the new database instance after the migration, the data in the new database instance can be considered as the full data after the migration is completed. Upon entering the compatible state, both the received read request and the write request are responded to by the new database instance. At this time, resources of the old database instance can be released, so that occupation of the storage space is reduced, the utilization rate of the storage space is improved, and normal response service requests are not affected.
Referring to fig. 4, fig. 4 is a flowchart illustrating a service system processing a service request during a new instance period or a migration period according to an exemplary embodiment. As shown in fig. 4, the process may include the steps of:
step 402, receiving a service request.
At step 404, the type of service request is identified.
Step 406, when the received service request is a write request, analyzing the switch state of the current dynamic switch.
Step 408, generate the single number.
In this embodiment, for data to be written, whether the data is stored in an old database instance or a new database instance is marked by generating a single number (as a data identification).
For example, when the received service request is a write request, the single number of the data to be written is an external single number a, the service system queries the current database state according to the on-off state of the dynamic switch, and reassembles a system single number for the data to be written after the current database state is queried to be in a new instance period or a migration period. For example, the database to which the single sign belongs is represented by the third last bit and the fourth last bit of the single sign, wherein "00" represents the old database instance, and "01" represents the new database instance. Then, a system single number "2019052700001" may be assembled for the data to be written contained in the write request received during the stabilization period; a system single number "2019052701001" may be assembled for data to be written contained in write requests received under other conditions, such as a new instance period, a new and old data compatibility period, etc. After the system single number is assembled, the assembled system single number can be returned to a sender of the write request or the corresponding relation between the system single number and the data to be written is broadcasted to each node of an upstream system. Then, when there is an actual need to read the data in the sender or any other node, a read request containing the system number may be sent to the service system to obtain the data.
At step 410, the write request is routed to the new database instance.
In this embodiment, the write request is responded to by the new database instance while in the new instance period or the migration period. Thus, the write request is routed to the new database instance.
In step 412, when the received service request is a read request, the database to which the data to be read belongs is identified according to the single number included in the read request.
Step 414, the read request is routed to the target database.
In the above example, when the received service request is a read request, the single number of the data to be read is the system single number of the service system. Then, the business system may intercept the third to last bit and the fourth to last bit of the single number to determine which database (i.e., the target database) the data to be read is stored in. For example, if the single number is 2019052701001, the database partitioning bit is intercepted to be "01", it is determined that the data to be read is stored in the new database instance, and the read request is routed to the new database instance for response; if the single number is 2019052700001, the database partitioning bit is "00" obtained by interception, it is determined that the data to be read is stored in the old database instance, and the read request is routed to the old database instance for response.
Step 416, return the result.
Accepting in step 410, returning information such as a write result and a single number to a sender of the write request; the acceptance returns the read result to the sender of the read request in step 414.
Referring to fig. 5, fig. 5 is a flowchart illustrating a business system processing read requests during a new data compatibility period and an old data compatibility period according to an exemplary embodiment. As shown in fig. 5, the process may include the steps of:
step 502, a read request is received.
Step 504, the single number included in the read request is parsed.
Step 506, if the sub-bin bit obtained by analysis is '00', the step 508 is carried out; otherwise, go to step 510.
Step 508, force routing to the new database instance.
Step 510, routing to the new database instance.
In this embodiment, when the parsed banking bit is "00", it is described that the data to be read is data that has been written in the old database instance before the migration is started, and then after the migration is completed, the new database instance responds to the read request instead, and even if the banking bit corresponds to the old database instance, the read request is forcibly routed to the new database instance (including the full amount of data, that is, all data of the old database instance before the migration, and the data that is newly written after the migration is started).
When the parsed banking bit is not "00" (i.e., the banking bit is "01"), it is indicated that the data to be read is the data written in the new database instance after the migration is started, and then the read request is routed to the new database instance.
In the process of migrating the data of the original database to the target database, on one hand, the service system can normally provide the service of writing the data outwards by importing the data requested to be written into the target database; on the other hand, the original database and the target database both provide the service of reading data to the outside normally, and then when a reading request is received, the requested reading data is determined to be stored in the original database or the target database, so that the reading data is further requested from the determined database. Therefore, the data reading and writing service can be normally provided in the database migration process without stopping the database for maintenance, so that the influence on the online service caused by the database migration can be avoided, and the user experience can be improved.
Fig. 6 is a schematic structural diagram of an apparatus according to an exemplary embodiment. Referring to fig. 6, at the hardware level, the apparatus includes a processor 602, an internal bus 604, a network interface 606, a memory 608 and a non-volatile memory 610, but may also include hardware required for other services. The processor 602 reads the corresponding computer program from the non-volatile memory 610 into the memory 608 and then runs, forming a database migration apparatus on a logical level. Of course, besides software implementation, the one or more embodiments in this specification do not exclude other implementations, such as logic devices or combinations of software and hardware, and so on, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Referring to fig. 7, in a software implementation, the database migration apparatus applied to a business system may include:
an identifying unit 71, configured to identify a type of a received service request, where the service request is received during a process of migrating data in an original database to a destination database;
a first routing unit 72, configured to route the write request to the destination database when the service request is a write request, so as to write data indicated by the write request in the destination database;
a second routing unit 73, configured to, when the service request is a read request, determine a target database corresponding to the read request, and route the read request to the target database, so that the target database returns data indicated by the read request; the target database is the original database or the target database.
Optionally, the service system generates a database identifier for indicating a database to which the data belongs, for the data written in the original database or the destination database; the second routing unit 73 is specifically configured to:
reading the database identification recorded in the reading request;
and determining a target database corresponding to the read request according to the read database identification.
Optionally, the method further includes:
a third routing unit 74, configured to route any read request to the original database when receiving any read request before the data in the original database starts to be migrated to the destination database, so that the original database returns the data indicated by any read request;
and when any write request is received, routing the write request to the original database so as to write the data indicated by the write request in the original database.
Optionally, the method further includes:
a fourth routing unit 75, configured to route any read request to the destination database when any read request is received after all data in the original database is migrated to the destination database, so that the destination database returns data indicated by any read request;
and when any write request is received, routing the write request to the destination database so as to write the data indicated by the write request in the destination database.
Optionally, after all the data in the original database are migrated to the destination database, the data in the original database are deleted.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present description to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of one or more embodiments herein. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The above description is only for the purpose of illustrating the preferred embodiments of the one or more embodiments of the present disclosure, and is not intended to limit the scope of the one or more embodiments of the present disclosure, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the one or more embodiments of the present disclosure should be included in the scope of the one or more embodiments of the present disclosure.

Claims (12)

1. A database migration method is applied to a business system, and comprises the following steps:
identifying the type of a received service request, wherein the service request is received in the process of transferring the data of an original database to a target database;
when the service request is a write request, routing the write request to the destination database so as to write the data indicated by the write request in the destination database;
when the service request is a reading request, determining a target database corresponding to the reading request, and routing the reading request to the target database so that the target database returns data indicated by the reading request; the target database is the original database or the target database.
2. The method according to claim 1, wherein the service system generates a database identifier for indicating a database to which the data belongs, for the data written in the original database or the destination database; the determining a target database corresponding to the read request comprises:
reading the database identification recorded in the reading request;
and determining a target database corresponding to the read request according to the read database identification.
3. The method of claim 1, further comprising:
before the data of the original database starts to be migrated to the destination database, when any read request is received, routing any read request to the original database so that the original database returns the data indicated by any read request;
and when any write request is received, routing the write request to the original database so as to write the data indicated by the write request in the original database.
4. The method of claim 1, further comprising:
after the data of the original database is completely migrated to the destination database, when any read request is received, routing any read request to the destination database so that the destination database returns the data indicated by any read request;
and when any write request is received, routing the write request to the destination database so as to write the data indicated by the write request in the destination database.
5. The method of claim 1, wherein the data in the source database is deleted after the data in the source database is migrated to the destination database.
6. A database migration device applied to a business system, the device comprising:
the identification unit is used for identifying the type of the received service request, and the service request is received in the process of transferring the data of the original database to the target database;
the first routing unit is used for routing the write request to the destination database when the service request is the write request so as to write the data indicated by the write request in the destination database;
the second routing unit is used for determining a target database corresponding to the reading request when the service request is the reading request, and routing the reading request to the target database so as to enable the target database to return the data indicated by the reading request; the target database is the original database or the target database.
7. The apparatus according to claim 6, wherein the service system generates a database identifier for indicating a database to which the data belongs, for the data written in the original database or the destination database; the second routing unit is specifically configured to:
reading the database identification recorded in the reading request;
and determining a target database corresponding to the read request according to the read database identification.
8. The apparatus of claim 6, further comprising:
a third routing unit, configured to route any read request to the original database when receiving any read request before data in the original database starts to be migrated to the destination database, so that the original database returns data indicated by any read request;
and when any write request is received, routing the write request to the original database so as to write the data indicated by the write request in the original database.
9. The apparatus of claim 6, further comprising:
a fourth routing unit, configured to route any read request to the destination database when any read request is received after all data in the original database is migrated to the destination database, so that the destination database returns data indicated by any read request;
and when any write request is received, routing the write request to the destination database so as to write the data indicated by the write request in the destination database.
10. The apparatus of claim 6, wherein the data in the source database is deleted after the data in the source database is migrated to the destination database.
11. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor implements the method of any one of claims 1-5 by executing the executable instructions.
12. A computer readable storage medium having stored thereon computer instructions which, when executed by a processor, carry out the steps of the method according to any one of claims 1 to 5.
CN201911012959.6A 2019-10-23 2019-10-23 Database migration method and device, electronic equipment and storage medium Pending CN110874354A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911012959.6A CN110874354A (en) 2019-10-23 2019-10-23 Database migration method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911012959.6A CN110874354A (en) 2019-10-23 2019-10-23 Database migration method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110874354A true CN110874354A (en) 2020-03-10

Family

ID=69717853

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911012959.6A Pending CN110874354A (en) 2019-10-23 2019-10-23 Database migration method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110874354A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2610765A1 (en) * 2011-12-30 2013-07-03 BMC Software, Inc. Systems and methods for migrating database data
WO2014106431A1 (en) * 2013-01-05 2014-07-10 Tencent Technology (Shenzhen) Company Limited Method and system for data migration
CN104866234A (en) * 2014-02-21 2015-08-26 腾讯科技(北京)有限公司 Data migration method, device and system
CN104881443A (en) * 2015-05-14 2015-09-02 新浪网技术(中国)有限公司 Inter-database data migration method and system
CN106682021A (en) * 2015-11-09 2017-05-17 五八同城信息技术有限公司 Database migration method and device
WO2018121120A1 (en) * 2016-12-26 2018-07-05 腾讯科技(深圳)有限公司 Data migration method and system
CN110196844A (en) * 2018-04-16 2019-09-03 腾讯科技(深圳)有限公司 A kind of data migration method, system and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2610765A1 (en) * 2011-12-30 2013-07-03 BMC Software, Inc. Systems and methods for migrating database data
WO2014106431A1 (en) * 2013-01-05 2014-07-10 Tencent Technology (Shenzhen) Company Limited Method and system for data migration
CN104866234A (en) * 2014-02-21 2015-08-26 腾讯科技(北京)有限公司 Data migration method, device and system
CN104881443A (en) * 2015-05-14 2015-09-02 新浪网技术(中国)有限公司 Inter-database data migration method and system
CN106682021A (en) * 2015-11-09 2017-05-17 五八同城信息技术有限公司 Database migration method and device
WO2018121120A1 (en) * 2016-12-26 2018-07-05 腾讯科技(深圳)有限公司 Data migration method and system
CN110196844A (en) * 2018-04-16 2019-09-03 腾讯科技(深圳)有限公司 A kind of data migration method, system and storage medium

Similar Documents

Publication Publication Date Title
US10242022B1 (en) Systems and methods for managing delayed allocation on clustered file systems
US11586673B2 (en) Data writing and reading method and apparatus, and cloud storage system
US10439937B2 (en) Service addressing in distributed environment
US20200344322A1 (en) Resource scheduling method, apparatus, device and system
CN110032599B (en) Data structure reading and updating method and device, and electronic equipment
US20170153909A1 (en) Methods and Devices for Acquiring Data Using Virtual Machine and Host Machine
CN109951494B (en) Simulation data processing method and device, simulation equipment and storage medium
CN114265670B (en) Memory block sorting method, medium and computing device
CN111897493B (en) Storage space management method and device, electronic equipment and storage medium
CN113204407A (en) Memory over-allocation management method and device
CN108399175B (en) Data storage and query method and device
CN115756955A (en) Data backup and data recovery method and device and computer equipment
CN106571935B (en) Resource scheduling method and equipment
CN112597151A (en) Data processing method, device, equipment and storage medium
CN110764930B (en) Request or response processing method and device based on message mode
CN107169752B (en) Resource transfer method and device
CN111913807A (en) Event processing method, system and device based on multiple storage areas
CN112596669A (en) Data processing method and device based on distributed storage
CN115174158B (en) Cloud product configuration checking method based on multi-cloud management platform
KR101810180B1 (en) Method and apparatus for distributed processing of big data based on user equipment
CN112948501B (en) Data analysis method, device and system
CN110874354A (en) Database migration method and device, electronic equipment and storage medium
CN111399753B (en) Method and device for writing pictures
CN111435320B (en) Data processing method and device
CN111158873A (en) System state machine implementation method and device, storage medium and processor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200310