Method and apparatus for mirroring service data, storage medium and electronic device

By identifying the business to be mirrored based on the business registration information and using multi-task parallel mirroring processing, the problem of long processing time for business data mirroring in existing technologies is solved, and efficient data mirroring is achieved.

CN117354321BActive Publication Date: 2025-12-19ZTE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210753842.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-29
Publication Date
2025-12-19
Estimated Expiration
2042-06-29

AI Technical Summary

Technical Problem

In existing technologies, business data mirroring methods are time-consuming due to the large amount of data, especially when the network node scale is large, resulting in poor performance and inability to guarantee real-time performance.

Method used

By obtaining the target image request, the business to be imaged is determined based on the business registration information list. Only the business data that is allowed to be imaged is imaged. Multi-task parallel imagery and image mode selection are adopted to reduce the amount of imaged data and improve imagery efficiency.

Benefits of technology

It reduces data mirroring time, minimizes database resource waste, and improves the efficiency and immediacy of data mirroring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117354321B_ABST
    Figure CN117354321B_ABST
Patent Text Reader

Abstract

The application discloses a service data mirroring method and device, a storage medium and an electronic device, wherein the method comprises the following steps: obtaining a target mirroring request, wherein the target mirroring request is used for requesting to perform mirroring processing on service data on a target device; in response to the target mirroring request, determining a to-be-mirrored service in a group of services according to a service registration information list of the group of services, wherein the service registration information list is used for indicating whether each service in the group of services is allowed to perform service data mirroring; and performing mirroring processing on service data of the to-be-mirrored service to obtain a data mirroring result of the service data of the to-be-mirrored service. Through the application, the technical problem that the service data mirroring method in the related art has a long data mirroring time caused by a large amount of service data required for mirroring is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication, in particular to a service data mirroring method and device, a storage medium and an electronic device. BACKGROUND

[0002] In the related art, in the process of mirroring the existing network data, a full table export technology is generally used, that is, all service configuration data (i.e., the above-mentioned existing network data) of the network device is exported in whole, and after storage is completed, planning simulation is performed on part of the service.

[0003] However, in the process of planning simulation, only one or several services are generally evaluated for future development (a form of planning simulation), and other data not used is synchronously exported, which causes waste of database resources, and when the network node scale is large, the speed of exporting all service configuration data of the network device in whole is slow and the performance is low.

[0004] Therefore, the service data mirroring method in the related art has the technical problem of long time consumption of data mirroring caused by large data volume of service data to be mirrored. SUMMARY

[0005] Embodiments of the present application provide a service data mirroring method and device, a storage medium and an electronic device to at least solve the technical problem of long time consumption of data mirroring caused by large data volume of service data to be mirrored in the related art.

[0006] According to an aspect of an embodiment of the present application, a service data mirroring method is provided, including: obtaining a target mirroring request, wherein the target mirroring request is used to request mirroring processing of service data on a target device; in response to the target mirroring request, determining a to-be-mirrored service in a group of services according to a service registration information list of the group of services, wherein the service registration information list is used to indicate whether each service in the group of services is allowed to perform service data mirroring; performing mirroring processing on service data of the to-be-mirrored service to obtain a data mirroring result of the service data of the to-be-mirrored service.

[0007] According to another aspect of the embodiments of the present application, a mirror device of service data is also provided, comprising: an obtaining unit configured to obtain a target mirror request, wherein the target mirror request is used to request mirror processing of service data on a target device; a determining unit configured to determine, in response to the target mirror request, a to-be-mirrored service from a group of services according to a service registration information list of the group of services, wherein the service registration information list is used to indicate whether each service in the group of services is allowed to perform service data mirroring; and a mirroring unit configured to perform mirror processing on service data of the to-be-mirrored service to obtain a data mirror result of the service data of the to-be-mirrored service.

[0008] In one example embodiment, the mirroring unit comprises: a starting module configured to start a plurality of mirror sub-tasks corresponding to a plurality of target services in a case where the to-be-mirrored service comprises the plurality of target services; and a first mirroring module configured to perform mirror processing on service data of a target service corresponding to each mirror sub-task in the plurality of mirror sub-tasks through the each mirror sub-task to obtain a data mirror result of service data of the plurality of target services.

[0009] In one example embodiment, the device further comprises: a first sending unit configured to send, before the mirror processing on the service data of the to-be-mirrored service to obtain the data mirror result of the service data of the to-be-mirrored service, a mirror starting notification message to a service module of the to-be-mirrored service by calling a starting interface of the service module of the to-be-mirrored service; and the mirroring unit comprises: a second mirroring module configured to perform mirror processing on the service data of the to-be-mirrored service to obtain the data mirror result of the service data of the to-be-mirrored service in response to a notification message returned by the service module of the to-be-mirrored service and permitting to start mirroring.

[0010] In one example embodiment, the device further comprises: a receiving unit configured to receive, after the sending of the mirror starting notification message to the service module of the to-be-mirrored service by calling the starting interface of the service module of the to-be-mirrored service, a notification message returned by the service module of the to-be-mirrored service and waiting to start mirroring, wherein the notification message carries a waiting time; and the mirroring unit comprises: a third mirroring module configured to perform mirror processing on the service data of the to-be-mirrored service to obtain the data mirror result of the service data of the to-be-mirrored service in response to a notification message returned by the service module of the to-be-mirrored service and permitting to start mirroring within the waiting time.

[0011] In an example embodiment, the apparatus further comprises a second sending unit configured to send a mirroring completion notification message to the service module of the to-be-mirrored service after the service data of the to-be-mirrored service is mirrored to obtain the data mirroring result of the service data of the to-be-mirrored service, wherein the mirroring completion notification message is used to indicate that the service module of the to-be-mirrored service is allowed to perform other service operations.

[0012] In an example embodiment, the mirroring unit comprises a first generating module configured to generate a first temporary database; a determining module configured to determine a data mirroring mode of the service data of the to-be-mirrored service to obtain a target mirroring mode; an obtaining module configured to obtain the service data of the to-be-mirrored service from a target data table according to the target mirroring mode, wherein the target data table is a data table in a service database corresponding to the to-be-mirrored service and used to store the service data of the to-be-mirrored service; a first importing module configured to import the service data of the to-be-mirrored service into the first temporary database; and a first dumping module configured to dump the first temporary database into a mirroring file to obtain the data mirroring result.

[0013] In an example embodiment, the obtaining module comprises a first executing submodule configured to, in a case where the target mirroring mode is a first mirroring mode, obtain a target table structure script dumped by a table structure of the target data table and a target table data script dumped by the service data of the to-be-mirrored service by accessing the service database corresponding to the to-be-mirrored service; and the first importing module comprises a second executing submodule configured to restore the target table structure script into a first temporary table in the first temporary database and restore the target table data script into table data in the first temporary table.

[0014] In an example embodiment, the obtaining module comprises a third executing submodule configured to, in a case where the target mirroring mode is a second mirroring mode, execute a database generation language corresponding to the service module of the to-be-mirrored service to obtain a reconstructed target table structure; and a calling submodule configured to call a data export interface of the service module of the to-be-mirrored service to obtain a target data message in a preset format, wherein the target data message carries the service data of the to-be-mirrored service; and the first importing module comprises a fourth executing submodule configured to parse the target data message to obtain the service data of the to-be-mirrored service and import the service data of the to-be-mirrored service into the first temporary database according to the target table structure.

[0015] In an example embodiment, the mirroring unit comprises: a second generation module configured to generate a second temporary database; a search module configured to, in a case where the target mirroring request is used to request mirroring of service data before a target historical time, search for a target data table and a target history table by accessing a service database corresponding to the service to be mirrored, wherein the target data table is a data table used to store service data of the service to be mirrored, and the target history table is a data table used to store data operation records of the target data table in chronological order; an execution module configured to mirror the target data table into a second temporary table, and query data operation records in the target history table whose operation times are after the target historical time to obtain a group of data operation records; a rollback module configured to, according to the group of data operation records, rollback service data in the second temporary table to the target historical time in an order from recent to remote, to obtain a third temporary table; a second import module configured to import data in the third temporary table into the second temporary database; and a second dump module configured to dump the second temporary database into a mirror file to obtain the data mirroring result.

[0016] In an example embodiment, the apparatus further comprises a registration unit configured to perform a registration operation on the service to be mirrored by calling a service registration interface by a service module of the service to be mirrored, to obtain service registration information of the service to be mirrored.

[0017] In an example embodiment, the apparatus further comprises an anti-registration unit configured to, after the registration operation on the service to be mirrored by calling the service registration interface by the service module of the service to be mirrored, perform an anti-registration operation on the service to be mirrored by calling a service anti-registration interface by the service module of the service to be mirrored, to delete the service registration information of the service to be mirrored.

