GBase8a database ip address switching method and device

By parsing and standardizing the IP address mapping files in the GBase8a database, IP address mapping relationships are generated. Combined with an automatic rollback mechanism, the problem of IP address replacement operation failure is solved, improving the success rate of IP address switching and data security.

CN121396943BActive Publication Date: 2026-02-27TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511947403.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-23
Publication Date
2026-02-27
Estimated Expiration
2045-12-23

AI Technical Summary

Technical Problem

In existing technologies, the failure rate of IP address replacement operations is relatively high due to inconsistencies in IP address format and writing methods, which affects data security.

Method used

By parsing the IP address mapping file, different types of IP addresses are identified and standardized, IP address mapping relationships are generated, and IP address switching operations are performed based on the parameter configuration file, combined with an automatic fallback mechanism to ensure successful switching.

Benefits of technology

It significantly improves the success rate of GBase8a database IP address switching, ensuring the security of cluster node network addresses and data integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121396943B_ABST
    Figure CN121396943B_ABST
Patent Text Reader

Abstract

The application provides a GBase8a database IP address switching method and device, and relates to the technical field of databases, and comprises the following steps: analyzing a preconfigured IP address mapping file to obtain an IP address type corresponding to each node in the IP address mapping file; in the case where the IP address type corresponding to the node is a first IP address type, performing standardization processing on a current IP address corresponding to the node in a current IP address list according to an actual IP address list; generating an IP address mapping relationship based on a target IP address list and the current IP address list after standardization processing; and performing an IP address switching operation based on a preconfigured parameter configuration file and the IP address mapping relationship, so as to replace the current IP address corresponding to a plurality of nodes in the GBase8a database with a target IP address. The application can significantly improve the success rate of GBase8a database IP address switching.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of database, in particular to a GBase8a database IP address switching method and device. BACKGROUND

[0002] At present, 5G (the fifth generation mobile communication technology) is developing rapidly, and a large amount of data is generated in many applications. In order to ensure the security of data, it has become the main strategy to back up data and store it on multiple nodes, so the network address security of cluster nodes is the guarantee of data security. In order to effectively reduce the network risk caused by the exposure of cluster node network address, periodic replacement of cluster node network address has become an effective and safe data protection method.

[0003] In the prior art, when the IP address input by the user is inconsistent with the actual IP address stored in the system in terms of format, writing method or representation specification, even if both point to the same network location in logic, the system may still determine that they are not matched, thereby causing the IP address replacement operation to fail. SUMMARY

[0004] Therefore, the purpose of the present application is to provide a GBase8a database IP address switching method and device, which can significantly improve the success rate of GBase8a database IP address switching.

[0005] In a first aspect, the present application provides a GBase8a database IP address switching method, the GBase8a database is a distributed database running in a cluster form, the method is applied to a target node in the GBase8a database, and the method comprises the following steps:

[0006] The pre-configured IP address mapping file is parsed to obtain the IP address type corresponding to each node in the IP address mapping file, and the IP address mapping file comprises a target IP address list and a current IP address list;

[0007] In the case that the IP address type corresponding to the node is a first IP address type, the current IP address corresponding to the node in the current IP address list is standardized according to the actual IP address list to obtain a standardized current IP address list;

[0008] Based on the target IP address list and the standardized current IP address list, an IP address mapping relationship is generated, and the IP address mapping relationship is used to describe the one-to-one correspondence between the target IP address contained in the target IP address list and the current IP address contained in the standardized current IP address list;

[0009] The IP address switching operation is performed based on the preconfigured parameter configuration file and IP address mapping relationship to replace the current IP addresses of the plurality of nodes in the GBase8a database with target IP addresses.

[0010] In an embodiment, the preconfigured IP address mapping file is parsed to obtain the IP address type corresponding to each node in the IP address mapping file, including:

[0011] For any current IP address in the current IP address list, the IP address type corresponding to the node to which the current IP address belongs is identified based on the structure delimiter in the current IP address.

[0012] In an embodiment, in the case where the IP address type corresponding to the node is a first IP address type, the current IP address corresponding to the node in the current IP address list is standardized according to the actual IP address list to obtain a standardized current IP address list, including:

[0013] In the case where the GBase8a database is in an offline state, the actual IP address list is obtained based on the node configuration file and the node snapshot information, and the current IP address list is integrity-verified based on the actual IP address list;

[0014] In the case where the current IP address list passes the integrity verification, the following operations are performed on the current IP address belonging to the first address type in the current IP address list:

[0015] The current IP address corresponding to the node is extended based on the standard structure corresponding to the first IP address type to obtain a standard IP address corresponding to the node; and / or, the current IP address corresponding to the node is updated based on the installation prefix path corresponding to the node to obtain a standardized current IP address list; wherein the first IP address type is an IPV6 type.

[0016] In an embodiment, the current IP address corresponding to the node is updated based on the installation prefix path corresponding to the node, including:

[0017] The folder name under the installation prefix path corresponding to the node is read;

[0018] In the case where the folder name belongs to the first IP address type based on the structure delimiter in the folder name, the current IP address corresponding to the node is replaced with the folder name.

[0019] In an embodiment, before the IP address switching operation is performed based on the preconfigured parameter configuration file and IP address mapping relationship, the method further includes:

[0020] In the case that the IP address type corresponding to the node is a second IP address type, the following operations are performed, and the second IP address type is an IPV4 type:

[0021] The current IP address corresponding to the node is extracted from the current IP address list, the current IP address is split into a plurality of current IP address segments according to the structure delimiter contained in the current IP address, and the current node ID corresponding to the node is generated based on the plurality of current IP address segments;

[0022] In addition, the target IP address corresponding to the node is extracted from the target IP address list, the target IP address is split into a plurality of target IP address segments according to the structure delimiter contained in the target IP address, and the target node ID corresponding to the node is generated based on the plurality of target IP address segments.

[0023] In an embodiment, the IP address switching operation is performed based on a preconfigured parameter configuration file and an IP address mapping relationship, including:

[0024] The IP address switching operation is performed based on the preconfigured parameter configuration file, the IP address mapping relationship, and the target node ID of the node corresponding to the second IP address type.

[0025] In an embodiment, the method further includes:

[0026] Backup the cluster meta information carrier of the GBase8a database;

[0027] If it is monitored that the IP address switching operation fails, a rollback mechanism is triggered, and a rollback operation is performed based on the backup cluster meta information carrier.

[0028] In a second aspect, the application further provides a GBase8a database IP address switching device, the GBase8a database is a distributed database running in a cluster form, and the device is applied to a target node in the GBase8a database, and the device includes:

[0029] The parsing module is configured to parse a preconfigured IP address mapping file to obtain the IP address type corresponding to each node in the IP address mapping file, and the IP address mapping file includes a target IP address list and a current IP address list.

[0030] The standardization module is configured to, in the case that the IP address type corresponding to the node is a first IP address type, perform standardization processing on the current IP address corresponding to the node in the current IP address list according to the actual IP address list to obtain a standardized current IP address list.

[0031] The mapping generation module is configured to generate an IP address mapping relationship based on the target IP address list and the standardized current IP address list, the IP address mapping relationship being used to describe a one-to-one correspondence between a target IP address included in the target IP address list and a current IP address included in the standardized current IP address list.

[0032] The address switching module is configured to perform an IP address switching operation based on the preconfigured parameter configuration file and the IP address mapping relationship, so as to replace the current IP addresses corresponding to the plurality of nodes in the GBase8a database with the target IP addresses.

[0033] In a third aspect, the present application further provides an electronic device, comprising a processor and a memory, the memory storing computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the method of any one of the first aspect.

[0034] In a fourth aspect, the present application further provides a computer readable storage medium, the computer readable storage medium storing computer executable instructions, and the computer executable instructions, when invoked and executed by a processor, cause the processor to implement the method of any one of the first aspect.

[0035] The GBase8a database IP address switching method and device provided by the present application are applied to a target node in a GBase8a database, which is a distributed database running in a cluster form. First, a preconfigured IP address mapping file is parsed to obtain an IP address type corresponding to each node in the IP address mapping file, the IP address mapping file including a target IP address list and a current IP address list. Then, in a case where the IP address type corresponding to the node is a first IP address type, a current IP address corresponding to the node in the current IP address list is standardized according to an actual IP address list to obtain a standardized current IP address list. Next, an IP address mapping relationship is generated based on the target IP address list and the standardized current IP address list, the IP address mapping relationship being used to describe a one-to-one correspondence between a target IP address included in the target IP address list and a current IP address included in the standardized current IP address list. Finally, an IP address switching operation is performed based on a preconfigured parameter configuration file and the IP address mapping relationship, so as to replace the current IP addresses corresponding to the plurality of nodes in the GBase8a database with the target IP addresses. The above method identifies the IP address type corresponding to each node in the IP address mapping file, and standardizes the current IP address of the first address type according to the actual IP address list, and generates the IP address mapping relationship in combination with the target IP address list. The IP address switching operation based on the above can significantly improve the success rate.

