A database expansion method, device, equipment and medium

Controlling database expansion and incremental synchronization through expansion version information solves the problems of long database expansion and high labor costs in the existing technology, achieves efficient and imperceptible database expansion, and reduces upgrade costs and communication time.

CN112925770BActive Publication Date: 2024-09-20XIAN TONGXING HENGYAO INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110255434.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-09
Publication Date
2024-09-20
Estimated Expiration
2041-03-09

AI Technical Summary

Technical Problem

Existing database expansion methods such as outage migration lead to long data migration time, high manual monitoring and high costs, making it difficult to achieve efficient and imperceptible database expansion.

Method used

Control the expansion of the distributed database through the expansion version information, generate the expanded database, and perform incremental synchronization after full data migration, automatically determine the timing of database switching, realize the database expansion process without awareness, and shorten the communication between business parties, DBAs, and component providers. time to avoid restarting the business.

Benefits of technology

It realizes the imperceptibility and efficiency of the database expansion process, reduces the upgrade cost, improves the expansion efficiency, and avoids the problem of having to restart the business after expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112925770B
    Figure CN112925770B
Patent Text Reader

Abstract

The present application provides a database expansion method, device, equipment and medium, which generates an expanded database according to the acquired expansion version information; after the full amount of data is migrated from the original database to the expanded database, the newly written business data of the original database is incrementally synchronized to the expanded database; and the database switching operation is performed without delay in the incremental synchronization. The generation of the corresponding expanded database is controlled according to the expansion version information, and the migration task is created to monitor the migration task in real time. After the full amount of data is migrated from the original database to the expanded database, incremental synchronization is performed without affecting the business processing during the expansion process. The timing of switching the database is automatically determined according to the synchronization information of the incremental synchronization, so as to achieve the purpose of imperceptible, low-cost and high-efficiency database expansion process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of database expansion, and in particular to a database expansion method, device, equipment and medium. Background Art

[0002] As the business volume of enterprises continues to grow, the database can easily become the bottleneck of the application system. The resources and processing capacity of a single-machine database are limited. In a highly concurrent distributed system, database sharding can be used to break through the limitations of a single machine. Even after the data is sharded, both the database capacity and the amount of data in a single database and table will reach their limits. At this time, how to expand database performance becomes an urgent problem that needs to be dealt with.

[0003] In order to expand the database, the service is stopped for migration. Specifically, a new database and corresponding tables are created on the target side; the source side service is stopped, the new sub-table routing rules on the target side are modified, and the data is migrated to the newly created database on the target side; the DBA (Database Administrator) manually determines whether the data migration is complete; when the migration is complete, the service is restarted, the newly created database is connected, and the service is provided externally. However, this method of data migration takes a long time, resulting in a long stop time. The DBA manually monitors whether the data migration is completed, which has high labor costs.

[0004] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present. Summary of the invention

[0005] The purpose of this application is to provide a database expansion method, device, equipment and medium to achieve the purpose of imperceptible, low-cost and high-efficiency database expansion process. The specific scheme is as follows:

[0006] In a first aspect, the present application discloses a method for expanding database capacity, comprising:

[0007] Generate a database after expansion according to the obtained expansion version information;

[0008] After all data is migrated from the original database to the expanded database, the incremental business data newly written to the original database is synchronized to the expanded database;

[0009] Preferably, in the case where there is no delay in the incremental synchronization, before executing the database switching operation, the method further includes:

[0010] Determining whether a stop-writing standard of the original database is met;

[0011] If the stop writing standard is reached, a stop writing event is pushed to the service end, so that the service end stops writing new service data according to the stop writing event;

[0012] The performing of the database switching operation when there is no delay in the incremental synchronization includes: after there is no delay in the incremental synchronization, pushing the database switching event to the business end so that the business end resets the write rule according to the database switching event; and determining that the database switching operation is completed.

