A database management method, device, terminal and storage medium

By selecting and judging database node conditions to create target clusters, providing graphical topology views and real-time monitoring, it solves the problems of error-prone configuration, time-consuming and labor-intensive, and high operation and maintenance costs of enterprise data replication tasks, and achieves efficient and accurate cluster configuration and real-time monitoring.

CN118377836BActive Publication Date: 2024-11-01TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410822597.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-11-01
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

In existing technologies, the configuration of enterprise data replication tasks is prone to errors, time-consuming and labor-intensive, difficult to maintain, and lacks real-time monitoring and automated processing, which increases operation and maintenance costs and security risks.

Method used

This paper provides a database management method that creates a target cluster, including master and slave nodes, by selecting and judging whether database nodes meet preset conditions. It also provides a graphical topology view and a real-time monitoring page, combined with security authentication and access control.

Benefits of technology

It improves the accuracy and efficiency of cluster configuration, reduces operation and maintenance costs, enables real-time monitoring and automated processing, and reduces human error and risk.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118377836B_ABST
    Figure CN118377836B_ABST
Patent Text Reader

Abstract

The present application provides a database management method, device, terminal and storage medium, which relate to the field of electronic digital data processing. The method includes: selecting at least two database nodes, and judging whether each database node meets the preset node conditions, the preset node conditions include abnormal point judgment sub-conditions, user identification judgment sub-conditions and node clock judgment sub-conditions; if each database node meets the preset node conditions, then using each database node to create a target cluster, the target cluster includes a cluster master node and at least one cluster slave node; if there are database nodes that do not meet the preset node conditions, then re-execute the steps of selecting at least two database nodes and judging whether each database node meets the preset node conditions. The present application can improve the accuracy and speed of database replication task configuration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic digital data processing, and in particular to a database management method, device, terminal and storage medium. Background Art

[0002] GBase 8S Enterprise Replication refers to the technology for implementing data synchronization and replication in the GBase 8S database system. It allows data to be replicated from one GBase 8S database to another GBase8S database to achieve data backup, load balancing, disaster recovery, etc., and ensure data consistency and integrity.

[0003] Enterprise data replication usually adopts the master-slave or multi-master replication architecture. In the master-slave architecture, one database (the master database) is designated as the data source, and other databases (slave databases) subscribe to and replicate the data of the master database. In multi-master replication, multiple databases replicate data to each other, which can achieve higher availability and load balancing.

[0004] The existing method of configuring enterprise data replication mainly requires logging in to the database server host and operating a series of commands to achieve the desired effect. However, manual operation is easily affected by human factors, which may lead to configuration parameter errors, configuration script writing errors and other problems, thus affecting the correctness and stability of the replication task; manual operation often cannot provide real-time monitoring and automated processing functions. Administrators need to manually monitor the status and performance indicators of replication tasks, and need to manually handle replication errors and failures, which will increase the operation and maintenance costs of the system; manual configuration of enterprise data replication usually requires administrators to spend a lot of time and energy, especially in complex environments or when there are many configuration parameters. Multiple attempts and adjustments may be required, increasing the time cost of configuration. Summary of the invention

[0005] The present application provides a database management method, device, terminal and storage medium to solve the problem in the prior art that enterprise data replication task configuration is prone to errors and operation and maintenance costs are high due to manual operation.

[0006] In a first aspect, the present application provides a database management method, comprising:

[0007] Select at least two database nodes, and determine whether each database node meets a preset node condition, wherein the preset node condition includes an abnormal point determination sub-condition, a user identification determination sub-condition, and a node clock determination sub-condition;

[0008] If each database node satisfies the preset node condition, a target cluster is created using each database node, wherein the target cluster includes a cluster master node and at least one cluster slave node;

[0009] If there are database nodes that do not meet the preset node condition, the step of selecting at least two database nodes and determining whether each database node meets the preset node condition is performed again.

[0010] In a second aspect, the present application provides a database management device, comprising:

[0011] A condition judgment module, used to select at least two database nodes and judge whether each database node meets a preset node condition, wherein the preset node condition includes an abnormal point judgment sub-condition, a user identification judgment sub-condition and a node clock judgment sub-condition;

[0012] A cluster creation module, configured to create a target cluster using each database node if each database node satisfies the preset node condition, wherein the target cluster includes a cluster master node and at least one cluster slave node;

[0013] The node reselection module is used to re-execute the step of selecting at least two database nodes and judging whether each database node satisfies the preset node condition if there is a database node that does not satisfy the preset node condition.

[0014] In a third aspect, the present application provides a terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method described in the first aspect or any possible implementation of the first aspect are implemented.

[0015] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the method described in the first aspect or any possible implementation of the first aspect.

[0016] The present application provides a database management method, device, terminal and storage medium, by selecting at least two database nodes, and judging whether each database node meets the preset node conditions, the preset node conditions include abnormal point judgment sub-conditions, user identification judgment sub-conditions and node clock judgment sub-conditions; if each database node meets the preset node conditions, then each database node is used to create a target cluster, and the target cluster includes a cluster master node and at least one cluster slave node; if there are database nodes that do not meet the preset node conditions, then re-execute the steps of selecting at least two database nodes and judging whether each database node meets the preset node conditions. The present application uses at least two database nodes that meet the preset node conditions to create a target cluster, which can shield the complex operations of manually building a cluster, reduce the cost of operation and maintenance, improve the efficiency and speed of cluster configuration, and also improve the configuration accuracy of database replication tasks, and can monitor the status of replication tasks, so as to facilitate subsequent business modifications. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only 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.