[0018] In an example embodiment, the apparatus further comprises a disable unit configured to, after the registration operation on the service to be mirrored by calling the service registration interface by the service module of the service to be mirrored, perform a disable operation on the service to be mirrored by calling a disable interface by the service module of the service to be mirrored, to prohibit mirroring of service data of the service module of the service to be mirrored.

[0019] According to another aspect of the embodiments of the present application, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is configured to execute the mirroring method of service data when running.

[0020] According to a further aspect of the embodiments of the present application, an electronic device is provided, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the mirror method of the service data by the computer program.

[0021] In the embodiments of the present application, the service to be mirrored is determined based on the service registration information, the target mirroring request is obtained, wherein the target mirroring request is used to request mirroring processing of the service data on the target device; in response to the target mirroring request, the service to be mirrored in the group of services is determined according to the service registration information list of the group of services, wherein the service registration information list is used to indicate whether each service in the group of services allows mirroring of service data; the service data of the service to be mirrored is mirrored to obtain the data mirroring result of the service data of the service to be mirrored. Since the service to be mirrored is determined based on the service registration information after receiving the mirroring request for mirroring processing of the service data, and only the service data of the service to be mirrored is mirrored, instead of mirroring all service data in the target device, the purpose of reducing the data volume of the service data to be mirrored can be achieved, the technical effect of reducing the time consumption of data mirroring and improving the efficiency of data mirroring is achieved, and the technical problem of long time consumption of data mirroring caused by large data volume of the service data to be mirrored in the mirror method of the service data in the related art is solved. BRIEF DESCRIPTION OF DRAWINGS

[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and serve to explain the principles of the present application together with the specification.

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0024] Figure 1 is a schematic diagram of a hardware environment of an optional mirror method of service data according to an embodiment of the present application;

[0025] Figure 2 is a flowchart of an optional mirror method of service data according to an embodiment of the present application;

[0026] Figure 3 is a framework diagram of an optional data mirroring processing according to an embodiment of the present application;

[0027] Figure 4is a flow chart of an optional data export according to an embodiment of the application;

[0028] Figure 5 is another flow chart of an optional data export according to an embodiment of the application;

[0029] Figure 6 is an example diagram of an optional Free mode Json message according to an embodiment of the application

[0030] Figure 7 is a relationship diagram of an optional source table and history table according to an embodiment of the application;

[0031] Figure 8 is a flow diagram of an optional business data mirroring method according to an embodiment of the application;

[0032] Figure 9 is another flow diagram of an optional business data mirroring method according to an embodiment of the application;

[0033] Figure 10 is a structural block diagram of an optional business data mirroring apparatus according to an embodiment of the application;

[0034] Figure 11 is a structural block diagram of an optional electronic apparatus according to an embodiment of the application. DETAILED DESCRIPTION

[0035] In order to make the personnel in the art better understand the scheme of the present application, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work should belong to the scope of protection of the present application.

[0036] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0037] According to an aspect of the embodiments of the present application, a service data mirroring method is provided. Optionally, the service data mirroring method can be applied to the hardware environment as shown in Figure 1 Fig. 1, which is composed of a terminal 102 and a server 104. As shown in Figure 1 Fig. 1, the server 104 is connected with the terminal 102 through a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server, and is used to provide data storage services for the server 104.

[0038] The network can include but is not limited to at least one of the following: a wired network, a wireless network. The wired network can include but is not limited to at least one of the following: a wide area network, a metropolitan area network, a local area network. The wireless network can include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal 102 can be but is not limited to a smart phone, a smart tablet, a smart computer, etc.

[0039] The service data mirroring method of the embodiments of the present application can be executed by the server 104, or by the terminal 102, or by both the server 104 and the terminal 102. Taking the execution of the service data mirroring method by the server 104 as an example, Figure 2 Fig. 2 is a flowchart of an optional service data mirroring method according to an embodiment of the present application. As shown in Figure 2 Fig. 2, the method can include the following steps:

[0040] In step S202, a target mirroring request is acquired, wherein the target mirroring request is used to request mirroring processing of service data on a target device.

[0041] The service data mirroring method of the embodiments of the present application can be applied to the scenario of data mirroring (Data Mirror, which means data replication) of service data on a network device, and can be applied to any network system requiring data mirroring processing. The network device can be a device in the Internet or the Internet of Things. The scenario of data mirroring can be data simulation in network planning, or other scenarios requiring data mirroring of service data on a network device, which is not limited in the embodiments of the present application. In some examples of the embodiments of the present application, network planning is taken as an example for illustration.

[0042] Currently, when network planning tools mirror the data of the existing network, the full table export technology is usually adopted: all service configuration data of the network device is exported in whole, and then the planning simulation is performed on part of the services. The mirror mode of the service data has the following disadvantages: network planning generally evaluates the future development of one or several services, and the export of other service configuration data will carry a large amount of irrelevant data, resulting in waste of database resources; when the network node scale is large, the overall export of the data of the existing network is slow and has low performance, and the instantaneity cannot be guaranteed.

[0043] In order to at least partially solve the above problems, the mirror processing of the service data can be performed according to the service registration information, that is, only the service registration information is indicated as the service allowed to perform the data mirroring, and the data mirroring is not performed on all services, so that the purpose of reducing the amount of data required for mirroring can be achieved, the waste of database resources can be reduced, the data export speed can be improved, the data export performance can be improved, and the instantaneity of the data export can be guaranteed.

[0044] In the embodiment, for a target device (which can be a network device), the server can obtain a target mirror request, and the target mirror request is used to request the mirror processing of the service data on the target device. Optionally, the target mirror request can be a mirror request generated according to the detected trigger operation after the target object or other device detects the trigger operation. For example, the target object (used to represent a target user) can generate a creation mirror request (that is, a target mirror request) by triggering the creation of a real-time data mirror operation, and can specify the mirror name and description in the process of generating the creation mirror request. In this case, the mirror name and mirror description information of the mirror to be generated are carried in the target mirror request.

[0045] If the mirror repository (that is, the repository storing the mirror service data) already has a mirror entry with the same mirror name as the mirror name, the target object is returned with an indication that the mirror creation fails, and the subsequent steps are terminated, otherwise the mirror ID (Identity document, identity identifier), mirror name, mirror description, creator, creation time, mirror type and other mirror information information of the mirror to be generated are stored in the mirror information master table, and the mirror ID can be a randomly generated string, and the mirror IDs of different mirror files are different.

[0046] Optionally, the service data on the target device can be live network data of a live service on the target device, and in the process of executing the live service on the target device, the service data corresponding to the live service can be recorded. The target object can be an object that has a connection relationship with the target device, for example, can be an object that has a data mirroring permission for the service data on the target device, and the embodiment is not limited in this regard.

[0047] In step S204, in response to the target mirroring request, a to-be-mirrored service in the group of services is determined according to a service registration information list of the group of services, where the service registration information list is used to indicate whether each service in the group of services allows service data mirroring.

[0048] In this embodiment, after obtaining the target mirroring request, in response to the target mirroring request, a to-be-mirrored service in the group of services can be determined according to a service registration (Business Register, which refers to the registration of the service module information that needs to be mirrored) information list of the group of services. The service registration information list is used to indicate whether each service in the group of services allows service data mirroring, and can include a plurality of service registration information, each of which is used to indicate whether the corresponding service allows service data mirroring.

[0049] For example, the service registration information list includes service registration information of each of services A, B, C, and D on the network device. Based on the service registration information, it is determined that services A and C are services that allow service data mirroring (for example, the data mirroring operation information is “yes”), and services B and D are services that do not allow service data mirroring (for example, the data mirroring operation information is “no”), and then services A and C can be determined as to-be-mirrored services.

[0050] Optionally, the service registration information can include at least one of the following: micro-service information, a mirroring service list, a mirroring mode (supporting Direct mode, Free mode), database table name or table creation script information, etc. Before determining the to-be-mirrored service in the group of services according to the service registration information list of the group of services, each service in the group of services can be registered, and the service registration information of each service can be sent to the server,

[0051] Optionally, the process of determining the to-be-mirrored service in the group of services according to the service registration information list of the group of services can be: determining the enabling state of the data mirroring operation of each service according to the service registration information of each service in the group of services in the service registration information list; and determining the to-be-mirrored service in the group of services according to the enabling state of the data mirroring operation of each service.

[0052] In step S206, the service data of the to-be-mirrored service is mirrored to obtain a data mirror result of the service data of the to-be-mirrored service.

[0053] In this embodiment, after determining the to-be-mirrored service in the group of service data, the service data of the to-be-mirrored service is mirrored to obtain a data mirror result of the service data of the to-be-mirrored service. Optionally, the mirroring of the service data of the to-be-mirrored service to obtain the data mirror result of the service data of the to-be-mirrored service can be: simultaneously mirroring each service in the plurality of to-be-mirrored services to obtain mirror results of the plurality of to-be-mirrored services; or sequentially mirroring each to-be-mirrored service in the plurality of to-be-mirrored services to obtain mirror results of the plurality of to-be-mirrored services, which is not limited in this embodiment.

