Database expansion method, device and system
By synchronously storing data between databases and adjusting data source links based on routing information, the problem of data loss and technical complexity in database expansion is solved, and an efficient and reliable expansion process is achieved.
Patent Information
- Application Number
- CN202110512918.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-11
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-05-11
AI Technical Summary
Among the existing database expansion methods, uncompleted data migration due to downtime expansion may cause data loss, and smooth expansion is complex and requires additional technical support. There is a lack of efficient and reliable solutions.
By synchronously storing data between the original database and the newly added database, and determining the data source link based on the routing information of the new database, data migration and service adjustment are realized, downtime operations are avoided, and data integrity and system reliability are ensured.
It achieves the reliability, accuracy, convenience and efficiency of the database expansion process, avoids data loss and complex technical support requirements, and ensures data integrity and system high availability.
Smart Images

Figure CN113239011B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the fields of computer technology and Internet technology, and in particular, to a method, device and system for expanding the capacity of a database. Background Art
[0002] With the continuous development of Internet technology and computer technology, the amount of data has increased by leaps and bounds, such as user-related data of e-commerce platforms. In order to store data, databases are usually used. As the amount of data continues to increase, in order to ensure the reliability of data storage, the database needs to be expanded.
[0003] In the prior art, the method of expansion by shutdown is usually used to expand the database, wherein the method of expansion by shutdown may specifically include: after the staff sets the downtime (generally the downtime is at night when the amount of data is the least), and based on the downtime, the data reading and writing system is cut off from providing data reading and writing services to the outside world, the preset data migration software migrates the data in the original database to the existing database, and after the data migration is completed, the staff determines to restart the data reading and writing system to provide data reading and writing services to the outside world.
[0004] In the process of implementing the present application, the inventors found that there are at least the following problems in the prior art: the method of shutdown expansion has high requirements on the scene, and usually needs to be performed by staff at night when the traffic is the least. Accordingly, the time for completing data migration is relatively short, and data loss is likely to be caused by incomplete data migration. Summary of the invention
[0005] The embodiments of the present application provide a method, device and system for expanding the capacity of a database to solve the problem of data loss.
[0006] In a first aspect, an embodiment of the present application provides a method for expanding the capacity of a database, the method comprising:
[0007] If it is determined that the original data in the original database has been migrated to the newly added database, the acquired current data is stored in the original database and the newly added database respectively, and the original database and the newly added database belong to the data reading and writing system;
[0008] The routing information of the newly added database is obtained, and the data source link for the data reading and writing system to provide external services is determined according to the routing information of the newly added database.
[0009] In some embodiments, determining the data source link for the data reading and writing system to provide services externally according to the routing information of the newly added database includes:
[0010] Adjusting the routing information of the database for which the data reading and writing system provides external data reading and writing services to the routing information of the newly added database;
[0011] The data source link is determined according to the routing information of the newly added database.
[0012] In some embodiments, determining the data source link according to the routing information of the newly added database includes:
[0013] The configuration information of the data reading and writing system for providing external data reading and writing services is adjusted based on the routing information of the newly added database to obtain the adjusted configuration information, and the data source link is generated according to the adjusted configuration information.
[0014] In some embodiments, before storing the acquired current data in the original database and the newly added database respectively, the method further includes:
[0015] Obtaining original database table information of the original database, and obtaining newly added database table information of the newly added database;
[0016] A hash modulus process is performed on the newly added database table information according to the original database table information to obtain migration information, and the data in the original database is migrated to the newly added database according to the migration information, wherein the migration information indicates the location information of the original data in the newly added database.
[0017] In some embodiments, the original database table information includes an identifier of each original database table, and the newly added database table information includes a total number of newly added database tables; performing a hash modulo process on the newly added database table information according to the original database table information to obtain migration information includes:
[0018] The hash value of the identifier of each original data table is calculated, and the total number is modulo processed according to each hash value to obtain the migration information.
[0019] In some embodiments, the total number is determined based on attribute information of the original data, and the attribute information includes: the number of the original data and / or data growth information predicted based on the original data.
[0020] In some embodiments, obtaining original database table information of the original database includes:
[0021] The original data is acquired, and preprocessed, and the original database table information is generated according to the preprocessed original data, wherein the preprocessing includes cleaning processing and / or aggregation processing.
[0022] In some embodiments, after determining the data source link for external services provided by the data reading and writing system according to the routing information of the newly added database, the method further includes:
[0023] The data source link is initialized, and data reading and writing operations are performed on the data reading and writing system according to the initialized data source link.
[0024] In a second aspect, an embodiment of the present application provides a database expansion device, including:
[0025] A storage unit, for storing the acquired current data in the original database and the newly added database respectively if it is determined that the original data in the original database has been migrated to the newly added database, wherein the original database and the newly added database belong to the data reading and writing system;
[0026] A first acquisition unit, used to acquire routing information of the newly added database;
[0027] A determination unit is used to determine a data source link for external services provided by the data reading and writing system according to the routing information of the newly added database.
[0028] In some embodiments, the determining unit includes:
[0029] An adjusting subunit, used to adjust the routing information of the database for which the data reading and writing system provides external data reading and writing services to the routing information of the newly added database;
[0030] A determination subunit is used to determine the data source link according to the routing information of the newly added database.
[0031] In some embodiments, the determining subunit includes:
[0032] An adjustment module, configured to adjust configuration information of data reading and writing services provided externally by the data reading and writing system based on the routing information of the newly added database, to obtain adjusted configuration information;
[0033] A generating module is used to generate the data source link according to the adjusted configuration information.
[0034] In some embodiments, the apparatus further comprises:
[0035] A second acquisition unit, used to acquire original database table information of the original database;
[0036] A third acquisition unit, used to acquire the newly added database table information of the newly added database;
[0037] a processing unit, configured to perform a hash modulo process on the newly added database table information according to the original database table information to obtain migration information, wherein the migration information indicates location information of the original data in the newly added database;
[0038] A migration unit is used to migrate the data in the original database to the newly added database according to the migration information.
[0039] In some embodiments, the original database table information includes an identifier of each original database table, and the newly added database table information includes a total number of newly added database tables; the processing unit includes:
[0040] A calculation subunit, used to calculate a hash value of the identifier of each original data table;
[0041] The processing subunit is used to perform modulo processing on the total number according to each Hash value to obtain the migration information.
[0042] In some embodiments, the total number is determined based on attribute information of the original data, and the attribute information includes: the number of the original data and / or data growth information predicted based on the original data.
[0043] In some embodiments, the second acquiring unit includes:
[0044] An acquisition subunit, used for acquiring the original data;
[0045] A preprocessing subunit, used for preprocessing the raw data, wherein the preprocessing includes cleaning processing and / or aggregation processing;
[0046] The generating subunit is used to generate the original database table information according to the preprocessed original data.
[0047] In some embodiments, the apparatus further comprises:
[0048] An initialization unit, used to initialize the data source link;
[0049] The operation unit is used to perform data reading and writing operations on the data reading and writing system according to the data source link after the initialization process.
[0050] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0051] Memory; Memory for storing instructions executable by the processor;
[0052] The processor is configured to execute the method as described in the first aspect.
[0053] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.
[0054] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes: a computer program, which is stored in a readable storage medium, and at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the electronic device executes the method described in the first aspect.
[0055] In a sixth aspect, an embodiment of the present application provides a database expansion system, comprising: an original database, a newly added database, and the expansion device as described in the second aspect; wherein:
[0056] The original database is used to store the original data before the capacity expansion process and to store the current data during the capacity expansion process;
[0057] The newly added database is used to store current data during the capacity expansion process and to store current data migrated from the original database.
[0058] The database expansion method, device and system provided by the embodiment of the present application include: if it is determined that the original data in the original database has been migrated to the newly added database, the acquired current data is stored in the original database and the newly added database respectively, wherein the original database and the newly added database belong to the data reading and writing system, the routing information of the newly added database is acquired, and the data source link for the data reading and writing system to provide external services is determined according to the routing information of the newly added database. In this embodiment, if the original data is migrated, the current data is stored in the original database and the newly added database respectively, so as to realize the operation of synchronously storing the current data of the two types of databases without stopping the operation, and even if the newly added database cannot be used, the current data can still be stored in the original database to ensure the integrity of the data in the original database, and by determining the routing information of the newly added database as the data source link, the external device can be quickly located to the newly added database, so as to accept the external services provided by the newly added database. That is to say, by adopting the method of this embodiment to expand the database, the problem of data loss caused by stopping the expansion can be avoided, and the problem of complicated procedures and the need for additional technical support caused by smooth expansion can be avoided, so as to realize the technical effect of reliability, accuracy, convenience and efficiency in expanding the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0060] Figure 1 A schematic diagram of a method for expanding the capacity of a database according to an embodiment of the present application;
[0061] Figure 2 A schematic diagram of a method for expanding the capacity of a database according to another embodiment of the present application;
[0062] Figure 3 A schematic diagram of a database expansion device according to an embodiment of the present application;
[0063] Figure 4 A schematic diagram of a database expansion device according to another embodiment of the present application;
[0064] Figure 5 A block diagram of an electronic device for a method for expanding a database according to an embodiment of the present application;
[0065] Figure 6 Schematic diagram of a data reading and writing system according to an embodiment of the present application.
[0066] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0067] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0068] First, the terms involved in the embodiments of the present application are explained:
[0069] Routing information: refers to the path information of the network address of the database.
[0070] Database table: refers to the database object that contains all the data in the database.
[0071] Content distribution service device: refers to a sub-library and sub-table middleware product developed based on the client, which implements the Java Database Connectivity (JDBC) standard application programming interface (Application Programming Interface, API) and can support multiple databases (or database clusters) such as MySQL, Oracle and SQL Server.
[0072] With the continuous development of Internet technology and computer technology, the amount of data has increased by leaps and bounds, such as user-related data of e-commerce platforms. In order to store data, databases are usually used. As the amount of data continues to increase, in order to ensure the reliability of data storage, the database needs to be expanded.
[0073] In the related art, two expansion methods are usually used to expand the database, one is shutdown expansion, and the other is smooth expansion.
[0074] Among them, shutdown expansion means: the system stops external services at a preset time point, and migrates the data in the original database to the existing database (that is, the expanded database). After the data migration is completed, the system resumes external services.
[0075] For example, the staff sets a system downtime period, and when the time reaches the start time of the downtime period, the staff shuts down the system, that is, cuts off the system's external service function, and correspondingly increases a preset number of databases, and migrates the data in the original database to the newly added database through a pre-prepared migration method. After the data migration is completed, the database service configuration is modified, and the system's external service is restarted.
[0076] If the database is expanded by downtime expansion, when data migration fails or the test fails after data migration, the service configuration will be modified back to the original database and upgraded again in the future.
[0077] However, using the shutdown expansion method to expand the database has at least one of the following technical problems: low availability; a short time from starting the upgrade to completing the upgrade, and a high probability of error; if data migration fails, it is necessary to return to the time before the shutdown expansion, which may lead to data loss and other problems.
[0078] Smooth capacity expansion means: adding a new database, configuring dual-master for data synchronization, configuring master-master dual write after data synchronization is completed, deleting dual-master synchronization after dual write is completed, and modifying the database configuration to complete the capacity expansion process.
[0079] However, using the smooth expansion method to expand the database has at least one of the following technical problems: the program is complex; additional technologies such as dual-master configuration, master-master dual-write, and detection data synchronization are required.
[0080] In order to solve at least one of the above-mentioned technical problems, the inventor of this application, through creative work, obtained the inventive concept of this application: after the original data has been migrated to the newly added database, the current data is stored in the original database and the newly added database respectively, and the data source link is determined according to the routing information of the newly added database.
[0081] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0082] See also Figure 1 , Figure 1 A schematic diagram of a method for expanding the capacity of a database according to an embodiment of the present application.
[0083] like Figure 1 As shown, the method includes:
[0084] S101: If it is determined that the original data in the original database has been migrated to the newly added database, the acquired current data is stored in the original database and the newly added database respectively.
[0085] Among them, the original database and the newly added database belong to the data reading and writing system.
[0086] Exemplarily, the executor of this embodiment may be a capacity expansion device for a database (hereinafter referred to as the capacity expansion device), and the capacity expansion device may be a server (such as a local server or a cloud server), or a terminal device, or a processor, or a chip, etc., which is not limited in this embodiment.
[0087] The data reading and writing system may include two types of databases, one is the original database and the other is the newly added database. The original database may be understood as the database included in the data reading and writing system before the data reading and writing system is expanded, and the newly added database may be understood as the database newly added to the data reading and writing system in order to improve the reliability of data storage.
[0088] This step can be understood as: if the expansion device determines that the original data has been migrated (ie, the original data has been migrated from the original database to the newly added database), the current data is stored in both the original database and the newly added database.
[0089] It should be understood that current data and original data are relative concepts. Original data can be understood as data previously stored in the original database, and current data can be understood as new data received after the original data has been migrated to the newly added database.
[0090] It is worth noting that, in this embodiment, after the expansion device determines that the original data has been migrated to the newly added database, the current data is stored separately, that is, the current data is stored in both the original database and the newly added database. In this way, even if the subsequent test and verification of the new database fails, the data in the original database can still have a high degree of integrity and comprehensiveness, and the data in the newly added database can have a high degree of integrity (that is, it will not cause the problem of loss of current data).
[0091] S102: Obtain routing information of the newly added database, and determine the data source link for the data reading and writing system to provide external services according to the routing information of the newly added database.
[0092] Based on the above analysis, the present application provides a method for expanding a database, including: if it is determined that the original data in the original database has been migrated to the newly added database, the acquired current data is stored in the original database and the newly added database respectively, wherein the original database and the newly added database belong to the data reading and writing system, the routing information of the newly added database is obtained, and the data source link for the data reading and writing system to provide external services is determined according to the routing information of the newly added database. In this embodiment, if the original data is migrated, the current data is stored in the original database and the newly added database respectively, so as to realize the operation of synchronously storing the current data of the two types of databases without stopping the operation, and even if the newly added database cannot be used, the current data can still be stored in the original database to ensure the integrity of the data in the original database, and by determining the routing information of the newly added database as the data source link, the external device can be quickly located to the newly added database, so as to accept the external services provided by the newly added database. That is to say, by adopting the method of this embodiment to expand the database, the problem of data loss caused by downtime expansion can be avoided, and the problem of complex procedures and the need for additional technical support caused by smooth expansion can be avoided, thereby achieving the technical effect of reliability, accuracy, convenience and efficiency in expanding the database.
[0093] See also Figure 2 , Figure 2 This is a schematic diagram of a method for expanding the capacity of a database according to another embodiment of the present application.
[0094] like Figure 2 As shown, the method includes:
[0095] S201: Acquire original database table information of the original database, and acquire newly added database table information of the newly added database.
[0096] In some embodiments, obtaining original database table information of an original database may include the following steps:
[0097] The first step is to obtain the original data and preprocess the original data.
[0098] The second step: generating the original database table information according to the pre-processed original data.
[0099] The pretreatment includes cleaning treatment and / or polymerization treatment.
[0100] Exemplarily, obtaining original database table information can be understood as: performing cleaning processing and / or aggregation processing on the original data to obtain pre-processed original data, and generating original database table information according to the pre-processed original data.
[0101] The cleaning process may be understood as: deleting duplicate data in the original data, and / or correcting erroneous data in the original data.
[0102] Aggregation processing can be understood as merging data of the same type in the original data.
[0103] Generally speaking, the amount of preprocessed raw data is positively correlated with the original database table information. For example, the larger the amount of preprocessed raw data is, the larger the amount of original database table information is, specifically, the larger the amount of original database tables is.
[0104] It is worth noting that, in this embodiment, by cleaning the original data, the original database table information can be made relatively more concise and redundancy can be avoided; and by aggregation processing, the high integrity of the original data table information can be improved.
[0105] S202: Performing hash modulus processing on the newly added database table information according to the original database table information to obtain migration information.
[0106] The migration information indicates the location information of the original data in the newly added database.
[0107] In some embodiments, the original database table information includes an identifier of each original database table, and the newly added database table information includes the total number of newly added database tables. S202 may include the following steps:
[0108] The first step: Calculate the hash value of the identifier of each original data table.
[0109] Step 2: Perform modulo processing on the total quantity according to each hash value to obtain migration information.
[0110] The migration information is used to characterize the storage mapping relationship between each original data table and the newly added database table, that is, based on the migration information, it can be determined in which newly added database table the original data corresponding to each original data table can be stored.
[0111] It is worth noting that in this embodiment, by calculating the hash value and performing remainder processing based on the hash value to obtain the migration information, it is possible to achieve a more even distribution of the original data in the newly added database, thereby achieving the technical effect of balancing the load of the new database, improving the overall operating efficiency of the new database, and extending the overall service life of the new database.
[0112] In some embodiments, the total number is determined based on attribute information of the original data, where the attribute information includes: the number of the original data and / or data growth information predicted based on the original data.
[0113] There is a positive correlation between the total number and the number of original data. For example, if the number of original data is larger, the total number is larger; conversely, if the number of original data is smaller, the total number is smaller.
[0114] There is a positive correlation between the total number and the data growth information. For example, if the data growth information is higher, the total number is greater; conversely, if the data growth information is lower, the total number is smaller.
[0115] If the attribute information includes the amount of original data and data growth information, coefficients may be allocated to the amount of original data and the data growth information respectively, and the total amount may be determined based on the amount of original data, the data growth information, and the respective corresponding coefficients.
[0116] It is worth noting that, in this embodiment, by determining the total quantity based on the quantity of original data and / or data growth information, reasonable utilization of resources can be achieved.
[0117] S203: Migrate the data in the original database to the newly added database according to the migration information.
[0118] Exemplarily, after the capacity expansion device determines the migration information, it is equivalent to that the storage location of the original data in the newly added database has been determined, and the capacity expansion device can perform migration processing on the original data based on the migration information.
[0119] It is worth noting that, in this embodiment, by performing hash modulus processing on the newly added database table information according to the original database table information to obtain migration information, the original data can be quickly located in the newly added database, and the original data can be evenly migrated to the newly added database, thereby improving the efficiency and reliability of data migration and balancing the load of the new database.
[0120] In some embodiments, the original data may be migrated to the newly added database by means of parallel migration.
[0121] Exemplarily, the capacity expansion device may call different threads based on the migration information and assign migration tasks to different threads, so that each thread executes its corresponding migration task in parallel.
[0122] It is worth noting that, in this embodiment, the efficiency of data migration can be improved by migrating the original data in a parallel migration manner.
[0123] S204: If it is determined that the original data in the original database has been migrated to the newly added database, the acquired current data is stored in the original database and the newly added database respectively.
[0124] Among them, the original database and the newly added database belong to the data reading and writing system.
[0125] For example, the description of S204 may refer to S101, which will not be repeated here.
[0126] S205: Adjust the routing information of the database for which the data reading and writing system provides data reading and writing services to the outside to the routing information of the newly added database.
[0127] S206: Determine a data source link according to the routing information of the newly added database.
[0128] It is worth noting that in this embodiment, after migrating the original data to the newly added database and storing the current data in both the original database and the newly added database, the routing information of the database is adjusted to the routing information of the newly added database, and then the data source link is determined, which can improve the technical effect of the reliability and accuracy of the data reading and writing service provided by the data reading and writing system to the outside world.
[0129] In some embodiments, after the routing information of the newly added database is adjusted to the routing information of the database providing data reading and writing services externally, the data reading and writing service of the data reading and writing system can be verified, and specifically the data reading and writing service of the newly added database can be verified. If the verification passes, it means that the data reading and writing service can be completed by the newly added database, then S206 is executed (i.e., determining the data source link according to the routing information of the newly added database) to improve the accuracy and reliability of the data reading and writing services provided externally. Technical effect.
[0130] In some embodiments, S206 may include the following steps:
[0131] The first step: adjusting the configuration information of the data reading and writing service provided by the data reading and writing system to the outside based on the routing information of the newly added database to obtain the adjusted configuration information.
[0132] Step 2: Generate a data source link based on the adjusted configuration information.
[0133] It is worth noting that, in this embodiment, by determining the adjusted configuration information based on the routing information of the newly added database and generating a data source link according to the adjusted configuration information, the data source link can have higher reliability and accuracy, so that the external device can accurately and reliably write or read data to the data reading and writing system through the data source link.
[0134] S207: Initialize the data source link, and perform data read and write operations on the data read and write system according to the initialized data source link.
[0135] Please participate Figure 3 , Figure 3 A schematic diagram of a database expansion device according to an embodiment of the present application.
[0136] like Figure 3 As shown, the database expansion device 300 includes:
[0137] The storage unit 301 is used to store the acquired current data in the original database and the new database respectively if it is determined that the original data in the original database has been migrated to the new database. The original database and the new database belong to the data reading and writing system.
[0138] The first acquiring unit 302 is configured to acquire routing information of the newly added database.
[0139] The determination unit 303 is used to determine the data source link for the data reading and writing system to provide external services according to the routing information of the newly added database.
[0140] Please participate Figure 4 , Figure 4 It is a schematic diagram of a database expansion device according to another embodiment of the present application.
[0141] like Figure 4 As shown, the database expansion device 400 includes:
[0142] The second acquisition unit 401 is used to acquire original database table information of the original database.
[0143] like Figure 4 As shown, in some embodiments, the second acquisition unit 401 includes:
[0144] The acquisition subunit 4011 is used to acquire original data.
[0145] The preprocessing subunit 4012 is used to preprocess the original data, wherein the preprocessing includes cleaning processing and / or aggregation processing.
[0146] The generating subunit 4013 is used to generate original database table information according to the pre-processed original data.
[0147] The third acquisition unit 402 is used to acquire the newly added database table information of the newly added database.
[0148] The processing unit 403 is configured to perform a hash modulo process on the newly added database table information according to the original database table information to obtain migration information, wherein the migration information indicates location information of the original data in the newly added database.
[0149] like Figure 4 As shown, in some embodiments, the original database table information includes an identifier of each original database table, the newly added database table information includes the total number of newly added database tables, and the processing unit 403 includes:
[0150] The calculation subunit 4031 is used to calculate the hash value of the identifier of each original data table.
[0151] The processing subunit 4032 is used to perform modulo processing on the total quantity according to each Hash value to obtain migration information.
[0152] In some embodiments, the total number is determined based on attribute information of the original data, where the attribute information includes: the number of the original data and / or data growth information predicted based on the original data.
[0153] The migration unit 404 is used to migrate the data in the original database to the newly added database according to the migration information.
[0154] The storage unit 405 is used to store the acquired current data in the original database and the newly added database respectively if it is determined that the original data in the original database has been migrated to the newly added database. The original database and the newly added database belong to the data reading and writing system.
[0155] The first acquiring unit 406 is configured to acquire routing information of a newly added database.
[0156] The determination unit 407 is used to determine the data source link for the data reading and writing system to provide external services according to the routing information of the newly added database.
[0157] like Figure 4 As shown, in some embodiments, the determining unit 407 includes:
[0158] The adjusting subunit 4071 is used to adjust the routing information of the database for which the data reading and writing system provides data reading and writing services to the outside to the routing information of the newly added database.
[0159] The determination subunit 4072 is used to determine the data source link according to the routing information of the newly added database.
[0160] The initialization unit 408 is used to initialize the data source link.
[0161] The operation unit 409 is used to perform data reading and writing operations on the data reading and writing system according to the data source link after the initialization process.
[0162] According to an embodiment of the present application, the present application also provides a computer program product, the program product includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.
[0163] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.
[0164] like Figure 5 , is a block diagram of an electronic device according to the method for expanding the capacity of a database according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the present application described herein and / or required.
[0165] like Figure 5As shown, the electronic device includes: one or more processors 501, a memory 502, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to an interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 501 is taken as an example.
[0166] The memory 502 is a non-transient computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the database expansion method provided in the present application. The non-transient computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the database expansion method provided in the present application.
[0167] The memory 502 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / units corresponding to the method for expanding the capacity of a database in the embodiment of the present application. The processor 501 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 502, that is, implementing the method for expanding the capacity of a database in the above method embodiment.
[0168] The memory 502 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of an electronic device according to the method for expanding the capacity of a database, etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 502 may optionally include a memory remotely arranged relative to the processor 501, and these remote memories may be connected to the electronic device of the method for expanding the capacity of a database via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0169] The electronic device of the database expansion method may further include: an input device 503 and an output device 504. The processor 501, the memory 502, the input device 503 and the output device 504 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0170] The input device 503 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device of the method for expanding the capacity of the database, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 504 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.
[0171] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0172] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0173] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0174] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a Block-chain-based Service Network (BSN), a wide area network (WAN), and the Internet.
[0175] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.
[0176] According to another aspect of the embodiments of the present application, the embodiments of the present application further provide a data reading and writing system, which includes: an original database, a newly added database, and a capacity expansion device as described in any of the above embodiments.
[0177] See also Figure 6 , Figure 6 Schematic diagram of a data reading and writing system according to an embodiment of the present application.
[0178] like Figure 6 As shown, the data reading and writing system 600 includes: an original database 601, a newly added database 602, a big data platform 603 (which may include a capacity expansion device), a content distribution service device (Content Distribution Service, CDS) 604, and an online interaction device 605, wherein:
[0179] The original database 601 is used for data generated based on the online interactive device 605 before the expansion process (called original data), and is also used for data generated based on the online interactive device 605 during the expansion process (called current data).
[0180] The newly added database 602 is used for storing the data (referred to as current data) generated based on the online interactive device 605 during the expansion process, and for storing the original data migrated from the original database 601 .
[0181] It should be noted that, Figure 6 The number of databases in the data reading and writing system 600 is merely demonstrated by taking an original database 601 and a newly added database 602 as an example, and should not be understood as a limitation on the number of databases. Furthermore, there is not necessarily a certain positive or negative correlation between the number of original databases 601 and the number of newly added databases 602.
[0182] Exemplarily, the number of original databases 601 may be one, and the number of newly added databases 602 may be four, or eight, and so on.
[0183] The online interaction device 605 may be an online interaction device, such as an ABS device.
[0184] The big data platform 603 is used to extract data (including original data and current data) from the online interactive device 605. If before the expansion process, the extracted original data will be stored in the original database 601. If during the expansion process, the extracted current data will be stored in both the original database 601 and the newly added database 602.
[0185] The big data platform 603 is also used to pre-process the original data (such as cleaning and / or aggregation) and migrate the pre-processed original data to the newly added database 602.
[0186] That is, in this embodiment, during the capacity expansion process, the original database 601 and the newly added database 602 are both in operation, and the big data platform 603 stores the current data in the original database 601 and the newly added database 602 at the same time to ensure abnormal rollback. That is, if the capacity expansion fails, the data in the original database 601 will not be lost.
[0187] The big data platform 603 is also used to modify the data source link for the data reading and writing system 600 to provide external services after completing the migration of the original data, and to initialize it.
[0188] Based on the data source link, the user can read data and / or write data from the newly added database 602 through the online interaction device 605 and the content distribution service device 604 in sequence.
[0189] Among them, the content distribution service device 604 can support many functions such as sub-library and sub-table, read-write separation and data operation and maintenance, so as to provide high-performance, high-concurrency and high-reliability data reading and writing services.
[0190] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0191] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for expanding the capacity of a database, the method comprising: If it is determined that the original data in the original database has been migrated to the newly added database, the acquired current data is stored in the original database and the newly added database respectively, the original database and the newly added database belong to the data reading and writing system, and the newly added database is a database newly added in the data reading and writing system; the original database and the newly added database both store the original data and the current data, and the current data is new data received after the original data has been migrated to the newly added database; Acquire the routing information of the newly added database, and determine the data source link for the data reading and writing system to provide external services according to the routing information of the newly added database; Before storing the acquired current data in the original database and the newly added database respectively, the method further includes: Obtaining original database table information of the original database, and obtaining newly added database table information of the newly added database; A hash modulus process is performed on the newly added database table information according to the original database table information to obtain migration information, and the data in the original database is migrated to the newly added database according to the migration information, wherein the migration information indicates the location information of the original data in the newly added database.
2. The method according to claim 1, wherein: Determining the data source link for the data reading and writing system to provide services externally according to the routing information of the newly added database includes: Adjusting the routing information of the database for which the data reading and writing system provides external data reading and writing services to the routing information of the newly added database; The data source link is determined according to the routing information of the newly added database.
3. The method according to claim 2, wherein: Determining the data source link according to the routing information of the newly added database includes: The configuration information of the data reading and writing system for providing external data reading and writing services is adjusted based on the routing information of the newly added database to obtain the adjusted configuration information, and the data source link is generated according to the adjusted configuration information.
4. The method according to claim 1, wherein: The original database table information includes the identifier of each original database table, and the newly added database table information includes the total number of newly added database tables; Performing hash modulo processing on the newly added database table information according to the original database table information to obtain migration information includes: The hash value of the identifier of each original data table is calculated, and the total number is modulo processed according to each hash value to obtain the migration information.
5. The method according to claim 4, wherein: The total number is determined based on attribute information of the original data, where the attribute information includes: the number of the original data and / or data growth information predicted based on the original data.
6. The method according to claim 1, wherein: Obtaining original database table information of the original database includes: The original data is acquired, and preprocessed, and the original database table information is generated according to the preprocessed original data, wherein the preprocessing includes cleaning processing and / or aggregation processing.
7. The method according to claim 1, after determining the data source link for the data reading and writing system to provide external services according to the routing information of the newly added database, the method further comprises: The data source link is initialized, and data reading and writing operations are performed on the data reading and writing system according to the initialized data source link.
8. A database expansion device, comprising: A storage unit, for storing the acquired current data in the original database and the newly added database respectively if it is determined that the original data in the original database has been migrated to the newly added database, wherein the original database and the newly added database belong to the data reading and writing system, and the newly added database is a database newly added in the data reading and writing system; the original database and the newly added database both store the original data and the current data, and the current data is new data received after the original data has been migrated to the newly added database; A first acquisition unit, used to acquire routing information of the newly added database; A determination unit, configured to determine a data source link for external services provided by the data reading and writing system according to the routing information of the newly added database; A processing unit is used to obtain original database table information of the original database and obtain new database table information of the new database before storing the acquired current data in the original database and the new database respectively; perform hash modulus processing on the new database table information according to the original database table information to obtain migration information, and migrate the data in the original database to the new database according to the migration information, wherein the migration information indicates the location information of the original data in the new database.
9. An electronic device, comprising: Memory, processor; Memory; a memory for storing instructions executable by the processor; The processor is configured to execute the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
11. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.
12. A database expansion system, comprising: The original database, the newly added database, and the expansion device as claimed in claim 8; wherein, The original database is used to store the original data before the capacity expansion process and to store the current data during the capacity expansion process; The newly added database is used to store current data during the capacity expansion process and to store current data migrated from the original database.
Citation Information
Patent Citations
Database expansion method and device
CN110858194A