[0018] Figure 1 is a flowchart of the implementation of the database management method provided in the embodiment of the present application;

[0019] Figure 2 It is a structural diagram of a database management device provided in an embodiment of the present application;

[0020] Figure 3 It is a schematic diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0022] In order to make the purpose, technical solutions and advantages of the present application clearer, specific embodiments will be described below in conjunction with the accompanying drawings.

[0023] The existing enterprise data replication configuration method mainly requires logging in to the data server host and operating a series of commands to achieve the desired effect. The main reason for operating and configuring enterprise data replication is that there are the following problems:

[0024] (1) Error-prone: Human operations are easily affected by human factors, which may lead to configuration parameter errors, configuration script writing errors and other problems, thus affecting the correctness and stability of the replication task.

[0025] (2) Time-consuming and labor-intensive: Manually configuring enterprise data replication usually requires administrators to spend a lot of time and effort, especially in complex environments or when there are many configuration parameters. Multiple attempts and adjustments may be required, increasing the time cost of configuration.

[0026] (3) Difficult to maintain: Once the configuration is completed, subsequent maintenance and management work also needs to rely on manual operations, which may increase the burden on administrators, especially in the face of large-scale data environments or frequent changes.

[0027] (4) Lack of real-time monitoring and automated processing: Manual operations often cannot provide real-time monitoring and automated processing functions. Administrators need to manually monitor the status and performance indicators of replication tasks and manually handle replication errors and failures, which increases the system's operation and maintenance costs.

[0028] (5) Security risks: Human operations may pose security risks. For example, the administrator’s login credentials may be leaked, or the administrator may make mistakes during operations, resulting in data leakage or damage.

[0029] To solve the above problems, the present application can develop a web-based visual configuration wizard that allows users to configure database clusters and enterprise data replication through simple steps. The wizard can include a series of screens to guide users to set up key configuration items such as the master database (or cluster master node), slave database (or cluster slave node), replication topology, and data table selection.

[0030] Secondly, a graphical topology view can be provided to show the replication relationship and topology between various databases (or database nodes). This graphical topology view can clearly show the location and connection relationship of the master database and slave database, helping users to intuitively understand the replication configuration.

[0031] Then, a real-time monitoring page can be provided to display real-time information such as the status of the current replication task, delay, data synchronization rate, etc. The administrator can use this page to monitor the operation of the replication task at any time and make necessary adjustments and optimizations.

[0032] Finally, security authentication and permission control can also be provided to ensure that only authorized users can access the configuration and monitoring pages and can only perform corresponding operations.

[0033] The specific cluster configuration process is as follows Figure 1 As shown, Figure 1 The implementation flow chart of the database management method provided in the embodiment of the present application is detailed as follows:

[0034] In step 101, at least two database nodes are selected, and it is determined whether each database node meets a preset node condition, wherein the preset node condition includes an abnormal point determination sub-condition, a user identification determination sub-condition, and a node clock determination sub-condition.

[0035] Among them, a cluster includes at least one cluster master node and one cluster slave node, and a cluster includes at least two database nodes.

[0036] In an embodiment of the present application, for any target cluster, at least two database nodes corresponding to the number of database nodes in the target cluster are selected. Then, it is determined whether the at least two database nodes meet the preset node conditions. The preset node conditions may include an abnormal point determination sub-condition, a user identification determination sub-condition, and a node clock determination sub-condition.

[0037] In a possible implementation, determining whether each database node meets a preset node condition may include:

[0038] Execute abnormal point judgment, user identification judgment, and node clock judgment in sequence, and judge whether each database node satisfies the abnormal point judgment sub-condition, user identification judgment sub-condition, and node clock judgment sub-condition;

[0039] Correspondingly, after determining whether each database node meets the preset node condition, the following steps may also be included:

[0040] If all database nodes meet the abnormal point judgment sub-condition, the user identification judgment sub-condition, and the node clock judgment sub-condition, then the target cluster is created using all database nodes that meet the abnormal point judgment sub-condition, the user identification judgment sub-condition, and the node clock judgment sub-condition;

[0041] If there is a database node that does not meet any preset node condition, the step of selecting at least two database nodes and determining whether each database node meets the preset node condition is executed again.

[0042] Optionally, after obtaining at least two database nodes, abnormal point judgment, user identification judgment and node clock judgment are performed in sequence. It is also judged whether each database node satisfies the abnormal point judgment sub-condition, the user identification judgment sub-condition and the node clock judgment sub-condition. If each database node satisfies the preset node condition, at least two database nodes that satisfy the preset node condition are used to create a target cluster; if there is a database node that does not satisfy any of the preset node conditions, at least two database nodes are reselected and the judgment is performed again.

[0043] Among them, the abnormal point judgment process is:

[0044] Determine whether there are two identical database nodes among all database nodes.

[0045] If an identical database node exists, terminate the current cluster creation, reselect the database node, and recreate it.

[0046] If there are no two identical database nodes among all the database nodes, user identification judgment is performed using at least two database nodes that meet the abnormal point judgment sub-condition.

[0047] The user identification judgment process is as follows:

[0048] It is determined whether the identifiers under each database node are the same, wherein the identifiers under the database node include a user identifier (User Identification, UID) and user ID information (Group Identification, GID).

[0049] If there are database nodes with different identifiers, abandon the current cluster creation, reselect the database node, and recreate it; or manually modify the identifier, and after the modification is consistent, determine again whether the identifier under each database node is the same.

[0050] If the identifiers under each database node are the same, at least two database nodes that meet the user identifier judgment sub-condition are used to perform node clock judgment.

[0051] The node clock determination process is as follows:

[0052] Determine whether the node clock of each database node is the same.

[0053] If there are database nodes with different node clocks, abandon the current cluster creation, reselect the database node, and recreate it; or use the Internet clock or the node clock of all database nodes with different node clocks. If the Internet time is selected, the node clocks of all database nodes are synchronized to the Internet clock; if the node clock is selected, the node clocks of all database nodes are synchronized to the same node clock. Among them, the node clock includes the master node clock and the slave node clock.

[0054] For example, the node clock of the cluster master node is Beijing time, the node clock of the first cluster slave node is New York time, and the node clock of the second cluster slave node is Japan time. If the master node clock is selected for synchronization, the node clocks of the first cluster slave node and the second cluster slave node will be fully synchronized to the Beijing time of the master node clock.

[0055] In the process of judging the preset node conditions in this application, if the judgment is not satisfied, the current cluster creation is abandoned because the creation of the cluster is to determine the number of database nodes under the cluster and configure mutual trust for each database node. If a database node has a problem, it means that even if the database node is supplemented and the cluster is created later, the cluster created in this way does not meet the creation requirements. Therefore, it is necessary to reselect the database node and recreate it. The following types of situations are used.

[0056] In a possible implementation, before determining whether each database node meets a preset node condition, the method may further include:

[0057] Execute database status judgment and determine whether each database node meets the database status judgment conditions;

[0058] If there are database nodes that do not meet the database status judgment condition, re-execute the step of selecting at least two database nodes;

[0059] If all database nodes meet the database status judgment condition, a cluster is created using at least two database nodes that meet the database status judgment condition;

[0060] Name the cluster and lock the cluster name and at least two database nodes under the cluster for a preset period of time.

[0061] Optionally, after selecting at least two database nodes, it is necessary to first perform a database status judgment and determine whether each database node meets the database status judgment conditions. If there are database nodes that do not meet the database status judgment conditions, the current cluster creation is abandoned, the database nodes are reselected, and the cluster is recreated; if each database node meets the database status judgment conditions, the cluster is created using at least two database nodes that meet the database status judgment conditions.

[0062] The database status judgment includes two judgment processes, which are as follows:

[0063] The first judgment process is to judge whether the status of all database nodes is normal. If there are database nodes with abnormal status, the current cluster creation is abandoned, and the database nodes are reselected and recreated; if the status of all database nodes is normal, it is determined that at least two database nodes meet the first judgment sub-condition.

[0064] The second judgment process is to judge whether all database nodes have created a cluster. If there are database nodes that have created a cluster, the current cluster creation is abandoned, and a database node is reselected and recreated. If all database nodes have not created a cluster, it is determined that at least two database nodes meet the second judgment sub-condition.

[0065] A cluster is created using all database nodes that satisfy both the first judgment sub-condition and the second judgment sub-condition.

[0066] After creating a cluster, name the cluster and lock the cluster name and at least two database nodes under the cluster for a preset period of time. This is to ensure that during the creation process, the cluster name cannot be used by other clusters and the database nodes under the cluster cannot appear in other clusters.

[0067] Accordingly, during the user identification judgment process, when there are database nodes with different identifiers, if you recreate them, you need to unlock the cluster name and all database nodes under the cluster to ensure that both the database node and the cluster name can be used next time. If you manually modify the identifier, you need to extend the lock duration of the cluster name and all database nodes under the cluster, because the identifier modification must be completed within the lock duration of the cluster name and all database nodes under the cluster. If it times out, the current cluster creation ends, and you need to reselect the database node and recreate the cluster.

[0068] During the node clock judgment process, if there are database nodes with different node clocks, when re-creating, the cluster name and all database nodes under the cluster need to be unlocked to ensure that the database node and cluster name can be used next time. When synchronizing the node clock, the synchronization clock must be completed within the lock time range of the cluster name and all database nodes under the cluster. If it is not completed, the current cluster creation is completed, and the database node needs to be re-selected and the cluster needs to be re-created.

[0069] In a possible implementation, locking the name of the cluster and at least two database nodes under the cluster for a preset period of time may include:

[0070] Determine whether the cluster name already exists;

[0071] If the cluster name already exists, rename the cluster;

[0072] If the cluster name does not exist, the cluster name and at least two database nodes under the cluster are locked for a preset period of time.

[0073] Optionally, after naming the cluster, it is necessary to determine whether the cluster name already exists. If not, start creating the cluster and lock all database nodes under the cluster and the cluster name for a preset time; if it exists, rename the cluster.

[0074] In a possible implementation, before selecting at least two database nodes, the method may further include: configuring each database, specifically as follows:

[0075] Add database management information through the Web visual interface, including the database host address, port, account, password, database node name, database port and other information.

[0076] Verify whether the information you filled in is correct and whether you can connect to the host and database service. If the connection is successful, persist the data to the database.