[0036] Other features and advantages of the present application will be set forth in the description that follows, and in part will be apparent from the description, or can be learned by practice of the application. The purposes and other advantages of the application will be realized and attained by the structure particularly pointed out in the description, claims and drawings.

[0037] In order to make the above objectives, features and advantages of the present application more apparent, the following will specifically describe preferred embodiments of the present application, and the accompanying drawings will be described in detail as follows. BRIEF DESCRIPTION OF DRAWINGS

[0038] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0039] Figure 1 A flowchart of a GBase8a database IP address switching method provided by an embodiment of the present application is shown in the figure;

[0040] Figure 2 A flowchart of another GBase8a database IP address switching method provided by an embodiment of the present application is shown in the figure;

[0041] Figure 3 A workflow diagram of an automatic rollback provided by an embodiment of the present application is shown in the figure;

[0042] Figure 4 A structural diagram of a GBase8a database IP address switching device provided by an embodiment of the present application is shown in the figure;

[0043] Figure 5 A structural diagram of an electronic device provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0044] In order to make the objectives, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the present application will be described in detail below in combination with embodiments. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.

[0045] The prior art has a high failure rate of address switching operation due to the diversity of IP addresses, based on which the application provides a GBase8a database IP address switching method and device, which can significantly improve the success rate of GBase8a database IP address switching.

[0046] To facilitate the understanding of the present embodiment, first, a GBase8a database IP address switching method disclosed in the present embodiment is introduced in detail, the GBase8a database is a distributed database running in a cluster form, the method is applied to a target node in the GBase8a database, referring to Figure 1 The flowchart of the GBase8a database IP address switching method is shown in the figure, the method mainly includes the following steps S102 to S108:

[0047] Step S102, the pre-configured IP address mapping file is parsed to obtain the IP address type corresponding to each node in the IP address mapping file.

[0048] The IP address mapping file includes a target IP address list and a current IP address list, the target IP address list includes target IP addresses corresponding to multiple nodes, and the current IP address list includes current IP addresses corresponding to multiple nodes, the current IP addresses are manually filled by a user, so there may be differences with the actual IP addresses currently used by the nodes. The IP address type includes a first IP address type and a second IP address type, for example, the first IP address type is IPV6 type, and the second IP address type is IPV4 type. In an embodiment, the IP address type corresponding to each current IP address in the current IP address list can be identified by a structure delimiter contained in the current IP address.

[0049] Step S104, in the case that the IP address type corresponding to the node is the first IP address type, the current IP address corresponding to the node in the current IP address list is standardized according to the actual IP address list to obtain a standardized current IP address list.

[0050] In actual application, the IP address of IPV6 type has diversified characteristics, therefore, the current IP address of IPV6 type is standardized, in specific implementation, first, the actual IP address list is acquired in offline state or online state, the current IP address list is integrity checked by using the actual IP address list, in the case of passing the integrity check, the current IP address of IPV6 type is standardized, including expanding the current IP address of IPV6 type according to the standard structure, and replacing the current IP address of IPV6 type by using the corresponding folder name, etc., so that the current IP address in the current IP address list is consistent with the actual IP address currently used by the node.

[0051] In step S106, the IP address mapping relationship is generated based on the target IP address list and the current IP address list after standardization processing. The IP address mapping relationship is used to describe the one-to-one correspondence between the target IP address contained in the target IP address list and the current IP address contained in the current IP address list after standardization processing.

[0052] In step S108, the IP address switching operation is performed based on the pre-configured parameter configuration file and the IP address mapping relationship, so as to replace the current IP address corresponding to the multiple nodes in the GBase8a database with the target IP address.

[0053] In an embodiment, for the node of IPV4 type, the node ID of the node needs to be determined according to the corresponding target IP address, the cluster meta information carrier is backed up before the content of the related configuration file is modified, then the configuration file on each node in the cluster is modified according to the pre-configured parameter configuration file, the IP address mapping relationship and the node ID, including modifying the node IP (denoted as nodeip), the node ID (denoted as nodeid), the IP file under the cluster installation path, modifying the soft link of the cluster client service, etc. If the modification operation fails, the rollback mechanism is triggered, and the rollback operation is performed by using the backed up cluster meta information carrier.

[0054] The GBase8a database IP address switching method provided by the embodiment of the application can identify the IP address type corresponding to each node in the IP address mapping file, and standardize the current IP address of the first address type according to the actual IP address list, and generate the IP address mapping relationship in combination with the target IP address list, so that the IP address switching operation can significantly improve the success rate.