[0054] After obtaining the service result of the to-be-mirrored service, the service result can be sent to the target object. Optionally, when the service result of the to-be-mirrored service shows that the mirroring of the to-be-mirrored service fails, the data mirroring of the to-be-mirrored service can be performed again until the service result of the to-be-mirrored service shows that the mirroring of the to-be-mirrored service succeeds, or the target object can be directly notified that the mirroring of the to-be-mirrored service fails.

[0055] Optionally, before mirroring the service data of the to-be-mirrored service to obtain a data mirror result of the service data of the to-be-mirrored service, the time corresponding to the service data of the to-be-mirrored service can be determined. The service data of the to-be-mirrored service can be service data of the to-be-mirrored service before the current time, that is, real-time mirroring (Realtime Mirror, which can refer to mirroring of service data in a live network environment), or service data of the to-be-mirrored service before a certain historical time, that is, historical mirroring (History Mirror, which can refer to mirroring of service data at a certain historical time), or service data at other times.

[0056] Optionally, in the process of mirroring the service data of the to-be-mirrored service to obtain a data mirror result of the service data of the to-be-mirrored service, a mirroring mode for mirroring the service data of the to-be-mirrored service can be determined first, and then the service data of the to-be-mirrored service is mirrored by using a mirroring manner corresponding to the mirroring mode to obtain the data mirror result of the service data of the to-be-mirrored service. For example, when the mirroring mode corresponding to the service data of the to-be-mirrored service is Direct mode (direct mode), the service data of the to-be-mirrored service is mirrored by using a mirroring manner corresponding to the Direct mode; or when the mirroring mode corresponding to the service data of the to-be-mirrored service is Free mode (free mode), the service data of the to-be-mirrored service is mirrored by using a mirroring manner corresponding to the Free mode.

[0057] By steps S202 to S206, a target mirroring request is obtained, where the target mirroring request is used to request to perform mirroring processing on service data on a target device; in response to the target mirroring request, a to-be-mirrored service in a group of services is determined according to a service registration information list of the group of services, where the service registration information list is used to indicate whether each service in the group of services allows service data mirroring; and mirroring processing is performed on service data of the to-be-mirrored service to obtain a data mirroring result of the service data of the to-be-mirrored service, thereby solving the technical problem of long time consumption of data mirroring caused by large data volume of service data required for mirroring in the related art mirroring method of service data, reducing time consumption of data mirroring, and improving efficiency of data mirroring.

[0058] In one example embodiment, the mirroring processing is performed on the service data of the to-be-mirrored service to obtain the data mirroring result of the service data of the to-be-mirrored service, including:

[0059] S11, in a case where the to-be-mirrored service includes a plurality of target services, starting a plurality of mirroring sub-tasks corresponding to the plurality of target services one by one;

[0060] S12, performing mirroring processing on service data of a target service corresponding to each mirroring sub-task by each mirroring sub-task in the plurality of mirroring sub-tasks to obtain a data mirroring result of service data of the plurality of target services.

[0061] In this embodiment, after the to-be-mirrored service is determined from the group of services, mirroring processing can be performed on service data of the to-be-mirrored service to obtain a data mirroring result of the service data of the to-be-mirrored service. Optionally, in a case where the to-be-mirrored service includes a plurality of target services, to improve efficiency of data mirroring, a plurality of mirroring sub-tasks corresponding to the plurality of target services one by one can be started, and mirroring processing can be performed on service data of a target service corresponding to each mirroring sub-task by each mirroring sub-task in the plurality of mirroring sub-tasks to obtain a data mirroring result of service data of the plurality of target services.

[0062] Optionally, the process of starting the plurality of mirroring sub-tasks corresponding to the plurality of target services one by one can be: first inputting registration information (i.e., the foregoing service registration information) of the to-be-mirrored service to a mirroring generator to start a creation task, and then starting the plurality of mirroring sub-tasks corresponding to the plurality of target services one by one by the mirroring generator according to received registration information and other input parameter information.

[0063] It should be noted that, for example, Figure 3The illustrated framework diagram of the data mirroring processing, the mirror generator supports starting the mirror creation task, pushing the mirror creation progress information to the business module, and accessing the business database to obtain the source data; the business module is used for the life cycle management of the business, including: creation, modification, deletion, start, stop, pause, resume, query and other operations, these operations can be completed through the front-end interface or API (Application Programming Interface, Application Programming Interface) interface call, the data changes caused by these operations can be stored in the business database. At the same time, the business module can also indicate to the data mirroring processing module which data needs to be exported, the export mode (Direct mode, Free mode), and whether to enable the data mirroring operation when the business data is mirrored.

[0064] Here, the business database can provide source data for generating an engineering database, and the engineering database refers to a simulation database generated by the data mirroring processing module according to the business registration information and by exporting data from the business database. After the simulation database is generated, the planning simulation engineering system performs planning and simulation operations based on the database. The planning simulation engineering system can be used to trigger data mirroring processing, and after the engineering database is generated, corresponding planning and simulation operations are performed on the data in the engineering database.

[0065] For the above-mentioned data mirroring processing module, the data mirroring processing module can include a mirror generator, and can further include at least one of the following:

[0066] The mirror warehouse management module can support users to specify mirror name, description, mirror mode (real-time or history), historical time point and other information to create a mirror; at the same time, it can provide query and delete data mirror functions; during mirror creation, duplicate mirror creation is not supported, and in use mirrors are prohibited from being deleted.

[0067] The business registration enabling module can support the business module to register and enable the data mirroring processing module to obtain the related configuration of the business module data mirroring.

[0068] For example, the mirror generator can be called to start a creation task. In this step, the registration information list of each business module is queried first, and the registration information list and mirror ID are transmitted as input parameters to the mirror generator to start the creation task, and then the mirror generator starts the mirror generation subtask in units of business modules after receiving the input parameters.

[0069] Optionally, since in the process of mirroring the service data of the target service, if the target service is in a state of being operated by a certain user object, data mirroring errors are likely to occur, therefore, before each mirroring subtask mirrors the service data of the target service corresponding to the mirroring subtask, the mirroring subtask can send a notification to the service module of the target service corresponding to the mirroring subtask to notify the service module to prepare for mirroring, so as to improve the success rate of mirroring the service data of the target service.

[0070] For example, the mirror generation subtask can call the start interface implemented by the service module and notify the service module to prepare for mirroring to avoid business conflicts; if the service module has prepared, the mirroring of the data to be mirrored can be performed, and if the service module has not prepared, the mirror generator (or the mirror generation subtask started by the mirror generator) can be notified of the waiting time.

[0071] Through the embodiment, when the target service includes multiple services, the service data of the multiple services is mirrored by the multiple mirror subtasks corresponding to the multiple services one by one, so that the speed of mirroring the data of the target service is improved and the time consumption of mirroring the data of the target service is reduced.

[0072] In one example embodiment, before the service data of the target service is mirrored to obtain the data mirroring result of the service data of the target service, the above method further includes:

[0073] S21, a mirror start notification message is sent to the service module of the target service by calling the start interface of the service module of the target service.

[0074] In the embodiment, before the service data of the target service is mirrored, the mirror start notification message is sent to the service module of the target service by calling the start interface of the service module of the target service, and the mirror start notification message is used to notify the service module of the target service to prepare for mirroring.

[0075] Optionally, after the mirror start notification message is sent to the service module of the target service, the service module of the target service can send a feedback message to the mirror generator. For example, when the service module of the target service has prepared, a notification message reporting that the mirror is started immediately can be sent to the mirror generator; when the service module of the target service has not prepared, a notification message reporting that the mirror is started after waiting for a time can be sent to the mirror generator, and the time is carried in the notification message.

[0076] Correspondingly, the service data of the target service is mirrored to obtain the data mirroring result of the service data of the target service, including:

[0077] S22, in response to the received notification message of permission to start mirroring returned by the service module of the to-be-mirrored service, performing mirroring processing on the service data of the to-be-mirrored service to obtain a data mirroring result of the service data of the to-be-mirrored service.

[0078] In this embodiment, after sending the mirroring start notification message to the service module of the to-be-mirrored service, if the received notification message of permission to start mirroring returned by the service module of the to-be-mirrored service, the mirroring processing can be performed on the service data of the to-be-mirrored service in response to the notification message of permission to start mirroring to obtain a data mirroring result of the service data of the to-be-mirrored service.

[0079] Optionally, when no notification message returned by the service module of the to-be-mirrored service is received within the preset time threshold, the start interface of the service module of the to-be-mirrored service can be invoked again to send the mirroring start notification message to the service module of the to-be-mirrored service.

[0080] Through this embodiment, by invoking the start interface of the service module, sending the mirroring start notification message to the service module, and performing mirroring processing on the service data of the to-be-mirrored service after receiving the notification message of permission to start mirroring returned by the service module, the success rate of data mirroring can be improved.