[0077] In the embodiment of the present application, the connection between the various databases is realized in advance, which can improve the association efficiency between the cluster master node and the various cluster slave nodes in the cluster.

[0078] In step 102, if each database node meets the preset node condition, each database node is used to create a target cluster, and the target cluster includes a cluster master node and at least one cluster slave node.

[0079] In the embodiment of the present application, after determining that each database node meets the preset node condition, the database nodes meeting the preset node condition are used to create a target cluster, wherein the cluster includes a cluster master node and at least one cluster slave node.

[0080] In a possible implementation, before creating a target cluster using each database node, the method may further include:

[0081] Perform mutual trust configuration on each database node and determine whether the mutual trust configuration is successful;

[0082] If the mutual trust configuration fails, the configuration ends;

[0083] If the mutual trust configuration is successful, the data space file, logical log file, environment variable file and log storage file are configured for the database under each database node;

[0084] Restart the databases under each configured database node and determine whether each database has been restarted successfully, so as to create a target cluster based on the database nodes corresponding to each successfully restarted database.

[0085] Optionally, after determining that each database node meets the preset node conditions, firstly perform mutual trust configuration on each database node. The mutual trust configuration process is as follows:

[0086] Step 1.1, configure the .rhost file with + as the content and upload it to the directory / home / gbasedbt / .rhosts;

[0087] Step 1.2, find the .sqlhost file path;

[0088] Step 1.3, configure the sqlhost file. Taking two nodes as an example, the content is converted into a table as follows:

[0089]

[0090] Each node configuration line consists of several fields, which are separated by spaces or tabs.

[0091] The first field is the name of the node or the name of the group;

[0092] The second field specifies the type of node, for example, onsoctcp indicates a TCP / IP connection;

[0093] The third field is the host address of the node;

[0094] The fourth field is the port number used by the node;

[0095] The fifth field is the name of the group to which the node belongs.

[0096] After mutual trust configuration, determine whether the mutual trust configuration is successful. If mutual trust is unsuccessful, unlock the name of the cluster and all database nodes under the cluster, abandon the current cluster creation, reselect the database node, and recreate it. If mutual trust is successful, configure the data space file (dbspace), logical log file (sbspace), environment variable file (onconfig), and log storage file for the database under each database node respectively. Among them, the log storage file includes atsdir file and risdir file. The example file configuration process includes data space file configuration, logical log file configuration, environment variable file configuration, and log storage file configuration, as follows:

[0097] The data space file configuration is as follows:

[0098] Step 2.1: Verify whether the file datadir already exists. If it does, delete the folder datadir; if it does not exist, go to step 2.2.

[0099] Step 2.2, create a folder datadir, enter the folder datadir, and execute touch erdbspace and chmod 660 erdbspace in sequence;

[0100] In step 2.3, execute onspaces -c -d erdbspace -k 16 -p $DATADIR / erdbspace -o 0 -s 1024000 in the datadir directory.

[0101] Among them, onspaces: is an GBase command line utility for managing database spaces (dbspaces).

[0102] -c: is one of the options of the onspaces command, which means creating a new dbspace.

[0103] -d erdbspace: This option specifies the name of the dbspace to be created, i.e. erdbspace.

[0104] -k 16: This is an option for specifying the page size, which is 16KB. In Informix, database storage is in pages, and the page size affects the performance and storage efficiency of the database.

[0105] -p $DATADIR / erdbspace: This option specifies the path of the dbspace. For example, / opt / gbase / datadir / erdbspace is the physical storage path of the dbspace.

[0106] -o 0: This is the option that specifies the starting offset of the dbspace. Here, the offset is set to 0, which means to use the dbspace from the beginning.

[0107] -s 1024000: This is the option that specifies the size of the dbspace.

[0108] The logical log file configuration is as follows:

[0109] Step 3.1, execute in the datadir directory, touch ersbspace, chmod 660 ersbspace;

[0110] In step 3.2, execute onspaces -c -S sbspace -p $DATADIR / sbspace-o 0 -s 1000 * 1024 in the datadir directory.

[0111] Among them, onspaces: This is an GBase command line utility for managing database spaces (dbspaces).

[0112] -c: This is one of the options of the onspaces command, which means creating a new dbspace.

[0113] -S sbspace: Specifies the name of the space to be created as sbspace.

[0114] -p $DATADIR / sbspace: This option specifies the physical path of the space, such as / opt / gbase / datadir / sbspace is the storage path of the space.

[0115] -s 1000 * 1024: This option is used to specify the size of the space.

[0116] The environment variable file is configured as follows:

[0117] Configure the onconfig file and execute the following commands in sequence:

[0118] cdr change onconfig "CDR_QDATA_SBSPACE ersbspace";

[0119] cdr change onconfig "CDR_QHDR_DBSPACE erdbspace";

[0120] cdr change onconfig "CDR_DBSPACE erdbspace" .

[0121] The log storage file configuration is as follows:

[0122] Step 4.1, enter the / home / gbasedbt directory and verify whether the database instance folder exists. If it exists, delete it; if not, go to step 4.2.

[0123] Step 4.2, create a folder for the database instance and enter the folder;

[0124] Step 4.3, mkdir atsdir and mkdir risdir.

[0125] After configuration, restart the databases under each database node, determine whether each database has been restarted successfully, and create a target cluster with the database nodes corresponding to each successfully restarted database.

[0126] In a possible implementation, determining whether the restart of each database is successful may include:

[0127] If there is a database that fails to restart, re-execute the step of selecting at least two database nodes and determining whether each database node meets the preset node condition;

[0128] If all databases are restarted successfully, the target cluster is created using the database nodes corresponding to each successfully restarted database.

[0129] Optionally, if there is a database that fails to restart, the cluster creation fails, the cluster name and at least two database nodes under the cluster are unlocked, and the database nodes are reselected to recreate the cluster. If all databases are successfully restarted, the target cluster is created using the database nodes corresponding to the successfully restarted databases.

[0130] Accordingly, define the cluster master node and cluster slave node of the target cluster, for example:

[0131] Step 5.1, define the cluster master node, execute cdr define server -A / home / gbasedbt / gbase05 / atsdir -R / home / gbasedbt / gbase05 / risdir -I group1.

[0132] Among them, cdr: This is the command line program for GBase database management.

[0133] define server: This subcommand is used to define a cdr server.

[0134] -A: Specifies the path to the ATS (Alternate Transaction Server) directory, which is used to store log and data files.

[0135] / home / gbasedbt / gbase05 / atsdir: is the path of the ATS directory.

[0136] -R: Specifies the path to the RIS (Remote Informix Server) directory, which is used to store directory files and other replication information.

[0137] / home / gbasedbt / gbase05 / risdir: is the path to the RIS directory.

[0138] -I: Specifies the ID of the cdr server.

[0139] group1: is the identifier of the CDR server.

[0140] Step 5.2, define the cluster slave node and execute the command cdr define server -A / home / gbasedbt / gbase06 / atsdir -R / home / gbasedbt / gbase06 / risdir -I group1 -S group2.

[0141] Among them, -S: specifies the source server to be associated with the cdr server.

[0142] group2: is the identifier of the source server.

[0143] After the cluster is defined, this application also needs to verify the cluster status. Execute the command cdr list server. The following result indicates that the cluster was created successfully.

[0144]

[0145] After the cluster is successfully created, the cluster information is persisted, the cluster creation is completed, and the locks added to the cluster and at least two database nodes under the cluster are deleted.

[0146] In a possible implementation, after creating a target cluster using each database node, the method may further include:

[0147] Responding to a replication request from a user, wherein the replication request is generated based on a user selecting a list of clusters that have been created;

[0148] Determining a target cluster for the replication request based on a cluster master node and at least one cluster slave node in the replication request;

[0149] The database replication request is implemented through the target cluster.

[0150] Optionally, after the target cluster is created, in response to the user's replication request, the replication request may be generated based on the user selecting a list of already created clusters, or may be generated based on the user dragging a database component, selecting a replication option, or in response to a selection operation of a replication list option. Then, based on a cluster master node and at least one cluster slave node in the replication request, the target cluster of the replication request is determined. And through the selected target cluster, the database replication of the replication request is implemented.

[0151] The specific steps to implement the replication task are as follows:

[0152] In step 6.1, select the cluster created successfully above, connect to the cluster database, and display the database list under the cluster.

[0153] In step 6.2, select the database list in step 6.1. If the database names on both sides of the cluster are the same, verify whether the database under the cluster is in log mode. If it is in log mode, proceed to step 6.3.

[0154] In step 6.3, display all tables under the database, select tables with the same table name, and verify whether the table structures are consistent. If they are consistent, you can create a replication task.

[0155] In step 6.4, create a replication task and execute cdr define replicate -C ignore r_t_user1 "test@group1:gbasedbt.t_user" "select * from t_user" "test@group2:gbasedbt.t_user" "select * from t_user".

[0156] Among them, -C ignore: specifies the conflict resolution strategy to ignore conflicts, that is, if a conflict occurs, the system will ignore it and continue replication.

[0157] r_t_user1: is the name of the replication task to be created.

[0158] "test@group1:gbasedbt.t_user": specifies the connection information of the first participant, where test is the name of the database group, group1 is the name of the group, and gbasedbt.t_user is the full name of the table to be copied.

[0159] "select * from t_user": is the select query statement of the first participant, used to specify the data to be copied.

[0160] "test@group2:gbasedbt.t_user": specifies the connection information of the second participant, where test is the name of the database group, group2 is the name of the group, and gbasedbt.t_user is the full name of the table to be copied.

[0161] "select * from t_user": is the select query statement of the second participant, used to specify the data to be copied.

[0162] It can be seen that the above command defines a replication task named r_t_user1, which replicates the data of the gbasedbt.t_user table in the test@group1 database group and the gbasedbt.t_user in the test@group2 database group, and specifies a strategy to ignore conflicts.

[0163] If the replication task is executed successfully, go to step 6.5.

[0164] In step 6.5, execute the command cdr start replicate r_t_user1 to start the replication task. If the startup is successful, the data is persisted.

[0165] In step 6.6, run the command cdr status replicate r_t_user1 to verify the replication task status.

[0166] Based on the above process, the cluster configuration of the replication task and the process of performing the replication task based on the configured cluster are completed.

[0167] In step 103, if there are database nodes that do not meet the preset node condition, the step of selecting at least two database nodes and determining whether each database node meets the preset node condition is performed again.

[0168] In an embodiment of the present application, if there is a database node that does not meet the preset node conditions, the current cluster creation is abandoned, the name of the cluster and at least two database nodes under the cluster are unlocked, and the database node is reselected to recreate the cluster.