[0055] Currently, the cluster network address switching technology ensures the security of the overall cluster data. Embodiments of the present application aim to realize the compatibility of four different scenarios of cluster network address from IPV4 to IPV4, IPV4 to IPV6, IPV6 to IPV6, IPV6 to IPV4, and at the same time, in order to ensure the security of the cluster data during address switching, increase the security backup and automatic rollback mechanism of the cluster data, and reduce the risk brought by address switching. In the implementation process, the following problems are mainly faced: first, how to effectively obtain the IP address of all nodes of the cluster and the corresponding node ID in the cluster service stop state; second, due to the diversity of IPV6 address, the address can be abbreviated and expanded, so in the IPV6 scenario, how to match the address input by the user with the address recorded by the cluster is a relatively difficult problem; third, based on the gbase 8a cluster, how to handle the security rollback problem of cluster address switching.

[0056] The target of embodiments of the present application is to solve the three problems of IP and ID acquisition of cluster nodes, configuration file matching corresponding IP under IPV6 scenario and modification, safe replacement and rollback of multi-instance cluster in the address switching process in the cluster. For the IP and ID problem of cluster nodes, embodiments of the present application propose that when the cluster service is normally running, the IP and ID of all nodes of the cluster are obtained from the cluster management node port, and when the cluster service is stopped running, the IP and ID of all management nodes and single nodes are obtained from the configuration file of the current execution node. For the IPV6 address matching problem, embodiments of the present application propose to uniformly judge the type of network address and uniformly abbreviate the address to avoid the difficulty problem of IP matching introduced by IPV6 address. For the configuration file processing problem of multi-instance cluster, embodiments of the present application propose to traverse the cluster nodes before replacement, query the corresponding network IP information on each node, and generate the mapping of physical nodes and multi-instance IP. In addition, for automatic rollback, embodiments of the present application propose to add operation identification in each flow of address switching, and clearly define the execution stage. Further, when address switching error occurs, automatically switch to the rollback program of the corresponding stage to reduce the risk of misoperation of rollback.

[0057] The main components involved in the technology include: parameter analysis component, cluster network IP topology acquisition component, cluster node ID acquisition component, cluster service stopping component, snapshot brushing component, backup and rollback component, cluster IP modification component. The parameter analysis component mainly analyzes the IP replacement parameter configuration file input by the user, mainly including cluster installation path, cluster management node and single node IP, OS user and password, cluster version, new and old IP mapping file path, etc.; the cluster network IP topology acquisition component mainly acquires the IP of all nodes of the current cluster, and compares it with the IP list in the parameter configuration file input by the user; the cluster node ID acquisition component mainly acquires the nodeId of all single nodes of the cluster, and generates the mapping relationship between IP and ID; the cluster service stopping component is mainly used to stop the cluster service to ensure the safety of subsequent operations; the snapshot brushing component mainly refreshes the cluster snapshot, records the detailed information of the cluster into the snapshot file, and ensures that the cluster can normally run according to the snapshot information after being restarted; the backup and rollback component mainly backs up the configuration file to be modified before replacement, and performs automatic rollback when modification errors occur; the cluster IP modification component mainly modifies the related files containing IP and ID, and resets the related soft links of the cluster. The embodiments of the application complete the switching and rollback of the cluster IP address through the cooperation of these components. Referring to the flowchart of another GBase8a database IP address switching method shown in Figure 2 The main process includes the following steps: inputting parameters, parameter checking, acquiring cluster IP and ID, stopping cluster service, brushing snapshot, backing up configuration file, modifying node IP and ID, modifying disk IP path, and modifying soft link.

[0058] In specific implementation, the following steps 1 to 7 are mainly included:

[0059] Step 1, fill in the parameter configuration file and the IP address mapping file.

[0060] According to the current cluster IP and node type (management node or single node) and cluster installation path, version number, etc., fill in the parameter configuration file and the IP address mapping file.

[0061] For example, the parameter configuration file is as follows:

[0062] installPrefix = / home / opt / / cluster installation path

[0063] coordinaterHost = 192.168.11.1, 192.168.11.2

[0064] dataHost = 192.168.11.1, 192.168.11.2

[0065] gcwareHost = 192.168.11.1

[0066] dbaUser = user1

[0067] dbaGroup = user1

[0068] dbaPwd = 'passwd'

[0069] rootPwd = 'rootpwd'