[0081] In one example embodiment, after sending the mirroring start notification message to the service module of the to-be-mirrored service by invoking the start interface of the service module of the to-be-mirrored service, the above method further includes:

[0082] S31, receiving a notification message of waiting to start mirroring returned by the service module of the to-be-mirrored service, wherein the notification message of waiting to start mirroring carries a waiting time.

[0083] In this embodiment, after sending the mirroring start notification message to the service module of the to-be-mirrored service, the notification message of waiting to start mirroring (notification message) returned by the service module of the to-be-mirrored service can be received, and the notification message of waiting to start mirroring carries a waiting time. For example, when the service module of the to-be-mirrored service is being invoked and is expected to be used up for 3 minutes, the notification message of waiting to start mirroring can be sent to the mirror generator, and the notification message of waiting to start mirroring carries a waiting time (i.e., 3 minutes, or a time slightly longer than 3 minutes).

[0084] Optionally, the mirror image generator can receive the notification message of waiting to start mirroring returned by the service module of the service to be mirrored, and wait for other notification messages sent by the service module of the service to be mirrored within the waiting time according to the notification message of waiting to start mirroring. For example, when the notification message of waiting to start mirroring carries a waiting time of 3 minutes, the mirror image generator can wait for 3 minutes, and perform corresponding processing according to the subsequent received notification message.

[0085] Correspondingly, the service data of the service to be mirrored is processed to obtain a data mirror image result of the service data of the service to be mirrored.

[0086] S32, in response to the notification message of permitting to start mirroring returned by the service module of the service to be mirrored within the waiting time, the service data of the service to be mirrored is processed to obtain a data mirror image result of the service data of the service to be mirrored.

[0087] Optionally, after the service module of the service to be mirrored is ready, the service module of the service to be mirrored can send a notification message (notification packet, also referred to as mirror image start notification message) of permitting to start mirroring to the mirror image generator, and the mirror image generator processes the service data of the service to be mirrored only after receiving the notification message of permitting to start mirroring. For example, the mirror image generator waits for the service module that cannot start mirroring immediately to report a notification of permitting to start mirroring. If the service module is ready, the service module can report to the mirror image management (the mirror image generator in the data mirror image processing module) that the mirror image is permitted to start. If the waiting time is exceeded and the notification reported by the service module of the service to be mirrored is not received, the entire mirror image creation fails, and subsequent steps are terminated.

[0088] Through the embodiment, in response to the notification message of waiting to start mirroring returned by the service module of the service to be mirrored, the subsequent notification is waited for, and the data mirror image is performed after the notification of permitting to mirror is received within a certain time, so that the success rate of data mirror image can be improved.

[0089] In one example embodiment, after the service data of the service to be mirrored is processed to obtain a data mirror image result of the service data of the service to be mirrored, the above method further includes:

[0090] S41, a notification message of mirror image completion is sent to the service module of the service to be mirrored, wherein the notification message of mirror image completion is used to indicate that the service module of the service to be mirrored is allowed to perform other service operations.

[0091] In this embodiment, after obtaining the data mirroring result of the service data of the to-be-mirrored service, a mirroring completion notification message can be sent to the service module of the to-be-mirrored service to instruct the service module of the to-be-mirrored service to allow the service module of the to-be-mirrored service to perform other service operations. Here, allowing to perform other service operations can be indicated based on the identification that the data mirroring of the service data of the to-be-mirrored service has been completed.

[0092] Optionally, since there is a possibility of being stolen in the process of sending the mirroring completion notification message to the service module of the to-be-mirrored service, the notification message can be sent to the service module of the to-be-mirrored service after being encrypted.

[0093] For example, after performing data mirroring on the service data of service A and service C, the mirroring generator can send a mirroring completion notification message to the service modules of service A and service C to notify the service modules that the data mirroring is completed and other service operations can be performed.

[0094] Through this embodiment, after obtaining the data mirroring result of the service data of the to-be-mirrored service, the service module can be notified by sending a mirroring completion notification message, which can facilitate the service module to perform other service operations in time and improve the timeliness of service operation execution.

[0095] In one example embodiment, the service data of the to-be-mirrored service is subjected to mirroring processing to obtain a data mirroring result of the service data of the to-be-mirrored service, comprising:

[0096] S51, generating a first temporary database;

[0097] S52, determining a data mirroring mode of the service data of the to-be-mirrored service to obtain a target mirroring mode;

[0098] S53, acquiring the service data of the to-be-mirrored service from a target data table according to the target mirroring mode, wherein the target data table is a data table in a service database corresponding to the to-be-mirrored service and used to store the service data of the to-be-mirrored service;

[0099] S54, importing the service data of the to-be-mirrored service into the first temporary database;

[0100] S55, converting the first temporary database into a mirroring file to obtain the data mirroring result.

[0101] In this embodiment, after determining the to-be-mirrored service, the service data of the to-be-mirrored service can be subjected to mirroring processing. Optionally, a first temporary database can be generated first, and then the service data of the to-be-mirrored service can be subjected to mirroring in the first temporary database.

[0102] Optionally, the mirroring process of the service data of the to-be-mirrored service in the first temporary database can be: first determining a data mirroring mode of the service data of the to-be-mirrored service to obtain a target mirroring mode; then acquiring the service data of the to-be-mirrored service from the target data table according to the target mirroring mode, and importing the service data of the to-be-mirrored service into the first temporary database; and finally, converting the first temporary database into a mirroring file to obtain a data mirroring result, and the target data table is a data table in a service database corresponding to the to-be-mirrored service and used for storing the service data of the to-be-mirrored service.

[0103] The process of determining the data mirroring mode of the service data of the to-be-mirrored service to obtain the target mirroring mode can be: searching for registration information corresponding to the to-be-mirrored service in a registration information list of a group of services, and determining the data mirroring mode included in the registration information as the target mirroring mode, or other ways of determining the target mirroring mode.

[0104] For example, the mirroring mode of the specified table can be summarized, real-time data of the specified table can be acquired according to different mode processing processes, a temporary database can be generated, and data can be imported. The specified table is a data table used for storing service data of the to-be-mirrored service.

[0105] Optionally, the process of converting the first temporary database into a mirroring file to obtain the data mirroring result can be: converting the first temporary database into a file and storing it in a mirroring information detailed record table, and updating the end time, state and other fields in the mirroring information main table. After obtaining the data mirroring result, in order to reduce the consumption of storage resources, the first temporary database can be deleted. In addition, the user can be notified that the data mirroring processing is completed.

[0106] According to the embodiment, the service data of the specified table can be acquired according to the data mirroring mode of different service data, a temporary database can be generated, and data can be imported, which can improve the rationality and success rate of data mirroring.

[0107] In one example embodiment, acquiring the service data of the to-be-mirrored service from the target data table according to the target mirroring mode includes:

[0108] S61, in the case where the target mirroring mode is a first mirroring mode, acquiring a target table structure script converted from a table structure of the target data table and a target table data script converted from the service data of the to-be-mirrored service by accessing a service database corresponding to the to-be-mirrored service.

[0109] In the embodiment, if the target mirroring mode is the first mirroring mode, the target table structure script dumped by the table structure of the target data table and the target table data script dumped by the service data of the to-be-mirrored service can be obtained by accessing the service database corresponding to the to-be-mirrored service. The first mirroring mode can be the Direct mode.

[0110] For example, as shown in FIG. 6, the data export process of the Direct mode can include the following steps. Figure 4

[0111] Step S402, a temporary database is newly created.

[0112] When the mirroring mode of the data table specified in the registration information is the Direct mode, a temporary database can be newly created first.

[0113] Step S404, the structure and data of the specified table are dumped by accessing the service database.

[0114] The service database information in the service module return message can be used to access the service database. Then, the structure of the specified table and the real-time data of the specified table are extracted into the table structure script and the table data script by using the dump command.

[0115] Correspondingly, the service data of the to-be-mirrored service is imported into the first temporary database, including:

[0116] S62, the target table structure script is restored into a first temporary table in the first temporary database, and the target table data script is restored into the table data in the first temporary table.

[0117] After the target table structure script dumped by the table structure of the target data table and the target table data script dumped by the service data of the to-be-mirrored service are obtained, the service data of the to-be-mirrored service can be imported into the first temporary database. Optionally, the target table structure script can be restored into a first temporary table in the first temporary database, and the target table data script can be restored into the table data in the first temporary table.

[0118] For example, as shown in FIG. 6, the data export process of the Direct mode can include the following steps. Figure 4

[0119] Step S406, restore the specified table structure.

[0120] The table structure script can be restored into a temporary table in the temporary database by using the restore command.

[0121] Step S408, restore the data of the specified table.

[0122] ​​Using the restore command, the table data script can be restored into a temporary table.

[0123] Here, the Direct mode supports directly exporting a specified service table into an emulation table. The Direct mode is easy to implement, has good performance, and occupies small resources.

