A method, system, device and medium for building a dual-active and master-slave synchronization environment

The configuration information is received through the front-end interface and the master-slave node configuration and database synchronization is used to synchronize the master-slave nodes and databases, which solves the problems of cumbersome configuration and difficulty in mislocating the dual-active and master-slave synchronization environments in the existing technology, and achieves a fast and stable configuration process and the effect of reducing R&D costs.

CN113986881BActive Publication Date: 2025-04-15JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111276661.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2025-04-15
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

When building dual active and master-slave synchronization environments, the configuration process is cumbersome and error-prone, resulting in the location and repair of problem after configuration errors occupying a large amount of R&D work hours.

Method used

Receive configuration information through the front-end interface, and use back-end logic to establish communication connections between the master and slave nodes through SSH, obtain and modify high-availability and database configuration files, restart services, and perform database synchronization to build a master-slave synchronization environment.

Benefits of technology

It simplifies the master-slave environment configuration steps of the master-slave node, quickly matches error information and repair suggestions, and reduces the R&D cost of manual configuration environment and the error investigation and resolution costs after configuration errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986881B_ABST
    Figure CN113986881B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, system, device and medium for building a dual-active and master-slave synchronization environment, and the method includes: receiving configuration information through a front-end interface, and passing the configuration information to the back-end logic; after the back-end logic receives the configuration information, establishing a communication connection between the master node and the slave node through SSH based on the configuration information; after the master node and the slave node successfully establish a communication connection, obtaining the high-availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node respectively through the back-end logic; modifying the high-availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node, and restarting the respective high-availability services and databases after the modification is completed; synchronizing the database of the master node and the database of the slave node to build a master-slave synchronization environment. The present invention simplifies the master-slave environment configuration steps, and based on the configured error library, can quickly match error information and repair suggestions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a method, system, device and medium for building a dual-active and master-slave synchronization environment. Background Art

[0002] In order to maintain system stability, the current system generally uses specific software to build a dual-active environment, so that when the master node fails, it can quickly switch to the slave node, allowing users to use the system without noticing. However, the construction process is often cumbersome and prone to errors. Once an error occurs, it takes a lot of time to investigate the cause of the error, resulting in a lot of R&D time. Although the current master-slave synchronization solution for databases is relatively mature, the configuration process is still cumbersome, and problem location after configuration errors also takes up a lot of time. Therefore, there is an urgent need for a database synchronization method for master and slave nodes. Summary of the invention

[0003] In view of this, the present invention proposes a method, system, device and medium for building a dual-active and master-slave synchronization environment, which simplifies the master-slave environment configuration steps of the master-slave nodes, and based on the configured error library, can quickly match error information and repair suggestions.

[0004] Based on the above purpose, an embodiment of the present invention provides a method for building a dual-active and master-slave synchronization environment, which specifically includes the following steps:

[0005] Receive configuration information through the front-end interface and pass the configuration information to the back-end logic;

[0006] After the backend logic receives the configuration information, a communication connection is established between the master node and the slave node based on the configuration information and through SSH;

[0007] After the master node and the slave node successfully establish a communication connection, the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node are respectively obtained through the back-end logic;

[0008] Modify the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node, and restart the respective high availability services and databases after the modification is completed;

[0009] Synchronize the database of the master node and the database of the slave node to build a master-slave synchronization environment.

[0010] In some implementations, modifying the high availability configuration files of the master node and the slave node includes:

[0011] Obtaining the virtual IP of the high availability configuration file of the master node and the slave node in the backend logic;

[0012] The virtual IPs of the high availability configuration files of the master node and the slave node are respectively modified to the virtual IPs of the configuration information.

[0013] In some implementations, modifying the database configuration files of the master node and the slave node includes:

[0014] The database configuration files of the master node and the slave node are checked respectively, and the configuration parameters that do not meet the checking conditions are modified.

[0015] In some implementations, synchronizing the database of the master node and the database of the slave node to build a master-slave synchronization environment includes:

[0016] Create a synchronization user to grant master-slave synchronization permissions;

[0017] Restoring the database data of the master node to the slave node;

[0018] Accessing a database of the master node from the master node to view status information of the master node;

[0019] Enter the database of the slave node from the slave node, and configure the synchronization information of the synchronization user to synchronize the database from the designated node.

[0020] In some embodiments, the method further comprises:

[0021] Configuration error library;

[0022] In response to an error occurring during the synchronization process of the database in the backend logic, error information and modification suggestions corresponding to the error are obtained from the error library, and the corresponding error information and modification suggestions are sent to a user.