[0070] version = 'V862\V952\V953'

[0071] hostReplaceIpFile = hostReplaceIp.json / / File format for mapping old and new IP addresses

[0072] For example, the IP address mapping file is shown below:

[0073] {

[0074] “HOSTREPLACEIP”:[

[0075] {

[0076] "OLDIP":"192.168.11.1",

[0077] "NEWIP":"2001::ac10:191"

[0078] },

[0079] {

[0080] "OLDIP":"192.168.11.2",

[0081] "NEWIP":"2001::ac10:192"

[0082] } ]

[0084] }

[0085] OLDIP is the current IP address, and NEWIP is the target IP address.

[0086] Step 2: Parse the parameter configuration file.

[0087] The parameter configuration file is parsed to obtain information such as the cluster version, installation path, node username and password.

[0088] The IP address mapping file is parsed to obtain the IP address type corresponding to each node in the IP address mapping file. Specifically, for any current IP address in the current IP address list, the IP address type corresponding to the node to which the current IP address belongs is identified based on the structure delimiter in the current IP address, wherein the structure delimiter includes ":" and ".". In a specific embodiment, the IP of the execution node (i.e., the target node) is obtained by obtaining environment variables of the tool execution node, such as the GBASE_BASE environment variable, and then judging whether the current IP is IPV6 according to whether the IP contains ":". For example, if ":" exists, it is determined to be IPV6, otherwise, it is further judged whether the current IP contains "." to determine whether it is an IPV4 address. For example, if "." exists, it is determined to be IPV4.

[0089] Step 3, obtaining the IP and ID of each node in the cluster.

[0090] The embodiments of the present application provide two modes, one is cluster online replacement, that is, IP replacement is performed when the cluster service is normally running, and the other is cluster offline replacement, that is, the user manually stops the cluster service before performing IP replacement to ensure that the business is completely stopped. In the first mode, the gcware node (the node that saves the cluster information) provides a port service for obtaining the IP and ID of the cluster; and in the second mode, the IP and ID of all nodes in the cluster can only be obtained through the node configuration file and node snapshot information on the current execution node.

[0091] On this basis, the following operations are performed for IPV6 and IPV4 respectively:

[0092] (I) For IPV6, the following operations are performed:

[0093] (1.1) In the offline state of the GBase8a database, the actual IP address list is obtained based on the node configuration file and the node snapshot information, and the integrity of the current IP address list is verified based on the actual IP address list. Wherein, according to the obtained actual IP address list, the current IP list obtained by parsing is compared to determine whether there is an input error or missing node IP, and the user is prompted, and if there is no input error or missing node IP, it is determined to pass the integrity test.

[0094] (1.2) In the case of passing the integrity test, the following operations are performed on the current IP address in the current IP address list belonging to the first address type:

[0095] (I) The current IP address list is connected and attempted to determine whether there is a node in the cluster that cannot be connected, and if there is, the user is prompted to correct it so that all nodes can be successfully connected.

[0096] (II) Based on the standard structure corresponding to the first IP address type, the current IP address corresponding to the node is extended to obtain the standard IP address corresponding to the node. Considering that there may be abbreviation and extension issues with IPv6 addresses, the IPv6 addresses in the current IP address list are uniformly extended to standard IPv6 addresses, that is, the "::" in the IP address is extended to ":0000:", thereby avoiding the problem that the IPv6 format in the two configuration files may be inconsistent due to manual input.

[0097] (III) Update the current IP address corresponding to the node based on the installation prefix path corresponding to the node to obtain a standardized list of current IP addresses. In one example, read the folder name under the installation prefix path corresponding to the node; if the folder name belongs to the first IP address type based on the structure delimiter in the folder name, replace the current IP address corresponding to the node with the folder name.

[0098] In practical implementation, regarding IPv6 addresses, since the IPv6 directory created during cluster installation may be in abbreviated or extended format, inconsistent with the IPv6 format in the user-input configuration file, this design first remotely executes `ls -l installPrefix` on each node, where `installPrefix` is the cluster's installation prefix path. This retrieves all folder names under that path. Then, it checks if each folder name is an IPv6 address and if it's in the current IP address list in the IP mapping file. If so, the match is successful. The current IP address list in the IP mapping file is then updated, replacing the IPv6 entries with the matching folder names. This establishes the correspondence between the actual IP addresses on the nodes and the target IP addresses, ensuring smooth backup and modification of corresponding paths and configuration files in subsequent steps.

[0099] (ii) Perform the following operations for IPv4:

[0100] If the IP address type corresponding to the node is the second IP address type, the current IP address corresponding to the node is extracted from the current IP address list. Based on the structure delimiters contained in the current IP address, the current IP address is split into multiple IP address segments, and a current node ID corresponding to the node is generated based on these multiple IP address segments. Similarly, the target IP address corresponding to the node is extracted from the target IP address list. Based on the structure delimiters contained in the target IP address, the target IP address is split into multiple IP address segments, and a target node ID is generated based on these multiple IP address segments. In subsequent IP replacement processing, the node ID corresponding to the current IP address is replaced with the node ID corresponding to the target IP address.

[0101] In practical implementation, for scenarios where gcware may be abnormal, this embodiment of the invention automatically calculates the corresponding nodeId based on the target IPv4 address, and the calculation rules are as follows:

[0102] (2.1) For IPv4 type IPs, split them into 4 segments according to ".";

[0103] (2.2) Convert the decimal sequence corresponding to each IP segment into a hexadecimal sequence;

[0104] (2.3) Then concatenate the four hexadecimal sequences in reverse order to form an 8-digit hexadecimal sequence;

[0105] (2.4) Convert the hexadecimal sequence obtained in 2.3 to decimal to obtain the nodeId;

[0106] (2.5) If nodeId is greater than 2^31, it needs to be converted to two's complement (nodeId-2^32).

[0107] For example, assuming the IPv4 address is 192.168.6.182, the corresponding hexadecimal sequences of each segment are C0, A8, 06, and B6, respectively. Then, concatenating them in reverse order yields the hexadecimal sequence B606A8C0. Converting this to decimal 3053889728, which is greater than 2^31, we can convert it to the corresponding two's complement -1241077568.

[0108] Step 4: Stop all related services on all nodes in the cluster.

[0109] Based on the cluster information obtained from the statistics, an instruction is issued to stop the services in the cluster to ensure that user services can access the cluster without causing information chaos during subsequent operations.

[0110] Step 5: Start some services on the management node, refresh the snapshot, and then shut down the management node service.

[0111] In a V862 cluster, the snapshot refresh operation can be completed by performing three operations: stop, start, and stop the cluster.

[0112] In V952 and V953 clusters, the steps to refresh the snapshot when performing an online replacement are as follows:

[0113] (a) Start the gcware service on all gcware nodes;

[0114] (b) Execute the gcware.flush_statemachine() interface to refresh the snapshot;

[0115] (c) Comparing the snapshot versions before and after the refreshing, ensuring the success of the refreshing, only when the snapshot version after the refreshing is greater than the maximum snapshot version before the refreshing and greater than the maximum redolog version, it indicates that the refreshing is successful, otherwise, it will perform retry and re-execute (b);

[0116] (d) Stopping the gcware service of all gcware nodes;

[0117] When performing offline replacement, the refreshing snapshot step is as follows: cleaning the sessions file under / gcware / data / gcware / SNAPSHOT.X.X and initializing the resource file, ensuring that the connection information is empty without residual, releasing all resource information.

[0118] Step 6, backing up the local configuration file of each node in the cluster.

[0119] Backup the cluster meta information carrier (i.e. the local configuration file of each node) of the GBase8a database. For example:

[0120] Table 1 Cluster meta information carrier

[0121]

[0122] Specifically, in the V862 cluster, the files and directories in step 3 are all backed up in the / root path; in the V95 series cluster, the related files and directories are all backed up to the home directory of the cluster user, and for the multi-instance version cluster in V953, a folder is established in the home directory of the cluster user with the instance IP as the folder name to store the related files of the own instance.

[0123] Step 7, modifying the configuration file of each node in the cluster, including modifying nodeip, nodeid, IP file under the cluster installation path, modifying soft link of cluster client service, etc. In an embodiment, based on the pre-configured parameter configuration file, IP address mapping relationship and target node ID corresponding to the node of the second IP address type, the IP address switching operation is performed. If it is detected that the IP address switching operation fails, a rollback mechanism is triggered, and a rollback operation is performed based on the backup cluster meta information carrier.

[0124] Specifically, the configuration file on each node in the cluster is modified, including modifying nodeip, nodeid, IP file under the cluster installation path, modifying soft link of cluster client service, etc., to ensure the normal use of the cluster client.