[0124] Through the embodiment, when the data mirroring mode of the service data of the to-be-mirrored service is the Direct mode, the structure of a specified table and the service data in the specified table are extracted into a table structure script and a table data script using a dump command, the table structure script is reconstructed into a temporary table using a restore command in a temporary database, and the table data script is restored into the temporary table, so that the accuracy of data mirroring can be improved.

[0125] In one example embodiment, the service data of the to-be-mirrored service is obtained from a target data table according to a target mirroring mode, including:

[0126] S71, in the case where the target mirroring mode is the second mirroring mode, a database generation language corresponding to the service module of the to-be-mirrored service is executed to obtain a reconstructed target table structure;

[0127] S72, a data export interface of the service module of the to-be-mirrored service is called to obtain a target data message in a preset format, wherein the target data message carries the service data of the to-be-mirrored service;

[0128] In the embodiment, if the target mirroring mode is the second mirroring mode, a database generation language corresponding to the service module of the to-be-mirrored service can be executed to obtain a reconstructed target table structure, and a data export interface of the service module of the to-be-mirrored service is called to obtain a target data message in a preset format, wherein the target data message carries the service data of the to-be-mirrored service.

[0129] For example, as shown in FIG. 6, the data export flow of the Free mode can include the following steps: Figure 5

[0130] Step S502, a temporary database is newly created, and a DDL statement is executed.

[0131] When the mirroring mode of the data table specified in the registration information is the Free mode, a temporary database can be newly created, and a DDL (Data Definition Language) statement provided when the service module is registered is executed to reconstruct the structure of the specified table.

[0132] Step S504, a service interface is called to obtain a data JSON message of the specified table.

[0133] ​The data export interface implemented by the business module is called to obtain the real-time data JSON (a lightweight data exchange format) message of the specified table.

[0134] Correspondingly, the business data of the to-be-mirrored business is imported into the first temporary database, including:

[0135] S73, the target data message is parsed to obtain the business data of the to-be-mirrored business, and the business data of the to-be-mirrored business is imported into the first temporary database according to the target table structure.

[0136] After determining the target data message and the target table structure, the business data of the to-be-mirrored business can be imported into the first temporary database. Alternatively, the target data message can be parsed to obtain the business data of the to-be-mirrored business, and the business data of the to-be-mirrored business can be imported into the first temporary database according to the target table structure.

[0137] For example, as shown in Figure 5 The data export process of the Free mode can include the following steps:

[0138] Step S506, the real-time data JSON message is parsed, and the data is imported into the temporary database.

[0139] Here, the Free mode supports exporting the JSON format data provided by the business to the simulation table. The JSON message format is as follows: Figure 6 , wherein columns provide the name and type of the database table field, and the current type only supports string\int\long\float\double five kinds, data provides the value of the table field, each pair of {} represents a row of data, supports null, and needs to be one-to-one corresponding to the field. The Free mode is relatively flexible, but slow and resource-consuming, and is suitable for complex scenarios that cannot be solved by the Direct mode.

[0140] Through the embodiment, when the data mirroring mode of the business data of the to-be-mirrored business is the Free mode, the database generation language corresponding to the business module is first executed to obtain the reconstructed table structure; the data export interface of the business module is called to obtain the data message in the preset format; the data message is parsed to obtain the business data, and finally the business data is imported into the temporary database according to the table structure, which can improve the accuracy of data mirroring.

[0141] In one example embodiment, the business data of the to-be-mirrored business is mirrored to obtain a data mirroring result of the business data of the to-be-mirrored business, including:

[0142] S81, generating a second temporary database;

[0143] S82, in response to the target mirroring request for requesting mirroring of the service data before the target historical moment, the target data table and the target history table are found by accessing the service database corresponding to the to-be-mirrored service, where the target data table is a data table for storing service data of the to-be-mirrored service, and the target history table is a data table for storing data operation records performed on the target data table in chronological order;

[0144] S83, the target data table is mirrored to a second temporary table, and data operation records in the target history table with operation times after the target historical moment are queried to obtain a group of data operation records;

[0145] S84, the service data in the second temporary table is rolled back to the target historical moment according to the group of data operation records in chronological order of operation time from near to far to obtain a third temporary table;

[0146] S85, the data in the third temporary table is imported into the second temporary database;

[0147] S86, the second temporary database is dumped into a mirroring file to obtain a data mirroring result.

[0148] In the embodiment, in addition to the real-time data mirroring of the live service, the historical data mirroring of the live service can also be performed. Correspondingly, the target mirroring request can be used to request mirroring of the service data before the target historical moment, and the target historical moment can be carried in the target mirroring request.

[0149] After the to-be-mirrored service is determined, the second temporary database can be generated in a manner similar to that in the foregoing embodiment, and the service data of the to-be-mirrored service is mirrored in the second temporary database to restore the service data before the target historical moment. Alternatively, the process of mirroring the service data of the to-be-mirrored service in the second temporary database can be: finding the target data table and the target history table by accessing the service database corresponding to the to-be-mirrored service, and restoring the service data before the target historical moment in the second temporary database according to the target data table and the target history table. The target data table is a data table for storing service data of the to-be-mirrored service, and the target history table is a data table for storing data operation records performed on the target data table in chronological order.

[0150] It should be noted that when the service database creates a source table (i.e., a data table for storing service data, such as the target data table), a history table is also created accordingly. The history table and the source table are related through a trigger, as shown in Figure 7 , Figure 7 The table on the left is a source table,Figure 7 The right table is a history table (i.e., a target history table storing data operation records of the source table). The trigger is a method for ensuring data integrity, and its execution is triggered by an event. When an insert, delete, update, or the like is performed on the source table, the trigger is activated to automatically insert a data operation record of the source table into the history table, and the history table can record information such as a data change time, a change type, a pre-change data key-value, and a post-change data key-value.

[0151] When the business module is started, a database script is automatically called to create a business database, a source table, and a corresponding history table, and a trigger mechanism is created in the source table to ensure that subsequent business data changes can be recorded in the corresponding history table. For the to-be-mirrored business, when the business module of the to-be-mirrored business is started, a database script is called to create a business database, a target data table, and a corresponding target history table.

[0152] Optionally, the manner in which the target history time point before the business data in the second temporary database is restored can be that the target data table is first mirrored into a second temporary table, and data operation records in the target history table whose operation times are located after the target history time point are queried to obtain a group of data operation records; and then, according to the operation time from recent to remote, the business data in the second temporary table is rolled back to the target history time point according to the group of data operation records to obtain a third temporary table, and the data in the third temporary table is the business data before the target history time point.

[0153] For example, the business database information in the return message of the business module can be used to access the business database, mirror a specified table into a temporary table, query the data operation records of the source table after the specified history time point in the history table, and roll back the data in the temporary table to the history time point in reverse according to the operation time from recent to remote.

[0154] Optionally, after the third temporary table is obtained, the data in the third temporary table can be imported into the second temporary database; and the second temporary database is dumped into a mirror file to obtain a data mirroring result. The process of dumping the second temporary database into a mirror file to obtain a data mirroring result is similar to the process of dumping the first temporary database into a mirror file to obtain a data mirroring result, and details are not repeated herein.

[0155] It should be noted that the third temporary table can be a data table in the business database, and the manner in which the data in the third temporary table is imported into the second temporary database can be similar to the manner in which the target data table is imported into the first temporary database, and details have been described and will not be repeated herein.

[0156] Optionally, after the data in the third temporary table is imported into the second temporary database, the third temporary table in the business database can be deleted; after the temporary database (for example, the first temporary database, the second temporary database) is dumped into a mirror file to obtain a data mirror result, the obtained mirror file can be stored in a mirror warehouse, and the temporary database is deleted to reduce the consumption of storage resources; in addition, the business module can be notified that the data mirroring is completed, and other business operations can be performed.

[0157] Through the embodiment, by accessing the business database, the specified table and the historical table of the specified table are found, the specified table is first mirrored into a temporary table, and then the temporary table data is rolled back to a historical moment, so that the accuracy and flexibility of data mirroring can be improved.

[0158] In one example embodiment, the above method further comprises:

[0159] S91, performing a registration operation on the to-be-mirrored business through a business module of the to-be-mirrored business by calling a business registration interface to obtain business registration information of the to-be-mirrored business.

[0160] In the embodiment, the registration operation can be performed on the to-be-mirrored business through the business module of the to-be-mirrored business by calling the business registration interface to obtain the business registration information of the to-be-mirrored business. For example, the business module can be started, and the registration operation is completed by calling the data mirror processing module API interface during the starting process. If the mirror mode contains the Free mode, the exportSourceDataMicroService, the mirrorSchema, the mirrorTableName and the mirrorDDL need to be provided, and if the stored procedure function is used in the Direct mode, the mirrorFunctions also need to be provided.