[0013] Preferably, the determining whether the stop writing standard of the original database is met includes:

[0014] Determine whether the delay time of the incremental synchronization is within a preset time;

[0015] If within the preset time, it is determined that the stop writing standard is reached;

[0016] If it is not within the preset time, it is determined that the stop writing standard is not met.

[0017] Preferably, the determining whether the stop writing standard of the original database is met includes:

[0018] Determine whether there is newly written business data within a preset time during the execution of the incremental synchronization process;

[0019] If there is no newly written business data, it is determined that the stop writing standard is met;

[0020] If there is newly written business data, it is determined that the stop writing standard is not met.

[0021] Preferably, generating the expanded database according to the acquired expanded version information includes:

[0022] Building a database according to the expanded version information to obtain an initial database;

[0023] Obtain a table creation DDL file on the source side, and create a table on the target side according to the table creation DDL file;

[0024] The expanded database is obtained according to the initial database and the expanded database table of the target end.

[0025] Preferably, it also includes:

[0026] The monitoring information of the original database is obtained, and whether to expand the capacity is determined according to the monitoring information; if expansion is required, the expansion version information is obtained.

[0027] Preferably, it also includes:

[0028] receiving a rollback instruction;

[0029] The current database is restored according to the specified expansion version information in the rollback instruction.

[0030] In a second aspect, the present application discloses a database expansion device, comprising:

[0031] A post-expanded database generation module is used to generate a post-expanded database according to the acquired expanded version information;

[0032] A migration module, configured to synchronize the incremental business data newly written to the original database to the expanded database after all data is migrated from the original database to the expanded database;

[0033] The database switching module is used to perform the database switching operation when there is no delay in the incremental synchronization.

[0034] In a third aspect, the present application discloses an electronic device, comprising:

[0035] Memory for storing computer programs;

[0036] A processor is used to implement the steps of the above-mentioned database expansion method when executing the computer program.

[0037] In a fourth aspect, the present application discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the database expansion method described above are implemented.

[0038] The present application provides a database expansion method, comprising: generating an expanded database according to acquired expansion version information; after all data is migrated from an original database to the expanded database, synchronizing the newly written business data of the original database to the expanded database; and performing a database switching operation without delay in the incremental synchronization.

[0039] The present application controls the expansion of a distributed database through expansion version information, and controls the generation of a corresponding expanded database according to the expansion version information. The expanded database has a larger data storage capacity and / or data table volume than the original database; then creates a migration task to monitor the migration task in real time, and performs incremental synchronization after all data is migrated from the original database to the expanded database, which does not affect the business processing during the expansion process, and automatically determines the timing of switching databases based on the synchronization information of the incremental synchronization. The database expansion process is imperceptible. Through the above method, the communication time of the original business party, DBA, and component provider can be shortened, and the efficiency is greatly improved. It also avoids the problem of having to restart the business after the expansion in related technologies, and greatly reduces the upgrade cost. The present application also provides a database expansion device, an electronic device, and a computer-readable storage medium, all of which have the above-mentioned beneficial effects, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0041] Figure 1 A flowchart of a database expansion method provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of another method for expanding the capacity of a database provided in an embodiment of the present application

[0043] Figure 3 A schematic diagram of a specific method for expanding database capacity provided in an embodiment of the present application;

[0044] Figure 4 A schematic diagram of the structure of a database expansion device provided in an embodiment of the present application;

[0045] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0046] Figure 6 A structural diagram of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] A common method for database expansion is to stop the service for migration. However, this method takes a long time to migrate data, resulting in a long downtime. The DBA manually monitors whether the data migration is completed, which results in high labor costs.

