Cross-cloud database data access method and system and storage medium
By obtaining user input information and cloud database status information, data synchronization and switching between cloud databases are realized, which solves the problem of low cloud database availability in the existing technology and improves the high availability of the system.
Patent Information
- Application Number
- CN202411050174.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-11-08
AI Technical Summary
Existing data access methods usually only have access to one cloud database, which causes low availability of cloud databases when the cloud database fails.
By obtaining user input information and cloud database status information, determine whether the switching conditions are met, sending write stop instructions and switching instructions to the database software development toolkit, realizing data synchronization and switching between cloud databases, ensuring that data is switched to other places when the data fails. Cloud database for access.
Improve the availability of cloud databases. Even if one cloud database fails, it can switch to other cloud databases for data access, ensuring high availability of the system.
Smart Images

Figure CN118916423A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of cloud databases, and in particular to a data access method, system and storage medium across cloud databases. Background Art
[0002] Cloud databases have been widely used due to their advantages such as easy deployment, high reliability, and low cost. However, existing data access methods can usually only access one cloud database. When the cloud database fails, you can only wait for the cloud database to recover before using it, resulting in low availability of the cloud database. Therefore, how to improve the availability of cloud databases has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The present application provides a cross-cloud database data access method, system and storage medium to solve the problem that the existing data access method can usually only access one cloud database, resulting in low availability of the cloud database.
[0004] In a first aspect, an embodiment of the present application provides a data access method across cloud databases, which is applied to a high availability management and control component, and the method includes:
[0005] Acquiring user input information and acquiring state information of a first cloud database, wherein the first cloud database is a cloud database that currently allows the target application to access data;
[0006] Determining whether a preset condition for cloud database switching is currently met according to the input information and the state information of the first cloud database;
[0007] In the case of determining that the preset condition for cloud database switching is currently met, sending a stop-write instruction to the database software development kit in the target application, and determining through a data synchronization component whether the data in the first cloud database is completely synchronized to the second cloud database, wherein the second cloud database is any cloud database other than the first cloud database;
[0008] When it is determined that the data in the first cloud database is completely synchronized to the second cloud database, a first switching instruction is sent to the database software development kit to switch the cloud database that accesses data with the target application to the second cloud database, and a second switching instruction is sent to the data synchronization component to switch the data synchronization direction from the second cloud database to the first cloud database.
[0009] Optionally, the determining whether a preset condition for cloud database switching is currently met according to the input information and the state information of the first cloud database includes:
[0010] determining whether the input information is a third switching instruction input by a user, and determining whether the state information of the first cloud database indicates that the first cloud database is in a fault state;
[0011] In a case where the input information is the third switching instruction and / or the state information of the first cloud database indicates that the first cloud database is in a fault state, determining that a preset condition for cloud database switching is currently satisfied;
[0012] When the input information is not the third switching instruction and the state information of the first cloud database indicates that the first cloud database is in a normal state, it is determined that the preset condition for cloud database switching is not currently met.
[0013] Optionally, after sending a first switching instruction to the database software development kit to switch the cloud database accessing data with the target application to the second cloud database, and sending a second switching instruction to the data synchronization component to synchronize data in the second cloud database to the first cloud database, the method further includes:
[0014] Acquire user input information and status information of the second cloud database;
[0015] Determining whether a preset condition for cloud database switching is currently met according to the input information and the state information of the second cloud database;
[0016] In the case of determining that the preset condition for cloud database switching is currently met, sending a stop-write instruction to the database software development toolkit, and determining, through the data synchronization component, whether the data in the second cloud database is completely synchronized to the first cloud database;
[0017] When it is determined that the data in the second cloud database is completely synchronized to the first cloud database, a fourth switching instruction is sent to the database software development kit to switch the cloud database that accesses data with the target application to the first cloud database, and a fifth switching instruction is sent to the data synchronization component to switch the data synchronization direction from the first cloud database to the second cloud database.
[0018] Optionally, obtaining the status information of the first cloud database includes:
[0019] Acquire status information of the first cloud database based on the received status message returned in real time by the first cloud database; or,
[0020] Performing a dial test on the first cloud database, and obtaining status information of the first cloud database according to the dial test result; or,
[0021] The database software development toolkit is used to monitor the status of the first cloud database, and the status information of the first cloud database is obtained from the monitoring result of the database software development toolkit.
[0022] In a second aspect, an embodiment of the present application further provides a cross-cloud database data access method, which is applied to a database software development kit, and the database software development kit is integrated into a target application, and the method includes:
[0023] receiving a stop-write instruction sent by a high availability management and control component, and controlling the target application to stop performing a data writing operation on a first cloud database according to the stop-write instruction, wherein the stop-write instruction is generated by the high availability management and control component when it is determined that a preset condition for cloud database switching is currently satisfied, the preset condition for cloud database switching is determined according to user input information and state information of the first cloud database, and the first cloud database is a cloud database that currently allows the target application to perform data access;
[0024] Receive a first switching instruction sent by the high availability management and control component, and switch the cloud database that accesses data with the target application to a second cloud database according to the first switching instruction, wherein the second cloud database is any cloud database other than the first cloud database, and the first switching instruction is generated by the high availability management and control component when it is determined that the data in the first cloud database is completely synchronized to the second cloud database.
[0025] Optionally, before receiving the stop-write instruction sent by the high availability management and control component, the method further includes:
[0026] The status of the first cloud database and the status of the second cloud database are monitored, and the monitoring results are sent to the high availability management and control component, so that the high availability management and control component obtains the status information of the first cloud database from the monitoring results.
[0027] In a third aspect, an embodiment of the present application further provides a data access method across cloud databases, which is applied to a data synchronization component, and the method includes:
[0028] receiving a second switching instruction sent by the high availability management and control component, wherein the second switching instruction is generated by the high availability management and control component when determining that a preset condition for cloud database switching is currently satisfied and determining that data in the first cloud database is completely synchronized to the second cloud database, the preset condition for cloud database switching is determined according to user input information and status information of the first cloud database, the first cloud database is a cloud database that currently allows a target application to access data, and the second cloud database is any cloud database other than the first cloud database;
[0029] According to the second switching instruction, the data synchronization direction is switched to synchronization from the second cloud database to the first cloud database.
[0030] Optionally, before receiving the second switching instruction sent by the high availability management and control component, the method further includes:
[0031] Parsing the change logs in the first cloud database and the second cloud database to obtain data changes in the first cloud database and the second cloud database;
[0032] Determining whether data changes in the first cloud database and the second cloud database are consistent;
[0033] When it is determined that the data changes in the first cloud database and the second cloud database are consistent, it is determined that the data in the first cloud database is completely synchronized to the second cloud database.
[0034] In a fourth aspect, an embodiment of the present application further provides a cross-cloud database data access system, the system comprising a high availability management and control component, a database software development kit, and a data synchronization component, the database software development kit being integrated into a target application;
[0035] The high availability management and control component is used to execute the steps of the cross-cloud database data access method described in any one of the first aspects;
[0036] The database software development kit is used to execute the steps of the cross-cloud database data access method described in any one of the second aspects;
[0037] The data synchronization component is used to execute the steps of the cross-cloud database data access method described in any one of the third aspects.
[0038] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the cross-cloud database data access method described in any one of the first aspect is implemented, or the cross-cloud database data access method described in any one of the second aspect is implemented, or the cross-cloud database data access method described in any one of the third aspect is implemented.
[0039] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application obtains the input information of the user and the status information of the first cloud database, wherein the first cloud database is the cloud database that currently allows the target application to access data; determines whether the preset condition for cloud database switching is currently met according to the input information and the status information of the first cloud database; if it is determined that the preset condition for cloud database switching is currently met, sends a stop-write instruction to the database software development toolkit in the target application, and determines whether the data in the first cloud database is completely synchronized to the second cloud database through the data synchronization component, wherein the second cloud database is any cloud database other than the first cloud database; if it is determined that the data in the first cloud database is completely synchronized to the second cloud database, sends a first switching instruction to the database software development toolkit to switch the cloud database that accesses data with the target application to the second cloud database, and sends a second switching instruction to the data synchronization component to switch the data synchronization direction from the second cloud database to the first cloud database. Through the above method, the high availability management and control component can switch the cloud database that accesses data with the target application from the first cloud database to the second cloud database when it is determined that the preset conditions for cloud database switching are currently met and the data in the first cloud database is completely synchronized to the second cloud database. In this way, even if one of the cloud databases fails, it is possible to switch to other cloud databases for data access, thereby improving the availability of the cloud database. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0041] In order to more clearly illustrate the embodiments of the present invention 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0042] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0043] Figure 1 A flowchart of a data access method across cloud databases provided in an embodiment of the present application;
[0044] Figure 2 A flowchart of another cross-cloud database data access method provided in an embodiment of the present application;
[0045] Figure 3 A flowchart of another cross-cloud database data access method provided in an embodiment of the present application;
[0046] Figure 4 A schematic diagram of the structure of a data access device across cloud databases provided in an embodiment of the present application;
[0047] Figure 5 A schematic diagram of the structure of another cross-cloud database data access device provided in an embodiment of the present application;
[0048] Figure 6 A schematic diagram of the structure of another cross-cloud database data access device provided in an embodiment of the present application;
[0049] Figure 7 A schematic diagram of the structure of a cross-cloud database data access system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] 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 making creative work are within the scope of protection of this application.
[0051] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0052] In order to solve the problem that the existing data access method can usually only access one cloud database, resulting in low cloud database availability, the present application provides a cross-cloud database data access method, system and storage medium, which can improve the availability of the cloud database.
[0053] See also Figure 1 , Figure 1 A schematic diagram of a cross-cloud database data access method provided in an embodiment of the present application. Figure 1 As shown, the cross-cloud database data access method may include the following steps:
[0054] Step 101: Obtain user input information and obtain status information of a first cloud database, wherein the first cloud database is a cloud database that currently allows a target application to access data.
[0055] It should be noted that the data access method across cloud databases provided in the embodiment of the present application is applied to a high availability (HA) control component, which can communicate with the data synchronization component and the database software development kit (SDK) in the target application. Among them, the high availability control component is mainly responsible for obtaining the user's input information and the status information of the cloud database, and sending HA control instructions to the database software development kit and the data synchronization component according to the user's input information or the status information of the cloud database. The database software development kit is based on the database driver, encapsulated with the data source dynamic switching capability, and integrated into the target application of the business. When the currently accessed cloud database is in a normal state, it is mainly responsible for receiving the data access requirements of the target application and performing routing processing; when the currently accessed cloud database is in a faulty state, it is mainly responsible for receiving the data source switching instruction of the high availability control component, and dynamically switching the data source according to the instruction. The data synchronization component is mainly responsible for parsing the cloud database change log and synchronizing the cloud database change operation from the cloud database of one cloud vendor to the cloud database of another cloud vendor. When the currently accessed cloud database is in normal state, it is mainly responsible for synchronizing data between cloud databases of cloud vendors to ensure that the data in the backup cloud database of the cloud vendor is available; when the currently accessed cloud database is in a faulty state, it is mainly responsible for receiving data synchronization direction switching instructions from the high availability management and control components to adjust the data synchronization direction between cloud databases of different cloud vendors.
[0056] It should be noted that the data synchronization component and the high availability management and control component can be deployed on any platform, which can be a physical machine, a virtual machine, a container, etc. The database software development kit can be integrated into the target application for business interaction and does not need to be deployed separately.
[0057] Specifically, the input information refers to the relevant operation information input by the user based on the interactive interface of the high availability management and control component. The state information of the first cloud database refers to the state information when the first cloud database accesses data with the target application. Based on the state information of the first cloud database, it can be determined whether the first cloud database has a fault.
[0058] Step 102: Determine whether a preset condition for cloud database switching is currently met based on the input information and the state information of the first cloud database.
[0059] In this step, the high availability control component can determine whether the preset conditions for cloud database switching are currently met based on the input information and the status information of the first cloud database. Specifically, it can be determined separately whether the input information is a switching instruction input by the user. If the input information is a switching instruction input by the user, it means that the user wants to manually switch the currently accessed cloud database, thereby determining that the preset conditions for cloud database switching are currently met; it can also be determined separately whether the status information of the first cloud database indicates that the first cloud database is in a faulty state. If the status information of the first cloud database indicates that the first cloud database is in a faulty state, it means that the first cloud database cannot be accessed normally, thereby determining that the preset conditions for cloud database switching are currently met; of course, it is also possible to comprehensively determine whether the input information is a switching instruction input by the user, and whether the status information of the first cloud database indicates that the first cloud database is in a faulty state. If the input information is a switching instruction input by the user, and the status information of the first cloud database indicates that the first cloud database is in a faulty state, it can be determined that the preset conditions for cloud database switching are currently met.
[0060] Step 103: When it is determined that the preset conditions for cloud database switching are currently met, a stop writing instruction is sent to the database software development tool kit in the target application, and a data synchronization component is used to determine whether the data in the first cloud database is completely synchronized to the second cloud database, wherein the second cloud database is any cloud database other than the first cloud database.
[0061] Specifically, the stop write instruction is used to control the database software development kit to temporarily stop writing new data to the first cloud database, so as to avoid data conflicts in the high availability management and control component during the data source switching process, resulting in inconsistent data in different cloud databases. The second cloud database can be any cloud database other than the first cloud database. Specifically, the first cloud database and the second cloud database here can be understood as databases of different cloud vendors, and the first cloud database and the second cloud database can be independent databases or independent database clusters.
[0062] Step 104: When it is determined that the data in the first cloud database is completely synchronized to the second cloud database, a first switching instruction is sent to the database software development kit to switch the cloud database that accesses data with the target application to the second cloud database, and a second switching instruction is sent to the data synchronization component to switch the data synchronization direction from the second cloud database to the first cloud database.
[0063] Specifically, the first switching instruction is used to control the database software development kit to switch the cloud database for data access with the target application from the first cloud database to the second cloud database. The second switching instruction is used to control the data synchronization component to switch the data synchronization direction.
[0064] In this embodiment, the high availability management and control component can switch the cloud database that accesses data with the target application from the first cloud database to the second cloud database when it is determined that the preset conditions for cloud database switching are currently met and the data in the first cloud database is completely synchronized to the second cloud database. In this way, even if one of the cloud databases fails, it is possible to switch to other cloud databases for data access, thereby improving the availability of the cloud database.
[0065] Furthermore, the above step 102, determining whether a preset condition for cloud database switching is currently met according to the input information and the state information of the first cloud database, includes:
[0066] determining whether the input information is a third switching instruction input by a user, and determining whether the state information of the first cloud database indicates that the first cloud database is in a fault state;
[0067] When the input information is the third switching instruction and / or the state information of the first cloud database indicates that the first cloud database is in a fault state, determining that a preset condition for cloud database switching is currently satisfied;
[0068] When the input information is not the third switching instruction and the state information of the first cloud database indicates that the first cloud database is in a normal state, it is determined that the preset condition for cloud database switching is not currently met.
[0069] In one embodiment, when determining whether the preset conditions for cloud database switching are currently met, the high availability management and control component may first determine whether the input information is a third switching instruction input by the user, and determine whether the state information of the first cloud database indicates that the first cloud database is in a faulty state. If the input information is the third switching instruction and / or the state information of the first cloud database indicates that the first cloud database is in a faulty state, it may be determined that the preset conditions for cloud database switching are currently met. If the input information is not the third switching instruction and the state information of the first cloud database indicates that the first cloud database is in a normal state, it may be determined that the preset conditions for cloud database switching are currently not met.
[0070] In this way, it is possible to determine whether the preset conditions for cloud database switching are currently met based on the user's input information and the status information of the first cloud database, so as to implement manual switching and automatic switching of the cloud database, thereby improving the flexibility of cloud database switching.
[0071] Furthermore, after the above step 104, sending a first switching instruction to the database software development kit to switch the cloud database accessing data with the target application to the second cloud database, and sending a second switching instruction to the data synchronization component to synchronize the data in the second cloud database to the first cloud database, the method further includes:
[0072] Obtain user input information and status information of the second cloud database;
[0073] Determining whether a preset condition for cloud database switching is currently met according to the input information and the status information of the second cloud database;
[0074] When it is determined that the preset conditions for cloud database switching are currently met, a stop-write instruction is sent to the database software development tool kit, and a data synchronization component is used to determine whether the data in the second cloud database is completely synchronized to the first cloud database;
[0075] When it is determined that the data in the second cloud database is completely synchronized to the first cloud database, a fourth switching instruction is sent to the database software development kit to switch the cloud database that accesses data with the target application to the first cloud database, and a fifth switching instruction is sent to the data synchronization component to switch the data synchronization direction from the first cloud database to the second cloud database.
[0076] In one embodiment, when the target application switches from accessing the second cloud database to accessing the first cloud database, the high availability management component also needs to obtain the user's input information and the status information of the second cloud database, and determine whether the preset conditions for cloud database switching are currently met based on the input information and the status information of the second cloud database. If it is determined that the preset conditions for cloud database switching are currently met, a stop write instruction is sent to the database software development toolkit, and the data synchronization component is used to determine whether the data in the second cloud database is completely synchronized to the first cloud database. And when it is determined that the data in the second cloud database is completely synchronized to the first cloud database, a fourth switching instruction is sent to the database software development toolkit to switch the cloud database that accesses data with the target application to the first cloud database, and a fifth switching instruction is sent to the data synchronization component to switch the data synchronization direction from the first cloud database to the second cloud database.
[0077] By adopting the above method, when the second cloud database fails or receives a switching instruction from the user again, the target application can be switched from accessing the second cloud database to accessing the first cloud database, so as to improve the availability of the cloud database.
[0078] Furthermore, the above step 101, obtaining the status information of the first cloud database, includes:
[0079] Based on the received status message returned in real time by the first cloud database, the status information of the first cloud database is obtained; or,
[0080] Performing a dial test on the first cloud database, and obtaining status information of the first cloud database according to the dial test result; or,
[0081] The state of the first cloud database is monitored using a database software development tool kit, and the state information of the first cloud database is obtained from the monitoring result of the database software development tool kit.
[0082] As an optional implementation, the high availability management and control component may receive a status message returned by the first cloud database in real time, and then obtain the status information of the first cloud database based on the received status message returned by the first cloud database in real time.
[0083] As another optional implementation, the high availability management and control component can also perform a dial test on the first cloud database and obtain the status information of the first cloud database according to the dial test result. The dial test here is a method of testing the performance and availability of the cloud database service by simulating user requests and accesses. The importance of the dial test is that it can help to timely discover potential cloud database problems and ensure the high availability and performance of the cloud database.
[0084] As another optional implementation, the high availability management and control component may monitor the status of the first cloud database using a database software development toolkit, and obtain the status information of the first cloud database from the monitoring result of the database software development toolkit.
[0085] Through the above manner, the high availability management and control component can flexibly obtain the status information of the first cloud database, so as to facilitate the subsequent determination of whether to switch the cloud database based on the obtained status information of the first cloud database.
[0086] See also Figure 2 , Figure 2 A flowchart of another cross-cloud database data access method provided in an embodiment of the present application. Figure 2 As shown, the cross-cloud database data access method may include the following steps:
[0087] Step 201: Receive a stop-write instruction sent by a high availability management and control component, and control the target application to stop performing data writing operations on a first cloud database according to the stop-write instruction, wherein the stop-write instruction is generated by the high availability management and control component when it is determined that a preset condition for cloud database switching is currently met, and the preset condition for cloud database switching is determined based on user input information and status information of the first cloud database, and the first cloud database is a cloud database that currently allows the target application to access data.
[0088] It should be noted that the cross-cloud database data access method provided in the embodiment of the present application is applied to a database software development kit, which can be communicated with a data synchronization component and a high availability control component. Among them, the high availability control component is mainly responsible for obtaining the user's input information and the status information of the cloud database, and sending HA control instructions to the database software development kit and the data synchronization component according to the user's input information or the status information of the cloud database. The database software development kit is based on the database driver, encapsulated with the data source dynamic switching capability, and integrated into the target application of the business. When the currently accessed cloud database is in a normal state, it is mainly responsible for receiving the data access requirements of the target application and performing routing processing; when the currently accessed cloud database is in a faulty state, it is mainly responsible for receiving the data source switching instruction of the high availability control component, and dynamically switching the data source according to the instruction. The data synchronization component is mainly responsible for parsing the cloud database change log and synchronizing the cloud database change operation from a cloud database of one cloud vendor to a cloud database of another cloud vendor. When the currently accessed cloud database is in normal state, it is mainly responsible for synchronizing data between cloud databases of cloud vendors to ensure that the data in the backup cloud database of the cloud vendor is available; when the currently accessed cloud database is in a faulty state, it is mainly responsible for receiving data synchronization direction switching instructions from the high availability management and control components to adjust the data synchronization direction between cloud databases of different cloud vendors.
[0089] Specifically, the above-mentioned input information refers to the relevant operation information input by the user based on the interactive interface of the high availability management and control component. The status information of the above-mentioned first cloud database refers to the status information when the first cloud database accesses data with the target application. Based on the status information of the first cloud database, it can be determined whether the first cloud database has a fault. The above-mentioned stop write instruction is used to control the database software development kit to temporarily stop writing new data to the first cloud database. The above-mentioned second cloud database can be any cloud database other than the first cloud database. Specifically, the first cloud database and the second cloud database here can be understood as databases of different cloud vendors. The first cloud database and the second cloud database can be independent databases or independent database clusters.
[0090] In this step, the high availability control component can obtain the user's input information and the status information of the first cloud database, and then determine whether the preset conditions for cloud database switching are currently met based on the input information and the status information of the first cloud database. Then, when the high availability control component determines that the preset conditions for cloud database switching are currently met, it sends a stop-write instruction to the database software development toolkit in the target application, so that the database software development toolkit can receive the stop-write instruction sent by the high availability control component, and control the target application to stop writing data to the first cloud database according to the stop-write instruction, so as to avoid data conflicts in the high availability control component during the data source switching process, resulting in inconsistent data in different cloud databases.
[0091] Step 202: Receive a first switching instruction sent by the high availability control component, and switch the cloud database that accesses data with the target application to a second cloud database according to the first switching instruction, wherein the second cloud database is any cloud database other than the first cloud database, and the first switching instruction is generated by the high availability control component when it is determined that the data in the first cloud database is completely synchronized to the second cloud database.
[0092] Specifically, the first switching instruction is used to control the database software development toolkit to switch the cloud database that performs data access with the target application from the first cloud database to the second cloud database.
[0093] When the high availability management and control component determines that the data in the first cloud database is completely synchronized to the second cloud database, it can send a first switching instruction to the database software development tool kit. In this way, the database software development tool kit can receive the first switching instruction sent by the high availability management and control component, and switch the cloud database that accesses data with the target application to the second cloud database according to the first switching instruction.
[0094] In this embodiment, the high availability management and control component can switch the cloud database that accesses data with the target application from the first cloud database to the second cloud database when it is determined that the preset conditions for cloud database switching are currently met and the data in the first cloud database is completely synchronized to the second cloud database. In this way, even if one of the cloud databases fails, it is possible to switch to other cloud databases for data access, thereby improving the availability of the cloud database.
[0095] Furthermore, before the above step 201, receiving the stop writing instruction sent by the high availability management and control component, the method further includes:
[0096] The status of the first cloud database and the status of the second cloud database are monitored, and the monitoring results are sent to the high availability management and control component, so that the high availability management and control component obtains the status information of the first cloud database from the monitoring results.
[0097] In one embodiment, the database software development tool kit can monitor the status of the first cloud database and the status of the second cloud database, and send the monitoring results to the high availability management and control component, so that the high availability management and control component can obtain the status information of the first cloud database from the monitoring results, so as to facilitate the subsequent judgment of whether to switch the cloud database based on the obtained status information of the first cloud database.
[0098] See also Figure 3 , Figure 3 A flowchart of another cross-cloud database data access method provided in an embodiment of the present application. Figure 3 As shown, the cross-cloud database data access method may include the following steps:
[0099] Step 301: Receive a second switching instruction sent by the high availability control component, wherein the second switching instruction is generated by the high availability control component when it is determined that a preset condition for cloud database switching is currently met and that data in the first cloud database is completely synchronized to the second cloud database, the preset condition for cloud database switching is determined based on user input information and status information of the first cloud database, the first cloud database is a cloud database that currently allows a target application to access data, and the second cloud database is any cloud database other than the first cloud database;
[0100] Step 302: According to the second switching instruction, the data synchronization direction is switched to synchronization from the second cloud database to the first cloud database.
[0101] It should be noted that the data access method across cloud databases provided in the embodiment of the present application is applied to the data synchronization component, which can be communicated and connected with the database software development kit and the high availability control component. Among them, the high availability control component is mainly responsible for obtaining the user's input information and the status information of the cloud database, and sending HA control instructions to the database software development kit and the data synchronization component according to the user's input information or the status information of the cloud database. The database software development kit is based on the database driver, encapsulates the data source dynamic switching capability, and is integrated into the target application of the business. When the currently accessed cloud database is in a normal state, it is mainly responsible for receiving the data access requirements of the target application and performing routing processing; when the currently accessed cloud database is in a faulty state, it is mainly responsible for receiving the data source switching instruction of the high availability control component, and dynamically switching the data source according to the instruction. The data synchronization component is mainly responsible for parsing the cloud database change log and synchronizing the cloud database change operation from a cloud database of one cloud vendor to a cloud database of another cloud vendor. When the currently accessed cloud database is in normal state, it is mainly responsible for synchronizing data between cloud databases of cloud vendors to ensure that the data in the backup cloud database of the cloud vendor is available; when the currently accessed cloud database is in a faulty state, it is mainly responsible for receiving data synchronization direction switching instructions from the high availability management and control components to adjust the data synchronization direction between cloud databases of different cloud vendors.
[0102] Specifically, the second switching instruction is used to control the data synchronization component to switch the data synchronization direction.
[0103] When the high availability control component determines that the data in the first cloud database is completely synchronized to the second cloud database, it can send a second switching instruction to the data synchronization component, so that the data synchronization component can receive the second switching instruction sent by the high availability control component and switch the data synchronization direction from the second cloud database to the first cloud database according to the second switching instruction. In this way, when switching cloud databases, the data synchronization direction between cloud databases of different cloud vendors can be adjusted in time to ensure data consistency.
[0104] Furthermore, before receiving the second switching instruction sent by the high availability management and control component, the method further includes:
[0105] Parse the change logs in the first cloud database and the second cloud database to obtain data changes in the first cloud database and the second cloud database;
[0106] Determine whether the data changes in the first cloud database and the second cloud database are consistent;
[0107] When it is determined that the data changes in the first cloud database and the second cloud database are consistent, it is determined that the data in the first cloud database is completely synchronized to the second cloud database.
[0108] In one embodiment, the data synchronization component can parse the change logs in the first cloud database and the second cloud database to obtain the data changes in the first cloud database and the second cloud database, and then determine whether the data changes in the first cloud database and the second cloud database are consistent. If the data changes in the first cloud database and the second cloud database are consistent, it can be determined that the data in the first cloud database is completely synchronized to the second cloud database, thereby avoiding data conflicts during the data source switching process of the high availability management and control component, resulting in inconsistent data in different cloud databases.
[0109] See also Figure 4 , Figure 4 A schematic diagram of a cross-cloud database data access device provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the cross-cloud database data access device is applied to a high availability management and control component, and the device 400 includes:
[0110] A first acquisition module 401 is used to acquire user input information and acquire state information of a first cloud database, wherein the first cloud database is a cloud database that currently allows the target application to access data;
[0111] A first determination module 402, configured to determine whether a preset condition for cloud database switching is currently met according to input information and state information of the first cloud database;
[0112] A first sending module 403 is used to send a stop-write instruction to the database software development kit in the target application when it is determined that the preset condition for cloud database switching is currently met, and determine whether the data in the first cloud database is completely synchronized to the second cloud database through the data synchronization component, wherein the second cloud database is any cloud database other than the first cloud database;
[0113] The second sending module 404 is used to send a first switching instruction to the database software development kit to switch the cloud database that accesses data with the target application to the second cloud database when it is determined that the data in the first cloud database is completely synchronized to the second cloud database, and send a second switching instruction to the data synchronization component to switch the data synchronization direction from the second cloud database to the first cloud database.
[0114] Further, the first determining module 402 includes:
[0115] a judgment submodule, configured to judge whether the input information is a third switching instruction input by a user, and to judge whether the state information of the first cloud database indicates that the first cloud database is in a fault state;
[0116] A first determining submodule, configured to determine that a preset condition for cloud database switching is currently satisfied when the input information is a third switching instruction and / or the state information of the first cloud database indicates that the first cloud database is in a fault state;
[0117] The second determining submodule is configured to determine that a preset condition for cloud database switching is not currently satisfied when the input information is not the third switching instruction and the state information of the first cloud database indicates that the first cloud database is in a normal state.
[0118] Furthermore, the device 400 further includes:
[0119] A second acquisition module, used to acquire user input information and state information of a second cloud database;
[0120] A second determination module, configured to determine whether a preset condition for cloud database switching is currently met based on the input information and the state information of the second cloud database;
[0121] A third sending module is used to send a stop-write instruction to the database software development kit when it is determined that the preset conditions for cloud database switching are currently met, and determine whether the data in the second cloud database is completely synchronized to the first cloud database through the data synchronization component;
[0122] The fourth sending module is used to send a fourth switching instruction to the database software development kit to switch the cloud database that accesses data with the target application to the first cloud database when it is determined that the data in the second cloud database is completely synchronized to the first cloud database, and send a fifth switching instruction to the data synchronization component to switch the data synchronization direction from the first cloud database to the second cloud database.
[0123] Furthermore, the first acquisition module 401 includes:
[0124] A first acquisition submodule is configured to acquire status information of the first cloud database based on a status message received in real time from the first cloud database; or
[0125] The second acquisition submodule is used to perform a dial test on the first cloud database and obtain the status information of the first cloud database according to the dial test result; or,
[0126] The third acquisition submodule is used to monitor the status of the first cloud database using the database software development toolkit, and obtain the status information of the first cloud database from the monitoring result of the database software development toolkit.
[0127] It should be noted that the device 400 can implement the above Figure 1 The method embodiments shown provide a data access method across cloud databases and can achieve the same technical effect, which will not be described in detail here.
[0128] See also Figure 5 , Figure 5 A schematic diagram of the structure of another cross-cloud database data access device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the cross-cloud database data access device is applied to a database software development kit, and the database software development kit is integrated into a target application. The device 500 includes:
[0129] The control module 501 is used to receive a stop-write instruction sent by the high availability management and control component, and control the target application to stop performing data writing operations on the first cloud database according to the stop-write instruction, wherein the stop-write instruction is generated by the high availability management and control component when it is determined that a preset condition for cloud database switching is currently met, and the preset condition for cloud database switching is determined according to user input information and state information of the first cloud database, and the first cloud database is a cloud database that currently allows the target application to perform data access;
[0130] The first switching module 502 is used to receive a first switching instruction sent by the high availability control component, and switch the cloud database that accesses data with the target application to the second cloud database according to the first switching instruction, wherein the second cloud database is any cloud database except the first cloud database, and the first switching instruction is generated by the high availability control component when it is determined that the data in the first cloud database is completely synchronized to the second cloud database.
[0131] Furthermore, the device 500 also includes:
[0132] The monitoring module is used to monitor the status of the first cloud database and the status of the second cloud database, and send the monitoring results to the high availability management and control component, so that the high availability management and control component obtains the status information of the first cloud database from the monitoring results.
[0133] It should be noted that the device 500 can implement the above Figure 2 The method embodiments shown provide a data access method across cloud databases and can achieve the same technical effect, which will not be described in detail here.
[0134] See also Figure 6 , Figure 6 A schematic diagram of the structure of another cross-cloud database data access device provided in an embodiment of the present application is shown in FIG. Figure 6As shown, the cross-cloud database data access device is applied to a data synchronization component, and the device 600 includes:
[0135] The receiving module 601 is used to receive a second switching instruction sent by the high availability control component, wherein the second switching instruction is generated by the high availability control component when it is determined that a preset condition for cloud database switching is currently met and that data in the first cloud database is completely synchronized to the second cloud database, the preset condition for cloud database switching is determined based on user input information and status information of the first cloud database, the first cloud database is a cloud database that currently allows the target application to access data, and the second cloud database is any cloud database other than the first cloud database;
[0136] The second switching module 602 is used to switch the data synchronization direction to synchronization from the second cloud database to the first cloud database according to the second switching instruction.
[0137] Furthermore, the device 600 further includes:
[0138] A parsing module, used to parse the change logs in the first cloud database and the second cloud database to obtain data changes in the first cloud database and the second cloud database;
[0139] A judgment module, used to judge whether the data changes in the first cloud database and the second cloud database are consistent;
[0140] The third determination module is used to determine that the data in the first cloud database is completely synchronized to the second cloud database when it is determined that the data changes in the first cloud database and the second cloud database are consistent.
[0141] It should be noted that the device 600 can implement the above Figure 3 The method embodiments shown provide a data access method across cloud databases and can achieve the same technical effect, which will not be described in detail here.
[0142] See also Figure 7 , Figure 7 A schematic diagram of a cross-cloud database data access system provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the cross-cloud database data access system includes: a high availability management and control component, a database software development kit, and a data synchronization component, and the database software development kit is integrated into the target application;
[0143] Among them, the high availability control component is used to perform the above Figure 1 The steps of the cross-cloud database data access method provided by the method embodiment shown;
[0144] Database software development kit is used to perform the above Figure 2 The steps of the cross-cloud database data access method provided by the method embodiment shown;
[0145] The data synchronization component is used to perform the above Figure 3 The method embodiment shown provides steps of a method for accessing data across cloud databases.
[0146] It should be noted that since the relevant execution steps of the high availability management and control component, the database software development toolkit and the data synchronization component have been described in detail in the above embodiments, they are not limited here.
[0147] The data access and synchronization process of the cross-cloud database data access system in this application under normal circumstances is as follows:
[0148] 1. Normally deploy cloud database services of two public clouds, including cloud database A of public cloud vendor A and cloud database B of public cloud vendor B;
[0149] 2. Cloud database A provides services. That is, when the data access requirements of the target application reach the database software development kit, the database software development kit routes them to cloud database A.
[0150] 3. The data synchronization component monitors the data change log of cloud database A. When there is a data change, the data change is synchronously copied to cloud database B;
[0151] 4. The high availability management and control component connects to the monitoring alarms of cloud database A and cloud database B to monitor the status of the two cloud databases in real time.
[0152] The switching process of the cross-cloud database data access system in this application when a cloud database fails includes:
[0153] 1. When the high availability control component detects that cloud database A has failed, or receives an instruction from the operation and maintenance personnel to manually switch the cloud database, the high availability control component sends a stop-write instruction to the database software development toolkit. After receiving the instruction, the database software development toolkit temporarily stops writing new data to avoid data conflicts and data inconsistency during the data source switching process;
[0154] 3. The high availability control component queries the status of the data synchronization component, confirms that all the data of cloud database A has been synchronized to cloud database B, and then sends a data synchronization direction switching instruction to the data synchronization component;
[0155] 4. The data synchronization component switches the data synchronization direction to monitor the data change log of cloud database B and replicate the data changes to cloud database A;
[0156] 5. The high availability management and control component sends instructions to the database software development kit to switch the data source and resume data writing;
[0157] 6. After receiving the instruction, the database software development toolkit re-allows the business's data write request and switches all read and write operations to cloud database B for execution.
[0158] It should be noted that the above data switching process is equal. After switching to cloud database B, if cloud database B fails and cloud database A has recovered, the high availability management component can issue instructions to switch the data source back to cloud database A. That is, the two cloud databases back up each other, and as long as one cloud database is normal, the database service can be provided normally.
[0159] It can be seen that the cross-cloud database data access system in this application has the following beneficial effects:
[0160] 1. Provide database software development tools and add the ability to dynamically switch data sources to the database software development tools. This allows flexible switching of data sources in the event of data source failures. Compared with proxy solutions, it has higher availability, better performance, and lower costs.
[0161] 2. Parse the database change log through the data synchronization component and establish data synchronization capabilities between databases of different cloud vendors, making high availability of multiple cloud databases possible;
[0162] 3. The failover process of stopping writing first, confirming the synchronization status, and then switching ensures data consistency during the data source switching process.
[0163] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the cross-cloud database data access method provided by any of the aforementioned method embodiments is implemented.
[0164] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0165] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0166] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0167] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A data access method across cloud databases, characterized in that: Applied to a high availability management and control component, the method includes: Acquiring user input information and acquiring state information of a first cloud database, wherein the first cloud database is a cloud database that currently allows the target application to access data; Determining whether a preset condition for cloud database switching is currently met according to the input information and the state information of the first cloud database; In the case of determining that the preset condition for cloud database switching is currently met, sending a stop-write instruction to the database software development kit in the target application, and determining through a data synchronization component whether the data in the first cloud database is completely synchronized to the second cloud database, wherein the second cloud database is any cloud database other than the first cloud database; When it is determined that the data in the first cloud database is completely synchronized to the second cloud database, a first switching instruction is sent to the database software development kit to switch the cloud database that accesses data with the target application to the second cloud database, and a second switching instruction is sent to the data synchronization component to switch the data synchronization direction from the second cloud database to the first cloud database.
2. The method according to claim 1, characterized in that The determining, according to the input information and the state information of the first cloud database, whether a preset condition for cloud database switching is currently met includes: determining whether the input information is a third switching instruction input by a user, and determining whether the state information of the first cloud database indicates that the first cloud database is in a fault state; In a case where the input information is the third switching instruction and / or the state information of the first cloud database indicates that the first cloud database is in a fault state, determining that a preset condition for cloud database switching is currently satisfied; When the input information is not the third switching instruction and the state information of the first cloud database indicates that the first cloud database is in a normal state, it is determined that the preset condition for cloud database switching is not currently met.
3. The method according to claim 1, characterized in that After sending a first switching instruction to the database software development kit to switch the cloud database accessing data with the target application to the second cloud database, and sending a second switching instruction to the data synchronization component to synchronize data in the second cloud database to the first cloud database, the method further includes: Acquire user input information and status information of the second cloud database; Determining whether a preset condition for cloud database switching is currently met according to the input information and the state information of the second cloud database; In the case of determining that the preset condition for cloud database switching is currently met, sending a stop-write instruction to the database software development toolkit, and determining, through the data synchronization component, whether the data in the second cloud database is completely synchronized to the first cloud database; When it is determined that the data in the second cloud database is completely synchronized to the first cloud database, a fourth switching instruction is sent to the database software development kit to switch the cloud database that accesses data with the target application to the first cloud database, and a fifth switching instruction is sent to the data synchronization component to switch the data synchronization direction from the first cloud database to the second cloud database.
4. The method according to claim 1, characterized in that: The obtaining of the status information of the first cloud database includes: Acquire status information of the first cloud database based on the received status message returned in real time by the first cloud database; or, Performing a dial test on the first cloud database, and obtaining status information of the first cloud database according to the dial test result; or, The database software development toolkit is used to monitor the status of the first cloud database, and the status information of the first cloud database is obtained from the monitoring result of the database software development toolkit.
5. A data access method across cloud databases, characterized in that: Applied to a database software development kit, the database software development kit is integrated into a target application, the method comprising: receiving a stop-write instruction sent by a high availability management and control component, and controlling the target application to stop performing a data writing operation on a first cloud database according to the stop-write instruction, wherein the stop-write instruction is generated by the high availability management and control component when it is determined that a preset condition for cloud database switching is currently satisfied, the preset condition for cloud database switching is determined according to user input information and state information of the first cloud database, and the first cloud database is a cloud database that currently allows the target application to perform data access; Receive a first switching instruction sent by the high availability management and control component, and switch the cloud database that accesses data with the target application to a second cloud database according to the first switching instruction, wherein the second cloud database is any cloud database other than the first cloud database, and the first switching instruction is generated by the high availability management and control component when it is determined that the data in the first cloud database is completely synchronized to the second cloud database.
6. The method according to claim 5, characterized in that Before receiving the stop-write instruction sent by the high availability management and control component, the method further includes: The status of the first cloud database and the status of the second cloud database are monitored, and the monitoring results are sent to the high availability management and control component, so that the high availability management and control component obtains the status information of the first cloud database from the monitoring results.
7. A data access method across cloud databases, characterized in that: Applied to a data synchronization component, the method includes: receiving a second switching instruction sent by the high availability management and control component, wherein the second switching instruction is generated by the high availability management and control component when it is determined that a preset condition for cloud database switching is currently satisfied and that data in the first cloud database is completely synchronized to the second cloud database, the preset condition for cloud database switching is determined according to user input information and status information of the first cloud database, the first cloud database is a cloud database that currently allows a target application to access data, and the second cloud database is any cloud database other than the first cloud database; According to the second switching instruction, the data synchronization direction is switched to synchronization from the second cloud database to the first cloud database.
8. The method according to claim 7, characterized in that Before receiving the second switching instruction sent by the high availability management and control component, the method further includes: Parsing the change logs in the first cloud database and the second cloud database to obtain data changes in the first cloud database and the second cloud database; Determining whether data changes in the first cloud database and the second cloud database are consistent; When it is determined that the data changes in the first cloud database and the second cloud database are consistent, it is determined that the data in the first cloud database is completely synchronized to the second cloud database.
9. A data access system across cloud databases, characterized in that: The system includes a high availability management and control component, a database software development kit, and a data synchronization component, wherein the database software development kit is integrated into a target application; Wherein, the high availability management and control component is used to execute the steps of the cross-cloud database data access method according to any one of claims 1 to 4; The database software development kit is used to execute the steps of the cross-cloud database data access method according to any one of claims 5 to 6; The data synchronization component is used to execute the steps of the cross-cloud database data access method described in any one of claims 7-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the cross-cloud database data access method described in any one of claims 1-4, or implements the cross-cloud database data access method described in any one of claims 5-6, or implements the cross-cloud database data access method described in any one of claims 7-8.
Citation Information
Patent Citations
Database switching method, computer equipment and storage medium
CN115640281A
Cloud resource switching method and device based on multi-cloud management platform, equipment and medium
CN117118814A
Database switching method and device, computer equipment and system storage medium
CN117785972A