[0023] In some implementations, the method further includes: during the synchronization process of the database in the backend logic, sending the synchronization progress of the database to the front-end interface via websocket in real time to display the synchronization progress.

[0024] In some implementations, the configuration information of the master node or the configuration information of the slave node includes: the IP address, port number, user name, and password of the node.

[0025] Another aspect of the embodiment of the present invention further provides a system for building a dual-active and master-slave synchronization environment, including:

[0026] A front-end interface, the front-end interface being configured to receive configuration information and pass the configuration information to a back-end logic;

[0027] A backend logic, wherein the backend logic is configured to establish a communication connection between the master node and the slave node through SSH based on the configuration information after the backend logic receives the configuration information;

[0028] The backend logic is further configured to obtain, through the backend logic, respectively the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node after the master node and the slave node successfully establish a communication connection;

[0029] The backend logic is also configured to modify the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node, and restart the respective high availability services and databases after the modification is completed;

[0030] The backend logic is also configured to synchronize the database of the master node with the database of the slave node to build a master-slave synchronization environment.

[0031] According to another aspect of an embodiment of the present invention, a computer device is provided, comprising: at least one processor; and a memory, wherein the memory stores a computer program executable on the processor, and the computer program implements the steps of the above method when executed by the processor.

[0032] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, which stores a computer program that implements the above method steps when executed by a processor.

[0033] The present invention has at least the following beneficial technical effects: the front-end interface is concise and easy to use; the back-end logic automatically executes pre-configured scripts, quickly performs configuration, and quickly pushes configuration progress and process information to the front-end interface. The overall process is fast and stable, reducing the R&D cost of the manual configuration environment; based on the error library, it can match common errors and provide repair suggestions, reducing the R&D cost of error investigation and resolution after configuration errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] 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, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.

[0035] Figure 1A block diagram of an embodiment of a method for building a dual-active and master-slave synchronization environment provided by the present invention;

[0036] Figure 2 A schematic diagram of an embodiment of a system for building a dual-active and master-slave synchronization environment provided by the present invention;

[0037] Figure 3 A schematic diagram of the structure of an embodiment of a computer device provided by the present invention;

[0038] Figure 4 A schematic diagram of the structure of an embodiment of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION

[0039] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0040] In order to enable ordinary technicians in the field to better understand the technical solutions of the embodiments of the present invention, some relevant technical terms are explained below.

[0041] Active-active is a resource-saving computer disaster recovery solution.

[0042] The implementation mode is to let both the primary and backup data centers take on the user's business at the same time. At this time, the primary and backup data centers back up each other and perform real-time backup. Generally speaking, the primary data center may have a larger load, such as sharing 60% to 70% of the business, and the backup data center only shares 40% to 30% of the business, ensuring that when one side fails, it will not cause the business to be unable to handle.

[0043] Master-slave environment is a term for dividing nodes based on active-active. In an active-active environment, there are two servers, one is the master node and the other is called the slave node. Users use a virtual IP to access the master node by default. When the master node fails, the active-active system automatically switches the user to the slave node, thereby achieving high resource availability.

[0044] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.

[0045] Based on the above purpose, the first aspect of the embodiment of the present invention provides an embodiment of a method for building a dual-active and master-slave synchronization environment. Figure 1 As shown, it includes the following steps:

[0046] Step S101: receiving configuration information through the front-end interface and transmitting the configuration information to the back-end logic;

[0047] Step S103: after the backend logic receives the configuration information, a communication connection between the master node and the slave node is established through SSH based on the configuration information;

[0048] Step S105: After the master node and the slave node successfully establish a communication connection, respectively obtain the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node through the back-end logic;

[0049] Step S107: modify the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node, and restart the respective high availability services and databases after the modification is completed;

[0050] Step S109: Synchronize the database of the master node and the database of the slave node to build a master-slave synchronization environment.

[0051] The front-end interface receives corresponding configuration information input by the user and passes the configuration information to the back-end logic, wherein the configuration information includes the master node IP, the master node port number, the master node user name, the master node password, the slave node IP, the slave node port number, the slave node user name, the slave node password, and the virtual IP; after the back-end logic receives the configuration information, it logs in to the master and slave nodes through SSH based on the port number, user name, password, and IP of the master and slave nodes to establish a communication connection between the master node and the slave node; after the master and slave nodes successfully establish a communication connection, the back-end logic respectively obtains the high-availability configuration file and the database configuration file of the master and slave nodes, and modifies the high-availability configuration file and the database configuration file of the master and slave nodes, and restarts their respective high-availability services and databases after the modification is completed; the database of the master node and the database of the slave node are synchronized to build a master-slave synchronization environment, wherein the database is a MySQL database.