[0049] Based on the above technical problems, this embodiment provides a database expansion method, which controls the expansion of a distributed database through expansion version information, and controls the generation of a corresponding expanded database according to the expansion version information. The expanded database has a larger data storage capacity and / or data table volume than the original database; then a migration task is created to monitor the migration task in real time. After the full amount of data is migrated from the original database to the expanded database, incremental synchronization is performed without affecting the business processing during the expansion process. Moreover, the timing of switching the database is automatically determined according to the synchronization information of the incremental synchronization. The database expansion process is imperceptible. Through the above method, the communication time among the original business party, DBA, and component provider can be shortened, and the efficiency is greatly improved. It also avoids the problem that the business must be restarted after the expansion in the related technology, which greatly reduces the upgrade cost.

[0050] Please refer to Figure 1 , Figure 1 A flowchart of a database expansion method provided in an embodiment of the present application specifically includes:

[0051] Step S101, generating a database after expansion according to the acquired expansion version information;

[0052] Among them, the expansion version information is provided with the number of databases and the number of database tables after expansion; the required expanded database can be generated according to the expansion version information, and the user can set it according to actual needs. For example, if the original database has one database and one table, the expanded database will have two databases and two tables (each database has one database table). For another example, if the original database has two databases and two tables, the expanded database will have two databases and four tables, or four databases and four tables. The specific expansion version information can freely apply for the corresponding resources. You can apply for a small specification first, and then slowly expand it. The utilization rate of database resources can be increased by more than 50%. The original database and the expanded database can be set on the same server or on different servers. Users can customize the settings as long as the purpose of this embodiment can be achieved.

[0053] This application does not limit the method of obtaining the expansion version information, and users can customize the settings.

[0054] In an achievable implementation, obtaining the capacity expansion version information includes: obtaining a capacity expansion instruction issued by a user, and obtaining the capacity expansion version information according to the capacity expansion instruction.

[0055] Among them, the execution subject controller of this embodiment is pre-installed with a client, and provides the user with an information input interface and an information sending trigger unit on the user interaction interface, wherein the controller obtains the expansion instruction input by the test party through the information input interface. When the information sending trigger unit is triggered by the outside world, the controller can obtain the expansion version information corresponding to the expansion instruction, realizing a simple one-click expansion operation, streamlining the cumbersome expansion operation steps, and controllable risks.

[0056] In another achievable implementation, obtaining the expanded version information includes: obtaining monitoring information of the original database, determining whether to expand the capacity according to the monitoring information; and obtaining the expanded version information if expansion is required.

[0057] Among them, the monitoring information of the original database includes but is not limited to: data storage capacity, usage rate, data volume of the database table, and database performance. When the data storage capacity is greater than the capacity threshold, it is determined that expansion is required, and when the data storage capacity is not greater than the capacity threshold, it is determined that expansion is not required; or, when the usage rate is greater than the usage rate threshold, it is determined that expansion is required, and when the usage rate is not greater than the usage rate threshold, it is determined that expansion is not required; or, when the data volume of the database table is greater than the data volume threshold, it is determined that expansion is required, and when the data volume of the database table is not greater than the data volume threshold, it is determined that expansion is not required; or, when the database performance is less than the performance threshold, it is determined that expansion is required, and when the data volume of the database table is not less than the performance threshold, it is determined that expansion is not required. Real-time monitoring of the original database to obtain monitoring information, automatically determine whether expansion is required based on the monitoring information, without manual operation, to achieve automatic expansion of the database, more efficient.

[0058] Step S102: after all data is migrated from the original database to the expanded database, the incremental business data newly written into the original database is synchronized to the expanded database;

[0059] Among them, after creating the expanded database, this embodiment first migrates the full data of the original database to the expanded database, and then synchronizes the newly written business data except the full data in the incremental.

[0060] Further elaboration is given on the migration of all data from the original database to the expanded database. When the expanded databases are all new databases, the original database and the expanded database are independent of each other. At this time, the full data of the original database is migrated to the expanded database; when the expanded database includes a new database and the original database (all or part of the original database), part of the data in the original database can be migrated to the new database, so that the expanded database includes all the data of the original database, that is, the full data; this application no longer limits the above two methods, and users can choose according to actual needs, as long as it can achieve the purpose of this embodiment.

