Relational database deployment method and device, equipment and medium
By deploying the primary and standby relational databases on two virtual machines and synchronizing data changes in real time using proxy distribution software, the problems of high database deployment costs and long delays in failure migration in the existing technology are solved, and strong consistency of low-cost and efficient database deployment and real-time data transmission is achieved.
Patent Information
- Application Number
- CN202412000492.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art requires at least three virtual machines when deploying relational databases, resulting in high configuration and high cost in the environment, and the inability to achieve high availability and fast failure migration, and the failure migration delay is high.
By creating two virtual machines, deploying the main and standby relational databases respectively, and using proxy distribution software to synchronize data changes in real time, real-time data transmission and strong consistency.
It realizes low-cost and high-efficiency relational database deployment, ensures real-time data transmission and strong consistency, reduces the delay of failure migration, and improves the risk resistance of the database.
Smart Images

Figure CN119806752A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data storage, and in particular to a relational database deployment method, device, equipment and medium. Background Art
[0002] In the related art, when deploying a database, the method usually chosen is to deploy the relational database into a virtual machine created in a server cluster, and to achieve data sharing by sharing hard disks between virtual machines. The shared hard disks are connected through the multi-copy mode of RAC (Real Application Cluster) to achieve data protection and high availability of the relational database. By creating three independent virtual machines that share a hard disk on a server cluster, the virtual machines are deployed on different host hosts, and then a relational database is deployed on each virtual machine. The three virtual machines are mutually active and standby. At the same time, only the active node provides services to the outside. When the active node fails, it switches to a random standby node. The RAC cluster provides services to the outside through a virtual IP (Internet Protocol).
[0003] However, this method has its drawbacks. It requires at least three virtual machines to be configured, has high requirements for the environment in which the relational database is deployed, and also requires more costs. At the same time, since the virtual machines need to be configured with shared disks, it is impossible to achieve high availability and fast fault migration of the relational database. During the fault migration process, the operation logs need to be read and analyzed, resulting in a high delay in the fault migration.
[0004] Therefore, a low-cost, high-efficiency, relational database deployment method with real-time data transmission and strong consistency is urgently needed. Summary of the invention
[0005] Based on the above technical problems, the embodiments of the present application provide a relational database deployment method, device, equipment and medium, aiming to deploy a relational database at low cost and high efficiency, and to achieve real-time data transmission with strong consistency.
[0006] A first aspect of an embodiment of the present application provides a relational database deployment method, the method comprising:
[0007] In response to the establishment instruction of the relational database, a first virtual machine and a second virtual machine are created, and agent distribution software is deployed on the first virtual machine and the second virtual machine respectively;
[0008] Setting a primary relational database in the first virtual machine and a backup relational database in the second virtual machine, wherein the backup relational database is a backup of the primary relational database;
[0009] In response to a data change instruction, the data change instruction is sent to the first virtual machine through the proxy distribution software, and the storage content of the primary relational database is changed through the first virtual machine, and a first change log is generated, where the first change log is used to record the changed content;
[0010] sending the first change log to the second virtual machine through the agent distribution software;
[0011] According to the content of the first change log, the change content is parsed by the second virtual machine, and the content stored in the standby relational database is changed.
[0012] Optionally, the method further comprises:
[0013] Deploy a first relational database component on the first virtual machine, and deploy a second relational database component on the second virtual machine, wherein the first relational database component and the second relational database component form a two-node cluster, and the two-node cluster is used to detect and store the working status of the virtual machines in the cluster;
[0014] Deploying virtual address management software on the first virtual machine and the second virtual machine respectively;
[0015] Sending the working status of the first virtual machine and the second virtual machine to the virtual address management software through the dual-node cluster;
[0016] According to the working status of the first virtual machine and the second virtual machine, a virtualization access interface is provided to the user terminal through the virtual address management software, so that the user terminal can realize virtualization access to the primary relational database or the backup relational database through the virtualization access interface.
[0017] Optionally, the method further comprises:
[0018] Switching the first virtual machine and the second virtual machine through the two-node cluster according to the working status of the first virtual machine and the second virtual machine;
[0019] In response to the first virtual machine being unavailable, the virtualization access interface is switched from being connected to the first virtual machine to being connected to the second virtual machine through the dual-node cluster.
[0020] Optionally, the method further comprises:
[0021] Creating a lock file by the two-node cluster, wherein the lock file is shared by the first virtual machine and the second virtual machine;
[0022] The two-node cluster queries the renewal record in the lock file to determine whether the first virtual machine or the second virtual machine is unavailable;
[0023] When the first virtual machine renews the lock file, it is determined that the first virtual machine is available; when the second virtual machine renews the lock file, it is determined that the second virtual machine is available.
[0024] Optionally, the method further comprises:
[0025] Creating a lock file by the two-node cluster, wherein the lock file is shared by the first virtual machine and the second virtual machine;
[0026] When the first virtual machine is connected to the virtualization access interface, the first virtual machine renews the lock file;
[0027] In response to a communication anomaly between the first virtual machine and the second virtual machine, the two-node cluster queries a renewal record in the lock file to determine a virtual machine connected to the virtualization access interface;
[0028] In response to the first virtual machine being unavailable, switching the virtualization access interface from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster includes:
[0029] In response to the first virtual machine not renewing the lock file, it is determined that the first virtual machine is unavailable, and the virtualization access interface is switched from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster.
[0030] Optionally, the method further comprises:
[0031] Creating a shared storage area in the two-node cluster, the first virtual machine and the second virtual machine both having access rights to the shared storage area;
[0032] Storing the lock file in the shared storage area;
[0033] When the first virtual machine is connected to the virtualization access interface, renewing the lock file by accessing the shared storage area;
[0034] When the second virtual machine is connected to the virtualization access interface, the lock file is renewed by accessing the shared storage area.
[0035] Optionally, in response to a communication anomaly between the first virtual machine and the second virtual machine, the two-node cluster queries a renewal record in the lock file to determine a virtual machine connected to the virtualization access interface, and the method further includes:
[0036] In response to the renewal record in the lock file being that the lock file is renewed by the first virtual machine, determining that the virtual machine connected to the virtualization access interface is the first virtual machine, and synchronizing the storage content of the standby relational database in the second virtual machine with the storage content of the primary relational database in the first virtual machine;
[0037] In response to the renewal record in the lock file renewing the lock file for the second virtual machine, the virtual machine connected to the virtualization access interface is determined to be the second virtual machine, and the storage content of the primary relational database in the first virtual machine is synchronized with the storage content of the backup relational database in the second virtual machine.
[0038] A second aspect of an embodiment of the present application provides a relational database deployment device, the device comprising:
[0039] A virtual machine creation module, configured to create a first virtual machine and a second virtual machine in response to an instruction to establish a relational database, and to deploy agent distribution software on the first virtual machine and the second virtual machine respectively;
[0040] A relational database setting module, used to set a primary relational database in the first virtual machine and a backup relational database in the second virtual machine, wherein the backup relational database is a backup of the primary relational database;
[0041] a first data change module, configured to respond to a data change instruction, send the data change instruction to the first virtual machine through the agent distribution software, and change the storage content of the primary relational database through the first virtual machine, and generate a first change log, wherein the first change log is used to record the change content;
[0042] a change log sending module, configured to send the first change log to the second virtual machine through the agent distribution software;
[0043] The second data modification module is used to parse the modified content through the second virtual machine according to the content of the first modification log, and modify the content stored in the standby relational database.
[0044] Optionally, the relational database deployment device further includes:
[0045] A relational database component deployment module, used to deploy a first relational database component on the first virtual machine, and to deploy a second relational database component on the second virtual machine, wherein the first relational database component and the second relational database component form a two-node cluster, and the two-node cluster is used to detect and store the working status of the virtual machines in the cluster;
[0046] A virtual address management software deployment module, used to deploy virtual address management software on the first virtual machine and the second virtual machine respectively;
[0047] A working status sending module, used for sending the working status of the first virtual machine and the second virtual machine to the virtual address management software through the dual-node cluster;
[0048] A virtualization access interface providing module is used to provide a virtualization access interface to the user terminal through the virtual address management software according to the working status of the first virtual machine and the second virtual machine, so that the user terminal can realize virtualization access to the primary relational database or the backup relational database through the virtualization access interface.
[0049] Optionally, the relational database deployment device further includes:
[0050] A virtual machine switching module is used to switch the first virtual machine and the second virtual machine through the two-node cluster according to the working status of the first virtual machine and the second virtual machine; in response to the first virtual machine being unavailable, the virtualization access interface is switched from connecting to the first virtual machine to connecting to the second virtual machine through the two-node cluster.
[0051] Optionally, the relational database deployment device further includes:
[0052] A lock file creation module, used to create a lock file through the dual-node cluster, wherein the lock file is shared by the first virtual machine and the second virtual machine;
[0053] A renewal record query module, used for the dual-node cluster to query the renewal record in the lock file to determine whether the first virtual machine or the second virtual machine is unavailable;
[0054] The virtual machine availability status confirmation module is used to determine that the first virtual machine is available when the first virtual machine renews the lock file; and to determine that the second virtual machine is available when the second virtual machine renews the lock file.
[0055] Optionally, the relational database deployment device further includes:
[0056] A lock file creation module, used to create a lock file through the dual-node cluster, wherein the lock file is shared by the first virtual machine and the second virtual machine;
[0057] A first renewal module, configured to, when the first virtual machine is connected to the virtualization access interface, renew the lock file by the first virtual machine;
[0058] a renewal record query module, configured to query the renewal record in the lock file by the dual-node cluster to determine the virtual machine connected to the virtualization access interface in response to a communication anomaly between the first virtual machine and the second virtual machine;
[0059] In response to the first virtual machine being unavailable, switching the virtualization access interface from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster includes:
[0060] A virtual machine switching module is used to determine that the first virtual machine is unavailable in response to the first virtual machine not renewing the lock file, and switch the virtualization access interface from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster.
[0061] Optionally, the relational database deployment device further includes:
[0062] A shared storage area creation module, used to create a shared storage area in the dual-node cluster, and the first virtual machine and the second virtual machine both have access rights to the shared storage area;
[0063] A lock file storage module, used for storing the lock file in the shared storage area;
[0064] A first renewal module, configured to renew the lock file by accessing the shared storage area when the first virtual machine is connected to the virtualization access interface;
[0065] The second renewal module is used to renew the lock file by accessing the shared storage area when the second virtual machine is connected to the virtualization access interface.
[0066] Optionally, the renewal record query module further includes:
[0067] a first virtual machine determination submodule, configured to determine that the virtual machine connected to the virtualization access interface is the first virtual machine in response to a renewal record in the lock file being the first virtual machine renewing the lock file, and synchronize the storage content of the standby relational database in the second virtual machine with the storage content of the primary relational database in the first virtual machine;
[0068] The second virtual machine determination submodule is used to determine that the virtual machine connected to the virtualization access interface is the second virtual machine in response to the renewal record in the lock file renewing the lock file for the second virtual machine, and synchronize the storage content of the primary relational database in the first virtual machine with the storage content of the backup relational database in the second virtual machine.
[0069] A third aspect of an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the relational database deployment method of the first aspect of the embodiment of the present application is implemented.
[0070] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the relational database deployment method of the first aspect of the embodiment of the present application is implemented.
[0071] A fifth aspect of an embodiment of the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the relational database deployment method of the first aspect of an embodiment of the present application.
[0072] Through the relational database deployment method of the embodiment of the present application, different users can access the relational database by accessing the virtualization access interface. The virtualization access interface is distributed and connected to the virtual machine with priority access according to the virtualization address management software. Taking the first virtual machine as an example, after the first virtual machine is connected to the virtualization access interface, the agent distribution software receives the user's access requirements or change requests. While the first virtual machine calls the primary relational database to respond to the user's needs, a first change log is generated and obtained by the second virtual machine. The same change operation is performed on the backup relational database as on the primary relational database. At the same time, since it is the first virtual machine that responds to the user access, the first virtual machine continues to renew the shared lock file.
[0073] In the present application, a dual-node cluster is created by the first virtual machine and the second virtual machine for data storage, and the data in the primary relational database and the backup relational database are synchronized in real time by obtaining the change log. At the same time, a dual-node cluster is combined with a lock mechanism to avoid the risk of brain split due to the dual nodes. Not only does the dual node bring higher availability than multiple nodes, but also forms an efficient decision-making cluster system. The real-time transmission of data also ensures the strong consistency of the data stored in the primary relational database and the backup relational database, enhances the risk resistance of the relational database, saves the cost of establishing the relational database, and improves the working efficiency of the relational database. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0075] Figure 1 It is a flow chart of a relational database deployment method proposed in one embodiment of the present application;
[0076] Figure 2 It is a structural diagram of a relational database deployment proposed by related technologies;
[0077] Figure 3 It is a schematic diagram of a relational database with a different architecture proposed by the related technology;
[0078] Figure 4 It is a relational database network topology diagram proposed by related technologies;
[0079] Figure 5 This is a schematic diagram of data synchronization proposed in an embodiment of the present application;
[0080] Figure 6 This is a schematic diagram of data reading and writing proposed in an embodiment of the present application;
[0081] Figure 7 This is a schematic diagram of cluster status detection proposed in an embodiment of the present application;
[0082] Figure 8 It is a schematic diagram of the deployment of a relational database proposed in an embodiment of the present application;
[0083] Fig. 9 It is a structural block diagram of a relational database deployment provided by an embodiment of the present application;
[0084] Fig.10It is a schematic diagram of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0085] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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.
[0086] In the drawings, the size of the constituent elements, the thickness of the layer or the area may be exaggerated for the sake of clarity. Therefore, any implementation of the present disclosure is not necessarily limited to the size shown in the drawings, and the shapes and sizes of the components in the drawings do not reflect the true proportions. In addition, the drawings schematically show ideal examples, and any implementation of the present disclosure is not limited to the shapes or values shown in the drawings.
[0087] Please refer to Figure 1 , Figure 1 FIG. 1 is a flow chart of a relational database deployment method proposed in an embodiment of the present application. Figure 1 As shown, it may include steps S101 to S105:
[0088] Step 101: In response to an instruction to establish a relational database, create a first virtual machine and a second virtual machine, and deploy agent distribution software on the first virtual machine and the second virtual machine respectively;
[0089] Step 102: Setting a primary relational database in the first virtual machine and a backup relational database in the second virtual machine, wherein the backup relational database is a backup of the primary relational database;
[0090] Step 103: In response to the data change instruction, the data change instruction is sent to the first virtual machine through the proxy distribution software, and the storage content of the primary relational database is changed through the first virtual machine, and a first change log is generated, where the first change log is used to record the changed content;
[0091] Step 104: Sending the first change log to the second virtual machine through the agent distribution software;
[0092] Step 105: According to the content of the first change log, the second virtual machine parses the change content and changes the content stored in the standby relational database.
[0093] In related technologies, such as Figure 2 As shown, Figure 2It is a structural diagram of a relational database deployment proposed by a related technology. The relational database is deployed in a virtual machine created in a server cluster. Data sharing is achieved through hard disk sharing between virtual machines. In a related technology, an ORACLE relational database is deployed in a virtual machine in a hyper-converged platform. Data sharing is achieved through hard disk sharing between virtual machines. The shared hard disks are connected through a multi-copy mode of RAC (Real Application Cluster) to achieve data protection and high availability of the relational database. By creating three independent virtual machines that share hard disks on a hyper-converged platform server cluster, the virtual machines are deployed on different host hosts, and then an ORACLE relational database is deployed on each virtual machine. The three virtual machines are mutually active and standby. At the same time, only the primary node provides services to the outside. When the primary node fails, it switches to a random standby node. The RAC cluster provides services to the outside through a virtual IP (Internet Protocol).
[0094] like Figure 3 As shown, Figure 3 It is a diagram of a relational database with a different architecture proposed by the related technology. For RAC, like a single virtual machine, a data file is placed on the same storage with relational database files, but three virtual machines share the same data file and make redundancy between virtual machines. RAC provides redundancy at the virtual machine level, which can also play the role of physical node redundancy. All relational database files are placed on shared storage, and parameter files are placed on each virtual machine's own local disk. Each virtual machine can have its own parameter file, which can be placed locally or on shared storage. Multiple virtual machines use the same parameter file.
[0095] like Figure 4 As shown, Figure 4 It is a relational database network topology diagram proposed by related technologies. RAC requires at least two physically different networks. The private network is used specifically for data interaction between instances. If all data is in the private network, it will affect the data and seriously affect the performance of RAC. The private network used for data transmission between instances and the network provided for external services are physically separated. Therefore, RAC has at least two networks, one for data transmission between instances, and the other is a public network for providing services to the outside world. The external business provides the public network IP link to the relational database.
[0096] Since RAC uses shared storage to store relational database files, DSAN (Deep Subdomain Adaption Network) storage is usually mounted in the cluster. Storage and servers are separated, so when a node fails, not only will the business be switched to another node, but the remaining issues of the failed node also need to be handled by reading the operation log after the last record point in the failed node, and the new node will take over the tasks of the failed node.
[0097] However, RAC cannot solve the problem of data security. Although there are multiple virtual machines, there is only one data file. As long as the data file is damaged, the entire relational database will be damaged, and it is necessary to rely on the copy protection of a third-party DSAN. The relevant technology requires at least three virtual machines, otherwise it is easy to cause brain splits, and the environment configuration is high and the cost is high. In addition, since virtual machines need to be configured with shared disks, high availability and fault migration cannot be achieved. When RAC performs fault migration, it is necessary to read the operation log of the faulty node first, analyze the operation log, and perform data recovery operations. The fault migration delay is relatively high.
[0098] Therefore, a method for deploying a relational database is proposed in the present application. Through the method proposed in the present application, two virtual machines, a first virtual machine and a second virtual machine, can be established in response to the instruction of creating a relational database. The two virtual machines are respectively equipped with a relational database, which is divided into a primary relational database and a backup relational database. The two virtual machines are interconnected and store the same data. The content stored in the backup relational database is used as a backup of the primary relational database to prevent the loss or damage of data information. When receiving the instruction of data change, the first virtual machine first modifies the content stored in the primary relational database according to the instruction. At the same time, a first change log is generated for the modified content. The first change log contains the modification action and the specific modified content. The first change log is the operation log record of the primary relational database. At the same time, the second virtual machine will also synchronously obtain the first change log, parse it according to the content, and modify the content stored in the backup relational database accordingly with the content in the primary relational database to ensure the consistency of the content stored in the primary relational database and the backup relational database. In an optional manner, the second virtual machine can parse the content of the received first change log into SQL statements by using SQL Apply (Structured Query Language Apply) technology, and then perform corresponding modification operations in the standby relational database to modify the content stored in the standby relational database to be consistent with the main relational database. In this way, when the user issues a data modification instruction, the first virtual machine makes corresponding modifications to the data in the main relational database. At the same time, since the second virtual machine immediately obtains the first change log in the first virtual machine, the second virtual machine also makes corresponding modifications to the data in the standby relational database at the same time, realizing high-speed shared storage of the main relational database and the standby relational database, achieving real-time synchronization of the data stored in the main relational database and the standby relational database, saving the time consumed by information transmission, and reducing network bandwidth competition.
[0099] In an optional embodiment, two virtual machines, a first virtual machine and a second virtual machine, are created in a hyper-converged system, and a local large-capacity disk is configured to store relational database data. ORACLE relational databases are deployed on the two virtual machines respectively, and the HA (High Availability) function of the virtual machines is enabled. After the first virtual machine modifies the content stored in the primary relational database, ORACLE will record the change in the first change log, and the second virtual machine obtains the first change log and synchronously modifies the content stored in the backup relational database.
[0100] In a specific embodiment, Figure 5 As shown, Figure 5 This is a data synchronization diagram proposed in an embodiment of the present application. After receiving the change instruction, the first virtual machine changes the data stored in the primary relational database and generates a first change log. The first change log can be a redo log. The first change log is transmitted to the change log stream, and then the second virtual machine obtains the first change log to obtain the corresponding standby redo log. After the standby relational database receives the log information, it can automatically use the log information to synchronize data through the Data Guard solution, and parse the log content and convert it into an available SQL statement. According to the content in the change log, the content stored in the standby relational database is changed accordingly. At the same time, a data disaster recovery solution is also provided in this way. If the primary relational database fails during the data change process, the change content can also be obtained according to the content in the first change log to prevent data loss and damage.
[0101] Step 101: In response to an instruction to establish a relational database, a first virtual machine and a second virtual machine are created, and agent distribution software is deployed on the first virtual machine and the second virtual machine respectively.
[0102] In the embodiment of the present application, unlike the related art which requires at least three virtual machines to establish a relational database, in the present application, only two virtual machines need to be created, the first virtual machine and the second virtual machine. This method has lower requirements for environmental configuration than before, and also has lower requirements for cost. It can achieve a more low-cost and efficient establishment of a relational database, achieve high data availability and data protection. In addition, in order to send various instructions of the user using the relational database to the virtual machine, it is also necessary to deploy proxy distribution software on the first virtual machine and the second virtual machine respectively. The proxy distribution software can distribute traffic, improve the performance and reliability of the system, and distribute the user's request to multiple backend virtual machines as needed.
[0103] Step 102: Setting a primary relational database in the first virtual machine and setting a backup relational database in the second virtual machine, wherein the backup relational database is a backup of the primary relational database.
[0104] In the embodiment of the present application, after creating two virtual machines, it is also necessary to establish a corresponding relational database in the virtual machine for data storage. Generally speaking, a primary relational database is created in the first virtual machine. When a user needs to access data in the relational database or change the content in the relational database, the primary relational database in the first virtual machine will be accessed first. At the same time, a backup relational database is created in the second virtual machine. The content stored in the backup relational database is consistent with the primary relational database, and when receiving a change instruction, the backup relational database also needs to be changed accordingly. The backup relational database exists as a backup of the primary relational database to prevent data damage or loss when the primary relational database fails due to various reasons.
[0105] Step 103: In response to the data change instruction, the data change instruction is sent to the first virtual machine through the agent distribution software, and the storage content of the primary relational database is changed through the first virtual machine, and a first change log is generated, where the first change log is used to record the changed content.
[0106] In an embodiment of the present application, after receiving a data change instruction issued by a user, the agent distribution software will give priority to sending the change instruction to the primary relational database in the first virtual machine. The first virtual machine will make corresponding changes to the primary relational database therein according to the user's change instruction, and will generate a first change log at the same time. The first change log is not only used to record operations performed on the primary relational database, but also serves as a basis for data synchronization of the backup relational database. Even if the primary relational database fails, the backup relational database can also determine the change instruction based on the content recorded in the first change log to ensure data consistency.
[0107] Step 104: Send the first change log to the second virtual machine through the agent distribution software.
[0108] In an embodiment of the present application, after receiving a change instruction, the first virtual machine makes corresponding changes to the primary relational database and generates a first change log. The first change log is generated before the change is completed. At the same time, the agent distribution software will also send the first change log generated by the first virtual machine to the second virtual machine. The second virtual machine obtains the first change log, so as to maintain real-time synchronization of data between the backup relational database and the primary relational database.
[0109] Step 105: According to the content of the first change log, the second virtual machine parses the change content and changes the content stored in the standby relational database.
[0110] In an embodiment of the present application, after the second virtual machine obtains the first change log, it is necessary to first convert the content in the first change log into relevant statements that can be recognized by the relational database, that is, to parse the change content. After the parsing is completed, the content stored in the backup relational database is changed accordingly to ensure that the backup relational database serves as a backup of the primary relational database, and the storage content of the two after the changes are also consistent.
[0111] In an optional embodiment, HAProxy (High Availability Proxy) can be selected as the proxy distribution software, and traffic distribution can be performed through HAProxy to achieve real-time data synchronization between the primary relational database and the backup relational database. In addition, the above-mentioned Data Guard solution can be used to perform a secondary check on the data in the primary relational database and the backup relational database to ensure strong data consistency. In this application, by integrating HAProxy and Data Guard, real-time data synchronization is achieved, strong data consistency is guaranteed, data synchronization time and business bandwidth occupancy are reduced, and it can be ensured that in the Data Guard maximum protection mode, the performance exceeds the original highest performance mode and data is not lost.
[0112] In combination with the above embodiments, in one implementation, the present application further provides a relational database deployment method, which specifically includes the following contents:
[0113] First, a first relational database component is deployed on the first virtual machine, and a second relational database component is deployed on the second virtual machine. The first relational database component and the second relational database component form a two-node cluster, and the two-node cluster is used to detect and store the working status of the virtual machines in the cluster.
[0114] In the embodiment of the present application, since only two virtual machines are selected to be created for relational database storage, the present application also proposes to link the first virtual machine with the second virtual machine by deploying the first relational database component on the first virtual machine and the second relational database component on the second virtual machine. The first relational database component and the second relational database component form a two-node cluster, which can detect and store the working status of the first virtual machine and the second virtual machine in the cluster, ensuring real-time synchronization of data between the first virtual machine and the second virtual machine.
[0115] In an optional embodiment, a two-node cluster can be constructed through ETCD (Enhanced Transactional Consistent Database), and the cluster status can be assisted by ETCD, and the working status of each node can be stored.
[0116] Then, virtual address management software is deployed on the first virtual machine and the second virtual machine respectively.
[0117] In an embodiment of the present application, in order to ensure that the user can access the first virtual machine and the second virtual machine for virtual access when the user needs to use the relational database, it is also necessary to deploy virtual address management software on the first virtual machine and the second virtual machine respectively, and the user accesses the relational database through the virtual address management software.
[0118] Next, the working status of the first virtual machine and the second virtual machine is sent to the virtual address management software through the dual-node cluster.
[0119] In an embodiment of the present application, the dual-node cluster records the working status of the first virtual machine and the second virtual machine in the cluster, and can synchronize the working status of the virtual machines to the virtual address management software. The virtual address management software can determine whether to connect the user's virtual access to the first virtual machine or the second virtual machine when the user needs to access the relational database through the working status of each virtual machine. Normally, when there is no failure problem in the virtual machine and the communication between the virtual machines is good, the virtual address management software will give priority to sending the user's access request to the primary relational database in the first virtual machine.
[0120] Finally, according to the working status of the first virtual machine and the second virtual machine, a virtualization access interface is provided to the user terminal through the virtual address management software, so that the user terminal can realize virtualization access to the primary relational database or the backup relational database through the virtualization access interface.
[0121] In an embodiment of the present application, based on the working status of the first virtual machine and the second virtual machine, the virtual address management software selects a virtual machine to be provided to the user for access. When it is determined that a virtual machine is to be connected, the virtual address management software provides a virtualization access interface to the user terminal. Through the virtualization access interface, the user terminal can perform virtualization access to the main relational database in the first virtual machine or the backup relational database in the second virtual machine selected by the virtual address management software, query the content in the relational database or issue change instructions.
[0122] In a specific embodiment, Figure 6 As shown, Figure 6 This is a data reading and writing schematic diagram proposed in an embodiment of the present application. The user accesses the first virtual machine or the second virtual machine through a virtualization access interface. According to the virtual address management software, it is determined that the address accessed by the user this time is the first virtual machine. Therefore, the virtualization access interface is connected to the first virtual machine, and the software is distributed through an agent. At the same time, the change instructions issued by the user during the access process are synchronized to the second virtual machine. If the user issues a change instruction during use, the first virtual machine makes data changes to the primary relational database while the second virtual machine makes corresponding changes to the backup relational database.
[0123] In combination with the above embodiments, in one implementation, the present application further provides a relational database deployment method, which specifically includes the following contents:
[0124] First, according to the working status of the first virtual machine and the second virtual machine, the first virtual machine and the second virtual machine are switched through the two-node cluster.
[0125] In the embodiment of the present application, as described above, the dual-node cluster monitors and stores the working status of the virtual machines in the cluster, and the dual-node cluster can also be responsible for switching the virtual machines in the cluster and selecting different virtual machines for responding to user access.
[0126] Specifically, in response to the first virtual machine being unavailable, the virtualization access interface is switched from being connected to the first virtual machine to being connected to the second virtual machine through the dual-node cluster.
[0127] In the embodiment of the present application, under normal circumstances, the user's virtual access interface is connected to the first virtual machine, and data access or data modification operations are performed on the primary relational database in the first virtual machine. However, when the first virtual machine fails and the first virtual machine is unavailable, the dual-node cluster will detect the unavailable state of the first virtual machine, and then perform node switching to change the connection of the virtualized access interface from the first virtual machine to the second virtual machine. At this time, when the user accesses the relational database, the virtualized access interface is connected to the second virtual machine and accesses the backup relational database.
[0128] In combination with the above embodiments, in one implementation, the present application further provides a relational database deployment method, which specifically includes the following contents:
[0129] First, a lock file is created through the dual-node cluster, and the lock file is shared by the first virtual machine and the second virtual machine.
[0130] In the related art, when there are multiple virtual machines in a cluster, in order to prevent the split-brain phenomenon caused by communication failures between virtual machines, at least three virtual machines are usually required to form a virtual machine cluster so that the main virtual machine to be used can be determined through a voting mechanism when communication failures between virtual machines occur.
[0131] In the embodiment of the present application, unlike the related art which requires at least three virtual machines to form a virtual machine cluster, only two virtual machines are required to form a two-node cluster. In order to prevent the occurrence of brain split, the present application proposes to create a lock file in the two-node cluster, and replace a virtual machine participating in the voting with the relevant mechanism of the lock file to avoid brain split when a virtual machine communication failure occurs. The lock file is shared by the first virtual machine and the second virtual machine.
[0132] On this basis, the two-node cluster queries the renewal record in the lock file to determine whether the first virtual machine or the second virtual machine is unavailable;
[0133] When the first virtual machine renews the lock file, it is determined that the first virtual machine is available; when the second virtual machine renews the lock file, it is determined that the second virtual machine is available.
[0134] In an embodiment of the present application, when the virtual machine is connected to the virtualization access interface, the lock file needs to be continuously renewed. The renewal behavior is an behavior that needs to be repeated periodically, and a record will be left in the lock file. The continuous renewal behavior is used to determine whether the virtual machine connected to the virtualization access interface is in a normal and available state. Therefore, according to the renewal record in the lock file, it can be used to determine whether the virtual machine is available. When the first virtual machine is connected to the virtualization access interface, the first virtual machine continuously renews the lock file, indicating that the first virtual machine is available. Conversely, if the first virtual machine cannot renew the contract in time, it is considered that the first virtual machine is in an unavailable state. Similarly, when the second virtual machine is connected to the virtualization access interface, the available state of the second virtual machine can also be determined according to the renewal record.
[0135] In combination with the above embodiments, in one implementation, the present application further provides a relational database deployment method, which specifically includes the following contents:
[0136] First, a lock file is created through the dual-node cluster, and the lock file is shared by the first virtual machine and the second virtual machine.
[0137] In an embodiment of the present application, as described above, it is necessary to create a lock file shared by the first virtual machine and the second virtual machine in a dual-node cluster, and use the relevant mechanism of the lock file to replace a virtual machine participating in the voting in the related technology to determine whether the virtualization reverse interface is connected to the first virtual machine or the second virtual machine.
[0138] Then, when the first virtual machine is connected to the virtualization access interface, the first virtual machine renews the lock file.
[0139] In the embodiments of the present application, it is generally believed that the first virtual machine and the primary relational database created therein are given priority for users to access the relational database through the virtualization access interface. Therefore, in order to establish the priority position of the first virtual machine, it is necessary to renew the lock file when the first virtual machine is connected to the virtualization access interface. As described above, the renewal behavior is an behavior that needs to be repeated regularly, and renewal is continuously performed to ensure that the first virtual machine works normally and continues to be the virtual machine that is preferentially connected to the virtualization access interface.
[0140] Under the above conditions, in response to a communication anomaly between the first virtual machine and the second virtual machine, the two-node cluster queries the renewal record in the lock file to determine the virtual machine connected to the virtualization access interface.
[0141] In an embodiment of the present application, once a communication abnormality occurs between the first virtual machine and the second virtual machine, since there are only two virtual machines in the cluster, it is impossible to make a decision through the voting rules in the relevant technology. Therefore, the two-node cluster will query the renewal record in the shared lock file, and determine whether the virtual machine currently connected to the virtualization access interface is the first virtual machine or the second virtual machine based on the renewal record in the lock file.
[0142] Finally, in response to the first virtual machine being unavailable, switching the virtualization access interface from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster includes:
[0143] In response to the first virtual machine not renewing the lock file, it is determined that the first virtual machine is unavailable, and the virtualization access interface is switched from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster.
[0144] In an embodiment of the present application, as described above, when the first virtual machine is unavailable, the two-node cluster will switch the connection of the virtualization access interface from the first virtual machine to the second virtual machine. When the user accesses data in the relational database, the user will also access the backup relational database in the second virtual machine. In the case where the first virtual machine and the second virtual machine share a lock file, a method for detecting whether the virtual machine is available is also provided. In the case where the first virtual machine is the priority connected virtual machine, if the first virtual machine continues to fail to renew the lock file for more than the expected renewal time, it will be determined that the first virtual machine has a fault and is unavailable. In this case, the two-node cluster will switch the virtualization access interface from connecting to the first virtual machine to connecting to the second virtual machine.
[0145] In a specific embodiment, Figure 7 As shown, Figure 7 This is a cluster status detection schematic diagram proposed in an embodiment of the present application. A lock mechanism is introduced in a two-node cluster. By deploying SANlock (Storage Area Network Lock) in the first virtual machine and the second virtual machine respectively, the node status is monitored. The node holding the lock will continue to renew the lock file (lockspace) shared in the two-node cluster. At the same time, the first virtual machine and the second virtual machine can also establish a connection through the first relational database component and the second relational database component of ETCD. In this way, the present invention uses SANlock to assist ETCD in making two-node decisions. When a communication failure occurs between the first virtual machine and the second virtual machine, ETCD can determine the virtual machine holding the current lock in SANlock by querying the virtual machine that is renewed in the lock file, and determine the virtual machine as the node connected to the virtualization access interface. In this application, the voting rules of ETCD are optimized, and the voting mechanism of nodes greater than two and an odd number is optimized to require only two nodes. The method of detecting the node status through the lock mechanism for judgment avoids the brain split phenomenon between the two nodes and forms an efficient decision-making cluster system.
[0146] In combination with the above embodiments, in one implementation, the present application further provides a relational database deployment method, which specifically includes the following contents:
[0147] First, a shared storage area is created in the dual-node cluster, and both the first virtual machine and the second virtual machine have access rights to the shared storage area.
[0148] In the embodiment of the present application, as described above, the first virtual machine and the second virtual machine need to renew the shared lock file, so a shared storage area needs to be created in a two-node cluster, and the shared storage area needs to open access rights to both the first virtual machine and the second virtual machine.
[0149] Then, the lock file is stored in the shared storage area.
[0150] In an embodiment of the present application, the lock file is stored in a shared storage area. In this way, whether the first virtual machine is connected to the virtualization access interface or the second virtual machine is connected to the virtualization access interface, the lock file in the shared storage area can be accessed to renew the lock file, thereby ensuring that the node status is monitored in real time through the lock mechanism described above, and ensuring the master-slave relationship between the two nodes in the dual-node cluster.
[0151] The specific method is that when the first virtual machine is connected to the virtualization access interface, the lock file is renewed by accessing the shared storage area; when the second virtual machine is connected to the virtualization access interface, the lock file is renewed by accessing the shared storage area.
[0152] In an embodiment of the present application, depending on which virtual machine is selected to connect to the virtualization access interface, the virtual machine needs to access the shared storage area and renew the lock file regularly to ensure that the master-slave relationship between the two virtual machines is distinguished to prevent the occurrence of a dual-node brain split.
[0153] In combination with the above embodiments, in one implementation, the present application further provides a relational database deployment method, in response to a communication exception between the first virtual machine and the second virtual machine, the two-node cluster queries the renewal record in the lock file to determine the virtual machine connected to the virtualization access interface, and specifically includes the following contents:
[0154] In response to the renewal record in the lock file being that the lock file is renewed by the first virtual machine, determining that the virtual machine connected to the virtualization access interface is the first virtual machine, and synchronizing the storage content of the standby relational database in the second virtual machine with the storage content of the primary relational database in the first virtual machine;
[0155] In response to the renewal record in the lock file renewing the lock file for the second virtual machine, the virtual machine connected to the virtualization access interface is determined to be the second virtual machine, and the storage content of the primary relational database in the first virtual machine is synchronized with the storage content of the backup relational database in the second virtual machine.
[0156] In an embodiment of the present application, as described above, once a communication abnormality occurs between the first virtual machine and the second virtual machine, since there are only two virtual machines in the cluster, it is impossible to make a decision by voting among three or more virtual machines in the related technology. Therefore, a method is proposed in the present application, which uses a two-node cluster to query the lock file stored in the shared storage space to determine which virtual machine is currently connected to the virtualization access interface and in use.
[0157] Specifically, by querying the renewal record in the lock file, if the first virtual machine continues to renew the lock file, it is determined that the first virtual machine is the virtual machine currently in use, it is determined that the virtual machine currently connected to the virtualization access interface is the first virtual machine, and the storage content in the backup relational database in the second virtual machine is synchronized with the storage content in the primary relational database in the first virtual machine to ensure the consistency of the storage content in the relational databases of the two virtual machines after communication is restored; conversely, if the second virtual machine continues to renew the lock file, it is determined that the second virtual machine is the virtual machine currently in use, it is determined that the virtual machine currently connected to the virtualization access interface is the second virtual machine, and the storage content in the primary relational database in the first virtual machine is synchronized with the storage content in the backup relational database in the second virtual machine to ensure the consistency of the storage content in the relational databases of the two virtual machines after communication is restored.
[0158] In a specific embodiment, Figure 8 As shown, Figure 8This is a schematic diagram of the deployment of a relational database proposed in an embodiment of the present application. A first virtual machine and a second virtual machine are created in a server cluster, and a large-capacity disk is configured for both virtual machines to store data in a relational database, and the high availability function of the virtual machine is enabled. Then, a primary relational database is created on the first virtual machine, and a backup relational database is created on the second virtual machine. At the same time, a shared lock file is created in the shared storage area of the two virtual machines. Optionally, NFS (Network File System) shared storage is mounted on the first virtual machine and the second virtual machine. The storage medium can use NVMe (NonVolatile Memory Express, non-volatile memory host controller interface specification), and the storage network protocol can use RDMA (Remote Direct Memory Access) to reduce network latency. At the same time, an ETCD two-node cluster is constructed on the first virtual machine and the second virtual machine. The first relational database component and the second relational database component are respectively deployed in the first virtual machine and the second virtual machine and communicate with each other; SANlock is deployed on the first virtual machine and the second virtual machine, and the lock file reads and writes the storage area network lock. The storage area network lock and the relational database can also check the relational database component in the same virtual machine; Data is also enabled Guard function, real-time synchronization of the two virtual machines, and deployment of virtualization address management software (VIP-Manager, Virtual IP Manager) and proxy distribution software on the first virtual machine and the second virtual machine to connect to the virtualization access port. Different users can access the relational database through the virtualization access port.
[0159] Based on the same design concept, an embodiment of the present application provides a relational database deployment device. Fig. 9 , Fig. 9 1 is a structural block diagram of a relational database deployment device provided in an embodiment of the present application. Fig. 9 As shown, the device comprises:
[0160] A virtual machine creation module, configured to create a first virtual machine and a second virtual machine in response to an instruction to establish a relational database, and to deploy agent distribution software on the first virtual machine and the second virtual machine respectively;
[0161] A relational database setting module, used to set a primary relational database in the first virtual machine and a backup relational database in the second virtual machine, wherein the backup relational database is a backup of the primary relational database;
[0162] a first data change module, configured to respond to a data change instruction, send the data change instruction to the first virtual machine through the agent distribution software, and change the storage content of the primary relational database through the first virtual machine, and generate a first change log, wherein the first change log is used to record the change content;
[0163] a change log sending module, configured to send the first change log to the second virtual machine through the agent distribution software;
[0164] The second data modification module is used to parse the modified content through the second virtual machine according to the content of the first modification log, and modify the content stored in the standby relational database.
[0165] Optionally, the relational database deployment device further includes:
[0166] A relational database component deployment module, used to deploy a first relational database component on the first virtual machine, and to deploy a second relational database component on the second virtual machine, wherein the first relational database component and the second relational database component form a two-node cluster, and the two-node cluster is used to detect and store the working status of the virtual machines in the cluster;
[0167] A virtual address management software deployment module, used to deploy virtual address management software on the first virtual machine and the second virtual machine respectively;
[0168] A working status sending module, used for sending the working status of the first virtual machine and the second virtual machine to the virtual address management software through the dual-node cluster;
[0169] A virtualization access interface providing module is used to provide a virtualization access interface to the user terminal through the virtual address management software according to the working status of the first virtual machine and the second virtual machine, so that the user terminal can realize virtualization access to the primary relational database or the backup relational database through the virtualization access interface.
[0170] Optionally, the relational database deployment device further includes:
[0171] A virtual machine switching module is used to switch the first virtual machine and the second virtual machine through the two-node cluster according to the working status of the first virtual machine and the second virtual machine; in response to the first virtual machine being unavailable, the virtualization access interface is switched from connecting to the first virtual machine to connecting to the second virtual machine through the two-node cluster.
[0172] Optionally, the relational database deployment device further includes:
[0173] A lock file creation module, used to create a lock file through the dual-node cluster, wherein the lock file is shared by the first virtual machine and the second virtual machine;
[0174] A renewal record query module, used for the dual-node cluster to query the renewal record in the lock file to determine whether the first virtual machine or the second virtual machine is unavailable;
[0175] The virtual machine availability status confirmation module is used to determine that the first virtual machine is available when the first virtual machine renews the lock file; and to determine that the second virtual machine is available when the second virtual machine renews the lock file.
[0176] Optionally, the relational database deployment device further includes:
[0177] A lock file creation module, used to create a lock file through the dual-node cluster, wherein the lock file is shared by the first virtual machine and the second virtual machine;
[0178] A first renewal module, configured to, when the first virtual machine is connected to the virtualization access interface, renew the lock file by the first virtual machine;
[0179] a renewal record query module, configured to query the renewal record in the lock file by the dual-node cluster to determine the virtual machine connected to the virtualization access interface in response to a communication anomaly between the first virtual machine and the second virtual machine;
[0180] In response to the first virtual machine being unavailable, switching the virtualization access interface from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster includes:
[0181] A virtual machine switching module is used to determine that the first virtual machine is unavailable in response to the first virtual machine not renewing the lock file, and switch the virtualization access interface from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster.
[0182] Optionally, the relational database deployment device further includes:
[0183] A shared storage area creation module, used to create a shared storage area in the dual-node cluster, and the first virtual machine and the second virtual machine both have access rights to the shared storage area;
[0184] A lock file storage module, used for storing the lock file in the shared storage area;
[0185] A first renewal module, configured to renew the lock file by accessing the shared storage area when the first virtual machine is connected to the virtualization access interface;
[0186] The second renewal module is used to renew the lock file by accessing the shared storage area when the second virtual machine is connected to the virtualization access interface.
[0187] Optionally, the renewal record query module further includes:
[0188] a first virtual machine determination submodule, configured to determine that the virtual machine connected to the virtualization access interface is the first virtual machine in response to a renewal record in the lock file being the first virtual machine renewing the lock file, and synchronize the storage content of the standby relational database in the second virtual machine with the storage content of the primary relational database in the first virtual machine;
[0189] The second virtual machine determination submodule is used to determine that the virtual machine connected to the virtualization access interface is the second virtual machine in response to the renewal record in the lock file renewing the lock file for the second virtual machine, and synchronize the storage content of the primary relational database in the first virtual machine with the storage content of the backup relational database in the second virtual machine.
[0190] Based on the same design concept, another embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the relational database deployment method described in any of the above embodiments of the present application are implemented.
[0191] Based on the same design concept, another embodiment of the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps in the relational database deployment method described in any of the above embodiments of the present application.
[0192] Based on the same design concept, another embodiment of the present application provides an electronic device, such as Fig.10 shown. Fig.10 1 is a schematic diagram of an electronic device shown in an embodiment of the present application. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes, the steps in the relational database deployment method described in any of the above embodiments of the present application are implemented.
[0193] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0194] The various embodiments in this 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 referenced to each other.
[0195] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0196] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0197] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0198] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0199] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0200] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0201] The above is a detailed introduction to a relational database deployment method, device, equipment and medium provided by the present application. Specific examples are used in this article 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 of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A relational database deployment method, characterized in that: include: In response to the establishment instruction of the relational database, a first virtual machine and a second virtual machine are created, and agent distribution software is deployed on the first virtual machine and the second virtual machine respectively; Setting a primary relational database in the first virtual machine and a backup relational database in the second virtual machine, wherein the backup relational database is a backup of the primary relational database; In response to a data change instruction, the data change instruction is sent to the first virtual machine through the proxy distribution software, and the storage content of the primary relational database is changed through the first virtual machine, and a first change log is generated, where the first change log is used to record the changed content; sending the first change log to the second virtual machine through the agent distribution software; According to the content of the first change log, the change content is parsed by the second virtual machine, and the content stored in the standby relational database is changed.
2. The relational database deployment method according to claim 1, characterized in that: Also includes: Deploy a first relational database component on the first virtual machine, and deploy a second relational database component on the second virtual machine, wherein the first relational database component and the second relational database component form a two-node cluster, and the two-node cluster is used to detect and store the working status of the virtual machines in the cluster; Deploying virtual address management software on the first virtual machine and the second virtual machine respectively; Sending the working status of the first virtual machine and the second virtual machine to the virtual address management software through the dual-node cluster; According to the working status of the first virtual machine and the second virtual machine, a virtualization access interface is provided to the user terminal through the virtual address management software, so that the user terminal can realize virtualization access to the primary relational database or the backup relational database through the virtualization access interface.
3. The relational database deployment method according to claim 2, characterized in that: Also includes: Switching the first virtual machine and the second virtual machine through the two-node cluster according to the working status of the first virtual machine and the second virtual machine; In response to the first virtual machine being unavailable, the virtualization access interface is switched from being connected to the first virtual machine to being connected to the second virtual machine through the dual-node cluster.
4. The relational database deployment method according to claim 3, characterized in that: Also includes: Creating a lock file by the two-node cluster, wherein the lock file is shared by the first virtual machine and the second virtual machine; The two-node cluster queries the renewal record in the lock file to determine whether the first virtual machine or the second virtual machine is unavailable; When the first virtual machine renews the lock file, it is determined that the first virtual machine is available; when the second virtual machine renews the lock file, it is determined that the second virtual machine is available.
5. The relational database deployment method according to claim 3, characterized in that: Also includes: Creating a lock file by the two-node cluster, wherein the lock file is shared by the first virtual machine and the second virtual machine; When the first virtual machine is connected to the virtualization access interface, the first virtual machine renews the lock file; In response to a communication anomaly between the first virtual machine and the second virtual machine, the two-node cluster queries a renewal record in the lock file to determine a virtual machine connected to the virtualization access interface; In response to the first virtual machine being unavailable, switching the virtualization access interface from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster includes: In response to the first virtual machine not renewing the lock file, it is determined that the first virtual machine is unavailable, and the virtualization access interface is switched from connecting to the first virtual machine to connecting to the second virtual machine through the dual-node cluster.
6. The relational database deployment method according to claim 5, characterized in that: Also includes: Creating a shared storage area in the two-node cluster, the first virtual machine and the second virtual machine both having access rights to the shared storage area; Storing the lock file in the shared storage area; When the first virtual machine is connected to the virtualization access interface, renewing the lock file by accessing the shared storage area; When the second virtual machine is connected to the virtualization access interface, the lock file is renewed by accessing the shared storage area.
7. The relational database deployment method according to claim 5, characterized in that: In response to a communication anomaly between the first virtual machine and the second virtual machine, the two-node cluster queries the renewal record in the lock file to determine the virtual machine connected to the virtualization access interface, further comprising: In response to the renewal record in the lock file being that the lock file is renewed by the first virtual machine, determining that the virtual machine connected to the virtualization access interface is the first virtual machine, and synchronizing the storage content of the standby relational database in the second virtual machine with the storage content of the primary relational database in the first virtual machine; In response to the renewal record in the lock file renewing the lock file for the second virtual machine, the virtual machine connected to the virtualization access interface is determined to be the second virtual machine, and the storage content of the primary relational database in the first virtual machine is synchronized with the storage content of the backup relational database in the second virtual machine.
8. A relational database deployment device, characterized in that: The device comprises: A virtual machine creation module, configured to create a first virtual machine and a second virtual machine in response to an instruction to establish a relational database, and to deploy agent distribution software on the first virtual machine and the second virtual machine respectively; A relational database setting module, used to set a primary relational database in the first virtual machine and a backup relational database in the second virtual machine, wherein the backup relational database is a backup of the primary relational database; a first data change module, configured to respond to a data change instruction, send the data change instruction to the first virtual machine through the agent distribution software, and change the storage content of the primary relational database through the first virtual machine, and generate a first change log, wherein the first change log is used to record the change content; a change log sending module, configured to send the first change log to the second virtual machine through the agent distribution software; The second data modification module is used to parse the modified content through the second virtual machine according to the content of the first modification log, and modify the content stored in the standby relational database.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the computer program is executed by the processor, the relational database deployment method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the relational database deployment method according to any one of claims 1 to 7 is implemented.