[0161] Through the embodiment, the business module calls the business registration interface to enable the business module registration, and obtains the business registration information of the to-be-mirrored business, so that the process of obtaining the business registration information of the to-be-mirrored business can be simplified, and the time consumption of mirroring the business data of the to-be-mirrored business can be reduced.

[0162] In one example embodiment, after the registration operation is performed on the to-be-mirrored business through the business module of the to-be-mirrored business by calling the business registration interface, the above method further comprises:

[0163] S101, performing an anti-registration operation on the to-be-mirrored business through the business module of the to-be-mirrored business by calling a business anti-registration interface to delete the business registration information of the to-be-mirrored business.

[0164] In this embodiment, after the registration operation is performed on the to-be-mirrored service by the service module of the to-be-mirrored service through the service registration interface, the service registration information of the to-be-mirrored service can be deleted. Alternatively, the de-registration operation can be performed on the to-be-mirrored service by the service module of the to-be-mirrored service through the service de-registration interface, so as to delete the service registration information of the to-be-mirrored service.

[0165] For example, after the service module of the to-be-mirrored service is registered, the registration information can be deleted by calling the de-registration interface on the service module.

[0166] By this embodiment, the registration information is deleted by calling the service de-registration interface, so that the deletion process of the service registration information is simplified, and the convenience of the service data mirroring control is improved.

[0167] In one example embodiment, after the registration operation is performed on the to-be-mirrored service by the service module of the to-be-mirrored service through the service registration interface, the method further includes:

[0168] S111, the de-activation operation is performed on the to-be-mirrored service by the service module of the to-be-mirrored service through the de-activation interface, so as to prohibit the service data mirroring on the service module of the to-be-mirrored service.

[0169] In this embodiment, after the registration operation is performed on the to-be-mirrored service by the service module of the to-be-mirrored service through the service registration interface, the service data mirroring on the service module of the to-be-mirrored service can be prohibited. Alternatively, the de-activation operation can be performed on the to-be-mirrored service by the service module of the to-be-mirrored service through the de-activation interface, so as to prohibit the service data mirroring on the service module of the to-be-mirrored service.

[0170] For example, after the registration is completed, the service module is generally in an enabled state, that is, the data mirroring processing module can perform data mirroring on the service module. If the service module needs to pause the data mirroring, the de-activation interface can be called to disable it; and the enable interface can be called to recover it later.

[0171] By this embodiment, the de-activation operation is performed on the to-be-mirrored service by calling the de-activation interface, so that the de-activation process of the service module is simplified, and the convenience of the service data mirroring control is improved.

[0172] The mirroring method of the service data in the embodiments of the present application will be explained and described below in combination with an optional example. In this optional example, the target mirroring mode is Direct mode or Free mode.

[0173] In order to avoid the export of irrelevant service data volume during data mirroring, improve the data export performance, and avoid the waste of storage resources, the present optional example provides a mirroring processing scheme supporting real-time data and historical data, which can be applied to, for example,Figure 3 The framework diagram of the data mirroring processing is shown. The mirroring processing of service data is performed according to the service registration information. The user can decide which online service to register and start the data mirroring processing according to actual needs. In addition, not only the real-time data of the online service can be mirrored, but also the data of a certain historical moment of the online service can be mirrored. The above scheme can be embedded in a planning simulation system, and an operation entrance is provided by the system, or the operation can be completed by calling an API interface.

[0174] In combination Figure 8 For real-time data mirroring, the real-time data mirroring processing flow in the mirroring method of service data in the present example can include the following steps:

[0175] Step S802, a user creation mirroring request is obtained. The request parameters include a mirroring name and a description.

[0176] Step S804, a mirroring generator is called to start a creation task. The registration information of each service module and a mirroring ID (randomly generated) are input.

[0177] In this step, the registration information list of each service module is queried. The registration information list and the mirroring ID are input as parameters into the mirroring generator to start the creation task.

[0178] Step S806, the mirroring generator concurrently starts the mirroring generation subtasks of the registered service modules.

[0179] Step S808, each subtask calls the "start apiURL" in the registration information to notify the service module to prepare for mirroring.

[0180] In this step, the subtask calls the start interface implemented by the service module to notify the service module to prepare for mirroring. If the service module has prepared, step S810 is skipped, and step S812 is executed. If the service module has not prepared, the mirroring generator needs to be notified of the waiting time.

[0181] Step S810, the service module feeds back start information to allow the mirroring generator to start creation.

[0182] In this step, the mirroring generator waits for the notification reported by the service module in step S808. If the notification reported by the service module is not received after the waiting time is exceeded, the entire mirroring creation fails, and the subsequent steps are terminated.

[0183] Step S812, the tables specified as Direct mode and Free mode in the registration information are respectively summarized. The real-time data of the tables is obtained according to different mode processing processes, and the data is imported into a temporary database.

[0184] Step S814, notify the service module that the mirroring has been completed.

[0185] Step S816, dump the temporary database into a file and store it in the mirror repository, and delete the temporary database.

[0186] In this step, the temporary database is dumped into a file and stored in the mirror information detailed record table, the temporary database is deleted, and the end time, state and other fields in the mirror information main table are updated, and the user is notified that the data mirroring process is completed.

[0187] In combination Figure 9 As shown in FIG. 8, for historical data mirroring, the historical data mirroring processing flow in the service data mirroring method in the present exemplary embodiment can include the following steps:

[0188] Step S902, obtain a user request for creating a mirror, and the request parameters include a mirror name and a description.

[0189] Here, the user triggers the operation of creating a historical data mirror, specifies the mirror name, description and historical time point. The information carried by the request for creating a mirror can include the historical time point.

[0190] Step S904, call the mirror generator, start a creation task, and pass in the registration information of each service module and the mirror ID (randomly generated).

[0191] Step S906, the mirror generator concurrently starts the mirror generation subtasks of the registered service modules.

[0192] Step S908, each subtask calls the "start apiURL" in the registration information to notify the service module to prepare for mirroring.

[0193] Step S910, the service module feeds back the start information and permits the mirror generator to start the creation.

[0194] The execution process of step S908 and step S910 is similar to that of step S808 and step S810, which will not be described here.

[0195] Step S912, access the service database, find the specified table and the historical table of the specified table, first mirror the specified table into a temporary table, and then roll back the temporary table data to the historical time.

[0196] Step S914, respectively aggregate the tables specified as Direct mode and Free mode in the registration information, then obtain data from the temporary table according to different mode processing processes, and import the data into a temporary database.

[0197] Step S916, notifying the service module that the mirroring is completed, and deleting the temporary table in the service database. Here, the service database is accessed, and the temporary table generated in step S912 is deleted.

[0198] Step S918, dumping the temporary database into a file and storing it in the mirror repository, and deleting the temporary database.

[0199] Through the optional example, when mirroring the data in the live network, both real-time data mirroring and historical data mirroring are supported, and multi-mode mirroring table data is also supported, so that the mirroring processing of real-time data and historical data can be quickly and stably completed, the system performance is effectively improved, and resource waste is reduced.

[0200] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the action sequence described, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.

[0201] From the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM (Read-Only Memory), a RAM (Random Access Memory), a magnetic disk, or an optical disk), and includes a number of instructions for causing an end device (which can be a mobile phone, a computer, a server, or a network device) to execute the methods described in the embodiments of the present application.

[0202] According to another aspect of the embodiments of the present application, a service data mirroring device for implementing the service data mirroring method described above is also provided. Figure 10 is a structural block diagram of an optional service data mirroring device according to an embodiment of the present application, as shown in Figure 10 The device can include:

[0203] The acquisition unit 1002 is configured to acquire a target mirroring request, wherein the target mirroring request is used to request mirroring processing of service data on a target device.

[0204] The determining unit 1004, connected with the obtaining unit 1002, is configured to determine, in response to the target mirroring request, a to-be-mirrored service in a group of services according to a service registration information list of the group of services, where the service registration information list is used to indicate whether each service in the group of services is allowed to perform service data mirroring.

[0205] The mirroring unit 1006, connected with the determining unit 1004, is configured to perform mirroring processing on service data of the to-be-mirrored service to obtain a data mirroring result of the service data of the to-be-mirrored service.

[0206] It should be noted that the obtaining unit 1002 in this embodiment can be configured to perform the above step S202, the determining unit 1004 in this embodiment can be configured to perform the above step S204, and the mirroring unit 1006 in this embodiment can be configured to perform the above step S206.

[0207] Through the above modules, a target mirroring request is obtained, where the target mirroring request is used to request to perform mirroring processing on service data on a target device; in response to the target mirroring request, a to-be-mirrored service in a group of services is determined according to a service registration information list of the group of services, where the service registration information list is used to indicate whether each service in the group of services is allowed to perform service data mirroring; and mirroring processing is performed on service data of the to-be-mirrored service to obtain a data mirroring result of the service data of the to-be-mirrored service, thereby solving the technical problem of long time consumption of data mirroring caused by large data volume of service data required for mirroring in the related art, reducing the time consumption of data mirroring, and improving the efficiency of data mirroring.