[0061] Furthermore, in order to ensure that the full data migration does not affect the writing of business data, the incremental synchronization of the newly written business data of the original database to the expanded database may include: caching the newly written business data in the newly created cache library of the original database, and when the full migration is completed, synchronizing the newly written business data in the newly created cache library to the expanded database, thereby ensuring uninterrupted business data operations such as writing, storage, and modification during the full data migration process.

[0062] Step S105: When there is no delay in incremental synchronization, execute the database switching operation.

[0063] In the case of incremental synchronization without delay, the database switching operation is executed to switch the database, replace the original database with the expanded database, and complete the database expansion. The business is unaware of the operation and there is no need to shut down or restart, which is more user-friendly.

[0064] Based on the above technical solution, this embodiment controls the expansion of the distributed database through the expansion version information, and controls the generation of the corresponding expanded database according to the expansion version information. The expanded database has a larger data storage capacity and / or data table volume than the original database; then a migration task is created to monitor the migration task in real time. After the full amount of data is migrated from the original database to the expanded database, incremental synchronization is performed without affecting the business processing during the expansion process. Moreover, the timing of switching the database is automatically determined according to the synchronization information of the incremental synchronization. The database expansion process is imperceptible. Through the above method, the communication time among the original business party, DBA, and component provider can be shortened, and the efficiency is greatly improved. It also avoids the problem that the business must be restarted after the expansion in the related technology, which greatly reduces the upgrade cost.

[0065] Based on any of the above embodiments, in order to facilitate business processing, this embodiment provides another database expansion method, please refer to Figure 2 , Figure 2 A schematic diagram of another method for expanding database capacity provided in an embodiment of the present application includes:

[0066] Step S101, generating a database after expansion according to the acquired expansion version information;

[0067] Step S102: after all data is migrated from the original database to the expanded database, the incremental business data newly written into the original database is synchronized to the expanded database;

[0068] Step S103, determining whether the stop writing standard of the original database is reached;

[0069] During the execution of step S102, the migration status and progress, as well as the status and progress of incremental synchronization are monitored in real time. Step S103 mainly monitors the synchronization information obtained during incremental synchronization to determine whether the stop writing standard of the original database is met. When the stop writing standard is met, the database application is in a read-only state and a write error will be reported.

[0070] When the stop writing criterion is reached, step S104 is executed. When the stop writing criterion is not reached, incremental synchronization is continued until the stop writing criterion is reached.

[0071] In an achievable implementation, step S103 includes:

[0072] Step S1031a, determining whether the delay time of incremental synchronization is within a preset time;

[0073] Step S1032a: If it is within the preset time, it is determined that the stop writing standard is reached;

[0074] Step S1033a: If it is not within the preset time, it is determined that the stop writing standard is not reached.

[0075] The preset time can be 1s, 2s, or 0.1s, and can be set by the user. The shorter the preset time, the shorter the stop writing time, and the less sensitive the database switching operation is. It can be seen that this embodiment uses the delay time in the synchronization information of incremental synchronization to determine whether the stop writing standard is met, and the method is simple.

[0076] In another achievable implementation, step S103 includes:

[0077] Step S1031b, determining whether there is newly written business data within a preset time during the incremental synchronization process;

[0078] Step S1032b: if there is no newly written business data, it is determined that the stop writing standard is reached;

[0079] Step S1033b: If there is newly written business data, it is determined that the stop writing standard is not reached.

[0080] It is understandable that it is determined whether there is traffic of the database service within the preset time. For example, when there is no traffic within 10 seconds, it is determined that the standard for stopping writing is met. For another example, when there is no traffic within 5 seconds, it is determined that the standard for stopping writing is met.

[0081] Step S104: Pushing a stop-writing event to the service end, so that the service end stops writing new service data according to the stop-writing event;

