CN111241068B - Information processing method, device and equipment and computer readable storage medium - Google Patents

Information processing method, device and equipment and computer readable storage medium Download PDF

Info

Publication number
CN111241068B
CN111241068B CN202010038303.8A CN202010038303A CN111241068B CN 111241068 B CN111241068 B CN 111241068B CN 202010038303 A CN202010038303 A CN 202010038303A CN 111241068 B CN111241068 B CN 111241068B
Authority
CN
China
Prior art keywords
instance
log
database
user
data
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
CN202010038303.8A
Other languages
Chinese (zh)
Other versions
CN111241068A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN202010038303.8A priority Critical patent/CN111241068B/en
Publication of CN111241068A publication Critical patent/CN111241068A/en
Application granted granted Critical
Publication of CN111241068B publication Critical patent/CN111241068B/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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention provides an information processing method, an information processing device, information processing equipment and a computer readable storage medium, wherein the method comprises the following steps: when detecting that data in a first database is copied to a second database, determining a first instance when a user service executes service operation on the first database; generating a second instance according to the first operation log of the first instance; executing the second instance to perform the business operation on the data in the second database; determining a second operation log generated by the second instance; and when the first operation log and the second operation log meet the migration condition, migrating the user service from the first instance to the second instance. The embodiment of the application provides the instance migration which is not perceived by the user, so that the migration efficiency is improved under the condition that the use of the user is not influenced.

Description