[0169] As long as there is a database node that does not meet the preset node conditions, the database node must be reselected, because each cluster has a fixed cluster master node and at least one cluster slave node, and these database nodes are connected to each other before the cluster is created. If a database node that does not meet the preset node conditions appears, it means that the creation of the cluster is meaningless, so the database node needs to be reselected.

[0170] The embodiment of the present application can also perform security authentication and permission control. Implementing the security authentication and permission control mechanism can ensure that only authorized users can access the configuration page and the monitoring page, and can only perform corresponding operations. The embodiment of the present application can inherit the LDAR login, and can use the company domain account to log in, or provide the administrator to add an account to log in.

[0171] The steps for administrators to add an account and log in are as follows:

[0172] Step 6.1: The administrator logs in to the system using the pre-set administrator account and password.

[0173] Step 6.2, use the user management module to add user information, and the system will automatically send the initialization password to the newly added email address.

[0174] Step 6.3, users can log in to the system using the administrator's newly added email address and the password received in the email. For the first login, the password needs to be changed. After logging in to the system, users can only access public page data, but not specific data.

[0175] In step 6.4, the administrator can grant data permissions to the user. Click Resource Center Database Management to grant the user the permissions to view, delete, and modify the database. The user can perform any operation on the database cluster and replication tasks.

[0176] Step 6.5, the user has administrator privileges for the newly added data. The user can grant privileges to other users.

[0177] The present application provides a database management method, by selecting at least two database nodes, and judging whether each database node meets the preset node conditions, the preset node conditions include abnormal point judgment sub-conditions, user identification judgment sub-conditions and node clock judgment sub-conditions; if each database node meets the preset node conditions, then each database node is used to create a target cluster, and the target cluster includes a cluster master node and at least one cluster slave node; if there are database nodes that do not meet the preset node conditions, then re-execute the steps of selecting at least two database nodes and judging whether each database node meets the preset node conditions. The present application uses at least two database nodes that meet the preset node conditions to create a target cluster, which can shield the complex operations of manually building a cluster, reduce the cost of operation and maintenance, improve the efficiency and speed of cluster configuration, and also improve the configuration accuracy of database replication tasks, and can monitor the status of replication tasks, so as to facilitate subsequent business modifications.

[0178] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0179] The following is an embodiment of the device of the present application. For details not described in detail, please refer to the corresponding method embodiment described above.

[0180] Figure 2 A schematic diagram of the structure of a database management device provided in an embodiment of the present application is shown. For ease of description, only the parts related to the embodiment of the present application are shown, which are described in detail as follows:

[0181] like Figure 2As shown, the database management device 2 includes: .

[0182] The condition judgment module 21 is used to select at least two database nodes and judge whether each database node meets the preset node condition, wherein the preset node condition includes an abnormal point judgment sub-condition, a user identification judgment sub-condition and a node clock judgment sub-condition;

[0183] The cluster creation module 22 is used to create a target cluster using each database node if each database node meets the preset node condition. The target cluster includes a cluster master node and at least one cluster slave node.

[0184] The node reselection module 23 is used to re-execute the steps of selecting at least two database nodes and determining whether each database node meets the preset node condition if there is a database node that does not meet the preset node condition.

[0185] The present application provides a database management device, which selects at least two database nodes and determines whether each database node meets the preset node conditions, and the preset node conditions include abnormal point judgment sub-conditions, user identification judgment sub-conditions and node clock judgment sub-conditions; if each database node meets the preset node conditions, each database node is used to create a target cluster, and the target cluster includes a cluster master node and at least one cluster slave node; if there are database nodes that do not meet the preset node conditions, the steps of selecting at least two database nodes and judging whether each database node meets the preset node conditions are re-executed. The present application uses at least two database nodes that meet the preset node conditions to create a target cluster, which can shield the complex operation of manually building a cluster, reduce the cost of operation and maintenance, improve the efficiency and speed of cluster configuration, and also improve the configuration accuracy of database replication tasks, and can monitor the replication task status, so as to facilitate subsequent business to modify it.

[0186] In a possible implementation, the condition judgment module can be used to:

[0187] Execute abnormal point judgment, user identification judgment, and node clock judgment in sequence, and judge whether each database node satisfies the abnormal point judgment sub-condition, user identification judgment sub-condition, and node clock judgment sub-condition;

[0188] Accordingly, the device can be used for:

[0189] The cluster creation module can be used to:

[0190] If all database nodes meet the abnormal point judgment sub-condition, the user identification judgment sub-condition, and the node clock judgment sub-condition, then the target cluster is created using all database nodes that meet the abnormal point judgment sub-condition, the user identification judgment sub-condition, and the node clock judgment sub-condition;

[0191] The node re-election module can be used to:

[0192] If there is a database node that does not meet any preset node condition, the step of selecting at least two database nodes and determining whether each database node meets the preset node condition is executed again.

[0193] In a possible implementation, the device may further include a locking module, which may be used to:

[0194] Execute database status judgment and determine whether each database node meets the database status judgment conditions;

[0195] If there are database nodes that do not meet the database status judgment condition, re-execute the step of selecting at least two database nodes;

[0196] If all database nodes meet the database status judgment condition, a cluster is created using at least two database nodes that meet the database status judgment condition;

[0197] Name the cluster and lock the cluster name and at least two database nodes under the cluster for a preset period of time.