[0125] In this step, the automatic rollback mechanism is added because the IP replacement operation may fail due to machine or other objective factors. In the replacement process, the operation identifier is recorded for each modification operation. When the IP replacement operation fails, the currently executed step is automatically identified according to the operation identifier and the backup file, the step that needs to be rolled back is judged, the corresponding file is copied from the backup directory for rollback, such as Figure 3 As shown in an automatic rollback workflow diagram, after the error-triggered rollback is performed, the cluster service is stopped, the configuration file is rolled back according to the backup file, the cluster IP directory is rolled back, and the environment variable and the client soft link are rolled back.

[0126] On the basis of the foregoing embodiment, the embodiment of the application provides a GBase8a database IP address switching device, the GBase8a database is a distributed database running in a cluster form, the device is applied to a target node in the GBase8a database, and as shown in a structure diagram of a GBase8a database IP address switching device, the device mainly comprises the following parts: Figure 4

[0127] The analysis module 402 is configured to analyze the preconfigured IP address mapping file to obtain the IP address type corresponding to each node in the IP address mapping file, and the IP address mapping file comprises a target IP address list and a current IP address list.

[0128] The standardization module 404 is configured to, in the case that the IP address type corresponding to the node is the first IP address type, perform standardization processing on the current IP address corresponding to the node in the current IP address list according to the actual IP address list to obtain a standardized current IP address list.

[0129] The mapping generation module 406 is configured to generate an IP address mapping relationship based on the target IP address list and the standardized current IP address list, and the IP address mapping relationship is used to describe a one-to-one correspondence between the target IP address included in the target IP address list and the current IP address included in the standardized current IP address list.

[0130] The address switching module 408 is configured to perform an IP address switching operation based on the preconfigured parameter configuration file and the IP address mapping relationship to replace the current IP address corresponding to the plurality of nodes in the GBase8a database with the target IP address.

[0131] ​The GBase8a database IP address switching device provided by the embodiment of the present application can identify the IP address type corresponding to each node in the IP address mapping file, standardize the current IP address of the first address type according to the actual IP address list, generate an IP address mapping relationship in combination with the target IP address list, and can significantly improve the success rate of the IP address switching operation.

[0132] The device provided by the embodiment of the present application has the same implementation principle and technical effects as the foregoing method embodiments, and for brevity of description, the part not mentioned in the device embodiment can be referred to the corresponding content in the foregoing method embodiments.

[0133] The embodiment of the present application provides an electronic device, specifically, the electronic device includes a processor and a memory; the memory stores a computer program, and the computer program executes the method of any one of the above embodiments when executed by the processor.

[0134] Figure 5 The structure schematic diagram of the electronic device provided by the embodiment of the present application, the electronic device 100 includes: a processor 50, a memory 51, a bus 52 and a communication interface 53, the processor 50, the communication interface 53 and the memory 51 are connected through the bus 52; the processor 50 is used for executing the executable module stored in the memory 51, for example, a computer program.

[0135] The memory 51 can include a high-speed random access memory (RAM) and can also include a non-volatile memory, for example, at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 53 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used.

[0136] The bus 52 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 5 Only one bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0137] The memory 51 is used for storing a program, and the processor 50 executes the program after receiving an execution instruction. The method executed by the device defined by the flow process disclosed in any one of the foregoing embodiments of the present application can be applied to the processor 50 or realized by the processor 50.

[0138] The processor 50 can be an integrated circuit chip with signal processing capability. In implementation, each step of the above method can be completed by integrated logic circuit of hardware in the processor 50 or by instructions in the form of software. The processor 50 described above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Each method, step and logic block diagram disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium in the art. The storage medium is located in the memory 51, and the processor 50 reads the information in the memory 51, and combines the hardware to complete the steps of the above method.

[0139] The computer program product of the readable storage medium provided by the embodiments of the present application includes a computer readable storage medium storing program codes, and the program codes include instructions for executing the method described in the foregoing method embodiments. For specific implementation, reference can be made to the foregoing method embodiments, which will not be described here.

[0140] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes instructions for making a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0141] Finally, it should be noted that: the above-described embodiments are only specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, but not to limit them. The protection scope of the present application is not limited to this. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily think of changes to the technical solutions recorded in the foregoing embodiments within the technical range disclosed by the present application, or make equivalent replacements to some technical features. The modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for switching IP addresses in a GBase8a database, characterized in that, The GBase8a database is a distributed database running in a cluster. The method is applied to target nodes in the GBase8a database, and the method includes: The pre-configured IP address mapping file is parsed to obtain the IP address type corresponding to each node in the IP address mapping file, which includes a target IP address list and a current IP address list; When the IP address type corresponding to the node is the first IP address type, the current IP address corresponding to the node in the current IP address list is standardized according to the actual IP address list to obtain the standardized current IP address list. Based on the target IP address list and the standardized current IP address list, an IP address mapping relationship is generated. The IP address mapping relationship is used to describe the one-to-one correspondence between the target IP addresses contained in the target IP address list and the current IP addresses contained in the standardized current IP address list. Based on the pre-configured parameter configuration file and the IP address mapping relationship, an IP address switching operation is performed to replace the current IP address corresponding to multiple nodes in the GBase8a database with the target IP address.