Information processing method, device and equipment and computer readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an information processing method, apparatus and device, and a computer-readable storage medium.
Background
A database is a collection of data stored in some form in a computer memory, or hard disk. The database instance can add, delete or modify the data in the database. When the database instance performs operations such as adding, deleting or modifying on data in the database, logs of the database can be generated, and one operation log can be generated by performing one operation on each pair of data in the database. In order to improve data processing performance, it is necessary to migrate databases and database instances, for example, to migrate a high-performance server cluster from a current capacity type server.
In the prior art, when a database is migrated, a user is required to stop an original instance and reestablish a new instance after the database is migrated. And after the new instance is created, in order to ensure that the data in the database can be completely migrated, the operations of the operation logs on the data in the old database are executed again in the new database according to the operation logs of the old database.
However, the new instance needs to copy the operation executed by the operation log of the old database in the new database from the first operation log of the original database, and the operation of the process is complex and time-consuming, and an effective technical means for solving the technical problem does not exist at present.
Disclosure of Invention
In view of this, embodiments of the present invention provide an information processing method, an information processing apparatus, an information processing device, and a computer-readable storage medium, which perform a judgment on a migration condition by monitoring an operation log, so as to complete an unaware migration of an instance when the migration condition is satisfied, so as to solve the technical problems in the prior art that an operation is complex and time-consuming during instance migration.
Thus, in one embodiment of the present invention, an information processing method is provided. The method comprises the following steps:
when detecting that data in a first database is copied to a second database, determining a first instance when a user service executes service operation on the first database;
generating a second instance according to the first operation log of the first instance;
executing the second instance to perform the business operation on the data in the second database;
determining a second operation log generated by the second instance;
and when the first operation log and the second operation log meet the migration condition, migrating the user service from the first instance to the second instance.
In another embodiment of the present application, there is provided an information processing apparatus including:
the first determining module is used for determining a first instance when a user service executes service operation on a first database when detecting that data in the first database is copied to a second database;
the instance generation module is used for generating a second instance according to the first operation log of the first instance;
an instance execution module, configured to execute the second instance to perform the business operation on the data in the second database;
a second determining module, configured to determine a second operation log generated by the second instance;
and the service migration module is used for migrating the user service from the first instance to the second instance when the first operation log and the second operation log meet the migration condition.
In another embodiment of the present invention, an information processing apparatus is provided. The apparatus comprises: a storage component and a processing component; the storage component is used for storing one or more computer instructions, wherein the one or more computer instructions are used for the processing component to call and execute;
the processing component is to:
when detecting that data in a first database is copied to a second database, determining a first instance when a user service executes service operation on the first database; generating a second instance according to the first operation log of the first instance; executing the second instance to perform the business operation on the data in the second database; determining a second operation log generated by the second instance; and when the first operation log and the second operation log meet the migration condition, migrating the user service from the first instance to the second instance.
Furthermore, an embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and the computer program enables a computer to implement any embodiment when the computer program is executed.
According to the technical scheme provided by the embodiment of the invention, when the data in the first database is detected to be copied to the second database, the first instance when the user service executes the service operation on the first database can be determined. The user service performs the relevant service operations on the data in the first database at this time via the first instance. Then, a second instance may be generated according to the first operation log of the first instance, and the second instance is executed to execute the business operation on the data in the second database, so that the data operation executed by the first instance on the first database is processed in the second database in the same way. After determining the second operation log generated by the second instance, the user service may be migrated from the first instance to the second instance when the first operation log and the second operation log satisfy a migration condition. By monitoring the first operation log and the second operation log, user service can be migrated from the first instance to the second instance when the instance migration condition is met. The process does not influence the continuous execution of the user service, realizes service migration without perception of the user, and improves migration efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a flowchart of an embodiment of an information processing method according to an embodiment of the present invention;
fig. 2 is a flowchart of an information processing method according to another embodiment of the present invention;
fig. 3 is a flowchart of an information processing method according to another embodiment of the present invention;
fig. 4 is a diagram illustrating an application example of an information processing method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an embodiment of an information processing apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an implementation of an information processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, and "a" and "an" generally include at least two, but do not exclude at least one, unless the context clearly dictates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a recognition", depending on the context. Similarly, the phrase "if determined" or "if identified (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when identified (a stated condition or event)" or "in response to an identification (a stated condition or event)", depending on the context.
It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a good or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such good or system. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of additional like elements in a commodity or system comprising the element.
The embodiment of the application can be applied to an instance migration scene of a database, the actual execution process of the instance is monitored through the operation logs generated by the instance, the actual migration of the instance is carried out when the operation logs of the two instances are to be completed synchronously, the migration work of the instance is automatically completed through the monitoring of the operation logs of the instance, the continuous execution of user services is not influenced by the process, the service migration without perception of a user is realized, and the migration efficiency is improved.
In the prior art, a service operation performed by a user to add, modify, or delete data in a database may be referred to as a user service, and the user service may be performed by a database instance. An example is that one operation is executed on each pair of data in the database, and an operation log can be generated. When migrating the database, the instance corresponding to the user service needs to be migrated as well, so as to ensure that the user can still use the database. In the existing example migration of the database, a user is required to stop the service processing of the original example and rebuild the example, which may affect the user to use the database and interrupt the data processing task of the user to the database. Moreover, in order to ensure that the data in the database can be completely migrated, the operation log of the old database is needed, and the operation performed on the database by the operation log of the old database is copied in the new database, so that the operation process is complex and takes a long time.
In order to solve the above technical problem, in the embodiment of the present application, when data in a first database is copied to a second database, a first instance when a user service performs a service operation on the first database may be determined. The user service performs the relevant service operations on the data in the first database at this time via the first instance. Then, a second instance may be generated according to the first operation log of the first instance, and the second instance is executed to execute the business operation on the data in the second database, so that the data operation executed by the first instance on the first database is processed in the second database in the same way. After determining the second operation log generated by the second instance, the user service may be migrated from the first instance to the second instance when the first operation log and the second operation log satisfy a migration condition. By monitoring the first operation log and the second operation log, user service can be migrated from a first instance to a second instance when instance migration conditions are met. The monitoring and judgment of the migration process of the example are automatically realized, the participation of a user is not needed, the interruption of business operation by the user is not needed in the migration process, the migration of the database example which is not sensed by the user can be realized, and the example migration efficiency is improved.
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
As shown in fig. 1, a flowchart of an embodiment of an information processing method provided in the embodiment of the present application may include the following steps:
101: when detecting that data in a first database is copied to a second database, determining a first instance when a user service executes service operation on the first database.
The information processing method provided by the embodiment of the application can be configured as a channel Service (Tunnel Service). The channel server may be a middleware, which is a type of software that is intermediate between application systems and system software. The channel server can be configured in a server or any electronic device. The server may include a general computer server or a cloud server. The electronic device may include an intelligent terminal, a notebook, a personal computer, a super computer, and the like, and the embodiment of the present application does not excessively limit the device type of the specific device where the channel server is located.
The channel server can provide data consumption service for a service party, namely a user, and can also request service operation from a corresponding server of the database based on a user request, and the channel server can provide services such as instance migration and data consumption service of the database.
When the data in the first database is copied to the second database, copying the data in the first database from the capacity type computer cluster to the second database of the high-performance computer cluster to improve the performance; copying data in the first database from the high-performance computer cluster to the capacity computer cluster to reduce operating costs; the method can further include copying data in the first database from the first cloud service cluster to a second database in a second cloud service cluster to enable replacement of the cloud service cluster.
The user service may include an addition service, a modification service, a deletion service, and the like, which are performed on data in the database by the user. The user service may include specific service operation instructions that the user wants to perform on the data in the database. When the data in the first database is not copied or the data in the first database is not migrated, the first instance may perform a service operation corresponding to the user service on the data in the first database.
When the database in the first database is copied to the second database, the user service is still executed by the first instance, and the first instance continuously executes service operations such as adding, modifying or deleting and the like on the data in the first database. When the data in the first database is copied to the second database, that is, the starting time of the database copy is detected, and the starting time when the data in the first database starts to be copied to the second database, a first instance of the user service executing the service operation on the data in the first database can be determined, so that a first operation log corresponding to the first instance can be obtained.
Optionally, when data in a first database starts to be copied to a second database, a first instance of a user service when the service operation is performed on the first database may be determined.
102: and generating a second instance according to the first operation log of the first instance.
In the data copying process, the user service continuously executes service operation on the data in the first database based on the first instance. The first instance performs a business operation on each pair of data in the first database, i.e., a first operation log may be generated. The first operation log of the first instance can be determined according to the processing type of the data, and if the first operation log is of a full data type, a second instance can be generated from the first operation log; if the incremental data type is the incremental data type, a second instance can be generated by starting from a first operation log obtained at the starting moment when the data of the first database is copied to the second database; if the full-delta data type, a second instance may be generated starting from a first oplog of the first database.
The first operation log records the business operation performed by the first instance on the data in the first database, and the second instance may be generated according to log information of the first operation log. The first instance and the second instance are synchronous links, and when the first instance has a business operation of data, the second instance corresponds to the business operation which generates the same data. According to the second instance generated by the first operation log, the same data as the first operation log can be executed currently, and the same business operation can be executed.
103: executing the second instance to perform the business operation on the data in the second database.
The second instance may perform a business operation corresponding to the first oplog of the first instance on data in the second database.
104: determining a second operation log generated by the second instance.
The second instance may generate a second operation log by performing a business operation on each pair of data in the second database. The channel server may obtain a second operation log generated by the second instance.
105: and when the first operation log and the second operation log meet the migration condition, migrating the user service from the first instance to the second instance.
A migration node at which user traffic is migrated from a first instance to a second instance may be determined from a first oplog of the first instance and a second oplog of the second instance. The first instance and the second instance are synchronous links, and when the first operation log and the second operation log meet the migration condition, the RPO (Recovery Point Object) which describes the service operation between the first instance and the second instance is close to 100%, and at this time, the user service can be migrated from the first instance to the second instance.
The user service may be a series of sets of service operation instructions. When the data of the first database is migrated to the second database, the user service is continuously executed through the first instance, the first instance executes the service operation corresponding to the user service, and the first operation log is continuously generated in the process. The first operation log records the business operations executed by the first instance on the data in the first database, and the second instance generated by the first operation log executes the same business operations on the business operations executed in the first database in the second database so as to ensure the complete copy of the data. When the first operation log and the second operation log satisfy the migration condition, the service operation instruction which is not executed in the user service can be migrated to the second instance, and the second instance executes the user service corresponding to the service operation instruction which is not executed in the user service.
In the embodiment of the application, when the server detects that the data in the first database is copied to the second database, the server determines a first instance when the user service performs the service operation on the first database, where the first instance is the service operation on the data in the first database, so as to add, modify, or delete the data in the first database. The specific operation performed on the first database by the first instance is recorded in the first operation log of the first instance, the second instance may be generated according to the first operation log of the first instance, the second instance is specific to the second database, the operation log may also be generated when the second instance performs the business operation on the second database, and the second operation log generated when the second instance performs the business operation on the data in the second database may be determined. Therefore, the user service can be migrated from the first instance to the second instance by monitoring the first operation log and the second operation log when the first operation log and the second operation log meet the migration condition. The migration nodes can be obtained through monitoring the operation logs so as to realize automatic migration of the instances, user operation is not needed in the migration process, complexity is reduced, and the user services are directly migrated from the first instance of the first database to the second instance of the second database when the user services meet migration conditions, so that the user services are not interrupted in the migration process, the service operation of the user on the database is not influenced, and the unaware migration of the user services can be realized.
The operation log is used for recording the business operation executed by the instance on the data in the database, the instance generates an operation log when the instance performs the business operation on the data in the database, the operation log can be used for monitoring the process of the instance on the business operation executed by the data in the database, and whether the user business can be migrated can be judged by monitoring the operation log.
As a possible implementation manner, the migrating the user service from the first instance to the second instance when the first operation log and the second operation log satisfy a migration condition may include:
migrating the user traffic from the first instance to the second instance while the first oplog is synchronized with the second oplog.
In some embodiments, the user service may not be continuous, and when the user service is executed in the first instance and no new user service is generated after the second instance executes all the service operations corresponding to the first operation logs, at this time, the service operation executed by the second operation log is the same as the service operation of the last first operation log, and it may be determined that the first operation log and the second operation log are synchronized. And then, monitoring new user service and migrating the new user service to the second instance for execution. The migrating the user traffic from the first instance to the second instance while the first oplog is synchronized with the second oplog may include:
if the service operation corresponding to the first operation log is executed by the second instance, and the first instance corresponding to the user service is finished, determining that the first operation log and the second operation log are synchronous; and when detecting a new user service, migrating the new user service to the second instance. And executing the service operation corresponding to the new user service on the data in the second database by the second instance.
In some embodiments, the user service always performs a service operation on data in the first database, when an operation time of the second operation log is very close to an operation time of a first operation log generated by the current user service performing the service operation, it may be determined that the first operation log is synchronized with the second operation log, the user service may be migrated from a first instance to a second instance, and the second instance performs the service operation corresponding to the user service on the data in the second database. The operation log includes an operation time. The migrating the user traffic from the first instance to the second instance while the second oplog is synchronized with the first oplog may include:
the user traffic may be migrated from the first instance to the second instance when a difference between a second operation time of the second operation log and a first operation time of the first operation log is less than a time threshold.
The operation time of the second operation log is the current time of the second instance performing the service operation on the data in the second database, the second operation time of the second operation log may be compared with the first operation time of the first operation log, if the second operation time is very close to the second operation time, it is described that the copy operation of the second instance on the service operation of the first instance and the service operation of the current user service performed through the first instance are nearly synchronized in time, it is described that the copy operation of the second instance on the service operation of the first instance is finished, and the user service may be migrated from the first instance to the second instance.
The user sets the user service, so that when the user performs service operations such as adding, modifying or deleting data in the database, the user can specify the instance name of the instance to set the specific instance corresponding to the user service. The example domain name is a website containing the example name, the channel server receives the example domain name sent by the user terminal, and analyzes the example domain name to schedule the example corresponding to the user service to the network address of the corresponding database, so that the service operation is executed on the data in the database through the example corresponding to the example name. And then, the user can continuously set user service on the website page corresponding to the instance domain name so as to continuously execute service operation on the data in the database.
Therefore, switching from the first instance to the second instance is specifically switching the network address of the first database corresponding to the first instance to the network address of the second database corresponding to the second instance. As one embodiment, the instance name of the first instance and the instance name of the second instance are both target instance names; the migrating the user traffic from the first instance to the second instance when the first operation log and the second operation log satisfy a migration condition may include:
when the first operation log and the second operation log meet the migration condition, determining an instance domain name corresponding to the user service; wherein the instance domain name comprises a target instance name;
when the instance domain name is analyzed, the association relationship between the instance domain name and the network address of the first database is released, so that the target instance name corresponding to the first instance executes the business operation on the data in the first database, and the association relationship between the instance domain name and the network address of the second database is established, so that the target instance name corresponding to the second instance executes the business operation on the data in the second database is formed.
In order to avoid the need for the user to reset the user service to reduce the complexity of the operation, the instance name of the first instance and the instance name of the second instance may both be set as the target instance name. When the instance names of the first instance and the second instance are the same, the instance domain name actually corresponding to the user service may not change, and when the instance domain name is analyzed, the network address associated with the instance domain name may be migrated from the network address of the first database to the network address of the second database. Before the network address associated with the instance domain name is changed, the user service corresponding to the first instance continues to perform service operation on the data in the first database, and after the network address associated with the instance domain name is changed, the user service corresponding to the second instance performs service operation on the data in the second database. In the process, the domain name resolution function of the channel server can be completed without user participation, so that the user service can be uninterrupted, the instance migration without perception of the user can be realized, the migration efficiency is improved, and the migration difficulty is reduced.
In order to distinguish different logs, each log can be provided with an index number, the index number of the log can be called as a log position, and because the index number has a large size, the generation sequence of the log can be determined through the size of the index number, namely, the processing sequence of the log can also be determined through the log position. To accurately implement migration of instances, the nodes to be migrated may be determined from the log location. As an embodiment, the migrating the user traffic from the first instance to the second instance when the first operation log and the second operation log satisfy a migration condition may include:
when the first operation log and the second operation log meet the migration condition, recording a first log locus of the current first operation log;
and starting the service operation executed by the user service corresponding to the first log locus, and migrating the next service operation of the user service from the first example to the second example.
Migrating a next service operation of a user service from the first instance to the second instance, starting from a service operation performed by the user service corresponding to the first log location, may include: and controlling the first instance not to execute the next service operation of the user service from the service operation executed by the user service corresponding to the first log locus, and controlling the second instance to execute the next service operation of the user service.
In some embodiments, the first oplog of the first instance may include: the method comprises a first operation log generated in real time when the data in the first database is detected to start to be copied to the second database and a first operation log generated in history before the data in the first database is detected to start to be copied to the second database.
The generating a second instance according to the first operation log of the first instance may include:
and respectively generating a second instance according to a first operation log generated in real time when the data in the first database is detected to start to be copied to the second database and a historical first operation log generated before the data in the first database is detected to start to be copied to the second database.
The channel service end can provide data consumption service besides the service of instance migration. The user can request the channel server to acquire the log generated in the data processing process, and execute corresponding processing tasks on the data processing conditions in the database through the detailed log information in the log. For example, the consumption processing stage of the data is monitored by a log.
When the database is migrated, the instances that need to perform business operations on the database are also migrated. In the prior art, an instance migration scheme adopted is generally reconstruction of an instance, that is, an original instance is stopped and an instance is newly built. In order to ensure complete migration of data, the new instance needs to execute the same service operation according to the operation log generated by the old instance, and the new instance can generate one operation log every time the new instance executes the service operation. When a user consumes data to a channel server to obtain log data, because the new instance is a copy of the service operation of the old instance, the operation log of the new instance and the operation log of the old instance have a part with crossed contents, that is, the operation contents of the newly generated operation log and the operation log of the old instance are repeated in the process from the start of the service operation of the new instance to the completion of the copying of the operation log of the old instance.
When a user requests to obtain log data from the channel server, the channel server may feed back to the user from the first newly added operation log because the new instance generates a new operation log, but the operation logs overlap with the operation logs of the old instance to generate invalid log feedback. And when the new instance copies the operation log of the old instance, the operation log is completely fed back, and the new instance generated when the user service is executed again needs a long time to feed back to the user, so that the user is interrupted from executing corresponding processing tasks on the fed-back log, and the processing efficiency of the user is influenced.
Therefore, when detecting that the data in the first database is copied to the second database, after determining the first instance of the user service executed on the first database, the method further includes:
responding to a log consumption request of a user, and executing a consumption task of a first operation log aiming at the first instance;
when the first operation log and the second operation log meet the migration condition, recording a second log site of the current second operation log;
and responding to the log consumption request of the user, and executing a consumption task aiming at a second operation log corresponding to the next log position of the second log position.
The recording of the second log location of the current second operation log and the migration of the user service from the first instance to the second instance are both performed when the first operation log and the second operation log satisfy the migration condition, and therefore, the recording of the second log location and the migration of the user service can be performed simultaneously.
As shown in fig. 2, a flowchart of another embodiment of an information processing method according to an embodiment of the present invention is provided, where the method includes the following steps:
201: when detecting that data in a first database is copied to a second database, determining a first instance when a user service executes service operation on the first database.
Some steps of the embodiments of the present application have been described in detail in the foregoing embodiments, and are not described herein again.
202: and responding to a log consumption request of a user, and executing a consumption task of the first operation log aiming at the first instance.
The log consumption request of the user can comprise a plurality of log consumption requests, and the user can continuously send the log consumption request to the channel server.
203: and generating a second instance according to the first operation log of the first instance.
204: executing the second instance to perform the business operation on the data in the second database.
205: determining a second operation log generated by the second instance.
206: and when the first operation log and the second operation log meet the migration condition, migrating the user service from the first instance to the second instance, and recording a second log position of the current second operation log.
207: and responding to the log consumption request of the user, and executing a consumption task aiming at a second operation log corresponding to the next log position of the second log position.
In the embodiment of the application, when the first operation log and the second operation log meet the migration condition, besides the user service is migrated from the first instance to the second instance, the second log site of the current second operation log is recorded, so that the consumption task of the second operation log corresponding to the next log site of the second log site can be executed in response to the log consumption request of the user. Therefore, the consumption task can be dispatched from the first operation log to the second operation log according to the second log site, the repeated second operation log generated when the second instance copies the service operation of the first operation log of the first instance can be skipped, so that when the user service is executed at the second instance, the second operation log newly generated by the second instance is subjected to data consumption, the seamless switching from the first operation log to the second operation log is realized, and the invalid log consumption task can be reduced.
Optionally, the consuming task for any log may specifically be to feed the log back to the user. As an embodiment, the executing the consumption task for the first operation log in response to the log consumption request of the user includes:
responding to the log consumption request of the user, and feeding back the first operation log serving as consumption data to the user;
the executing, in response to the log consumption request of the user, a consumption task for a second operation log corresponding to a next log location of the second log location may include:
and responding to the log consumption request of the user, and feeding back a second operation log corresponding to the next log site of the second log sites to the user as consumption data.
When the operation log is directly fed back to a user as consumption data, the feedback of the second operation log repeated with the first operation log before the second log position is skipped through the record of the second log position, so that invalid feedback is avoided, and the feedback efficiency can be improved. Meanwhile, when the first operation log is directly jumped to the second operation log corresponding to the second log site, the log consumption request of the user is not interrupted, the non-perception switching of the log consumption of the user can be realized, the continuous log feedback is realized, and the feedback efficiency is improved.
The user can continuously try to acquire new logs from the channel server, namely continuously send log consumption requests to the channel server, and the channel server can respond the log consumption requests and feed the logs back to the user.
In some embodiments, the log consumption request of the user may be dispatched to the second oplog only when the consumption task of the first oplog ends. The executing, in response to the log consumption request of the user, a consumption task for the second operation log next to the second log location may include:
responding to the log consumption request of the user, and executing the consumption task of the second operation log corresponding to the next log position of the second log positions if the consumption task of the first operation log is completed.
Optionally, a prerequisite for performing a consuming task for any one log is that there is a new log. The responding the log consumption request of the user, and if the consumption task for the first operation log is completed, executing the consumption task for the second operation log corresponding to the next log site of the second log site may include responding the log consumption request of the user, and determining whether there is a first operation log that has not been fed back. If the consumption task does not exist, the consumption task of the first operation log can be determined to be completed, and the consumption task corresponding to the second operation log at the next log position of the second log positions is executed.
In still other embodiments, the method may further comprise: responding to the log consumption request of the user, and if the consumption task aiming at the first operation log is not completed, continuing to execute the consumption task aiming at the first operation log.
Further, optionally, the responding to the log consumption request of the user, if the consumption task for the first operation log is not completed, continuing to execute the consumption task for the first operation log may further include: responding to the log consumption request of the user, if the first operation log which is not fed back exists, determining that the consumption task of the first operation log is not completed, and continuing to execute the consumption task aiming at the first operation log. And executing a consumption task aiming at a second operation log corresponding to a next log position of the second log positions until the first operation log which is not fed back does not exist.
The channel server may provide an Application Programming Interface (API) for a user to use, and the user accesses the channel server through the API, so as to send a log consumption request to the channel server and obtain log data fed back by the channel server through the API.
In one possible design, before the executing the consumption task for the first operation log in response to the log consumption request of the user, the method may further include:
and acquiring the log consumption request sent by the user through the user side based on an application program interface of the user side corresponding to the user.
When an instance processes a database, data in the database may be processed based on different data processing types, and common data processing types may include: full data processing, incremental data processing, or full plus incremental data processing. The data processing types of the first instance and the second instance are the same.
The full data type may refer to processing all data in the database; the incremental data type is to process newly added data in the database; the full increment data type refers to processing both original data and newly added data in the database.
The operation log may include a storage location, an operation type, and an operation content of data for which the business operation is performed. The storage location of the data may include which partition the data is in, which file in the partition it is in, and an offset in the file it is in. The operation type may specifically refer to a specific type of operation on data, and may specifically include an addition type, a deletion type, or a modification type of data. The operation content may specifically refer to operation content specific to data, for example, if the operation type is an increase type, the operation content is data increased by one "55"; if the operation type is a deletion type, the operation content is data of a deletion storage location; if the operation type is a change type, the operation content may be to change the data of "66" at the storage location to "88".
Thus, as one embodiment, the first oplog may include: the operation data comprises a first storage position, a first operation type and a first operation content in the first database.
The generating a second instance according to the first operation log of the first instance may include:
determining a second storage position of the operation data in the second database according to a first storage position of the operation data in the first operation log of the first instance in the first database;
and generating a second instance of the operation data corresponding to a second storage position in the second database according to the first operation type and the first operation content.
As a possible implementation, the first storage location includes: the operation data comprises a first storage partition of the first database, a first file of the first storage partition and a first offset of the first file;
the second storage location comprises: the operational data is in a second storage partition of the second database, a second file in the second storage partition, and a second offset in the second file.
As shown in fig. 3, a flowchart of another embodiment of an information processing method provided in the embodiment of the present application may include the following steps:
301: and judging whether the data of the first database is copied to the second database, if so, executing the step 302, and if not, continuing to execute the step 301.
302: and determining a first example when the user service corresponds to the first database to execute service operation.
A first operation log may be generated while the first instance performs a business operation on a database.
When the first database starts to be copied to the second database, a first operation log before the copying is started and a first operation log after the copying is started can be obtained. The first operation log before the start of the copying may refer to a history first operation log, and the first operation log after the start of the copying may refer to a real-time first operation log.
303: and generating a second instance according to the first operation log of the first instance.
304: executing the second instance to perform the business operation on the data in the second database.
The business operation performed by the first instance is replicated by the second instance. The second instance may generate a second operation log when performing the business operation on the log in the second database.
305: judging whether the difference between the second operation time of the current second operation log and the first operation time of the first operation log is smaller than a time threshold value or not; if yes, go to step 306; if so, go back to step 302.
306: and recording a first log locus of the current first operation log, and simultaneously recording a second log locus of the current second operation log.
307: and starting from the service operation executed by the user service corresponding to the first log locus, migrating the next service operation of the user service from the first instance to the second instance.
308: responding to the log consumption request of the user, judging whether the consumption task aiming at the first operation log is completed, if so, executing a step 309; if not, step 310 is performed.
In a general case, a log consumption request initiated by a user can be received, and qualified log data can be fed back to the user.
Generally, the consumption of log data is mainly the operation log which is not fed back by the user. When the log for the first database is not consumed, the first operation log is continuously consumed, that is, continuously fed back to the user. When the first database is consumed and no new log data is generated, no log is fed back to the user.
In some designs, the consumption speed of the log may be lower than the operation speed of the user service on the database, and the first operation log may be continuously fed back to the user side when the consumption of the database is not completed. After the migration of the database is completed, a second operation log may be generated when the user service for the second database is executed. Because each pair of databases performs one service operation, a log can be generated, and the earlier stage in the second operation log may be a data copy log executed on the second database, including a log when the first database is copied and a log when the first operation log is copied and the same service operation is executed. When the first operation log and the second operation log meet the migration condition, the user service is migrated from the first database to the second data, a log different from the first operation log is generated, and consumption can be started from the log different from the first operation log so as to feed back a new operation log to the user.
In order to obtain a log different from the first operation log, a log location of the second operation log when the user traffic is migrated from the first instance to the second instance may be recorded, so that consumption may be started from the second operation log at the log location.
309: and executing consumption tasks of a second operation log corresponding to the next log position of the second log positions.
310: and feeding back the first operation log as consumption data to the user.
The second operation log is a log obtained by currently executing the service operation by the second instance, and the second instance executing the current service operation is generated based on the first operation log of the first instance, that is, the second operation log corresponds to the first operation log generating the corresponding second instance.
In the embodiment of the application, when the database starts to be migrated, a first instance when the user service executes the service operation on the first database is obtained, a second instance can be generated according to a first operation log of the first instance, and the second instance is executed to execute the service operation on the data in the database. Then, whether the time difference between the second operation time of the current second operation log and the first operation time of the first operation log is smaller than a time threshold value or not can be judged, if so, the first log location of the current first operation log can be recorded, and the second log location of the second operation log can be recorded at the same time. The records of the first log site and the second log site can be used for migration of instances and data consumption based on the current log site, so that the next business operation of the user business can be migrated from the first instance to the second instance from the business operation executed by the user business corresponding to the first log site, and therefore the unaware migration of the instances is completed, and the migration efficiency of the instances is improved. The method comprises the steps that in the process of executing business operation on a database by an instance, data consumption aiming at logs can be executed simultaneously, when the database is not completely migrated, data consumption aiming at a first operation log of a first instance is executed all the time, and after the database is completely migrated, a second operation log is transferred aiming at the newly generated log consumption different from the first operation log. And responding to a log consumption request of a user, judging whether the consumption task aiming at the first operation log is finished or not, executing confirmation on whether the current consumption task is finished or not, and if the current consumption task is confirmed to be finished, executing the consumption task aiming at a second operation log corresponding to a next log position of a second log position. In the process, the data consumption task of the user does not need to be interrupted, the user does not need to feed back an invalid log from the first log of the second operation log, the seamless scheduling of the data consumption task aiming at the operation log is realized, the continuous consumption is realized, and the processing efficiency of the consumption task is improved.
For describing the technical solution of the embodiment of the present application in detail, as shown in fig. 4, a channel server M1 is taken as a cloud server, a user service is initiated through a first user M2, and a log consumption request is initiated through a second user M3.
In some embodiments, the first ue M2 and the second ue M3 may be the same ue, and for convenience of description, the first ue M2 and the second ue M3 are described by using different ues.
In fig. 4, a first server M4 where a first database (not shown) is located and a second server M5 where a second database (not shown) is located are also included.
User service is initiated 401 from the first user end M2, and the channel service end M1 may interact with the first server M4 where the first database is located based on the user service, so as to implement a service operation 402 on data in the first database. Each time a user service performs a service operation, a first operation log may be generated, and the channel server may determine the first operation log 403.
The user may initiate a log consumption request 404 to the channel server M1 through the second user terminal M3, and the channel server M1 may respond to the log consumption request of the user and feed back the first operation log as consumption data to the user 405.
When the data in the first database is copied to the second database of the second server M5 by the first server M4, the channel server M1 may determine a first instance generated when the user service performs a service operation on the first database. And generating a second instance according to the first log operation of the first instance. Thereafter, a second instance may be executed to perform business operations on the data in the second database. The second instance may generate a second operation log while performing the business operation on the data in the second database.
After that, the channel server M1 may record a first log location of the current first operation log and record a second log location of the current second operation log when it is determined that a time difference between the second operation time of the current second operation log and the first operation time of the first operation log is smaller than a time threshold.
For convenience of understanding, as shown in 406 in fig. 4, which is an example of switching between the first instance and the second instance, it is assumed that there are 99 first operation logs, that is, it is assumed that 99 service operations on the first database have been performed by the current user service through the first instance, and 99 first operation logs have been generated. The second instance generated based on the first oplog also performs the copy operation of the 99 first oplogs, that is, there are also 99 second oplogs at this time. The current second oplog 4062, i.e., the 99 th second oplog, may be compared with the current first oplog 4061, i.e., the 99 th first oplog, and if the time difference between the second operation time of the second oplog and the first operation time of the first oplog is less than the time threshold, it indicates that the business operations performed by the second instance of the second database and the first instance of the first database have already approached synchronization. At this time, a first log location of the first operation log 4061 and a second log location of the second operation log 4062 may be recorded.
Thereafter, the next service operation corresponding to the 99 th first operation log 4061 may stop being executed by the first instance, that is, the 100 th service operation of the user service stops being executed at the first instance, and starts being executed 407 by the second instance. Then, the user service is no longer executed by the first instance, and the second instance may generate 408 a new second operation log after executing the new service operation, for example, generate 4063 a 100 th second operation log when executing the 100 th service operation.
When the log consumption request sent 404 by the second user end M3 is obtained again, on the basis that the first operation log consumption is finished, the operation logs after the second operation log 4062 corresponding to the second log node, for example, log100, may be sequentially sent to the second user end M3409.
It should be noted that the technical solutions of the embodiments shown in fig. 4 are only exemplary, and should not be construed as limiting the technical solutions of the embodiments of the present application, and any combination of devices or individual implementation of the technical solutions of the present application shall belong to the technical solutions protected by the present application.
As shown in fig. 5, a flowchart of an embodiment of an information processing apparatus provided in an embodiment of the present application may include the following modules:
the first determination module 501: the method comprises the steps of detecting that data in a first database is copied to a second database, and determining a first instance when a user service executes service operation on the first database.
The instance generation module 502: the method is used for generating a second instance according to the first operation log of the first instance.
The instance execution module 503: for executing the second instance to perform the business operation on the data in the second database.
The second determination module 504: for determining a second oplog generated by the second instance.
The service migration module 505: the second operation log is used for migrating the user service from the first instance to the second instance when the first operation log and the second operation log meet migration conditions.
The information processing apparatus provided in the embodiment of the present application may be configured as a channel server to implement the technical solution of the embodiment of the present application.
In the embodiment of the application, when the server detects that the data in the first database is copied to the second database, the server determines a first instance when the user service performs the service operation on the first database, where the first instance is the service operation on the data in the first database, so as to add, modify, or delete the data in the first database. The specific operation performed on the first database by the first instance is recorded in the first operation log of the first instance, the second instance may be generated according to the first operation log of the first instance, the second instance is specific to the second database, the operation log may also be generated when the second instance performs the business operation on the second database, and the second operation log generated when the second instance performs the business operation on the data in the second database may be determined. Therefore, the user service can be migrated from the first instance to the second instance by monitoring the first operation log and the second operation log when the first operation log and the second operation log meet the migration condition. The migration nodes can be obtained through monitoring the operation logs so as to realize automatic migration of the instances, user operation is not needed in the migration process, complexity is reduced, and the user services are directly migrated from the first instance of the first database to the second instance of the second database when the user services meet migration conditions, so that the user services are not interrupted in the migration process, the service operation of the user on the database is not influenced, and the unaware migration of the user services can be realized.
As an embodiment, the service migration module may include:
a first migration unit, configured to migrate the user service from the first instance to the second instance when the second operation log is synchronized with the first operation log.
In some embodiments, the oplog includes an operation time; the first migration unit may include:
a first migration subunit, configured to migrate the user traffic from the first instance to the second instance when a difference between a second operation time of the second operation log and a first operation time of the first operation log is smaller than a time threshold.
As yet another embodiment, the instance name of the first instance and the instance name of the second instance are both target instance names; the instance migration module may include:
a second determining unit, configured to determine an instance domain name corresponding to the user service when the first operation log and the second operation log meet a migration condition; wherein the instance domain name comprises a target instance name;
the second migration unit is configured to, when the instance domain name is resolved, remove the association between the instance domain name and the network address of the first database, to terminate the execution of the service operation on the data in the first database by the first instance corresponding to the target instance name, and establish the association between the instance domain name and the network address of the second database, to form a second instance corresponding to the target instance name for executing the service operation on the data in the second database.
As another embodiment, the service migration module may include:
the first recording unit is used for recording a first log locus of the current first operation log when the first operation log and the second operation log meet the migration condition;
a third migration unit, configured to, starting from a service operation executed by the user service corresponding to the first log location, migrate a next service operation of the user service from the first instance to the second instance.
As yet another embodiment, the apparatus may further include:
the first response module is used for responding to a log consumption request of a user and executing a consumption task of a first operation log aiming at the first instance;
the first recording module is used for recording a second log position of the current second operation log when the first operation log and the second operation log meet the migration condition;
and the second response module is used for responding to the log consumption request of the user and executing a consumption task aiming at a second operation log corresponding to the next log position of the second log position.
As an embodiment, the first response module may include:
the first response unit is used for responding to the log consumption request of the user and feeding back the first operation log serving as consumption data to the user;
the second response module may include:
and the second response unit is used for responding to the log consumption request of the user and feeding back a second operation log corresponding to the next log position of the second log position as consumption data to the user.
In some embodiments, the second response unit may include:
and the first response subunit is used for responding to the log consumption request of the user, and executing the consumption task of the second operation log corresponding to the next log position of the second log positions if the consumption task of the first operation log is completed.
In some embodiments, the second response unit may further include:
and the second response subunit is used for responding to the log consumption request of the user, and if the consumption task aiming at the first operation log is not completed, continuing to execute the consumption task aiming at the first operation log.
In one possible design, the apparatus further includes:
and the request acquisition module is used for acquiring the log consumption request sent by the user through the user side based on an application program interface of the user side corresponding to the user.
As an embodiment, the data processing types of the first instance and the second instance are the same, and the data processing types include: full data processing, incremental data processing, or full plus incremental data processing.
As yet another embodiment, the first oplog includes: the method comprises the steps that operation data are stored in a first storage position of a first database, a first operation type and first operation content;
the instance generation module may include:
a location determining unit, configured to determine, according to a first storage location of operation data in a first operation log of the first instance in the first database, a second storage location of the operation data in the second database;
and the first generation unit is used for generating a second example of operation data corresponding to a second storage position in the second database according to the first operation type and the first operation content.
Further, optionally, the first storage location comprises: the operation data comprises a first storage partition of the first database, a first file of the first storage partition and a first offset of the first file;
the second storage location comprises: the operational data is in a second storage partition of the second database, a second file in the second storage partition, and a second offset in the second file.
As one embodiment, the first oplog includes: a first operation log generated in real time when the data in the first database is detected to start to be copied to the second database and a first operation log generated in history before the data of the first database is detected to start to be copied to the second database;
the instance generation module may include:
and the second generation unit is used for generating a second instance according to a first operation log generated in real time when the data in the first database is detected to start to be copied to the second database and a historical first operation log generated before the data in the first database is detected to start to be copied to the second database respectively.
The method for implementing information processing described in fig. 5 may execute the information processing described in the foregoing embodiment, and details of the implementation principle and the technical effect are not repeated. The specific manner of implementing the information processing apparatus in the above embodiments, in which each module and unit performs operations, has been described in detail in the embodiments related to the method, and will not be described in detail herein.
In addition, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium; the computer program causes a computer to implement the information processing method according to any one of the preceding embodiments when executed.
In practical applications, the information processing apparatus as described in fig. 5 may be configured as an information processing device as shown in fig. 6, which is a flowchart of an embodiment of an information processing device provided in an embodiment of the present application, and the device may include: a storage component 601 and a processing component 602; the storage component 601 is configured to store one or more computer instructions, where the one or more computer instructions are invoked for execution by the processing component 602;
the processing component 602 is configured to:
when detecting that data in a first database is copied to a second database, determining a first instance when a user service executes service operation on the first database; generating a second instance according to the first operation log of the first instance; executing the second instance to perform the business operation on the data in the second database; determining a second operation log generated by the second instance; and when the first operation log and the second operation log meet the migration condition, migrating the user service from the first instance to the second instance.
The information processing device may be configured with a channel server, and the specific application of the technical solution of the embodiment of the present application is realized through the channel server.
In the embodiment of the application, when the server detects that the data in the first database is copied to the second database, the server determines a first instance when the user service performs the service operation on the first database, where the first instance is the service operation on the data in the first database, so as to add, modify, or delete the data in the first database. The specific operation performed on the first database by the first instance is recorded in the first operation log of the first instance, the second instance may be generated according to the first operation log of the first instance, the second instance is specific to the second database, the operation log may also be generated when the second instance performs the business operation on the second database, and the second operation log generated when the second instance performs the business operation on the data in the second database may be determined. Therefore, the user service can be migrated from the first instance to the second instance by monitoring the first operation log and the second operation log when the first operation log and the second operation log meet the migration condition. The migration nodes can be obtained through monitoring the operation logs so as to realize automatic migration of the instances, user operation is not needed in the migration process, complexity is reduced, and the user services are directly migrated from the first instance of the first database to the second instance of the second database when the user services meet migration conditions, so that the user services are not interrupted in the migration process, the service operation of the user on the database is not influenced, and the unaware migration of the user services can be realized.
As an embodiment, when the first operation log and the second operation log satisfy a migration condition, the migrating the user service from the first instance to the second instance by the processing component may specifically be:
migrating the user traffic from the first instance to the second instance while the second oplog is synchronized with the first oplog.
As a possible implementation, the operation log includes an operation time; when the second operation log is synchronized with the first operation log, the migrating the user service from the first instance to the second instance may specifically be:
migrating the user traffic from the first instance to the second instance when a difference between a second operation time of the second operation log and a first operation time of the first operation log is less than a time threshold.
In some embodiments, the instance name of the first instance and the instance name of the second instance are both target instance names; the specifically, when the first operation log and the second operation log satisfy a migration condition, the migrating the user service from the first instance to the second instance by the processing component may be:
when the first operation log and the second operation log meet the migration condition, determining an instance domain name corresponding to the user service; wherein the instance domain name comprises a target instance name;
when the instance domain name is analyzed, the association relationship between the instance domain name and the network address of the first database is released, so that the target instance name corresponding to the first instance executes the business operation on the data in the first database, and the association relationship between the instance domain name and the network address of the second database is established, so that the target instance name corresponding to the second instance executes the business operation on the data in the second database is formed.
As another embodiment, when the first operation log and the second operation log satisfy the migration condition, the migrating the user service from the first instance to the second instance by the processing component may specifically be:
when the first operation log and the second operation log meet the migration condition, recording a first log locus of the current first operation log;
and starting from the service operation executed by the user service corresponding to the first log locus, migrating the next service operation of the user service from the first instance to the second instance.
In some embodiments, the processing component may be further operative to:
responding to a log consumption request of a user, and executing a consumption task of a first operation log aiming at the first instance;
when the first operation log and the second operation log meet the migration condition, recording a second log position of the current second operation log;
and responding to the log consumption request of the user, and executing a consumption task aiming at a second operation log corresponding to the next log position of the second log position.
As a possible implementation manner, the executing, by the processing component, the consumption task for the first operation log in response to the log consumption request of the user may specifically be:
responding to the log consumption request of the user, and feeding back the first operation log serving as consumption data to the user;
the executing a consumption task aiming at a second operation log corresponding to a next log position of the second log positions in response to the log consumption request of the user comprises:
and responding to the log consumption request of the user, and feeding back a second operation log corresponding to the next log site of the second log sites to the user as consumption data.
In some embodiments, the processing component, in response to the log consumption request of the user, may specifically execute a consumption task for the second operation log next to the second log location by:
responding to the log consumption request of the user, and executing the consumption task of the second operation log corresponding to the next log position of the second log positions if the consumption task of the first operation log is completed.
In some embodiments, the processing component may be further operative to:
responding to the log consumption request of the user, and if the consumption task aiming at the first operation log is not completed, continuing to execute the consumption task aiming at the first operation log.
In some embodiments, the processing component may be further operative to:
and acquiring the log consumption request sent by the user through the user side based on an application program interface of the user side corresponding to the user.
As another embodiment, the first instance and the second instance have the same data processing type, and the data processing type includes: full data processing, incremental data processing, or full plus incremental data processing.
In some embodiments, the first oplog comprises: the method comprises the steps that operation data are stored in a first storage position of a first database, a first operation type and first operation content;
the generating, by the processing component, the second instance according to the first operation log of the first instance may specifically be:
determining a second storage position of the operation data in the second database according to a first storage position of the operation data in the first operation log of the first instance in the first database;
and generating a second instance of the operation data corresponding to a second storage position in the second database according to the first operation type and the first operation content.
Further, optionally, the first storage location comprises: the operation data comprises a first storage partition of the first database, a first file of the first storage partition and a first offset of the first file;
the second storage location comprises: the operational data is in a second storage partition of the second database, a second file in the second storage partition, and a second offset in the second file.
As one embodiment, the first oplog includes: a first operation log generated in real time when the data in the first database is detected to start to be copied to the second database and a first operation log generated in history before the data of the first database is detected to start to be copied to the second database;
the generating, by the processing component, the second instance according to the first operation log of the first instance may specifically be:
and respectively generating a second instance according to a first operation log generated in real time when the data in the first database is detected to start to be copied to the second database and a historical first operation log generated before the data in the first database is detected to start to be copied to the second database.
The information processing method according to any of the above embodiments may be executed by the information processing device described in fig. 6, and details of the implementation principle and the technical effect are not repeated. The specific manner in which the processing components of the above-described embodiments that implement the information processing apparatus operate has been described in detail in the embodiments related to the method, and will not be described in detail here.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course, can also be implemented by a combination of hardware and software. With this understanding in mind, the above-described solutions and/or portions thereof that are prior art may be embodied in the form of a computer program product, which may be embodied on one or more computer-usable storage media having computer-usable program code embodied therein (including but not limited to disk storage, CD-ROM, optical storage, etc.).
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device 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 tape magnetic disk storage 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.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (16)

1. An information processing method characterized by comprising:
when detecting that data in a first database is copied to a second database, determining a first instance when a user service executes service operation on the first database;
generating a second instance according to the first operation log of the first instance;
executing the second instance to perform the business operation on the data in the second database;
determining a second operation log generated by the second instance;
when the first operation log and the second operation log meet the migration condition, migrating the user service from the first instance to the second instance;
wherein the migrating the user traffic from the first instance to the second instance when the first operation log and the second operation log satisfy a migration condition comprises:
migrating the user traffic from the first instance to the second instance while the second oplog is synchronized with the first oplog.
2. The method of claim 1, wherein the oplog comprises an operation time; the migrating the user traffic from the first instance to the second instance while the second oplog is synchronized with the first oplog comprises:
migrating the user traffic from the first instance to the second instance when a difference between a second operation time of the second operation log and a first operation time of the first operation log is less than a time threshold.
3. The method of claim 1, wherein the instance name of the first instance and the instance name of the second instance are both target instance names; the migrating the user traffic from the first instance to the second instance when the first operation log and the second operation log satisfy a migration condition comprises:
when the first operation log and the second operation log meet the migration condition, determining an instance domain name corresponding to the user service; wherein the instance domain name comprises a target instance name;
when the instance domain name is analyzed, the association relationship between the instance domain name and the network address of the first database is released, so that the target instance name corresponding to the first instance executes the business operation on the data in the first database, and the association relationship between the instance domain name and the network address of the second database is established, so that the target instance name corresponding to the second instance executes the business operation on the data in the second database is formed.
4. The method of claim 1, wherein migrating the user traffic from the first instance to the second instance when the first oplog and the second oplog satisfy a migration condition comprises:
when the first operation log and the second operation log meet the migration condition, recording a first log locus of the current first operation log;
and starting from the service operation executed by the user service corresponding to the first log locus, migrating the next service operation of the user service from the first instance to the second instance.
5. The method of claim 1, wherein detecting that the data in the first database is copied to the second database, after determining the first instance of the user service performed on the first database, further comprises:
responding to a log consumption request of a user, and executing a consumption task of a first operation log aiming at the first instance;
when the first operation log and the second operation log meet the migration condition, recording a second log position of the current second operation log;
and responding to the log consumption request of the user, and executing a consumption task aiming at a second operation log corresponding to a next log position of the second log position.
6. The method of claim 5, wherein performing the consumption task for the first oplog in response to the log consumption request of the user comprises:
responding to the log consumption request of the user, and feeding back the first operation log serving as consumption data to the user;
the executing a consumption task aiming at a second operation log corresponding to a next log position of the second log positions in response to the log consumption request of the user comprises:
and responding to the log consumption request of the user, and feeding back a second operation log corresponding to the next log site of the second log sites to the user as consumption data.
7. The method of claim 6, wherein performing a consumption task for the second oplog next to the second log location in response to the log consumption request of the user comprises:
responding to the log consumption request of the user, and executing the consumption task of the second operation log corresponding to the next log position of the second log positions if the consumption task of the first operation log is completed.
8. The method of claim 6, further comprising:
responding to the log consumption request of the user, and if the consumption task aiming at the first operation log is not completed, continuing to execute the consumption task aiming at the first operation log.
9. The method of claim 5, wherein before executing the consuming task for the first oplog in response to the log consuming request of the user, further comprising:
and acquiring the log consumption request sent by the user through the user side based on an application program interface of the user side corresponding to the user.
10. The method of claim 1, wherein the first instance and the second instance have the same data processing type, the data processing type comprising: full data processing, incremental data processing, or full plus incremental data processing.
11. The method of claim 1, wherein the first oplog comprises: the method comprises the steps that operation data are stored in a first storage position of a first database, a first operation type and first operation content;
the generating a second instance according to the first operation log of the first instance comprises:
determining a second storage position of the operation data in the second database according to a first storage position of the operation data in the first operation log of the first instance in the first database;
and generating a second instance of the operation data corresponding to a second storage position in the second database according to the first operation type and the first operation content.
12. The method of claim 11, wherein the first storage location comprises: the operation data comprises a first storage partition of the first database, a first file of the first storage partition and a first offset of the first file;
the second storage location comprises: the operational data is in a second storage partition of the second database, a second file in the second storage partition, and a second offset in the second file.
13. The method of claim 1, wherein the first oplog comprises: a first operation log generated in real time when the data in the first database is detected to start to be copied to the second database and a first operation log generated in history before the data of the first database is detected to start to be copied to the second database;
the generating a second instance according to the first operation log of the first instance comprises:
and respectively generating a second instance according to a first operation log generated in real time when the data in the first database is detected to start to be copied to the second database and a historical first operation log generated before the data in the first database is detected to start to be copied to the second database.
14. An information processing apparatus characterized by comprising:
the first determining module is used for determining a first instance when a user service executes service operation on a first database when detecting that data in the first database is copied to a second database;
the instance generation module is used for generating a second instance according to the first operation log of the first instance;
an instance execution module, configured to execute the second instance to perform the business operation on the data in the second database;
a second determining module, configured to determine a second operation log generated by the second instance;
and the service migration module is used for migrating the user service from the first instance to the second instance when the first operation log and the second operation log are synchronous.
15. An information processing apparatus characterized by comprising: a storage component and a processing component; the storage component is used for storing one or more computer instructions, wherein the one or more computer instructions are used for the processing component to call and execute;
the processing component is to:
when detecting that data in a first database is copied to a second database, determining a first instance when a user service executes service operation on the first database; generating a second instance according to the first operation log of the first instance; executing the second instance to perform the business operation on the data in the second database; determining a second operation log generated by the second instance; migrating the user traffic from the first instance to the second instance while the first oplog is synchronized with the second oplog.
16. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program;
the computer program causes a computer to implement the information processing method according to any one of claims 1 to 13 when executed.
CN202010038303.8A 2020-01-14 2020-01-14 Information processing method, device and equipment and computer readable storage medium Active CN111241068B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010038303.8A CN111241068B (en) 2020-01-14 2020-01-14 Information processing method, device and equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010038303.8A CN111241068B (en) 2020-01-14 2020-01-14 Information processing method, device and equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111241068A CN111241068A (en) 2020-06-05
CN111241068B true CN111241068B (en) 2023-04-07

Family

ID=70880937

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010038303.8A Active CN111241068B (en) 2020-01-14 2020-01-14 Information processing method, device and equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111241068B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106970920A (en) * 2016-01-14 2017-07-21 阿里巴巴集团控股有限公司 A kind of method and apparatus for database data migration
CN107357883A (en) * 2017-06-30 2017-11-17 北京奇虎科技有限公司 Data migration method and device
WO2018099397A1 (en) * 2016-12-01 2018-06-07 腾讯科技(深圳)有限公司 Method and device for data migration in database cluster and storage medium
CN108268501A (en) * 2016-12-30 2018-07-10 中国移动通信集团北京有限公司 Method for processing business and device in a kind of online data transition process
CN108932282A (en) * 2018-05-18 2018-12-04 腾讯科技(深圳)有限公司 A kind of database migration method, apparatus and storage medium
CN110321339A (en) * 2019-07-04 2019-10-11 深圳乐信软件技术有限公司 A kind of data migration method, device, equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9298752B2 (en) * 2013-08-26 2016-03-29 Dropbox, Inc. Facilitating data migration between database clusters while the database continues operating

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106970920A (en) * 2016-01-14 2017-07-21 阿里巴巴集团控股有限公司 A kind of method and apparatus for database data migration
WO2018099397A1 (en) * 2016-12-01 2018-06-07 腾讯科技(深圳)有限公司 Method and device for data migration in database cluster and storage medium
CN108268501A (en) * 2016-12-30 2018-07-10 中国移动通信集团北京有限公司 Method for processing business and device in a kind of online data transition process
CN107357883A (en) * 2017-06-30 2017-11-17 北京奇虎科技有限公司 Data migration method and device
CN108932282A (en) * 2018-05-18 2018-12-04 腾讯科技(深圳)有限公司 A kind of database migration method, apparatus and storage medium
CN110321339A (en) * 2019-07-04 2019-10-11 深圳乐信软件技术有限公司 A kind of data migration method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111241068A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
EP3739845B1 (en) Borrowing data storage resources in a distributed file system
CN102594849B (en) Data backup and recovery method and device, virtual machine snapshot deleting and rollback method and device
CN106970921B (en) Data migration method and device
CN109358947B (en) Method and system for realizing virtual machine snapshot
CN104461744A (en) Resource allocation method and device
CN106469087B (en) Metadata output method, client and metadata server
CN111209090B (en) Method and assembly for creating virtual machine in cloud platform and server
CN104239156A (en) External service call method and system
CN111381928B (en) Virtual machine migration method, cloud computing management platform and storage medium
CN111666266A (en) Data migration method and related equipment
CN112256433B (en) Partition migration method and device based on Kafka cluster
WO2021104383A1 (en) Data backup method and apparatus, device, and storage medium
CN106919620B (en) Single page processing method and device
CN112507187B (en) Index changing method and device
US20230376357A1 (en) Scaling virtualization resource units of applications
CN111241068B (en) Information processing method, device and equipment and computer readable storage medium
CN116594734A (en) Container migration method and device, storage medium and electronic equipment
WO2023098614A1 (en) Cloud instance capacity expansion/reduction method and related device therefor
CN111078127A (en) Data migration method, system and device
CN112134887B (en) Data synchronization method and device for nodes in distributed cluster
CN107018163B (en) Resource allocation method and device
CN113946542A (en) Data processing method and device
CN110059075B (en) Method, device and equipment for migrating database and computer readable medium
CN109445717B (en) Data storage method and device during dual-computer backup
CN111400098A (en) Copy management method and device, electronic equipment and storage medium

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