[0198] In a possible implementation, the locking module may also be used to:

[0199] Determine whether the cluster name already exists;

[0200] If the cluster name already exists, rename the cluster;

[0201] If the cluster name does not exist, the cluster name and at least two database nodes under the cluster are locked for a preset period of time.

[0202] In a possible implementation, the cluster creation module may be used to:

[0203] Perform mutual trust configuration on each database node and determine whether the mutual trust configuration is successful;

[0204] If the mutual trust configuration fails, the configuration ends;

[0205] If the mutual trust configuration is successful, the data space file, logical log file, environment variable file and log storage file are configured for the database under each database node;

[0206] Restart the databases under each configured database node and determine whether each database has been restarted successfully, so as to create a target cluster based on the database nodes corresponding to each successfully restarted database.

[0207] In a possible implementation, the cluster creation module may be used to:

[0208] If there is a database that fails to restart, re-execute the step of selecting at least two database nodes and determining whether each database node meets the preset node condition;

[0209] If all databases are restarted successfully, the target cluster is created using the database nodes corresponding to each successfully restarted database.

[0210] In a possible implementation, the device may further include a task duplication module, which may be used to:

[0211] Responding to a replication request from a user, wherein the replication request is generated based on a user selecting a list of clusters that have been created;

[0212] Determining a target cluster for the replication request based on a cluster master node and at least one cluster slave node in the replication request;

[0213] The database replication request is implemented through the target cluster.

[0214] Figure 3 is a schematic diagram of a terminal provided in an embodiment of the present application. Figure 3 As shown, the terminal 3 of this embodiment includes: a processor 30, a memory 31, and a computer program 32 stored in the memory 31 and executable on the processor 30. When the processor 30 executes the computer program 32, the steps in the above-mentioned database management method embodiments are implemented, for example Figure 1 Alternatively, when the processor 30 executes the computer program 32, the functions of each module / unit in the above-mentioned device embodiments are realized, for example, Figure 2 The functions of each module are shown.

[0215] Exemplarily, the computer program 32 may be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 30 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 32 in the terminal 3. For example, the computer program 32 may be divided into Figure 2 The modules shown.

[0216] The terminal 3 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal 3 may include, but is not limited to, a processor 30 and a memory 31. Those skilled in the art will appreciate that Figure 3It is only an example of terminal 3 and does not constitute a limitation on terminal 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal may also include input and output devices, network access devices, buses, etc.

[0217] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0218] The memory 31 may be an internal storage unit of the terminal 3, such as a hard disk or memory of the terminal 3. The memory 31 may also be an external storage device of the terminal 3, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal 3. Further, the memory 31 may also include both an internal storage unit and an external storage device of the terminal 3. The memory 31 is used to store the computer program and other programs and data required by the terminal. The memory 31 may also be used to temporarily store data that has been output or is to be output.

[0219] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0220] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0221] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0222] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0223] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0224] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0225] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned database management method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0226] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A database management method, characterized in that: include: Select at least two database nodes, and determine whether each database node meets a preset node condition, wherein the preset node condition includes an abnormal point determination sub-condition, a user identification determination sub-condition, and a node clock determination sub-condition; If each database node satisfies the preset node condition, a target cluster is created using each database node, wherein the target cluster includes a cluster master node and at least one cluster slave node; If there is a database node that does not meet the preset node condition, re-execute the step of selecting at least two database nodes and determining whether each database node meets the preset node condition; Before creating the target cluster using each database node, the method further includes: Perform mutual trust configuration on each database node and determine whether the mutual trust configuration is successful; If the mutual trust configuration fails, the configuration ends; If the mutual trust configuration is successful, the data space file, logical log file, environment variable file and log storage file are configured for the database under each database node; Restart the databases under each configured database node, and determine whether each database is successfully restarted, so as to create the target cluster based on the database nodes corresponding to each successfully restarted database; The configuration line of each database node consists of multiple fields, and each field is separated by a space or a tab. The fields include the name of the node or the name of the group, the type of the node, the host address of the node, the port number used by the node, and the name of the group to which the node belongs. After creating the target cluster using each database node, the method further includes: Responding to a copy request from a user, wherein the copy request is generated based on any one of a user selecting an already created cluster list, a user dragging a database component, a selection of a copy option, or a selection operation in response to a copy list option; Determine a target cluster for the replication request based on a cluster master node and at least one cluster slave node in the replication request; Implementing database replication of the replication request through the target cluster; The step of judging whether each database node meets a preset node condition includes: Execute abnormal point judgment, user identification judgment, and node clock judgment in sequence, and judge whether each database node satisfies the abnormal point judgment sub-condition, the user identification judgment sub-condition, and the node clock judgment sub-condition; The abnormal point judgment process is as follows: Determine whether there are two identical database nodes among all database nodes; If there is an identical database node, terminate the current cluster creation, reselect the database node, and recreate it; If there are no two identical database nodes among all database nodes, user identification judgment is performed using at least two database nodes that meet the abnormal point judgment sub-condition; The user identification determination process is as follows: Determine whether the identifiers under each database node are the same, wherein the identifiers under the database node include a user identifier UID and user ID information GID; If there are database nodes with different identifiers, abandon the current cluster creation, reselect the database node, and recreate it; or manually modify the identifier, and after the modification is consistent, determine again whether the identifiers under each database node are the same; If the identifiers under each database node are the same, at least two database nodes that meet the user identifier judgment sub-condition are used to perform node clock judgment; The node clock determination process is as follows: Determine whether the node clocks of each database node are the same; If there are database nodes with different node clocks, abandon the current cluster creation, reselect the database node, and recreate it; or use the Internet clock or the node clock of all database nodes that are different; If Internet time is selected, the node clocks of all database nodes will be synchronized to the Internet clock; If the node clock is selected, the node clocks of all database nodes are synchronized to the same node clock, wherein the node clock includes a master node clock and a slave node clock.