[0082] When the stop writing standard is reached, the stop writing event is pushed to the business end, and the business end will report an error for database application writing. At this time, the application is in a read-only state, and the stop writing time is achieved in seconds. During the stop writing event, incremental synchronization is still in progress. When there is no delay, step S1051 is entered.

[0083] Step S1051, when there is no delay in incremental synchronization, push the database switching event to the business end, so that the business end resets the write rule according to the database switching event; determine that the database switching operation is completed.

[0084] When incremental synchronization pushes the database switching event to the business end without delay, the business end resets the write rule according to the database switching event. The write rule is used to implement the expanded database to replace the original database and complete the database switching operation. The specific embodiment will not be repeated.

[0085] Based on any of the above embodiments, an expanded database is generated according to the obtained expanded version information, including: building a database according to the expanded version information to obtain an initial database; obtaining a source-side table creation DDL file, and building a table on a target side according to the table creation DDL file; and obtaining an expanded database according to the initial database and the expanded database table of the target side.

[0086] Among them, the source end is the original database instance information before expansion, and the target end is the database instance information after expansion. According to the expansion version information, a database is built to obtain the initial database. The size, structure, and quantity of the initial database can be determined according to the expansion version information; then, the source end table creation DDL file is obtained to establish the expanded database table with the same table structure on the target end; the expanded database is determined according to the initial database and the expanded database table on the target end. It can be understood that when the original database is two databases and two tables, and the database after expansion is two databases and four tables, there are sub-tables. Sub-tables are stored in different database tables according to different rules according to a specific sharding algorithm. The table is usually distinguished by different table suffixes. For example, a single table orders can be divided into orders_001 and orders_002; there are sub-databases, and a single database of a system is divided into multiple database instances.

[0087] Based on any of the above embodiments, in order to achieve controllable expansion risk, the database expansion method also includes: receiving a rollback instruction; and restoring the current database according to the specified expansion version information in the rollback instruction.

[0088] During the expansion process, the rollback time point of the expansion version information will be recorded. If the expansion is unsuccessful, the original data of the database can be restored to the version before the expansion through the rollback mechanism, so that the expansion can be performed again, which facilitates the rollback operation and makes the expansion risk controllable.

[0089] Based on any of the above embodiments, this embodiment provides a specific database expansion method. Figure 3 , Figure 3 A structural diagram of a specific database expansion method provided in an embodiment of the present application, wherein console is a controller, Dts is a data migration tool, Mydb is a database management tool, and App is a business end.

[0090] (1) Create a new version rule, that is, expand the version information, initiate the target end database creation, and authorize the machine running the migration task;

[0091] The user initiates an expansion instruction, the controller obtains the corresponding expansion version information according to the expansion instruction, and initiates database construction based on the expansion version information to establish the initial expanded database.

[0092] (2) Obtain the table creation DDL file on the source side and initiate the execution of the table creation DDL on the target side;

[0093] After completing the database table creation, the database is expanded.

[0094] (3) Create a migration task;

[0095] (4) Monitor the migration progress in real time. When the full data migration is completed and the incremental synchronization delay is within 1 second, the stop writing standard is reached and a stop writing event is initiated.

[0096] (5) Until there is no delay in incremental migration and the database switching standard is met, the target database permissions are granted to the currently running business end;

[0097] (6) Push database switching events to achieve database switching without business awareness.

[0098] This embodiment proposes to use version control to achieve one-click expansion of distributed databases, that is, according to different versions of the automatic creation of sub-table rules, the source and target ends of the expansion are controlled separately, and the expansion and data migration operations can be achieved without additional business configuration. The program monitors the progress of the migration in real time, and determines the timing of stopping writing and switching the database internally without manual intervention; it can also facilitate rollback operations based on version information, so that the risk of expansion can be controlled. Simplify the operating process, reduce DBA manual participation, save labor costs, and reduce risks such as misoperation. Automatically create an expansion database, assign permissions, migrate data, automatically compare data, and automatically switch databases, which can shorten the communication time between the original business party, DBA, and component provider, and more than double the efficiency; avoid the need for related technologies to restart the business after expansion, and the entire business process is imperceptible, greatly reducing the upgrade cost.