2. The GBase8a database IP address switching method according to claim 1, characterized in that, The pre-configured IP address mapping file is parsed to obtain the IP address type corresponding to each node in the IP address mapping file, including: For any current IP address in the current IP address list, identify the IP address type of the node to which the current IP address belongs based on the structure delimiter in the current IP address.

3. The GBase8a database IP address switching method according to claim 1, characterized in that, When the IP address type corresponding to the node is a first IP address type, the current IP addresses corresponding to the nodes in the current IP address list are standardized according to the actual IP address list to obtain the standardized current IP address list, including: When the GBase8a database is offline, the actual IP address list is obtained based on the node configuration file and node snapshot information, and the integrity of the current IP address list is checked based on the actual IP address list. If the integrity check passes, the following operation is performed on the current IP addresses in the current IP address list that belong to the first address type: Based on the standard structure corresponding to the first IP address type, the current IP address corresponding to the node is extended to obtain the standard IP address corresponding to the node; and / or, based on the installation prefix path corresponding to the node, the current IP address corresponding to the node is updated to obtain the standardized list of current IP addresses; wherein, the first IP address type is IPv6.

4. The GBase8a database IP address switching method according to claim 3, characterized in that, Based on the installation prefix path corresponding to the node, update the current IP address corresponding to the node, including: Read the folder name under the installation prefix path corresponding to the node; If the folder name is identified as belonging to the first IP address type based on the structural delimiter in the folder name, the current IP address corresponding to the node is replaced with the folder name.

5. The GBase8a database IP address switching method according to claim 1, characterized in that, Before performing the IP address switching operation based on the pre-configured parameter configuration file and the IP address mapping relationship, the method further includes: If the IP address type corresponding to the node is a second IP address type, the following operation is performed, where the second IP address type is IPv4: Extract the current IP address corresponding to the node from the current IP address list, split the current IP address into multiple current IP address segments according to the structure delimiter contained in the current IP address, and generate the current node ID corresponding to the node based on the multiple current IP address segments; Furthermore, the target IP address corresponding to the node is extracted from the target IP address list, and the target IP address is split into multiple target IP address segments according to the structural delimiter contained in the target IP address. The target node ID corresponding to the node is generated based on the multiple target IP address segments.

6. The GBase8a database IP address switching method according to claim 5, characterized in that, Based on a pre-configured parameter configuration file and the IP address mapping relationship, an IP address switching operation is performed, including: Based on the pre-configured parameter configuration file, the IP address mapping relationship, and the target node ID corresponding to the node of the second IP address type, an IP address switching operation is performed.

7. The GBase8a database IP address switching method according to claim 1, characterized in that, The method further includes: Back up the cluster metadata carrier of the GBase8a database; If the IP address switching operation fails, a rollback mechanism is triggered, and the rollback operation is performed based on the backed-up cluster metadata carrier.

8. A GBase8a database IP address switching device, characterized in that, The GBase8a database is a distributed database running in a cluster. The device is applied to the target node in the GBase8a database, and the device includes: The parsing module is used to parse the pre-configured IP address mapping file to obtain the IP address type corresponding to each node in the IP address mapping file, which includes a target IP address list and a current IP address list; The standardization module is used to standardize the current IP addresses corresponding to the nodes in the current IP address list according to the actual IP address list when the IP address type corresponding to the node is a first IP address type, so as to obtain the standardized current IP address list. The mapping generation module is used to generate an IP address mapping relationship based on the target IP address list and the standardized current IP address list. The IP address mapping relationship is used to describe the one-to-one correspondence between the target IP addresses contained in the target IP address list and the current IP addresses contained in the standardized current IP address list. The address switching module is used to perform IP address switching operations based on a pre-configured parameter configuration file and the IP address mapping relationship, so as to replace the current IP address corresponding to multiple nodes in the GBase8a database with the target IP address.

9. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Database switching method and device, electronic equipment and storage medium

    CN115344555A

  • Database switching result query method and device, equipment, medium and program product

    CN117041206A