2. The database management method according to claim 1, characterized in that: After determining whether each database node meets the preset node condition, the method further includes: If each database node satisfies the abnormal point judgment sub-condition, the user identification judgment sub-condition, and the node clock judgment sub-condition, then the target cluster is created using each database node that satisfies the abnormal point judgment sub-condition, the user identification judgment sub-condition, and the node clock judgment sub-condition; If there is a database node that does not meet any preset node condition, the step of selecting at least two database nodes and determining whether each database node meets the preset node condition is executed again.

3. The database management method according to claim 1, characterized in that: Before determining whether each database node meets the preset node condition, the method further includes: Execute database status judgment and determine whether each database node meets the database status judgment conditions; If there are database nodes that do not meet the database status judgment condition, re-execute the step of selecting at least two database nodes; If each database node satisfies the database status judgment condition, then creating a cluster using at least two database nodes that satisfy the database status judgment condition; The cluster is named, and the name of the cluster and at least two database nodes under the cluster are locked for a preset time period.

4. The database management method according to claim 3, characterized in that: The preset locking time for the name of the cluster and at least two database nodes under the cluster includes: Determine whether the name of the cluster already exists; If the name of the cluster already exists, rename the cluster; If the name of the cluster does not exist, the name of the cluster and at least two database nodes under the cluster are locked for a preset time period.

5. The database management method according to claim 1, characterized in that: The step of judging whether the restart of each database is successful includes: If there is a database that fails to restart, re-execute the step of selecting at least two database nodes and determining whether each database node meets a preset node condition; If each database is successfully restarted, the target cluster is created using the database nodes corresponding to each successfully restarted database.

6. A database management device, characterized in that: include: A condition judgment module, used to select at least two database nodes and judge whether each database node meets a preset node condition, wherein the preset node condition includes an abnormal point judgment sub-condition, a user identification judgment sub-condition and a node clock judgment sub-condition; A cluster creation module, configured to create a target cluster using each database node if each database node satisfies the preset node condition, wherein the target cluster includes a cluster master node and at least one cluster slave node; A node reselection module, configured to re-execute the step of selecting at least two database nodes and determining whether each database node satisfies the preset node condition if there is a database node that does not satisfy the preset node condition; Wherein, the cluster creation module is used to: Perform mutual trust configuration on each database node and determine whether the mutual trust configuration is successful; If the mutual trust configuration fails, the configuration ends; If the mutual trust configuration is successful, the data space file, logical log file, environment variable file and log storage file are configured for the database under each database node; Restart the databases under each configured database node, and determine whether each database is successfully restarted, so as to create the target cluster based on the database nodes corresponding to each successfully restarted database; The configuration line of each database node consists of multiple fields, and each field is separated by a space or a tab. The fields include the name of the node or the name of the group, the type of the node, the host address of the node, the port number used by the node, and the name of the group to which the node belongs. The device further comprises a task duplication module, and the task duplication module is used for: Responding to a copy request from a user, wherein the copy request is generated based on any one of a user selecting an already created cluster list, a user dragging a database component, a selection of a copy option, or a selection operation in response to a copy list option; Determine a target cluster for the replication request based on a cluster master node and at least one cluster slave node in the replication request; Implementing database replication of the replication request through the target cluster; Wherein, the condition judgment module is used for: Execute abnormal point judgment, user identification judgment, and node clock judgment in sequence, and judge whether each database node satisfies the abnormal point judgment sub-condition, the user identification judgment sub-condition, and the node clock judgment sub-condition; The abnormal point judgment process is as follows: Determine whether there are two identical database nodes among all database nodes; If there is an identical database node, terminate the current cluster creation, reselect the database node, and recreate it; If there are no two identical database nodes among all database nodes, user identification judgment is performed using at least two database nodes that meet the abnormal point judgment sub-condition; The user identification determination process is as follows: Determine whether the identifiers under each database node are the same, wherein the identifiers under the database node include a user identifier UID and user ID information GID; If there are database nodes with different identifiers, abandon the current cluster creation, reselect the database node, and recreate it; or manually modify the identifier, and after the modification is consistent, determine again whether the identifiers under each database node are the same; If the identifiers under each database node are the same, at least two database nodes that meet the user identifier judgment sub-condition are used to perform node clock judgment; The node clock determination process is as follows: Determine whether the node clocks of each database node are the same; If there are database nodes with different node clocks, abandon the current cluster creation, reselect the database node, and recreate it; or use the Internet clock or the node clock of all database nodes that are different; If Internet time is selected, the node clocks of all database nodes will be synchronized to the Internet clock; If the node clock is selected, the node clocks of all database nodes are synchronized to the same node clock, wherein the node clock includes a master node clock and a slave node clock.

7. A terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the database management method according to any one of claims 1 to 5 are implemented.

8. 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 database management method as described in any one of claims 1 to 5 are implemented.