[0052] In some implementations, modifying the high availability configuration files of the master node and the slave node includes:

[0053] Obtaining the virtual IP of the high availability configuration file of the master node and the slave node in the backend logic;

[0054] The virtual IPs of the high availability configuration files of the master node and the slave node are respectively modified to the virtual IPs of the configuration information.

[0055] Check whether the virtual IP in the master-slave keepalived (high availability) configuration file is the same as the virtual IP passed by the front end. If not, change it to the virtual IP passed by the front end. By changing the virtual IP in the keepalived configuration file to the virtual IP passed by the front end, a keepalived master-slave environment is established; after the modification is successful, restart the keepalived service to complete the keepalived service configuration. After restarting, the keepalived service is available.

[0056] In some implementations, modifying the database configuration files of the master node and the slave node includes:

[0057] The database configuration files of the master node and the slave node are checked respectively, and the configuration parameters that do not meet the checking conditions are modified.

[0058] Specifically, check the parameters such as server-id (service ID) and expire_logs_days (time to clear expired logs) in the MySQL configuration files of the master and slave nodes. The server-id needs to be different, and the expire_logs_days needs to be the same. After the modification is completed, restart MySQL.

[0059] In some implementations, synchronizing the database of the master node and the database of the slave node to build a master-slave synchronization environment includes:

[0060] Create a synchronization user to grant master-slave synchronization permissions;

[0061] Restoring the database data of the master node to the slave node;

[0062] Accessing a database of the master node from the master node to view status information of the master node;

[0063] Enter the database of the slave node from the slave node, and configure the synchronization information of the synchronization user to synchronize the database from the designated node.

[0064] Specifically, create a user name and password for the synchronization user, and set file permissions and master-slave synchronization permissions for synchronization of the master and slave node databases. After completing the permission setting, restart MySQL to update the configuration.

[0065] Enter the master node database to view the status of the master node database and record necessary information, and enter the slave database to configure the synchronization information of the synchronization user. The synchronization information includes: the master node server address master_host, the port number master_port, the data synchronization user master_user, the synchronization user's password master_password, the specified slave node from which log file to start copying data master_log_file, and the position from which to start reading master_log_pos, that is, the Position field value in the previous master node. 0 means to copy the master library completely from the beginning.

[0066] Now that the master-slave environment is set up, the databases of the master and slave nodes can be synchronized.

[0067] In some embodiments, the method further comprises:

[0068] Configuration error library;

[0069] In response to an error occurring during the synchronization process of the database in the backend logic, error information and modification suggestions corresponding to the error are obtained from the error library, and the corresponding error information and modification suggestions are sent to a user.

[0070] In some implementations, the method further includes: during the synchronization process of the database in the backend logic, sending the synchronization progress of the database to the front-end interface via websocket in real time to display the synchronization progress.

[0071] The synchronization process of the backend logic is pushed to the front-end interface in real time through websocket, so that users can quickly grasp the configuration progress. If an error occurs during the configuration process, the error information and repair suggestions will be provided to the user at the same time, allowing the user to quickly resolve the error.

[0072] In some implementations, the configuration information of the master node or the configuration information of the slave node includes: the IP address, port number, user name, and password of the node.

[0073] Based on the same inventive concept, according to another aspect of the present invention, Figure 2 As shown, an embodiment of the present invention further provides a system for building a dual-active and master-slave synchronization environment, including:

[0074] A front-end interface 110, wherein the front-end interface 110 is configured to receive configuration information and transmit the configuration information to a back-end logic;

[0075] The backend logic 120 is configured to establish a communication connection between the master node and the slave node through SSH based on the configuration information after the backend logic receives the configuration information;

[0076] The backend logic 120 is further configured to obtain, through the backend logic, respectively the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node after the master node and the slave node successfully establish a communication connection;

[0077] The backend logic 120 is also configured to modify the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node, and restart the respective high availability services and databases after the modification is completed;

[0078] The backend logic 120 is also configured to synchronize the database of the master node with the database of the slave node to build a master-slave synchronization environment.

[0079] In some implementations, the backend logic is further configured to:

[0080] Obtaining the virtual IP of the high availability configuration file of the master node and the slave node in the backend logic;

[0081] The virtual IPs of the high availability configuration files of the master node and the slave node are respectively modified to the virtual IPs of the configuration information.

[0082] In some implementations, the backend logic is further configured to:

[0083] The database configuration files of the master node and the slave node are checked respectively, and the configuration parameters that do not meet the checking conditions are modified.

[0084] In some implementations, the backend logic is further configured to:

[0085] Create a synchronization user to grant master-slave synchronization permissions;

[0086] Restoring the database data of the master node to the slave node;

[0087] Accessing a database of the master node from the master node to view status information of the master node;

[0088] Enter the database of the slave node from the slave node, and configure the synchronization information of the synchronization user to synchronize the database from the designated node.

[0089] In some embodiments, the system further comprises:

[0090] A configuration module, wherein the configuration module is used to configure an error library;

[0091] The backend logic is also configured to, in response to an error occurring during the synchronization process of the database of the backend logic, obtain error information and modification suggestions corresponding to the error from the error library, and send the corresponding error information and modification suggestions to the user.

[0092] In some implementations, the backend logic is further configured to send the synchronization progress of the database to the front-end interface via websocket in real time during the synchronization process of the database of the backend logic to display the synchronization progress.

[0093] In some implementations, the configuration information of the master node or the configuration information of the slave node includes: the IP address, port number, user name, and password of the node.

[0094] Based on the same inventive concept, according to another aspect of the present invention, Figure 3 As shown, an embodiment of the present invention further provides a computer device 20, in which the computer device 20 includes a processor 210 and a memory 220, and the memory 220 stores a computer program 221 that can be run on the processor. When the processor 210 executes the program, the steps of the following method are performed:

[0095] Receive configuration information through the front-end interface and pass the configuration information to the back-end logic;

[0096] After the backend logic receives the configuration information, a communication connection is established between the master node and the slave node based on the configuration information and through SSH;

[0097] After the master node and the slave node successfully establish a communication connection, respectively obtain the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node through the back-end logic;

[0098] Modify the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node, and restart the respective high availability services and databases after the modification is completed;

[0099] Synchronize the database of the master node and the database of the slave node to build a master-slave synchronization environment.

[0100] In some implementations, modifying the high availability configuration files of the master node and the slave node includes:

[0101] Obtaining the virtual IP of the high availability configuration file of the master node and the slave node in the backend logic;

[0102] The virtual IPs of the high availability configuration files of the master node and the slave node are respectively modified to the virtual IPs of the configuration information.

[0103] In some implementations, modifying the database configuration files of the master node and the slave node includes:

[0104] The database configuration files of the master node and the slave node are checked respectively, and the configuration parameters that do not meet the checking conditions are modified.

[0105] In some implementations, synchronizing the database of the master node and the database of the slave node to build a master-slave synchronization environment includes:

[0106] Create a synchronization user to grant master-slave synchronization permissions;

[0107] Restoring the database data of the master node to the slave node;

[0108] Accessing a database of the master node from the master node to view status information of the master node;

[0109] Enter the database of the slave node from the slave node, and configure the synchronization information of the synchronization user to synchronize the database from the designated node.

[0110] In some embodiments, the method further comprises:

[0111] Configuration error library;

[0112] In response to an error occurring during the synchronization process of the database in the backend logic, error information and modification suggestions corresponding to the error are obtained from the error library, and the corresponding error information and modification suggestions are sent to a user.

[0113] In some implementations, the method further includes: during the synchronization process of the database in the backend logic, sending the synchronization progress of the database to the front-end interface via websocket in real time to display the synchronization progress.

[0114] In some implementations, the configuration information of the master node or the configuration information of the slave node includes: the IP address, port number, user name, and password of the node.

[0115] Based on the same inventive concept, according to another aspect of the present invention, Figure 4 As shown, an embodiment of the present invention further provides a computer-readable storage medium 30, which stores a computer program 310 that performs the following method when executed by a processor:

[0116] Receive configuration information through the front-end interface and pass the configuration information to the back-end logic;

[0117] After the backend logic receives the configuration information, a communication connection is established between the master node and the slave node based on the configuration information and through SSH;

[0118] After the master node and the slave node successfully establish a communication connection, respectively obtain the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node through the back-end logic;

[0119] Modify the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node, and restart the respective high availability services and databases after the modification is completed;

[0120] Synchronize the database of the master node and the database of the slave node to build a master-slave synchronization environment.

[0121] In some implementations, modifying the high availability configuration files of the master node and the slave node includes:

[0122] Obtaining the virtual IP of the high availability configuration file of the master node and the slave node in the backend logic;

[0123] The virtual IPs of the high availability configuration files of the master node and the slave node are respectively modified to the virtual IPs of the configuration information.

[0124] In some implementations, modifying the database configuration files of the master node and the slave node includes:

[0125] The database configuration files of the master node and the slave node are checked respectively, and the configuration parameters that do not meet the checking conditions are modified.

[0126] In some implementations, synchronizing the database of the master node and the database of the slave node to build a master-slave synchronization environment includes:

[0127] Create a synchronization user to grant master-slave synchronization permissions;

[0128] Restoring the database data of the master node to the slave node;

[0129] Accessing a database of the master node from the master node to view status information of the master node;

[0130] Enter the database of the slave node from the slave node, and configure the synchronization information of the synchronization user to synchronize the database from the designated node.

[0131] In some embodiments, the method further comprises:

[0132] Configuration error library;

[0133] In response to an error occurring during the synchronization process of the database in the backend logic, error information and modification suggestions corresponding to the error are obtained from the error library, and the corresponding error information and modification suggestions are sent to a user.

[0134] In some implementations, the method further includes: during the synchronization process of the database in the backend logic, sending the synchronization progress of the database to the front-end interface via websocket in real time to display the synchronization progress.

[0135] In some implementations, the configuration information of the master node or the configuration information of the slave node includes: the IP address, port number, user name, and password of the node.

[0136] Finally, it should be noted that a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program can be a disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiments can achieve the same or similar effects as the corresponding above-mentioned arbitrary method embodiments.

[0137] It will also be appreciated by those skilled in the art that various exemplary logic blocks, modules, circuits and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given to the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or hardware depends on specific applications and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for each specific application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the embodiments of the present invention.

[0138] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.

[0139] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.

[0140] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0141] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0142] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the embodiments of the present invention as above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.

Claims

1. A method for building a dual-active and master-slave synchronization environment, characterized in that: The following steps are involved: Receive configuration information through the front-end interface and pass the configuration information to the back-end logic; After the backend logic receives the configuration information, a communication connection is established between the master node and the slave node based on the configuration information and through SSH; After the master node and the slave node successfully establish a communication connection, respectively obtain the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node through the back-end logic; Modify the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node, and restart the respective high availability services and databases after the modification is completed; Synchronize the database of the master node and the database of the slave node to build a master-slave synchronization environment; wherein, synchronize the database of the master node and the database of the slave node to build a master-slave synchronization environment includes: creating a synchronization user to grant master-slave synchronization authority; restoring the database data of the master node to the slave node; entering the database of the master node from the master node to view the status information of the master node; entering the database of the slave node from the slave node, and configuring the synchronization information of the synchronization user to synchronize the database from the specified node.

2. The method according to claim 1, characterized in that Modifying the high availability configuration files of the master node and the slave node includes: Obtaining the virtual IP of the high availability configuration file of the master node and the slave node in the backend logic; The virtual IPs of the high availability configuration files of the master node and the slave node are respectively modified to the virtual IPs of the configuration information.

3. The method according to claim 1, characterized in that: Modifying the database configuration files of the master node and the slave node includes: The database configuration files of the master node and the slave node are checked respectively, and the configuration parameters that do not meet the checking conditions are modified.

4. The method according to claim 1, characterized in that Further including: Configuration error library; In response to an error occurring during the synchronization process of the database in the backend logic, error information and modification suggestions corresponding to the error are obtained from the error library, and the corresponding error information and modification suggestions are sent to a user.

5. The method according to claim 1, characterized in that Further including: During the synchronization process of the database in the back-end logic, the synchronization progress of the database is sent to the front-end interface in real time through websocket to display the synchronization progress.

6. The method according to claim 1, characterized in that The configuration information of the master node or the slave node includes: the node's IP, port number, user name, and password.

7. A system for building a dual-active and master-slave synchronization environment, characterized in that: include: A front-end interface, the front-end interface being configured to receive configuration information and pass the configuration information to a back-end logic; A backend logic, wherein the backend logic is configured to establish a communication connection between the master node and the slave node through SSH based on the configuration information after the backend logic receives the configuration information; The backend logic is further configured to obtain, through the backend logic, respectively the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node after the master node and the slave node successfully establish a communication connection; The backend logic is also configured to modify the high availability configuration files of the master node and the slave node and the database configuration files of the master node and the slave node, and restart the respective high availability services and databases after the modification is completed; The backend logic is also configured to create a synchronization user to grant master-slave synchronization permissions; restore the database data of the master node to the slave node; enter the database of the master node from the master node to view the status information of the master node; enter the database of the slave node from the slave node, and configure the synchronization information of the synchronization user to synchronize the database from the specified node.

8. A computer device comprising: at least one processor; as well as A memory storing a computer program executable on the processor, wherein the processor executes the steps of the method according to any one of claims 1 to 6 when executing the program.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are performed.

Citation Information

Patent Citations

  • Database scattering system

    AU2003234400A1

  • Method, apparatus and system for recovering slave database from master-slave database system

    CN106383755A