Database configuration method, system and equipment and storage medium
By generating the data structure index information of the data search database and the general configuration of data synchronization, the problem of difficult data synchronization between the data management database and the data search database is solved, and efficient data synchronization and performance are achieved.
Patent Information
- Application Number
- CN202411577360.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to take into account data synchronization between the data management database and the data search database, which makes it difficult to take into account both the data management and data search requirements.
By determining the tables and data items that need to be queried based on the user's input information, generating the data structure index information of the data search database and the data synchronization general configuration from the data management database to the data search database, the full and incremental data synchronization between the data management database and the data search database is realized.
It realizes flexible and efficient data synchronization between the data management database and the data search database, taking into account data management and query performance, improving the practicality of the database and reducing development and maintenance costs.
Smart Images

Figure CN119513199A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of database technology, and in particular to a database configuration method, system, device and storage medium. Background Art
[0002] A database is a warehouse that organizes, stores, and manages data according to data structures. Users or applications can add, delete, update, and query data in a database through a database management system (DBMS). The main purpose of a database is to organize data efficiently for easy retrieval and management.
[0003] In related technologies, some databases use relational models to organize data and store data in the form of rows and columns. This series of rows and columns is called a table. A group of tables constitutes a database. This type of database is more suitable for data management and can be called a data management library. However, most business applications that have high requirements for search performance use non-relational databases as data search libraries. Due to the differences in structure between the data management library and the data search library, data synchronization is difficult. Existing solutions often cannot take into account both data management and data search requirements.
[0004] In summary, the problems existing in related technologies need to be solved urgently. Summary of the invention
[0005] The purpose of this application is to solve one of the technical problems existing in the related art to at least a certain extent.
[0006] To this end, an object of embodiments of the present application is to provide a database configuration method, system, device and storage medium.
[0007] In order to achieve the above technical objectives, the technical solutions adopted by the embodiments of the present application include:
[0008] On the one hand, an embodiment of the present application provides a method for configuring a database, the method comprising:
[0009] According to the user's input information, determine the table that the user needs to query and the data items that need to be queried in each table; wherein the data items include main data items and sub-data items;
[0010] Determining, according to the selection operation of the user, the association mode between the main data items and the sub-data items in different tables;
[0011] Generate data structure index information of the data search library and general configuration of data synchronization from the data management library to the data search library; wherein the field type of the main data item in the data structure index information is the field type of the corresponding table of the data management library, and the field type of the sub-data item is an array;
[0012] The data search library is synchronized according to the data structure index information and the data synchronization general configuration.
[0013] In addition, the database configuration method according to the above embodiment of the present application may also have the following additional technical features:
[0014] Furthermore, in one embodiment of the present application, the general data synchronization configuration includes a row of the data structure index information of the data search library, a row of the master data configuration information of the data management library, and multiple rows of sub-data configuration information of the data management library.
[0015] Further, in one embodiment of the present application, synchronizing the data search library according to the data structure index information and the data synchronization general configuration includes:
[0016] Create a new first index according to the data structure index information;
[0017] Querying and determining corresponding master data information from the data management library according to the master data configuration information, and determining corresponding sub-data information from the data management library according to the sub-data configuration information;
[0018] The master data information and the sub-data information are assembled, the data search library is fully synchronized, and the query index alias configured in the interface is pointed to the first index.
[0019] Further, in one embodiment of the present application, synchronizing the data search library according to the data structure index information and the data synchronization general configuration further includes:
[0020] Saving the first index into a cache;
[0021] Monitor the binlog in the data management library, and determine the data modification information of the table in the data management library according to the binlog;
[0022] Incremental data synchronization is performed on the data search library according to the first index and the data modification information stored in the cache.
[0023] Further, in one embodiment of the present application, synchronizing the data search library according to the data structure index information and the data synchronization general configuration further includes:
[0024] When the data search library needs to synchronize all data, the log location of the current binlog is obtained;
[0025] Create a new second index according to the data structure index information, perform full data synchronization, and point the query index alias configured in the interface to the second index when the full data synchronization is completed;
[0026] When data synchronization rollback is required, the data search library is rolled back according to the log location.
[0027] Furthermore, in one embodiment of the present application, the method further includes:
[0028] When an index name input into the data search library is received, a corresponding table field is determined from the data management library as a query parameter and a return result parameter.
[0029] Furthermore, in one embodiment of the present application, the input information includes an index name, relevant field information of the main table of data to be synchronized, relevant field information of the sub-table of data to be synchronized, interface queryable field parameters, and interface return information field parameters.
[0030] On the other hand, an embodiment of the present application provides a database configuration system, the system comprising:
[0031] An input unit, used to determine the table that the user needs to query and the data items that need to be queried in each table according to the user's input information; wherein the data items include main data items and sub-data items;
[0032] A selection unit, used to determine the association mode between the main data items and the sub-data items in different tables according to the selection operation of the user;
[0033] A generating unit, used to generate data structure index information of a data search library and a general configuration of data synchronization from a data management library to the data search library; wherein the field type of the main data item in the data structure index information is the field type of the corresponding table of the data management library, and the field type of the sub-data item is an array;
[0034] A synchronization unit is used to synchronize data on the data search library according to the data structure index information and the data synchronization general configuration.
[0035] On the other hand, an embodiment of the present application provides an electronic device, including:
[0036] at least one processor;
[0037] at least one memory for storing at least one program;
[0038] When the at least one program is executed by the at least one processor, the at least one processor implements the above-mentioned database configuration method.
[0039] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, which stores a program executable by a processor. When the program executable by the processor is executed by the processor, it is used to implement the above-mentioned database configuration method.
[0040] The advantages and benefits of the present application will be partially given in the following description, and partially become apparent from the following description, or be understood through the practice of the present application:
[0041] The configuration method, system, device and storage medium of the database disclosed in the embodiment of the present application, according to the user's input information, determine the table that the user needs to query and the data items that need to be queried in each table; wherein the data items include main data items and sub-data items; according to the user's selection operation, determine the association mode between the main data items and the sub-data items in different tables; generate data structure index information of the data search library and general configuration of data synchronization from the data management library to the data search library; wherein the field type of the main data item in the data structure index information is the field type of the corresponding table of the data management library, and the field type of the sub-data item is an array; according to the data structure index information and the general configuration of data synchronization, synchronize the data of the data search library. This method can flexibly and efficiently realize data synchronization between the data management library and the data search library, taking into account the performance of data management and query, and can improve the practicality of the database and reduce the cost of development and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following introduction is made to the drawings of the embodiments of the present application or the related technical solutions in the prior art. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present application. For technical personnel in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 A schematic diagram of an implementation environment of a database configuration method provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of a flow chart of a database configuration method provided in an embodiment of the present application;
[0045] Figure 3 A schematic diagram of a component provided in an embodiment of the present application;
[0046] Figure 4 A data processing timing diagram of a database provided in an embodiment of the present application;
[0047] Figure 5 A schematic diagram of the structure of a database configuration system provided in an embodiment of the present application;
[0048] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The present application is further described below in conjunction with the accompanying drawings and specific embodiments. The described embodiments should not be regarded as limiting the present application, and all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0050] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0052] 1) Relational database: refers to a database that uses a relational model to organize data. It stores data in the form of rows and columns. This series of rows and columns in a relational database is called a table, and a group of tables constitutes a database. Because it is more suitable for data management, it can also be called a data management library.
[0053] 2) NoSQL (non-relational): refers to a non-relational database in which there is no correlation between data and the underlying structure is completely different from that of a relational database. Contrary to the characteristics of a relational database, it is more suitable for data search and can be called a data search library.
[0054] 3) DQL (Data Query Language) is a part of SQL (Structured Query Language) and is mainly used to query data from a database. The most commonly used command in DQL is the `SELECT` statement, which allows users to retrieve data from one or more tables.
[0055] A database is a warehouse that organizes, stores, and manages data according to data structures. Users or applications can add, delete, update, and query data in a database through a database management system (DBMS). The main purpose of a database is to organize data efficiently for easy retrieval and management.
[0056] In related technologies, some databases use relational models to organize data and store data in the form of rows and columns. This series of rows and columns is called a table. A group of tables constitutes a database. This type of database is more suitable for data management and can be called a data management library. However, most business applications that have high requirements for search performance use non-relational databases as data search libraries. Due to the differences in structure between the data management library and the data search library, data synchronization is difficult. The current technical solutions generally use the following methods:
[0057] 1. Schedule full synchronization through third-party tools;
[0058] 2. Use third-party tools to manage and search for 1:1 incremental synchronization of tables in two data warehouses.
[0059] 3. When modifying data in the data management library through the program, the data in the data search library is modified synchronously.
[0060] Among them, for the first method, each data synchronization is a full synchronization, and the data in the data management database will change frequently. If the time interval between each full synchronization is too long, the query data and the real data will be out of sync; if the synchronization time interval is too short, it will cause excessive resource usage, and the synchronization time interval will inevitably become longer and longer as the data scale increases, and the query data and the real data will also be out of sync. For the second method, the incremental real-time synchronization of third-party tools requires that the table or index structure on both sides must be the same, and some system data requires cross-index query, but the cross-index query performance of unstructured databases is seriously degraded, and if the single table field of the structured database is too large, it will lead to reduced modification performance. For the third method, the method of synchronously modifying the data of the two databases in the program makes subsequent maintenance difficult, and errors in the program can easily lead to data out of sync.
[0061] Therefore, existing solutions often fail to take into account both data management and data search requirements.
[0062] In view of this, a method for configuring a database is provided in an embodiment of the present application, which determines the table that the user needs to query and the data items that need to be queried in each table according to the user's input information; wherein the data items include main data items and sub-data items; according to the user's selection operation, determines the association between the main data items and the sub-data items in different tables; generates data structure index information of a data search library and a general configuration for data synchronization from a data management library to the data search library; wherein the field type of the main data item in the data structure index information is the field type of the corresponding table of the data management library, and the field type of the sub-data item is an array; according to the data structure index information and the general configuration for data synchronization, synchronizes the data search library. This method can flexibly and efficiently realize data synchronization between the data management library and the data search library, taking into account the performance of data management and query, and can improve the practicality of the database and reduce the cost of development and maintenance.
[0063] Please refer to Figure 1 , Figure 1 The schematic diagram of the implementation environment of a database configuration method provided in the embodiment of the present application is shown. In the implementation environment, the main hardware and software entities involved include a terminal device 110 and a backend server 120. The terminal device 110 and the backend server 120 are connected in communication.
[0064] Specifically, the database configuration method provided in the embodiments of the present application can be configured to be executed separately on the terminal device 110 side, or it can be configured on the background server 120 side, and executed based on the data interaction between the terminal device 110 and the background server 120. Among them, the terminal device 110 in the above embodiment may include a mobile phone, a computer, a smart wearable device, an intelligent voice interaction device, a vehicle terminal, etc., but is not limited to this. The background server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0065] The terminal device 110 and the backend server 120 may establish a communication connection via a wireless network or a wired network. The wireless network or wired network uses standard communication technology and / or protocols, and the network may be set to the Internet or any other network, such as but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network.
[0066] Of course, it is understandable that Figure 1 The implementation environment in the example is only some optional application scenarios of the database configuration method provided in the embodiment of the present application, and the actual application is not fixed. Figure 1 The hardware and software environment shown.
[0067] Below, in combination with the introduction of the aforementioned implementation environment, a database configuration method provided in an embodiment of the present application is introduced and explained.
[0068] Please refer to Figure 2 , Figure 2 is a schematic diagram of a database configuration method provided in an embodiment of the present application. Specifically, the database configuration method provided in an embodiment of the present application includes but is not limited to:
[0069] Step 210: Determine the table that the user needs to query and the data items that need to be queried in each table according to the user's input information; wherein the data items include main data items and sub-data items;
[0070] Step 220: Determine the association mode between the main data item and the sub-data item in different tables according to the selection operation of the user;
[0071] Step 230: Generate data structure index information of the data search library and general configuration of data synchronization from the data management library to the data search library; wherein the field type of the main data item in the data structure index information is the field type of the corresponding table of the data management library, and the field type of the sub-data item is an array;
[0072] Step 240: synchronize the data search library according to the data structure index information and the general data synchronization configuration.
[0073] In an embodiment of the present application, a method for configuring a database is provided, which has at least the following advantages:
[0074] 1) Realize full and incremental data synchronization between data management libraries and data search libraries with different table and index structures, while taking into account the efficiency of data management and query performance.
[0075] 2) Implement configurable data synchronization operations. Develop once, and all subsequent data synchronization only requires adding or modifying configurations, making the data synchronization tool easy to use.
[0076] 3) Implement a unified query interface. The data query index itself must meet business requirements. A unified query interface can be configured without the need to repeatedly develop interfaces.
[0077] Specifically, the method in the embodiment of the present application can be implemented by related components, such as Figure 3 As shown, in the embodiment of the present application, three parts can be set up in the system: a configuration generation component, a data synchronization component, and a unified query interface.
[0078] The functions of each component are as follows:
[0079] Configuration generation component: Data management personnel input the data items that need to be queried in the data management library and determine the relationship between different tables through the management page, and automatically generate data index information and data synchronization configuration for the data search library.
[0080] Data synchronization component: performs automatic full and incremental data synchronization based on the configuration information generated by the configuration generation component.
[0081] Unified query interface component: The unified query interface uses all interface names and query conditions as unified input parameters and returns different query results through the same query interface.
[0082] When executing the method in the embodiment of the present application, first, the table to be queried and the primary key of the table can be determined according to the user's input information, and the data items to be queried in each table selected by the user can be determined. The data items here include primary data items and sub-data items. For example, the primary data item M a =[a0,a,…a x-1 ,a x ]、M b =[b0,b1,…b t-1 ,b t ], sub-data item N i =[n0,n1,…n t-1 ,n t ], ..., and select the association method of different table data items. For example, a0 = b1, a1 = pn0, where p represents a one-to-many relationship.
[0083] Next, the configuration generation component can automatically generate data structure index information of the data search library according to the user's input information and the user's selection operation, such as I = [a0, a1, a2, b3, n4 ... a x-1 ,b x ]; the field type of the master data item is the field type of the corresponding table in the data management library, and the field type of the sub-data item is an array.
[0084] The data synchronization component can simultaneously generate the main DQL configuration and sub-DQL configuration for the data management library query, and save the association information between the sub-data items and the main data items in the sub-DQL configuration. In an embodiment of the present application, data synchronization of the data search library can be achieved based on the data structure index information and combined with the general configuration of data synchronization from the data management library to the data search library. Specifically, here, the general configuration of data synchronization includes a row of data structure index information of the data search library, the main data configuration information of the data management library, and multiple rows of sub-data configuration information of the data management library. This information can be assembled together and then reported to the configuration table.
[0085] Specifically, in some embodiments, synchronizing the data search library according to the data structure index information and the data synchronization general configuration includes:
[0086] Create a new first index according to the data structure index information;
[0087] Querying and determining corresponding master data information from the data management library according to the master data configuration information, and determining corresponding sub-data information from the data management library according to the sub-data configuration information;
[0088] The master data information and the sub-data information are assembled, the data search library is fully synchronized, and the query index alias configured in the interface is pointed to the first index.
[0089] In the embodiment of the present application, a configurable data synchronization solution is proposed, which can be applied in the data synchronization component. It is a technology that synchronizes data from a relational database to a non-relational database in a comprehensive full and incremental manner. Specifically, in the embodiment of the present application, a new first index can be created based on the data structure index information, and then each row of master data information can be queried based on the master data configuration information of the data management library, and then the sub-data information can be queried based on the associated items of the master data information and the sub-data configuration information of the data management library, and the data can be assembled and then fully synchronized.
[0090] Moreover, in an embodiment of the present application, after the full data synchronization is successful, the query index alias configured in the interface can be pointed to the newly created first index, and the configuration information of the first index can be saved in the cache to facilitate the subsequent incremental synchronization and ensure the efficiency of obtaining the configuration during data synchronization.
[0091] Specifically, in some embodiments, synchronizing the data search library according to the data structure index information and the data synchronization general configuration further includes:
[0092] Saving the first index into a cache;
[0093] Monitor the binlog in the data management library, and determine the data modification information of the table in the data management library according to the binlog;
[0094] Incremental data synchronization is performed on the data search library according to the first index and the data modification information stored in the cache.
[0095] In the embodiment of the present application, the configuration information of the first index is saved in the cache, and the binlog of the data management library in the configuration can be monitored, and the row data modified in the current table and the type of data modification (addition, deletion, modification) can be obtained accordingly, and this information is recorded as data modification information. According to the configuration information of the first index and the monitored data modification information, data query assembly can be performed in the data management library and then synchronized to the data search library, and this process is data incremental synchronization.
[0096] Specifically, in some embodiments, synchronizing the data search library according to the data structure index information and the data synchronization general configuration further includes:
[0097] When the data search library needs to synchronize all data, the log location of the current binlog is obtained;
[0098] Create a new second index according to the data structure index information, perform full data synchronization, and point the query index alias configured in the interface to the second index when the full data synchronization is completed;
[0099] When data synchronization rollback is required, the data search library is rolled back according to the log location.
[0100] In an embodiment of the present application, a scheme for data synchronization that can be rolled back without downtime is also designed in the data synchronization component. This scheme is a full synchronization scheme that implements real-time query interface without impact and can be rolled back based on the data search library index alias. Specifically, in an embodiment of the present application, when the data search library needs to perform full data synchronization, the log location of the current binlog can be obtained and saved. Then, a new second index can be created based on the data structure index information, and full data synchronization can be performed, and the query index alias configured in the interface can be pointed to the new second index when the full data synchronization is completed. If there is a need to roll back, the current binlog read location can be rolled back to the previously saved log location. After that, the old and new versions of the same data will exist in the index system at the same time. If there is a problem with the data query of the new index, the index alias can be directly redirected to the old index, so as to implement the version rollback mechanism in this way.
[0101] In an embodiment of the present application, a technical solution for a configurable unified query interface is proposed in a unified query interface component. The interface query method is unified by configuring the interface name, interface input parameters, and interface return fields. Adding and modifying interfaces only requires modifying the configuration, and there is no need to repeatedly develop the query interface.
[0102] Specifically, the user enters the index name of the data search library and can select the table fields in the data management library as query parameters and return result parameters. When querying data based on the interface name and input parameters, first obtain the configuration information based on the interface name in the interface configuration, then query the result information of the corresponding index based on the query parameters, and finally assemble the result data and return it based on the return information in the configuration.
[0103] Reference Figure 4 , Figure 4 The following is a data processing sequence diagram of a database provided in an embodiment of the present application. The specific process is as follows:
[0104] 1) The data administrator user enters the interface name (index name), the relevant field information of the main table of data to be synchronized, the relevant field information of the sub-table of data to be synchronized, the interface query field parameters, the interface return information field parameters, etc. on the page for configuring the generated component;
[0105] 2) The configuration generation component automatically generates the index configuration, data synchronization configuration and unified interface query configuration of the data search library based on the input;
[0106] 3) After the configuration is generated, it is verified by the data administrator. After verification, data synchronization is enabled on the configuration generation component page. The data synchronization component automatically creates a new index for the data search library and imports all data into the index;
[0107] 4) After the full data import is completed, the data synchronization component automatically starts the table data modification monitoring of the relevant data management library, and performs data query assembly and incremental synchronization to the data search warehouse based on the monitored data changes and data synchronization configuration;
[0108] 5) After incremental synchronization is turned on, the unified interface query component automatically registers the index interface information into the unified interface configuration index and generates an interface call document based on the interface configuration;
[0109] 6) The interface caller performs data query according to the interface document. The request format example is:
[0110] http: / / host:port / api / query? querydata="{"apiname":"xxx","parameter":["parameter1","parameter r2"],"pagenum":2,"pagesize":10}
[0111] 7) After receiving the parameters, the unified query interface component identifies apiname as the interface name (index name), parameter as the query parameter, pagenum and pagesize as the paging parameters, and after querying the results, assembles and returns the results according to the query result field information configured by the interface;
[0112] 8) After the data search library index configuration is modified or the data is re-full, the data search library index is automatically created according to the current configuration, and the current incremental synchronization consumption point Z is recorded, and the data is re-searched from the data management library and imported into the new index of the data search library;
[0113] 9) After the new data search library index data is fully imported, the index alias is switched to the new index, the data synchronization configuration cache is refreshed, and the incremental consumption position is rolled back to Z, and the incremental synchronization information during the full synchronization is re-performed;
[0114] 10) If there is a problem with the new data search library index query interface, the index alias will be switched to the old index, and the query and incremental synchronization will be switched to the old index at the same time to implement the update version rollback mechanism.
[0115] Reference Figure 5 In an embodiment of the present application, a database configuration system is also provided, and the database configuration system includes:
[0116] The input unit 510 is used to determine the table that the user needs to query and the data items that need to be queried in each table according to the user's input information; wherein the data items include main data items and sub-data items;
[0117] A selection unit 520, configured to determine the association mode between the main data item and the sub-data item in different tables according to the selection operation of the user;
[0118] A generating unit 530 is used to generate data structure index information of a data search library and a general configuration of data synchronization from a data management library to the data search library; wherein the field type of the main data item in the data structure index information is the field type of the corresponding table of the data management library, and the field type of the sub-data item is an array;
[0119] The synchronization unit 540 is used to synchronize the data of the data search library according to the data structure index information and the data synchronization general configuration.
[0120] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0121] The present application also provides an electronic device, including:
[0122] at least one processor;
[0123] at least one memory for storing at least one program;
[0124] When at least one program is executed by at least one processor, the at least one processor implements the above-mentioned database configuration method.
[0125] The electronic device of the embodiment of the present application may be a terminal device, a computer device or a server device.
[0126] For example, taking the electronic device as a server device as an example, referring to Figure 6 The server device 600 may have relatively large differences due to different configurations or performances, and may include one or more central processing units 610 (abbreviated as CPU, Central Processing Units) and memory 660, and one or more storage media 630 (such as one or more mass storage devices) storing application programs 633 or data 632. Among them, the memory 660 and the storage medium 630 can be temporary storage or permanent storage. The program stored in the storage medium 630 may include one or more units or modules, and each unit or module may include a series of operating instructions in the server device 600. Furthermore, the central processing unit 610 can be configured to communicate with the storage medium 630 and execute a series of operating instructions in the storage medium 630 on the server device 600.
[0127] The server device 600 may further include one or more power supplies 620 , one or more wired or wireless network interfaces 640 , one or more input and output interfaces 650 , and one or more operating systems 631 .
[0128] The CPU 610 in the server device 600 may be used to execute the following Figure 2 An embodiment of a method for configuring a database is shown.
[0129] Similarly, the contents of the above method embodiments are all applicable to the electronic device embodiments. The functions specifically implemented by the electronic device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0130] The embodiment of the present application further provides a computer-readable storage medium, in which a program executable by the central processing unit 610 is stored. The program executable by the central processing unit 610 is used to execute the above-mentioned database configuration method when executed by the central processing unit 610.
[0131] Similarly, the contents of the above method embodiments are all applicable to the computer-readable storage medium embodiments. The functions specifically implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0132] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the application is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part described as a larger operation is performed independently.
[0133] In addition, although the present application is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present application. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional techniques of the engineer. Therefore, those skilled in the art can implement the present application set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present application, which is determined by the full scope of the attached claims and their equivalents.
[0134] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.
[0135] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0136] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0137] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0138] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0139] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
[0140] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the embodiments. Technical personnel familiar with the field can make various equivalent modifications or substitutions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.
Claims
1. A method for configuring a database, characterized in that: The method comprises: According to the user's input information, determine the table that the user needs to query and the data items that need to be queried in each table; wherein the data items include main data items and sub-data items; Determining, according to the user's selection operation, the association mode between the main data items and the sub-data items in different tables; Generate data structure index information of the data search library and general configuration of data synchronization from the data management library to the data search library; wherein the field type of the main data item in the data structure index information is the field type of the corresponding table of the data management library, and the field type of the sub-data item is an array; The data search library is synchronized according to the data structure index information and the data synchronization general configuration.
2. A database configuration method according to claim 1, characterized in that: The data synchronization general configuration includes a row of the data structure index information of the data search library, a row of the main data configuration information of the data management library, and a plurality of rows of sub-data configuration information of the data management library.
3. A database configuration method according to claim 2, characterized in that: The step of synchronizing the data search library according to the data structure index information and the data synchronization general configuration includes: Create a new first index according to the data structure index information; Querying and determining corresponding master data information from the data management library according to the master data configuration information, and determining corresponding sub-data information from the data management library according to the sub-data configuration information; The master data information and the sub-data information are assembled, the data search library is fully synchronized, and the query index alias configured in the interface is pointed to the first index.
4. A database configuration method according to claim 3, characterized in that: The step of synchronizing the data search library according to the data structure index information and the data synchronization general configuration further includes: Saving the first index into a cache; Monitor the binlog in the data management library, and determine the data modification information of the table in the data management library according to the binlog; Incremental data synchronization is performed on the data search library according to the first index and the data modification information stored in the cache.
5. A database configuration method according to claim 4, characterized in that: The step of synchronizing the data search library according to the data structure index information and the data synchronization general configuration further includes: When the data search library needs to synchronize all data, the log location of the current binlog is obtained; Create a new second index according to the data structure index information, perform full data synchronization, and point the query index alias configured in the interface to the second index when the full data synchronization is completed; When data synchronization rollback is required, the data search library is rolled back according to the log location.
6. A method for configuring a database according to any one of claims 1 to 5, characterized in that: The method further comprises: When an index name input into the data search library is received, a corresponding table field is determined from the data management library as a query parameter and a return result parameter.
7. A database configuration method according to claim 1, characterized in that: The input information includes index name, relevant field information of the main table of data to be synchronized, relevant field information of the sub-table of data to be synchronized, interface queryable field parameters, and interface return information field parameters.
8. A database configuration system, characterized in that: The system comprises: An input unit, used to determine the table that the user needs to query and the data items that need to be queried in each table according to the user's input information; wherein the data items include main data items and sub-data items; A selection unit, used to determine the association mode between the main data items and the sub-data items in different tables according to the selection operation of the user; A generating unit, used to generate data structure index information of a data search library and a general configuration of data synchronization from a data management library to the data search library; wherein the field type of the main data item in the data structure index information is the field type of the corresponding table of the data management library, and the field type of the sub-data item is an array; A synchronization unit is used to synchronize data on the data search library according to the data structure index information and the data synchronization general configuration.
9. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements a database configuration method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to implement a database configuration method according to any one of claims 1 to 7 when executed by the processor.
Citation Information
Patent Citations
Method and device for synchronizing data into search engine
CN112507200A
Data synchronization method and device based on table structure relationship
CN113326266A
Data synchronization method and device, equipment and storage medium
CN114036238A
Retrieval method and system based on system metadata
CN116680319A
Es data synchronization method
CN118349602A
Cited By
Database management method, database management device and computing device cluster
CN119988355A
A database management method, a database management device, and a computing device cluster
CN119988355B