[0099] The following is an introduction to a database expansion device provided in an embodiment of the present application. The database expansion device described below and the database expansion method described above can be referred to in correspondence with each other. Figure 4 , Figure 4 A schematic diagram of a database expansion device provided in an embodiment of the present application includes:

[0100] The expanded database generation module 401 is used to generate the expanded database according to the acquired expanded version information;

[0101] Migration module 402, used to synchronize the incremental business data newly written into the original database to the expanded database after all data is migrated from the original database to the expanded database;

[0102] The database switching module 403 is used to perform a database switching operation when there is no delay in incremental synchronization.

[0103] Based on the above technical solution, this embodiment controls the expansion of the distributed database through the expansion version information, and controls the generation of the corresponding expanded database according to the expansion version information. The expanded database has a larger data storage capacity and / or data table volume than the original database; then a migration task is created to monitor the migration task in real time. After the full amount of data is migrated from the original database to the expanded database, incremental synchronization is performed without affecting the business processing during the expansion process. Moreover, the timing of switching the database is automatically determined according to the synchronization information of the incremental synchronization. The database expansion process is imperceptible. Through the above method, the communication time among the original business party, DBA, and component provider can be shortened, and the efficiency is greatly improved. It also avoids the problem that the business must be restarted after the expansion in the related technology, which greatly reduces the upgrade cost.

[0104] Preferably, it also includes:

[0105] A stop writing standard judgment module is used to judge whether the stop writing standard of the original database is met;

[0106] A stop writing module is used to push a stop writing event to the business end if the stop writing standard is reached, so that the business end stops writing new business data according to the stop writing event;

[0107] The database switching module 403 includes:

[0108] The switching database unit is used to push the switching database event to the business end when there is no delay in the incremental synchronization, so that the business end resets the writing rules according to the switching database event; and determines that the switching database operation is completed.

[0109] Preferably, the stop writing standard judgment module is used to:

[0110] Determine whether the delay time of incremental synchronization is within the preset time;

[0111] If it is within the preset time, it is determined that the stop writing standard is reached;

[0112] If it is not within the preset time, it is determined that the stop writing standard is not reached.

[0113] Preferably, the stop writing standard judgment module can also be used for:

[0114] Determine whether there is newly written business data within a preset time during the incremental synchronization process;

[0115] If there is no newly written business data, it is determined that the stop writing standard has been reached;

[0116] If there is newly written business data, it is determined that the stop writing standard has not been met.

[0117] Preferably, the expanded database generation module 401 includes:

[0118] A database building unit is used to build a database according to the expansion version information to obtain an initial database;

[0119] The table creation unit is used to obtain the table creation DDL file on the source side and create a table on the target side according to the table creation DDL file;

[0120] The expanded database obtaining unit is used to obtain the expanded database according to the initial database and the expanded database table of the target end.

[0121] Preferably, the expanded database generation module 401 includes:

[0122] The expansion version information acquisition unit is used to obtain the monitoring information of the original database and determine whether to expand the capacity according to the monitoring information; if expansion is required, the expansion version information is obtained.

[0123] Preferably, it also includes:

[0124] A rollback instruction receiving module, used for receiving a rollback instruction;

[0125] The rollback module is used to restore the current database according to the specified expansion version information in the rollback instruction.

[0126] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0127] An electronic device provided in an embodiment of the present application is introduced below. The electronic device described below and the database expansion method described above can refer to each other.

[0128] The present application also provides an electronic device, see Figure 5 As shown, Figure 5A schematic diagram of the structure of an electronic device provided in an embodiment of the present application includes:

[0129] Memory 501, used for storing computer programs;

[0130] The processor 502 is used to implement the steps of the above-mentioned database expansion method when executing a computer program.

[0131] The memory 501 includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer-readable instructions, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium. The processor 502 provides computing and control capabilities for the electronic device, and when executing the computer program stored in the memory 501, the following steps can be implemented:

[0132] Generate a database after expansion according to the obtained expansion version information;

[0133] After all data is migrated from the original database to the expanded database, the newly written business data increments of the original database are synchronized to the expanded database;

[0134] In the case of incremental synchronization without delay, the database switch operation is performed.

[0135] Based on the above technical solution, this embodiment controls the expansion of the distributed database through the expansion version information, and controls the generation of the corresponding expanded database according to the expansion version information. The expanded database has a larger data storage capacity and / or data table volume than the original database; then a migration task is created to monitor the migration task in real time. After the full amount of data is migrated from the original database to the expanded database, incremental synchronization is performed without affecting the business processing during the expansion process. Moreover, the timing of switching the database is automatically determined according to the synchronization information of the incremental synchronization. The database expansion process is imperceptible. Through the above method, the communication time among the original business party, DBA, and component provider can be shortened, and the efficiency is greatly improved. It also avoids the problem that the business must be restarted after the expansion in the related technology, which greatly reduces the upgrade cost.

[0136] In some specific embodiments, when the processor 502 executes the computer subroutine stored in the memory 501, the following steps can be implemented: determine whether the stop writing standard of the original database is met; if the stop writing standard is met, push the stop writing event to the business end, so that the business end stops writing new business data according to the stop writing event; when the incremental synchronization is delayed without delay, push the switch database event to the business end, so that the business end resets the write rules according to the switch database event; determine that the switch database operation is completed.

[0137] In some specific embodiments, when the processor 502 executes the computer subroutine stored in the memory 501, the following steps can be implemented: determine whether the delay time of the incremental synchronization is within the preset time; if it is within the preset time, determine that the stop writing standard is met; if it is not within the preset time, determine that the stop writing standard is not met.

[0138] In some specific embodiments, when the processor 502 executes the computer subroutine stored in the memory 501, the following steps can be implemented: determining whether there is newly written business data within a preset time during the incremental synchronization process; if there is no newly written business data, determining that the stop writing standard is met; if there is newly written business data, determining that the stop writing standard is not met.

[0139] In some specific embodiments, when the processor 502 executes the computer subroutine stored in the memory 501, the following steps can be implemented: building a database according to the expanded version information to obtain an initial database; obtaining a source-side table creation DDL file, and building a table on the target side according to the table creation DDL file; obtaining an expanded database based on the initial database and the expanded database table of the target side.

[0140] In some specific embodiments, when the processor 502 executes the computer subroutine stored in the memory 501, the following steps can be implemented: obtaining monitoring information of the original database, determining whether to expand the capacity according to the monitoring information; if expansion is required, obtaining expansion version information.

[0141] In some specific embodiments, when the processor 502 executes the computer subroutine stored in the memory 501, the following steps may be implemented:

[0142] receiving a rollback instruction;

[0143] Restore the current database according to the specified expansion version information in the rollback instruction.

[0144] Based on the above embodiments, as a preferred embodiment, see Figure 6 , Figure 6 A structural diagram of another electronic device provided in an embodiment of the present application, the electronic device further includes:

[0145] The input interface 503 is connected to the processor 502 and is used to obtain externally imported computer programs, parameters and instructions, and save them in the memory 501 under the control of the processor 502. The input interface 503 can be connected to an input device to receive parameters or instructions manually input by a user. The input device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the terminal housing, or a keyboard, touchpad or mouse.

[0146] The display unit 504 is connected to the processor 502 and is used to display the data sent by the processor 502. The display unit 504 can be a display screen on a PC (Personal Computer), a liquid crystal display screen, or an electronic ink display screen.