[0208] In one example embodiment, the mirroring unit includes:

[0209] The starting module is configured to start a plurality of mirroring sub-tasks corresponding to the plurality of target services in a case where the to-be-mirrored service includes the plurality of target services.

[0210] The first mirroring module is configured to perform mirroring processing on service data of a target service corresponding to each mirroring sub-task through each mirroring sub-task in the plurality of mirroring sub-tasks to obtain a data mirroring result of service data of the plurality of target services.

[0211] In one example embodiment,

[0212] The above apparatus further includes a first sending unit configured to, before performing mirroring processing on service data of the to-be-mirrored service to obtain a data mirroring result of the service data of the to-be-mirrored service, send a mirroring starting notification message to a service module of the to-be-mirrored service by calling a starting interface of the service module of the to-be-mirrored service.

[0213] The mirror unit comprises a second mirror module, configured to perform mirror processing on the service data of the to-be-mirrored service according to the permission-to-start-mirroring notification message returned by the service module of the to-be-mirrored service, to obtain a data mirror result of the service data of the to-be-mirrored service.

[0214] In one example embodiment,

[0215] The apparatus further comprises a receiving unit, configured to receive a notification message of waiting to start mirroring returned by the service module of the to-be-mirrored service after sending the mirror start notification message to the service module of the to-be-mirrored service by calling the start interface of the service module of the to-be-mirrored service, wherein the notification message of waiting to start mirroring carries a waiting time.

[0216] The mirror unit comprises a third mirror module, configured to perform mirror processing on the service data of the to-be-mirrored service according to the permission-to-start-mirroring notification message returned by the service module of the to-be-mirrored service within the waiting time, to obtain a data mirror result of the service data of the to-be-mirrored service.

[0217] In one example embodiment, the apparatus further comprises:

[0218] The second sending unit is configured to send a mirror completion notification message to the service module of the to-be-mirrored service after performing mirror processing on the service data of the to-be-mirrored service to obtain the data mirror result of the service data of the to-be-mirrored service, wherein the mirror completion notification message is used to instruct the service module of the to-be-mirrored service to perform other service operations.

[0219] In one example embodiment, the mirror unit comprises:

[0220] The first generation module is configured to generate a first temporary database.

[0221] The determination module is configured to determine a data mirror mode of the service data of the to-be-mirrored service, to obtain a target mirror mode.

[0222] The acquisition module is configured to acquire the service data of the to-be-mirrored service from a target data table according to the target mirror mode, wherein the target data table is a data table in a service database corresponding to the to-be-mirrored service and used to store the service data of the to-be-mirrored service.

[0223] The first import module is configured to import the service data of the to-be-mirrored service into the first temporary database.

[0224] The first dump module is configured to dump the first temporary database into a mirror file to obtain the data mirror result.

[0225] In one example embodiment,

[0226] The obtaining module comprises: a first execution submodule, configured to, in a case where the target mirroring mode is a first mirroring mode, obtain, by accessing a service database corresponding to the to-be-mirrored service, a target table structure script dumped from a table structure of a target data table and a target table data script dumped from service data of the to-be-mirrored service.

[0227] The first import module comprises: a second execution submodule, configured to restore the target table structure script into a first temporary table in a first temporary database and restore the target table data script into table data in the first temporary table.

[0228] In one example embodiment,

[0229] The obtaining module comprises: a third execution submodule, configured to, in a case where the target mirroring mode is a second mirroring mode, execute a database generation language corresponding to a service module of the to-be-mirrored service to obtain a reconstructed target table structure; and a calling submodule, configured to call a data export interface of the service module of the to-be-mirrored service to obtain a target data message in a preset format, wherein the target data message carries service data of the to-be-mirrored service.

[0230] The first import module comprises: a fourth execution submodule, configured to parse the target data message to obtain the service data of the to-be-mirrored service and import the service data of the to-be-mirrored service into the first temporary database according to the target table structure.

[0231] In one example embodiment, the mirroring unit comprises:

[0232] The second generation module is configured to generate a second temporary database.

[0233] The finding module is configured to, in a case where the target mirroring request is used to request mirroring of service data before a target historical time, find, by accessing a service database corresponding to the to-be-mirrored service, a target data table and a target historical table, wherein the target data table is a data table used to store service data of the to-be-mirrored service, and the target historical table is a data table used to store, in time sequence, data operation records of execution on the target data table.

[0234] The execution module is configured to mirror the target data table into a second temporary table and query, in the target historical table, data operation records with operation times located after the target historical time to obtain a group of data operation records.

[0235] The rollback module is configured to, according to the group of data operation records, rollback service data in the second temporary table to the target historical time in reverse order from near to far to obtain a third temporary table.

[0236] The second import module is configured to import data in the third temporary table into the second temporary database.

[0237] A second dump module is configured to dump the second temporary database into a mirror file to obtain a data mirror result.

[0238] In an example embodiment, the apparatus further includes:

[0239] A registration unit is configured to perform a registration operation on the to-be-mirrored service by invoking a service registration interface of the service module of the to-be-mirrored service to obtain service registration information of the to-be-mirrored service.

[0240] In an example embodiment, the apparatus further includes:

[0241] A deregistration unit is configured to perform a deregistration operation on the to-be-mirrored service by invoking a service deregistration interface of the service module of the to-be-mirrored service after performing the registration operation on the to-be-mirrored service by invoking the service registration interface of the service module of the to-be-mirrored service, to delete the service registration information of the to-be-mirrored service.

[0242] In an example embodiment, the apparatus further includes:

[0243] A disabling unit is configured to perform a disabling operation on the to-be-mirrored service by invoking a disabling interface of the service module of the to-be-mirrored service after performing the registration operation on the to-be-mirrored service by invoking the service registration interface of the service module of the to-be-mirrored service, to prohibit the service data mirroring on the service module of the to-be-mirrored service.

[0244] It should be noted that the above modules have the same examples and application scenarios as the corresponding steps, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules as part of the apparatus can run in the hardware environment shown in Figure 1 , and can be implemented by software or hardware, where the hardware environment includes a network environment.

[0245] According to another aspect of the embodiments of the present application, a storage medium is provided. Optionally, in the present embodiment, the storage medium can be used to execute the program code of any of the above-mentioned service data mirroring methods.

[0246] Optionally, in the present embodiment, the storage medium can be located on at least one of the plurality of network devices in the network shown in the above embodiments.

[0247] Optionally, in the present embodiment, the storage medium is configured to store program code for executing the following steps:

[0248] S1, obtaining a target mirroring request, wherein the target mirroring request is used to request to perform mirroring processing on service data on a target device;

[0249] S2, in response to the target mirroring request, determining, according to a service registration information list of a group of services, a service to be mirrored in the group of services, wherein the service registration information list is used to indicate whether each service in the group of services allows service data mirroring;

[0250] S3, performing mirroring processing on service data of the service to be mirrored to obtain a data mirroring result of the service data of the service to be mirrored.

[0251] Optionally, specific examples in this embodiment can refer to examples described in the above embodiments, and this embodiment will not be described here.

[0252] Optionally, in this embodiment, the storage medium can include but is not limited to a U disk, a ROM, a RAM, a mobile hard disk, a magnetic disk or an optical disk, and various storage program code media.

[0253] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned service data mirroring method is also provided, which can be a server, a terminal, or a combination thereof.

[0254] Figure 11 is a structural block diagram of an optional electronic device according to an embodiment of the present application, as shown in Figure 11 , including a processor 1102, a communication interface 1104, a memory 1106 and a communication bus 1108, wherein the processor 1102, the communication interface 1104 and the memory 1106 complete mutual communication through the communication bus 1108, wherein,

[0255] The memory 1106 is used to store a computer program;

[0256] The processor 1102 is used to execute the computer program stored in the memory 1106, and implement the following steps:

[0257] S1, obtaining a target mirroring request, wherein the target mirroring request is used to request mirroring processing on service data on a target device;

[0258] S2, in response to the target mirroring request, determining, according to a service registration information list of a group of services, a service to be mirrored in the group of services, wherein the service registration information list is used to indicate whether each service in the group of services allows service data mirroring;

[0259] S3, performing mirroring processing on service data of the service to be mirrored to obtain a data mirroring result of the service data of the service to be mirrored.

[0260] Optionally, the communication bus can be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, Figure 11 only one bus or one type of bus is shown in the figure, but this does not indicate that there is only one bus or only one type of bus. The communication interface is used for communication between the electronic device and other devices.

[0261] The memory can include a RAM and can also include a non-volatile memory, for example, at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0262] As an example, the aforementioned memory 1106 can include, but is not limited to, the acquisition unit 1002, the determination unit 1004, and the mirroring unit 1006 in the mirroring device of the aforementioned service data. In addition, other module units in the mirroring device of the aforementioned service data can also be included, but are not limited to, which will not be described in detail in this example.