[0147] The network port 505 is connected to the processor 502 and is used for communication connection with external terminal devices. The communication technology used for the communication connection can be a wired communication technology or a wireless communication technology, such as mobile high-definition link technology (Mobile High-Definition Link, MHL), universal serial bus (Universal Serial Bus, USB), high-definition multimedia interface (High Definition Multimedia Interface, HDMI), wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, communication technology based on IEEE802.11s, etc.

[0148] Since the embodiments of the electronic device part correspond to the embodiments of the database expansion method part, the embodiments of the electronic device part refer to the description of the embodiments of the database expansion method part, which will not be repeated here.

[0149] A computer-readable storage medium provided in an embodiment of the present application is introduced below. The computer-readable storage medium described below and the method described above can be referenced to each other.

[0150] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.

[0151] Since the embodiments of the computer-readable storage medium part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the computer-readable storage medium part, which will not be repeated here.

[0152] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0153] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0154] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0155] The above is a detailed introduction to a database expansion method, device, equipment and medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. A method for expanding database capacity, characterized in that: include: Generate a database after expansion according to the obtained expansion version information; After all data is migrated from the original database to the expanded database, the incremental business data newly written to the original database is synchronized to the expanded database; In the case where there is no delay in the incremental synchronization, executing a database switching operation; In the case where there is no delay in the incremental synchronization, before executing the database switching operation, the method further includes: Determining whether a stop-writing standard of the original database is met; If the stop writing standard is reached, a stop writing event is pushed to the service end, so that the service end stops writing new service data according to the stop writing event.

2. The database expansion method according to claim 1, characterized in that: The performing of the database switching operation when there is no delay in the incremental synchronization includes: after there is no delay in the incremental synchronization, pushing the database switching event to the business end so that the business end resets the write rule according to the database switching event; and determining that the database switching operation is completed.

3. The method for expanding database capacity according to claim 2, characterized in that: The determining whether the stop writing standard of the original database is met includes: Determine whether the delay time of the incremental synchronization is within a preset time; If within the preset time, it is determined that the stop writing standard is reached; If it is not within the preset time, it is determined that the stop writing standard is not met.

4. The database expansion method according to claim 2, characterized in that: The determining whether the stop writing standard of the original database is met includes: Determine whether there is newly written business data within a preset time during the execution of the incremental synchronization process; If there is no newly written business data, it is determined that the stop writing standard is met; If there is newly written business data, it is determined that the stop writing standard is not met.

5. The method for expanding database capacity according to claim 1, characterized in that: The step of generating a database after expansion according to the acquired expansion version information includes: Building a database according to the expanded version information to obtain an initial database; Obtain a table creation DDL file on the source side, and create a table on the target side according to the table creation DDL file; The expanded database is obtained according to the initial database and the expanded database table of the target end.

6. The method for expanding database capacity according to claim 1, characterized in that: Also includes: Obtain monitoring information of the original database, and determine whether to expand capacity according to the monitoring information; If expansion is required, the expansion version information is obtained.

7. The method for expanding database capacity according to any one of claims 1 to 6, characterized in that: Also includes: receiving a rollback instruction; The current database is restored according to the specified expansion version information in the rollback instruction.

8. A database expansion device, characterized in that: include: A post-expanded database generation module is used to generate a post-expanded database according to the acquired expanded version information; A migration module, configured to synchronize the incremental business data newly written to the original database to the expanded database after all data is migrated from the original database to the expanded database; A database switching module, used for executing a database switching operation when there is no delay in the incremental synchronization; Also includes: A stop writing standard judgment module, used to judge whether the stop writing standard of the original database is met; The stop writing module is used to push a stop writing event to the service end if the stop writing standard is reached, so that the service end stops writing new service data according to the stop writing event.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the database expansion method as claimed in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the database expansion method according to any one of claims 1 to 7 are implemented.