[0263] The aforementioned processor can be a general-purpose processor, which can include, but is not limited to, a CPU (Central Processing Unit), an NP (Network Processor), and the like; and can also be a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0264] Optionally, specific examples in the present embodiment can refer to examples described in the aforementioned embodiments, which will not be described in detail in the present embodiment.

[0265] Those of ordinary skill in the art can understand that, Figure 11 The structure shown is only schematic, and the device for implementing the mirroring method of the aforementioned service data can be a terminal device, which can be a smart phone (such as an Android phone, an iOS phone, and the like), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like.Figure 11 It does not cause limitation to the structure of the electronic device. For example, the electronic device can further include more or less components (such as a network interface, a display device, etc.) than those shown in the figures, or have a different configuration from that shown in the figures. Figure 11 Figure 11

[0266] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by a program instructing the related hardware of the terminal device, and the program can be stored in a computer readable storage medium, which can include a flash disk, a ROM, a RAM, a magnetic disk, an optical disk, etc.

[0267] The serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0268] The integrated units in the above embodiments, if realized in the form of software function units and sold or used as independent products, can be stored in the above computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or the whole or part of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing one or more computer devices (which can be personal computers, servers or network devices, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application.

[0269] In the above embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0270] In the several embodiments provided by the present application, it should be understood that the disclosed client can be implemented in other ways. Of course, the above device embodiment is only illustrative, for example, the division of the units is only a logical function division, and there can be another division manner in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, units or modules, and can be electrical or other forms.

[0271] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the scheme provided in the embodiments.

[0272] ​​In addition, each of the functional units in the various embodiments of the present application can be integrated in one processing unit, or each unit can exist physically, or at least two units can be integrated in one unit. The integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0273] The above only describes the preferred embodiments of the present application. It should be noted that, for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should also be considered as the protection scope of the present application.

Claims

1. A method of mirroring service data, characterized by, The method comprises: acquiring a target mirroring request, wherein the target mirroring request is used to request mirroring processing of service data on a target device; in response to the target mirroring request, determining a to-be-mirrored service from a group of services according to a service registration information list of the group of services, wherein the service registration information list is used to indicate whether mirroring of service data of each service in the group of services is allowed; performing mirroring processing on service data of the to-be-mirrored service to obtain a data mirroring result of the service data of the to-be-mirrored service.

2. The method of claim 1, wherein, The mirroring processing on the service data of the to-be-mirrored service to obtain the data mirroring result of the service data of the to-be-mirrored service comprises: in a case where the to-be-mirrored service comprises a plurality of target services, starting a plurality of mirroring sub-tasks corresponding to the plurality of target services one by one; performing mirroring processing on service data of a target service corresponding to each mirroring sub-task in the plurality of mirroring sub-tasks by using the mirroring sub-task to obtain a data mirroring result of service data of the plurality of target services.

3. The method of claim 1, wherein, before the mirroring processing on the service data of the to-be-mirrored service to obtain the data mirroring result of the service data of the to-be-mirrored service, the method further comprises: sending, to a service module of the to-be-mirrored service, a mirroring start notification message by calling a start interface of the service module; the mirroring processing on the service data of the to-be-mirrored service to obtain the data mirroring result of the service data of the to-be-mirrored service comprises: in response to a notification message returned by the service module of the to-be-mirrored service and permitting the mirroring to be started, performing mirroring processing on the service data of the to-be-mirrored service to obtain the data mirroring result of the service data of the to-be-mirrored service.

4. The method of claim 3, wherein, after the sending, to the service module of the to-be-mirrored service, of the mirroring start notification message by calling the start interface of the service module, the method further comprises: receiving a notification message returned by the service module of the to-be-mirrored service and waiting for the mirroring to be started, wherein the notification message carries a waiting time; the mirroring processing on the service data of the to-be-mirrored service to obtain the data mirroring result of the service data of the to-be-mirrored service comprises: in response to a notification message returned by the service module of the to-be-mirrored service and permitting the mirroring to be started within the waiting time, performing mirroring processing on the service data of the to-be-mirrored service to obtain the data mirroring result of the service data of the to-be-mirrored service. after the mirroring processing on the service data of the to-be-mirrored service to obtain the data mirroring result of the service data of the to-be-mirrored service, the method further comprises: sending, to the service module of the to-be-mirrored service, a mirroring completion notification message, wherein the mirroring completion notification message is used to indicate that the service module of the to-be-mirrored service is allowed to perform other service operations.

5. The method of claim 3, wherein, ​ ​ 6. The method of claim 1, wherein, The mirroring processing on the service data of the to-be-mirrored service comprises: generating a first temporary database; determining a data mirroring mode of the service data of the to-be-mirrored service to obtain a target mirroring mode; acquiring the service data of the to-be-mirrored service from a target data table according to the target mirroring mode, wherein the target data table is a data table in a service database corresponding to the to-be-mirrored service and used for storing the service data of the to-be-mirrored service; importing the service data of the to-be-mirrored service into the first temporary database; dumping the first temporary database into a mirroring file to obtain the data mirroring result.

7. The method of claim 6, wherein: the acquiring the service data of the to-be-mirrored service from the target data table according to the target mirroring mode comprises, in a case where the target mirroring mode is a first mirroring mode, acquiring a target table structure script dumped from a table structure of the target data table and a target table data script dumped from the service data of the to-be-mirrored service by accessing a service database corresponding to the to-be-mirrored service; the importing the service data of the to-be-mirrored service into the first temporary database comprises restoring the target table structure script into a first temporary table in the first temporary database and restoring the target table data script into table data in the first temporary table.

8. The method of claim 6, wherein: the acquiring the service data of the to-be-mirrored service from the target data table according to the target mirroring mode comprises, in a case where the target mirroring mode is a second mirroring mode, executing a database generation language corresponding to a service module of the to-be-mirrored service to obtain a reconstructed target table structure, and calling a data export interface of the service module of the to-be-mirrored service to obtain a target data message in a preset format, wherein the target data message carries the service data of the to-be-mirrored service; the importing the service data of the to-be-mirrored service into the first temporary database comprises parsing the target data message to obtain the service data of the to-be-mirrored service and importing the service data of the to-be-mirrored service into the first temporary database according to the target table structure.

9. The method of claim 1, wherein, The mirroring processing on the service data of the to-be-mirrored service comprises: generating a first temporary database; in a case where the target mirroring request is used to request mirroring of service data before a target historical time, finding a target data table and a target history table by accessing a service database corresponding to the to-be-mirrored service, wherein the target data table is a data table used for storing the service data of the to-be-mirrored service, and the target history table is a data table used for storing data operation records performed on the target data table in chronological order; mirroring the target data table into a second temporary table, and querying data operation records in the target history table, which are located after the target history moment, to obtain a group of data operation records; in accordance with an order from near to far of operation time, rolling back, according to the group of data operation records, service data in the second temporary table to the target history moment in reverse to obtain a third temporary table; importing data in the third temporary table into the second temporary database; dumping the second temporary database into a mirror file to obtain the data mirror result.

10. The method according to any one of claims 1 to 9, characterized in that, The method further comprises: performing, by the service module of the to-be-mirrored service, a registration operation on the to-be-mirrored service through a service registration interface to obtain service registration information of the to-be-mirrored service.

11. The method of claim 10, wherein, After the registration operation is performed on the to-be-mirrored service through the service registration interface by the service module of the to-be-mirrored service, the method further comprises: performing, by the service module of the to-be-mirrored service, an anti-registration operation on the to-be-mirrored service through a service anti-registration interface to delete the service registration information of the to-be-mirrored service.

12. The method of claim 10, wherein, After the registration operation is performed on the to-be-mirrored service through the service registration interface by the service module of the to-be-mirrored service, the method further comprises: performing, by the service module of the to-be-mirrored service, a de-activation operation on the to-be-mirrored service through a de-activation interface to prohibit the service module of the to-be-mirrored service from being subjected to service data mirroring.

13. A mirror apparatus of service data, characterized by comprising: comprises: an acquisition unit configured to acquire a target mirroring request, wherein the target mirroring request is used to request mirroring processing of service data on a target device; a determination unit configured to, in response to the target mirroring request, determine, according to a service registration information list of a group of services, a to-be-mirrored service in the group of services, wherein the service registration information list is used to indicate whether each service in the group of services is allowed to be subjected to service data mirroring; a mirroring unit configured to perform mirroring processing on service data of the to-be-mirrored service to obtain a data mirror result of the service data of the to-be-mirrored service.

14. A computer readable storage medium, characterized in that, The computer-readable storage medium comprises a stored program, wherein the program performs the method of any one of claims 1 to 12 when executed. 15.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 12 through the computer program.

Citation Information

Patent Citations

  • Mirror image distribution method, electronic equipment and storage medium

    CN113872999A

  • Storage device and data duplication control method thereof

    JP2006004342A