WO2021179476A1 - Ctdb虚拟ip的分配方法、装置及分布式存储设备 - Google Patents

Ctdb虚拟ip的分配方法、装置及分布式存储设备 Download PDF

Info

Publication number
WO2021179476A1
WO2021179476A1 PCT/CN2020/098031 CN2020098031W WO2021179476A1 WO 2021179476 A1 WO2021179476 A1 WO 2021179476A1 CN 2020098031 W CN2020098031 W CN 2020098031W WO 2021179476 A1 WO2021179476 A1 WO 2021179476A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual
ipv4
parameters
ipv6
allocation
Prior art date
Application number
PCT/CN2020/098031
Other languages
English (en)
French (fr)
Inventor
翟云磊
张端
Original Assignee
苏州浪潮智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 苏州浪潮智能科技有限公司 filed Critical 苏州浪潮智能科技有限公司
Priority to US17/910,083 priority Critical patent/US11757830B2/en
Publication of WO2021179476A1 publication Critical patent/WO2021179476A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/659Internet protocol version 6 [IPv6] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/686Types of network addresses using dual-stack hosts, e.g. in Internet protocol version 4 [IPv4]/Internet protocol version 6 [IPv6] networks

Definitions

  • the present invention relates to the field of distributed storage technology, and in particular to a method, device, distributed storage device and computer-readable storage medium of CTDB virtual IP.
  • CTDB Cluster Trivial Database
  • the CTDB master node will read the configured virtual IP from the virtual IP configuration file and average these virtual IPs according to the specified virtual IP allocation algorithm And it is randomly assigned to each normal node of the cluster.
  • CTDB will perform failover, release the virtual IP allocated on the original failed node, and then drift the IP to other normal nodes. Read and write services will also drift to other normal nodes; when the node returns to join the cluster normally, CTDB will randomly select the virtual IP on other normal nodes and assign it to the node.
  • the current virtual IP allocation algorithm used by the CTDB master node is balanced allocation and random allocation, that is, to ensure that the number of virtual IPs held by each normal node is balanced (the number of virtual IPs held by any two normal nodes differs by at most 1 ), the virtual IP assigned to each normal node is random (it is not easy to predict which virtual IP each node will be assigned in advance).
  • CTDB randomly selects one or more virtual IPs and assigns it to The node.
  • the CTDB master node when the CTDB master node performs virtual IP allocation, it does not distinguish between IPV4 and IPV6, that is, an IPV4 is equivalent to an IPV6 in the virtual IP allocation process.
  • the virtual IP When the virtual IP is configured with both IPV4 and IPV6, it may cause some normal nodes
  • the ones that are allocated are all IPV4, and the ones that are allocated to other normal nodes are all IPV6. Therefore, how to ensure that the number of IPV4 and IPV6 allocated to each normal node is relatively balanced, meet the use requirements of some specific scenarios, and improve user experience is a problem that needs to be solved urgently.
  • the purpose of the present invention is to provide a CTDB virtual IP distribution method, device, distributed storage device and computer readable storage medium to ensure the IPV4 and IPV6 assigned to each normal node through the isolation and distribution of IPV4 and IPV6 virtual IP The number is relatively balanced.
  • the present invention provides a CTDB virtual IP allocation method, which is applied to a distributed storage cluster, including:
  • the CTDB master node obtains IPV4 known virtual IP parameters, IPV6 known virtual IP parameters, IPV4 available virtual IP parameters, and IPV6 available virtual IP parameters; wherein, the IPV4 known virtual IP parameters include the known IPV4 corresponding to each normal node Virtual IP;
  • IPV4 virtual IP parameters Use the known IPV4 virtual IP parameters and the IPV4 available virtual IP parameters to perform virtual IP allocation calculations to obtain an IPV4 allocation result
  • IPV6 Use the IPV6 known virtual IP parameters and the IPV6 available virtual IP parameters to perform virtual IP allocation calculations to obtain an IPV6 allocation result
  • the CTDB master node obtains IPV4 known virtual IP parameters, IPV6 known virtual IP parameters, IPV4 available virtual IP parameters, and IPV6 available virtual IP parameters, including:
  • the CTDB master node obtains known virtual IP parameters and available virtual IP parameters; wherein, the known virtual IP parameters include known virtual IPs corresponding to each of the normal nodes, and the available virtual IP parameters include each of the normal Available virtual IP corresponding to the node;
  • the known virtual IP parameters and the available virtual IP parameters Separate the known virtual IP parameters and the available virtual IP parameters to obtain the IPV4 known virtual IP parameters, the IPV6 known virtual IP parameters, the IPV4 available virtual IP parameters, and the IPV6 available Virtual IP parameters.
  • the known virtual IP parameters and the available virtual IP parameters are a known virtual IP list and an available virtual IP list, respectively, the known virtual IP parameters and the available virtual IP parameters are respectively compared Perform separation to obtain the IPV4 known virtual IP parameters, the IPV6 known virtual IP parameters, the IPV4 usable virtual IP parameters, and the IPV6 usable virtual IP parameters, including:
  • the first number is the IPV4 number in the known virtual IP list Know the number of virtual IPs
  • the second number is the number of known virtual IPs of IPV6 in the list of known virtual IPs
  • the first number and the second number generate an IPV4 known virtual IP list and an IPV6 known virtual IP list corresponding to the known virtual IP list; wherein the length of the IPV4 known virtual IP list is The first number, the length of the IPV6 known virtual IP list is the second number;
  • the third number is the number of available virtual IPs of IPV4 in the available virtual IP list
  • the fourth quantity is the quantity of available virtual IPs of IPV6 in the available virtual IP list
  • the third number and the fourth number generate an IPv4 available virtual IP list and an IPv6 available virtual IP list corresponding to the available virtual IP list; wherein the length of the IPv4 available virtual IP list is the third The length of the IPV6 available virtual IP list is the fourth number.
  • the performing virtual IP allocation to each normal node according to the IPV4 allocation result and the IPV6 allocation result includes:
  • IPV4 allocation result If the IPV4 allocation result is empty, use the IPV6 allocation result as the final allocation result, and perform virtual IP allocation to each normal node according to the final allocation result;
  • IPV6 allocation result If the IPV6 allocation result is empty, use the IPV4 allocation result as the final allocation result, and perform virtual IP allocation to each normal node according to the final allocation result;
  • the final allocation result is generated, and the final allocation result is assigned to each office according to the final allocation result.
  • the normal node performs virtual IP allocation.
  • said using the known IPV4 virtual IP parameters and the IPV4 available virtual IP parameters to perform virtual IP allocation, before obtaining the IPV4 allocation result further includes:
  • IPV4 Determine whether it is satisfied that the known virtual IP parameters of IPV4 include the known virtual IP of IPV4 corresponding to the target node, or the available virtual IP parameters of IPV4 include the available virtual IP of IPV4 corresponding to any normal node; wherein, The target node is any one of the normal nodes, and the target node currently holds an IPV4 virtual IP;
  • the number of known virtual IPs of IPV4 in the IPV4 known virtual IP parameters is an integer multiple of the number of normal nodes; the number of known virtual IPs of IPV6 in the IPV6 known virtual IP parameters is the number of normal nodes Integer multiples of.
  • the method before performing virtual IP allocation to each normal node according to the IPV4 allocation result and the IPV6 allocation result, the method includes:
  • the distribution target node is any one of the normal nodes
  • the present invention also provides a CTDB virtual IP distribution device, which is applied to a distributed storage cluster, and includes:
  • the acquiring module is used to acquire IPV4 known virtual IP parameters, IPV6 known virtual IP parameters, IPV4 available virtual IP parameters, and IPV6 available virtual IP parameters; wherein, the IPV4 known virtual IP parameters include IPV4 parameters corresponding to each normal node Known virtual IP;
  • the first allocation calculation module is configured to use the known IPV4 virtual IP parameters and the IPV4 available virtual IP parameters to perform virtual IP allocation calculations to obtain an IPV4 allocation result;
  • the second allocation calculation module is configured to use the known IPV6 virtual IP parameters and the IPV6 available virtual IP parameters to perform virtual IP allocation calculations to obtain an IPV6 allocation result;
  • the allocation module is configured to perform virtual IP allocation to each normal node according to the IPV4 allocation result and the IPV6 allocation result.
  • the acquisition module includes:
  • the obtaining sub-module is used to obtain known virtual IP parameters and available virtual IP parameters; wherein, the known virtual IP parameters include known virtual IPs corresponding to each of the normal nodes, and the available virtual IP parameters include each of the Available virtual IP corresponding to normal node;
  • the ionization module is used to separate the known virtual IP parameters and the available virtual IP parameters to obtain the IPV4 known virtual IP parameters, the IPV6 known virtual IP parameters, and the IPV4 available virtual IP Parameters and the IPV6 available virtual IP parameters.
  • the separation submodule includes:
  • the first traversal unit is configured to traverse all known virtual IPs corresponding to each normal node in the list of known virtual IPs, and record a first number and a second number; wherein, the first number is a known virtual IP The number of known virtual IPs of IPV4 in the IP list, and the second number is the number of known virtual IPs of IPV6 in the known virtual IP list;
  • the first generating unit is configured to generate an IPV4 known virtual IP list and an IPV6 known virtual IP list corresponding to the known virtual IP list according to the first number and the second number; wherein, the IPV4 has been The length of the known virtual IP list is the first number, and the length of the IPV6 known virtual IP list is the second number;
  • the second traversal unit is configured to traverse all available virtual IPs corresponding to each normal node in the available virtual IP list, and record the third number and the fourth number; wherein, the third number is in the available virtual IP list The number of available virtual IPs of IPV4, where the fourth number is the number of available virtual IPs of IPV6 in the list of available virtual IPs;
  • the second generating unit is configured to generate an IPV4 available virtual IP list and an IPV6 available virtual IP list corresponding to the available virtual IP list according to the third number and the fourth number; wherein, the IPV4 available virtual IP list The length of is the third number, and the length of the IPV6 available virtual IP list is the fourth number.
  • the distribution module includes:
  • the first allocation submodule is configured to, if the IPV4 allocation result is empty, use the IPV6 allocation result as the final allocation result, and perform virtual IP allocation to each normal node according to the final allocation result;
  • the second allocation sub-module is configured to, if the IPV6 allocation result is empty, use the IPV4 allocation result as the final allocation result, and perform virtual IP allocation to each normal node according to the final allocation result;
  • the third allocation sub-module is used to if the IPV4 allocation result and the IPV6 allocation result are not empty, after connecting the IPV6 allocation result to the IPV4 allocation result, generate the final allocation result, and follow The final allocation result performs virtual IP allocation to each of the normal nodes.
  • the device further includes:
  • the judging module is used to judge whether there is a redistribution node in the normal node according to the IPV4 allocation result and the IPV6 allocation result; wherein, the number of virtual IPs corresponding to the redistribution node is greater than the number of virtual IPs corresponding to the allocation target node. There are two more IPs, and the allocation target node is any of the normal nodes; if not, send a start signal to the allocation module;
  • the redistribution module is configured to, if there is a redistribution node, allocate a virtual IP in the IPV4 virtual IP corresponding to the redistribution node in the IPV4 allocation result to a corresponding one of the allocation target nodes, or allocate all In the IPV6 allocation result, one virtual IP in the IPV6 virtual IP corresponding to the redistribution node is allocated to a corresponding one of the allocation target nodes.
  • the present invention also provides a distributed storage device, including:
  • Memory used to store computer programs
  • the processor is used to implement the steps of the CTDB virtual IP allocation method as described above when the computer program is executed.
  • the present invention also provides a computer-readable storage medium with a computer program stored on the computer-readable storage medium, and when the computer program is executed by a processor, the method for allocating the virtual IP of CTDB as described above is implemented. step.
  • the CTDB virtual IP allocation method provided by the present invention is applied to distributed storage clusters.
  • IPV4 known virtual IP parameters corresponding to the virtual IP of IPV4 and the available virtual IP parameters of IPV4 and the IPV6 corresponding to the virtual IP of IPV6
  • Knowing the virtual IP parameters and IPV6 available virtual IP parameters you can calculate the IPV4 allocation results and the IPV6 allocation results respectively, and then use the IPV4 allocation results and the IPV6 allocation results to allocate virtual IP to each normal node, and you can realize the virtual IP of IPV4 and IPV6
  • the isolated distribution of IPV ensures that the number of IPV4 and IPV6 allocated to each normal node is relatively balanced, meets the use requirements of some specific scenarios, and improves user experience.
  • the present invention also provides a CTDB virtual IP distribution device, a distributed storage device and a computer-readable storage medium, which also have the above-mentioned beneficial effects.
  • Figure 1 is a flowchart of a CTDB virtual IP allocation method provided by an embodiment of the present invention
  • FIG. 2 is a flowchart of acquiring known virtual IP parameters and available virtual IP parameters in another CTDB virtual IP allocation method provided by an embodiment of the present invention
  • FIG. 3 is a flow chart of separating known virtual IP parameters and available virtual IP parameters in another CTDB virtual IP allocation method provided by an embodiment of the present invention
  • Fig. 4 is a structural block diagram of a CTDB virtual IP allocation device provided by an embodiment of the present invention.
  • FIG. 1 is a flowchart of a CTDB virtual IP allocation method provided by an embodiment of the present invention. This method is applied to distributed storage clusters and can include:
  • Step 101 The CTDB master node obtains IPV4 known virtual IP parameters, IPV6 known virtual IP parameters, IPV4 available virtual IP parameters, and IPV6 available virtual IP parameters; among them, the known virtual IP parameters of IPV4 include the IPV4 information corresponding to each normal node. Know the virtual IP.
  • the CTDB master node in this step may be a node that runs a CTDB software program in a distributed storage cluster to allocate virtual IP to normal nodes.
  • This embodiment does not limit the specific selection of the CTDB master node.
  • the CTDB master node can be correspondingly set in the same or similar manner as the CTDB master node in the prior art.
  • the IPV4 known virtual IP parameters and the IPV4 available virtual IP parameters in this step can be the two main variables used when the CTDB master node performs the IPV4 virtual IP allocation calculation;
  • the IPV4 known virtual IP parameters can include normal The known virtual IP of IPV4 corresponding to the node, and the available virtual IP parameters of IPV4 can include the available virtual IP of IPV4 corresponding to each normal node;
  • the known virtual IP parameters of IPV6 and the available virtual IP parameters of IPV6 in this step can be performed for the CTDB master node
  • Two variables are mainly used in the calculation of the virtual IP allocation of IPV6;
  • the known virtual IP parameters of IPV6 can include the known virtual IP of each normal node, and the available virtual IP parameters of IPV6 can include the availability of the IPV6 corresponding to each normal node.
  • the specific content of the known virtual IP parameters of IPV4, known virtual IP parameters of IPV6, available virtual IP parameters of IPV4, and available virtual IP parameters of IPV6 in this step can be set by the designer. If it can be used without distinction from the prior art
  • the known virtual IP parameters and available virtual IP parameters that need to be used in the calculation of virtual IP allocation for IPV4 and IPV6 are set correspondingly in the same or similar manner, as long as it is ensured that the virtual IP allocation calculation method in the prior art is used, such as calling virtual IP allocation Algorithm, you can use the known virtual IP parameters of IPV4 and the available virtual IP parameters of IPV4 to perform virtual IP allocation calculations for the virtual IP of IPV4, and use the known virtual IP parameters of IPV6 and the available virtual IP parameters of IPV6 to virtualize the virtual IP of IPV6 IP allocation calculation, this embodiment does not impose any restriction on this.
  • the specific method for the CTDB master node to obtain IPV4 known virtual IP parameters, IPV6 known virtual IP parameters, IPV4 available virtual IP parameters, and IPV6 available virtual IP parameters in this step can be determined by the designer according to practical scenarios and user needs Set it by yourself.
  • the CTDB master node can first obtain the known virtual IP parameters and available virtual IP parameters, and then separate the IPV4 part and the IPV6 part of the known virtual IP parameters and the available virtual IP parameters to obtain the IPV4 known virtual IP Parameters, IPV6 known virtual IP parameters, IPV4 available virtual IP parameters, and IPV6 available virtual IP parameters, that is, this step may include: the CTDB master node obtains known virtual IP parameters and available virtual IP parameters; where the known virtual IP parameters include The known virtual IP corresponding to each normal node, and the available virtual IP parameters include the available virtual IP corresponding to each normal node; separate the known virtual IP parameters and the available virtual IP parameters to obtain IPV4 known virtual IP parameters and IPV6 known Virtual IP parameters, IPV4 available virtual IP parameters, and IPV6 available virtual IP parameters.
  • the CTDB master node can also directly obtain the IPV4 known virtual IP parameters and the IPV4 available virtual IP parameters and the IPV6 virtual IP corresponding to the IPV4 virtual IP in a similar way to that in the prior art. IPV6 known virtual IP parameters corresponding to IP and IPV6 available virtual IP parameters.
  • the known virtual IP parameters may include the known virtual IP corresponding to each normal node, and the available virtual IP parameters may include the available virtual IP corresponding to each normal node; for example, when the known virtual IP parameter is a known virtual IP list (known_ips), Each element known_ips[i] in known_ips corresponds to a list of known virtual IPs on normal node i (that is, the known virtual IP list of the node), and the known virtual IP list of the node corresponds to the virtual IP configuration file, that is, on node i How many virtual IPs are configured, there are as many virtual IPs in the known virtual IP list of node i.
  • known_ips known virtual IP list
  • Each element known_ips[i] in known_ips corresponds to a list of known virtual IPs on normal node i (that is, the known virtual IP list of the node)
  • the known virtual IP list of the node corresponds to the virtual IP configuration file, that is, on node i How many virtual IPs are configured, there are as many virtual IPs
  • each element available_ips[i] in available_ips corresponds to a list of available virtual IPs on a normal node (that is, the list of available virtual IPs for the node), and each available virtual IP is first
  • the known virtual IP on this normal node must also meet the following conditions: 1.
  • the current CTDB is running normally, not in the state just started; 2.
  • the virtual IP has not been deleted, and it is not in the state of being deleted; 3.
  • the network card corresponding to the virtual IP is normal and not in a faulty state.
  • the CTDB master node obtains the known virtual IP parameters and the available virtual IP parameters.
  • the known virtual IP parameters are known virtual IP lists (known_ips), and the available virtual IP
  • the CTDB master node can send a message to all normal nodes to obtain the list of known virtual IPs read from the virtual IP configuration file when each normal node starts CTDB (ie, node Known virtual IP list), after receiving the data returned by all normal nodes (that is, the node's known virtual IP list), the CTDB master node organizes all data into known_ips; where known_ips[i].num can represent the ith number The number of known virtual IPs on the node (normal node), known_ips[i].ip can represent the node's known virtual IP list of the i-th node, and each element (pnn, addr) in the list can represent a virtual IP addr Currently held by the no
  • the CTDB master node can send a message to all normal nodes to obtain their node's available virtual IP list. After receiving the message, each node checks the node's known virtual IP list, and returns the available virtual IPs into the node's available virtual IP list; CTDB After the master node receives the data returned by all normal nodes (that is, the list of available virtual IPs for the node), it organizes all the data into available_ips; where available_ips[i].num can represent the number of available virtual IPs on the i-th node, available_ips [i].ip can represent the list of available virtual IPs for the i-th node, each element (pnn, addr) in the list represents the virtual IP addr is currently held by the node pnn, available_ips[i].ip[j].pnn The pnn corresponding to the jth element is the node number, and available_ips[i].ip[j].addr corresponds to the addr of the jth element,
  • this embodiment does not limit the storage format of the known virtual IP parameters of IPV4, the known virtual IP parameters of IPV6, the available virtual IP parameters of IPV4, the available virtual IP parameters of IPV6, the aforementioned known virtual IP parameters and the storage formats of available virtual IP parameters.
  • the known virtual IP parameter is a known virtual IP list (known_ips)
  • the known_ips storage format can be as follows:
  • node1 (num_ips,ips((pnn1,addr1),(pnn2,addr2),...,(pnnn1,addrn1)))
  • node2 (num_ips,ips((pnn1,addr1),(pnn2,addr2),...,(pnnn2,addrn2))
  • the CTDB master node can obtain IPV4 known virtual IP parameters and IPV6 known virtual IP parameters that are similar to the known virtual IP parameters based on the distinguishing features (such as address description) between the virtual IP of IPV4 and the virtual IP of IPV6. , And the IPV4 available virtual IP parameters and the IPV6 available virtual IP parameters similar to the available virtual IP parameters.
  • the CTDB master node can separate the known virtual IP according to the distinguishing characteristics (such as address description) between the virtual IP of IPV4 and the virtual IP of IPV6 The parameters obtain the IPV4 known virtual IP parameters and the IPV6 known virtual IP parameters, and separate the available virtual IP parameters to obtain the IPV4 available virtual IP parameters and the IPV6 available virtual IP parameters.
  • the CTDB master node can traverse each of the known virtual IP lists.
  • All known virtual IPs corresponding to a normal node record the first number and the second number; according to the first number and the second number, generate the IPV4 known virtual IP list corresponding to the known virtual IP list (that is, the IPV4 known virtual IP Parameter) and IPV6 known virtual IP list (that is, IPV6 known virtual IP parameters); where the first number is the number of known virtual IPs of IPV4 in the known virtual IP list, and the second number is the known virtual IP list
  • the number of known virtual IPs in IPV6 the length of the IPV4 known virtual IP list is the first number, the length of the IPV6 known virtual IP list is the second number, the IPV4 known virtual IP list and the IPV6 known virtual IP list
  • the structure of the known virtual IP list is the same as that of the known virtual IP list.
  • the IPV4 known virtual IP list includes the known virtual IPs of IPV4 corresponding to each normal node; the IPV6 known virtual IP list includes the known virtual IPs of IPV6 corresponding to each normal node;
  • the CTDB master node can traverse all available virtual IPs corresponding to each normal node in the available virtual IP list, and record the third and fourth numbers; according to the third and fourth numbers, generate the IPV4 available virtual IP corresponding to the available virtual IP list List (IPV4 available virtual IP parameters) and IPV6 available virtual IP list (IPV6 available virtual IP parameters); among them, the third number is the number of available virtual IPs of IPV4 in the available virtual IP list, and the fourth number is the available virtual IP list
  • the number of available virtual IPs in IPV6, the length of the IPV4 available virtual IP list is the third number, the length of the IPV6 available virtual IP list is the fourth number, the structure and available virtual IPV4 available virtual IP list and IPV6 available virtual IP list The structure of the IP list is the same.
  • the process of separating the IPV4 known virtual IP list (known_ips_ipv4) and the IPV6 known virtual IP list (known_ips_ipv4) from the known virtual IP list (known_ips) can be as follows:
  • step S1 Traverse each element known_ips[i] in known_ips (the node's known virtual IP list obtained from the i-th node), and perform step S2 for each element known_ips[i];
  • step S3 If the current j-th known virtual IP is IPV4, record the number of IPV4 in the known virtual IP list of node i (num_ipv4) plus one; if it is IPV6, record the number of IPV4 in the known virtual IP list of node i The number of IPV6 (num_ipv6) plus one, after traversing all known virtual IPs on node i, perform step S4; among them, the address description of the virtual IP of IPV4 is AF_INET, and the address description of the virtual IP of IPV6 is AF_INET6;
  • the process of separating the IPV4 available virtual IP list (available_ips_ipv4) and the IPV6 available virtual IP list (available_ips_ipv4) from the available virtual IP list (available_ips) corresponds to the above steps S1 to S7, and will not be repeated here.
  • Step 102 Use IPV4 known virtual IP parameters and IPV4 available virtual IP parameters to perform virtual IP allocation calculations to obtain IPV4 allocation results.
  • this step can be for the CTDB master node to use the parameters corresponding to the known virtual IP of IPV4 of each normal node (IPV4 known virtual IP parameters) and the parameters corresponding to the available virtual IP (IPV4 available virtual IP parameters) , Call the virtual IP allocation algorithm to calculate the virtual IP allocation, and obtain the IPV4 virtual IP allocation result (IPV4 allocation result).
  • the specific method of obtaining the IPV4 allocation result can be set by the designer. For example, it can be based on the prior art Known virtual IP parameters and available virtual IP parameters, call the virtual IP allocation algorithm to calculate the virtual IP allocation results in the same or similar way, but replace the known virtual IP parameters and available virtual IP parameters with IPV4 known virtual IP parameters With IPV4 available virtual IP parameters, other parameters required for invoking the virtual IP allocation algorithm can be unchanged or correspondingly changed, so as to calculate the allocation result of the virtual IP of IPV4, and this embodiment does not impose any limitation on this.
  • the virtual IP allocation algorithm in this step may be an algorithm used when the CTDB master node performs virtual IP allocation in the prior art, such as the ipalloc function.
  • the CTDB master node can first detect whether the conditions for virtual IP allocation for IPV4 are met: 1. At least one normal node has obtained a node known virtual IP list and there is IPV4 in the list, and the normal node currently holds at least An IPV4 virtual IP. 2. Get a list of available virtual IPs of the node from at least one normal node and IPV4 in the list.
  • IPV4 virtual IP allocation if the conditions for IPV4 virtual IP allocation are met, knonw_ips_ipv4 (IPV4 known virtual IP parameters) and available_ips_ipv4 (IPV4 available virtual IP parameters) are passed into the ipalloc function for allocation to get all_ips_ipv4 (IPV4 allocation result) .
  • Each element (pnn, addr) in all_ips_ipv4 indicates that the node with node number pnn should hold the virtual IP addr.
  • this step it can also include: judging whether the known virtual IP parameters of IPV4 include the known virtual IP of the target node corresponding to the IPV4, or the available virtual IP parameters of IPV4 include the availability of the IPV4 corresponding to any normal node. Steps of virtual IP; wherein, the target node is any normal node, and the target node currently holds a virtual IP of IPV4; if yes, proceed to this step; if not, proceed to step 103.
  • Step 103 Use IPV6 known virtual IP parameters and IPV6 available virtual IP parameters to perform virtual IP allocation calculations to obtain IPV6 allocation results.
  • this step can be for the CTDB master node to use the parameters corresponding to the known virtual IP of IPV6 of each normal node (IPV6 known virtual IP parameters) and the parameters corresponding to the available virtual IP (IPV6 available virtual IP parameters) , Call the virtual IP allocation algorithm to get the IPV6 virtual IP allocation result (IPV6 allocation result).
  • this step it can also include: judging whether the known virtual IP parameters of IPV6 include the known virtual IP of the IPV6 target node corresponding to the IPV6, or the available virtual IP parameters of IPV6 include the availability of the IPV6 corresponding to any normal node Steps of virtual IP; wherein the IPV6 target node is any normal node, and the IPV6 target node currently holds an IPV6 virtual IP; if yes, proceed to this step; if not, proceed to step 104.
  • this embodiment does not limit the logical sequence of this step and step 102.
  • Step 102 can be performed first and then this step can be performed as shown in this embodiment, or this step can be performed first and then step 102 can be performed, or two steps can be performed. In parallel.
  • Step 104 Perform virtual IP allocation for each normal node according to the IPV4 allocation result and the IPV6 allocation result.
  • the purpose of this step can be to use the virtual IP allocation result of IPV4 (IPV4 allocation result) and the allocation result of IPV6 virtual IP (IPV6 allocation result) obtained by the CTDB master node by calling the virtual IP allocation algorithm.
  • the normal nodes perform virtual IP allocation to realize the isolated allocation of the virtual IPs of IPV4 and IPV6, and ensure that the number of IPV4 and IPV6 allocated to each normal node is relatively balanced.
  • the specific method of virtual IP allocation for each normal node according to the IPV4 allocation result and the IPV6 allocation result in this step can be set by the designer.
  • the final allocation can be generated based on the IPV4 allocation result and the IPV6 allocation result. Result; according to the final allocation result, each normal node is allocated virtual IP, that is, the CTDB master node sends a message to each normal node according to the final allocation result to release the virtual IP that it should not hold and hold the virtual IP that it should hold Virtual IP.
  • this embodiment does not limit the storage format of the IPV4 distribution result, the IPV6 distribution result, and the above-mentioned final distribution result (all_ips).
  • the storage format of all_ips may be as follows:
  • the virtual IP of IPV4 and IPV6 can be assigned relatively isolated, so that the number of virtual IPs of IPV4 and IPV6 allocated to each normal node can be relatively balanced. That is, the number of virtual IPs of IPV4 or IPV6 held by any two normal nodes differs by at most 1. In order to further ensure the balance of the number of virtual IPs held by each normal node, avoid the situation where the number of virtual IPs held by two normal nodes differs by 2, that is, one normal node holds IPV4 and IPV6 virtual IPs compared to the other normal node.
  • the virtual IP distribution can be balanced by setting the number of IPV4 and/or IPV6 virtual IPs. For example, you can set the IPV4 virtual IP and/or IPV6 virtual IP that need to be allocated.
  • the number is an integer multiple of the number of normal nodes, that is, the number of known virtual IPs of IPV4 in the IPV4 known virtual IP parameters is an integer multiple of the number of normal nodes, and/or the known virtual IPs of IPV6 in the IPV6 known virtual IP parameters
  • the number of is an integer multiple of the number of normal nodes; thus avoiding the situation that a normal node has 1 more virtual IP than the number of IPV4 and IPV6 held by another normal node after the virtual IP is allocated.
  • this embodiment can also analyze and adjust the IPV4 allocation results and the IPV6 allocation results to ensure the balance of the number of virtual IPs held by each normal node. For example, the IPV4 allocation results and the IPV6 allocation results are not empty. Next, you can determine whether there is a redistribution node in the normal node according to the IPV4 distribution result and the IPV6 distribution result, that is, determine whether there is a normal node (redistribution node) corresponding to IPV4 and IPV6 than another normal node (distribution target node). The number is more than 1.
  • the number of virtual IP corresponding to the redistribution node is 2 more than the number of virtual IP corresponding to the allocation target node, and the allocation target node is any normal node; if not, it can be directly based on the IPV4 allocation result and IPV6 allocation results, virtual IP allocation to each normal node; if so, allocate a virtual IP in the IPV4 virtual IP corresponding to the redistributed node in the IPV4 allocation result to the corresponding allocation target node, or assign the IPV6 allocation result
  • a virtual IP in the IPV6 virtual IP corresponding to the redistribution node is allocated to a corresponding allocation target node, that is, by adjusting the IPV4 allocation result and/or the IPV6 allocation result, each redistribution node corresponds to an IPV4 or IPV6 virtual IP IP is allocated to a corresponding allocation target node to avoid the situation that after virtual IP allocation, a normal node has 1 more IPV4 and IPV6 virtual IPs than another normal node; among them,
  • the embodiment of the present invention obtains the IPV4 known virtual IP parameters and IPV4 available virtual IP parameters corresponding to the virtual IP of IPV4 and the IPV6 known virtual IP parameters and IPV6 available virtual IP parameters corresponding to the virtual IP of IPV6. Calculate the IPV4 allocation results and IPV6 allocation results separately, and use the IPV4 allocation results and the IPV6 allocation results to allocate virtual IP to each normal node, which can realize the isolated allocation of the virtual IP of IPV4 and IPV6, and ensure the IPV4 allocated to each normal node. It is relatively balanced with the number of IPV6, which meets the use requirements of some specific scenarios and improves the user experience.
  • FIG. 4 is a structural block diagram of a CTDB virtual IP allocation device provided by an embodiment of the present invention.
  • the device is applied to a distributed storage cluster and may include:
  • the obtaining module 10 is used to obtain IPV4 known virtual IP parameters, IPV6 known virtual IP parameters, IPV4 available virtual IP parameters, and IPV6 available virtual IP parameters; among them, the IPV4 known virtual IP parameters include the IPV4 parameters corresponding to each normal node. Know the virtual IP;
  • the first allocation calculation module 20 is configured to use the known virtual IP parameters of IPV4 and the available virtual IP parameters of IPV4 to perform virtual IP allocation calculations to obtain an IPV4 allocation result;
  • the second allocation calculation module 30 is configured to use IPV6 known virtual IP parameters and IPV6 available virtual IP parameters to perform virtual IP allocation calculations to obtain an IPV6 allocation result;
  • the allocation module 40 is configured to perform virtual IP allocation to each normal node according to the IPV4 allocation result and the IPV6 allocation result.
  • the obtaining module 10 may include:
  • the acquiring sub-module is used to acquire known virtual IP parameters and available virtual IP parameters; where the known virtual IP parameters include known virtual IPs corresponding to each normal node, and the available virtual IP parameters include available virtual IPs corresponding to each normal node;
  • the ionization module is used to separate the known virtual IP parameters and the available virtual IP parameters to obtain IPV4 known virtual IP parameters, IPV6 known virtual IP parameters, IPV4 available virtual IP parameters and IPV6 available virtual IP parameters.
  • the separation sub-module may include:
  • the first traversal unit is used to traverse all known virtual IPs corresponding to each normal node in the known virtual IP list, and record the first number and the second number; where the first number is the IPV4 number in the known virtual IP list The number of known virtual IPs, and the second number is the number of known virtual IPs of IPV6 in the list of known virtual IPs;
  • the first generating unit is configured to generate the IPV4 known virtual IP list and the IPV6 known virtual IP list corresponding to the known virtual IP list according to the first number and the second number; wherein the length of the IPV4 known virtual IP list is the first One number, the length of the IPV6 known virtual IP list is the second number, the structure of the IPV4 known virtual IP list and the IPV6 known virtual IP list is the same as the structure of the known virtual IP list, and the IPV4 known virtual IP list includes all normal The known virtual IP of IPV4 corresponding to the node; the IPV6 known virtual IP list includes the known virtual IP of IPV6 corresponding to each normal node;
  • the second traversal unit is used to traverse all available virtual IPs corresponding to each normal node in the available virtual IP list, and record the third and fourth numbers; where the third number is the available virtual IP of IPV4 in the available virtual IP list The fourth number is the number of available virtual IPs of IPV6 in the list of available virtual IPs;
  • the second generating unit is used to generate the IPV4 available virtual IP list and the IPV6 available virtual IP list corresponding to the available virtual IP list according to the third quantity and the fourth quantity; wherein the length of the IPV4 available virtual IP list is the third quantity, IPV6 The length of the available virtual IP list is the fourth number.
  • the structure of the IPV4 available virtual IP list and the IPV6 available virtual IP list is the same as the structure of the available virtual IP list.
  • the IPV4 available virtual IP list includes the available virtual IPs of IPV4 corresponding to each normal node;
  • the IPV6 available virtual IP list includes the available virtual IPs of IPV6 corresponding to each normal node.
  • the distribution module 40 may include:
  • the first allocation sub-module is configured to use the IPV6 allocation result as the final allocation result if the IPV4 allocation result is empty, and perform virtual IP allocation to each normal node according to the final allocation result;
  • the second allocation sub-module is used to, if the IPV6 allocation result is empty, use the IPV4 allocation result as the final allocation result, and perform virtual IP allocation to each normal node according to the final allocation result;
  • the third allocation sub-module is used for if both the IPV4 allocation result and the IPV6 allocation result are not empty, after connecting the IPV6 allocation result to the IPV4 allocation result, generate the final allocation result, and perform virtual IP on each normal node according to the final allocation result distribute.
  • the number of known virtual IPs of IPV4 in the IPV4 known virtual IP parameters is an integer multiple of the number of normal nodes; the number of known virtual IPs of IPV6 in the IPV6 known virtual IP parameters is an integer multiple of the number of normal nodes.
  • the device may also include:
  • the judgment module is used to judge whether there is a redistribution node in the normal node according to the IPV4 allocation result and the IPV6 allocation result; wherein the number of virtual IP corresponding to the redistribution node is 2 more than the number of virtual IP corresponding to the allocation target node.
  • the target node is any normal node; if not, it executes sending a start signal to the allocation module 40 according to the IPV4 allocation result and the IPV6 allocation result;
  • the adjustment module is used to allocate a virtual IP in the IPV4 virtual IP corresponding to the redistribution node in the IPV4 distribution result to a corresponding distribution target node, or to correspond to the redistribution node in the IPV6 distribution result if there is a redistribution node
  • One of the IPV6 virtual IPs is allocated to a corresponding allocation target node.
  • the device may also include:
  • the IPV4 allocation judgment module is used to judge whether the known virtual IP parameters of IPV4 include the known virtual IP of the target node corresponding to the IPV4, or the available virtual IP parameters of IPV4 include the available virtual IP of the IPV4 corresponding to any normal node; ,
  • the target node is any normal node, and the target node currently holds a virtual IP of IPV4; if it is, it sends an activation signal to the first allocation calculation module 20; if not, it sends an activation signal to the second allocation calculation module 30.
  • the embodiment of the present invention obtains the IPV4 known virtual IP parameters and IPV4 available virtual IP parameters corresponding to the IPV4 virtual IP through the acquiring module 10 and the IPV6 known virtual IP parameters and IPV6 available virtual IP corresponding to the IPV6 virtual IP
  • the parameters can be calculated separately to obtain the IPV4 allocation result and the IPV6 allocation result, so as to use the IPV4 allocation result and the IPV6 allocation result to allocate the virtual IP to each normal node, which can realize the isolated allocation of the virtual IP of IPV4 and IPV6, and ensure the distribution of each normal node.
  • the number of IPV4 and IPV6 obtained is relatively balanced, which meets the use requirements of some specific scenarios and improves the user experience.
  • the embodiment of the present invention also provides a distributed storage device, including:
  • Memory used to store computer programs
  • the processor is used to implement the steps of the CTDB virtual IP allocation method provided in the foregoing embodiment when the computer program is executed.
  • the memory in this embodiment includes at least one type of readable storage medium.
  • the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, CD etc.
  • the memory may be an internal storage unit of a distributed storage device (such as a distributed storage server), such as a hard disk of the server.
  • the memory may also be an external storage device of a distributed storage device, such as a plug-in hard disk equipped on a server, a smart memory card (SMC), or a secure digital (SD) card. Flash Card, etc.
  • the memory may also include both an internal storage unit of a distributed storage device and an external storage device.
  • the memory can be used not only to store application software and various data installed in distributed storage devices, such as the code of a program that executes the CTDB virtual IP allocation method, but also to temporarily store data that has been output or will be output.
  • the processor in this embodiment may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments, and is used to run the program code stored in the memory Or process data, such as the code of a program that executes the CTDB virtual IP allocation method.
  • CPU central processing unit
  • controller microcontroller
  • microprocessor or other data processing chip in some embodiments, and is used to run the program code stored in the memory Or process data, such as the code of a program that executes the CTDB virtual IP allocation method.
  • an embodiment of the present invention also provides a computer-readable storage medium with a computer program stored on the computer-readable storage medium.
  • the computer program is executed by a processor, the method for allocating CTDB virtual IP as provided in the above-mentioned embodiment is implemented. A step of.
  • the computer-readable storage medium may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
  • the medium of the program code may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
  • the medium of the program code may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

一种CTDB虚拟IP的分配方法、装置、分布式存储设备及计算机可读存储介质,方法应用于分布式存储集群,通过获取IPV4的虚拟IP对应的IPV4已知虚拟IP参数和IPV4可用虚拟IP参数与IPV6的虚拟IP对应的IPV6已知虚拟IP参数和IPV6可用虚拟IP参数,可以分别计算得到IPV4分配结果和IPV6分配结果,从而利用IPV4分配结果和IPV6分配结果对各正常节点进行虚拟IP分配,可以实现对IPV4和IPV6的虚拟IP的隔离分配,保证各正常节点分到的IPV4和IPV6的数量相对均衡,满足一些特定场景的使用要求,提高了用户体验。

Description

CTDB虚拟IP的分配方法、装置及分布式存储设备
本申请要求于2020年3月12日提交中国专利局、申请号为202010172468.4、发明名称为“CTDB虚拟IP的分配方法、装置及分布式存储设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及分布式存储技术领域,特别涉及一种CTDB虚拟IP的分配方法、装置、分布式存储设备及计算机可读存储介质。
背景技术
CTDB(Cluster Trivial Database)是一套集群高可用管理软件,CTDB主节点在CTDB启动过程中,会从虚拟IP配置文件中读出配置的虚拟IP并根据指定的虚拟IP分配算法将这些虚拟IP平均且随机分配到集群每个正常节点上,当集群中的某些节点发生故障时CTDB会执行故障切换,将原先故障节点上分配的虚拟IP释放掉然后将该IP漂移到其他正常节点,相应的读写业务也会漂移到其他正常节点;当该节点恢复正常加入集群时,CTDB会随机选取其他正常节点上的虚拟IP分配到该节点上。
CTDB主节点现有所使用的虚拟IP分配算法为均衡分配和随机分配,即保证每个正常节点持有的虚拟IP的数量是均衡的(任意两个正常节点持有的虚拟IP数量最多相差1),每个正常节点分到的虚拟IP是随机的(事先无法很容易地预知每个节点会分到哪些虚拟IP),节点重启后加入集群时CTDB随机选取某一个或多个虚拟IP分配到该节点。
现有技术中,CTDB主节点进行虚拟IP分配时,不区分IPV4和IPV6,即一个IPV4在虚拟IP分配过程中等价于一个IPV6,在虚拟IP同时配置了IPV4和IPV6时,可能导致一些正常节点上分到的都是IPV4,另一些正常节点上分到的都是IPV6。因此,如何能够保证各正常节点分到的IPV4和IPV6的数量相对均衡,满足一些特定场景的使用要求,提高用户体验,是现今急需解决的问题。
发明内容
本发明的目的是提供一种CTDB虚拟IP的分配方法、装置、分布式存储设备及计算机可读存储介质,以通过对IPV4和IPV6的虚拟IP隔离分配,保证各正常节点分到的IPV4和IPV6的数量相对均衡。
为解决上述技术问题,本发明提供一种CTDB虚拟IP的分配方法,应用于分布式存储集群,包括:
CTDB主节点获取IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数;其中,所述IPV4已知虚拟IP参数包括各正常节点对应的IPV4的已知虚拟IP;
利用所述IPV4已知虚拟IP参数和所述IPV4可用虚拟IP参数进行虚拟IP分配计算,得到IPV4分配结果;
利用所述IPV6已知虚拟IP参数和所述IPV6可用虚拟IP参数进行虚拟IP分配计算,得到IPV6分配结果;
根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配。
可选的,所述CTDB主节点获取IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数,包括:
所述CTDB主节点获取已知虚拟IP参数和可用虚拟IP参数;其中,所述已知虚拟IP参数包括各所述正常节点对应的已知虚拟IP,所述可用虚拟IP参数包括各所述正常节点对应的可用虚拟IP;
分别对所述已知虚拟IP参数和所述可用虚拟IP参数进行分离,得到所述IPV4已知虚拟IP参数、所述IPV6已知虚拟IP参数、所述IPV4可用虚拟IP参数和所述IPV6可用虚拟IP参数。
可选的,所述已知虚拟IP参数和所述可用虚拟IP参数分别为已知虚拟IP列表和可用虚拟IP列表时,所述分别对所述已知虚拟IP参数和所述可用虚拟IP参数进行分离,得到所述IPV4已知虚拟IP参数、所述IPV6已知虚拟IP参数、所述IPV4可用虚拟IP参数和所述IPV6可用虚拟IP参数,包括:
遍历所述已知虚拟IP列表中每个所述正常节点对应的全部已知虚拟IP,记录第一数量和第二数量;其中,所述第一数量为已知虚拟IP列表中的IPV4的已知虚拟IP的数量,所述第二数量为已知虚拟IP列表中的IPV6的已知虚拟IP的数量;
根据所述第一数量和所述第二数量,生成所述已知虚拟IP列表对应的IPV4已知虚拟IP列表和IPV6已知虚拟IP列表;其中,所述IPV4已知虚拟IP列表的长度为所述第一数量,所述IPV6已知虚拟IP列表的长度为所述第二数量;
遍历所述可用虚拟IP列表中每个所述正常节点对应的全部可用虚拟IP,记录第三数量和第四数量;其中,所述第三数量为可用虚拟IP列表中的IPV4的可用虚拟IP的数量,所述第四数量为可用虚拟IP列表中的IPV6的可用虚拟IP的数量;
根据所述第三数量和所述第四数量,生成所述可用虚拟IP列表对应的IPV4可用虚拟IP列表和IPV6可用虚拟IP列表;其中,所述IPV4可用虚拟IP列表的长度为所述第三数量,所述IPV6可用虚拟IP列表的长度为所述第四数量。
可选的,所述根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配,包括:
若所述IPV4分配结果为空,则将所述IPV6分配结果作为最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配;
若所述IPV6分配结果为空,则将所述IPV4分配结果作为最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配;
若所述IPV4分配结果和所述IPV6分配结果均不为空,则将所述IPV6分配结果连接到所述IPV4分配结果之后,生成所述最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配。
可选的,所述利用所述IPV4已知虚拟IP参数和所述IPV4可用虚拟IP参数进行虚拟IP分配,得到IPV4分配结果之前,还包括:
判断是否满足所述IPV4已知虚拟IP参数中包括目标节点对应的IPV4的已知虚拟IP,或所述IPV4可用虚拟IP参数中包括任一所述正常节点对 应的IPV4的可用虚拟IP;其中,所述目标节点为任一所述正常节点,所述目标节点当前持有IPV4的虚拟IP;
若是,则执行所述利用所述IPV4已知虚拟IP参数和所述IPV4可用虚拟IP参数进行虚拟IP分配,得到IPV4分配结果的步骤;
若否,则执行所述利用所述IPV6已知虚拟IP参数和所述IPV6可用虚拟IP参数进行虚拟IP分配,得到IPV6分配结果的步骤。
可选的,所述IPV4已知虚拟IP参数中IPV4的已知虚拟IP的数量为正常节点数量的整数倍;所述IPV6已知虚拟IP参数中IPV6的已知虚拟IP的数量为正常节点数量的整数倍。
可选的,所述根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配之前,包括:
根据所述IPV4分配结果和所述IPV6分配结果,判断所述正常节点中是否存在再分配节点;其中,所述再分配节点对应的虚拟IP的数量比分配目标节点对应的虚拟IP的数量多2个,所述分配目标节点为任一所述正常节点;
若否,则执行所述根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配的步骤;
若是,则将所述IPV4分配结果中所述再分配节点对应的IPV4的虚拟IP中的一个虚拟IP分配给对应的一个所述分配目标节点,或将所述IPV6分配结果中所述再分配节点对应的IPV6的虚拟IP中的一个虚拟IP分配给对应的一个所述分配目标节点。
本发明还提供了一种CTDB虚拟IP的分配装置,应用于分布式存储集群,包括:
获取模块,用于获取IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数;其中,所述IPV4已知虚拟IP参数包括各正常节点对应的IPV4的已知虚拟IP;
第一分配计算模块,用于利用所述IPV4已知虚拟IP参数和所述IPV4可用虚拟IP参数进行虚拟IP分配计算,得到IPV4分配结果;
第二分配计算模块,用于利用所述IPV6已知虚拟IP参数和所述IPV6可用虚拟IP参数进行虚拟IP分配计算,得到IPV6分配结果;
分配模块,用于根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配。
可选的,所述获取模块,包括:
获取子模块,用于获取已知虚拟IP参数和可用虚拟IP参数;其中,所述已知虚拟IP参数包括各所述正常节点对应的已知虚拟IP,所述可用虚拟IP参数包括各所述正常节点对应的可用虚拟IP;
分离子模块,用于分别对所述已知虚拟IP参数和所述可用虚拟IP参数进行分离,得到所述IPV4已知虚拟IP参数、所述IPV6已知虚拟IP参数、所述IPV4可用虚拟IP参数和所述IPV6可用虚拟IP参数。
可选的,所述已知虚拟IP参数和所述可用虚拟IP参数分别为已知虚拟IP列表和可用虚拟IP列表时,所述分离子模块,包括:
第一遍历单元,用于遍历所述已知虚拟IP列表中每个所述正常节点对应的全部已知虚拟IP,记录第一数量和第二数量;其中,所述第一数量为已知虚拟IP列表中的IPV4的已知虚拟IP的数量,所述第二数量为已知虚拟IP列表中的IPV6的已知虚拟IP的数量;
第一生成单元,用于根据所述第一数量和所述第二数量,生成所述已知虚拟IP列表对应的IPV4已知虚拟IP列表和IPV6已知虚拟IP列表;其中,所述IPV4已知虚拟IP列表的长度为所述第一数量,所述IPV6已知虚拟IP列表的长度为所述第二数量;
第二遍历单元,用于遍历所述可用虚拟IP列表中每个所述正常节点对应的全部可用虚拟IP,记录第三数量和第四数量;其中,所述第三数量为可用虚拟IP列表中的IPV4的可用虚拟IP的数量,所述第四数量为可用虚拟IP列表中的IPV6的可用虚拟IP的数量;
第二生成单元,用于根据所述第三数量和所述第四数量,生成所述可用虚拟IP列表对应的IPV4可用虚拟IP列表和IPV6可用虚拟IP列表;其中,所述IPV4可用虚拟IP列表的长度为所述第三数量,所述IPV6可用虚拟IP列表的长度为所述第四数量。
可选的,所述分配模块,包括:
第一分配子模块,用于若所述IPV4分配结果为空,则将所述IPV6分配结果作为最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配;
第二分配子模块,用于若所述IPV6分配结果为空,则将所述IPV4分配结果作为最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配;
第三分配子模块,用于若所述IPV4分配结果和所述IPV6分配结果均不为空,则将所述IPV6分配结果连接到所述IPV4分配结果之后,生成所述最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配。
可选的,该装置还包括:
判断模块,用于根据所述IPV4分配结果和所述IPV6分配结果,判断所述正常节点中是否存在再分配节点;其中,所述再分配节点对应的虚拟IP的数量比分配目标节点对应的虚拟IP的数量多2个,所述分配目标节点为任一所述正常节点;若否,则向所述分配模块发送启动信号;
再分配模块,用于若存在再分配节点,则将所述IPV4分配结果中所述再分配节点对应的IPV4的虚拟IP中的一个虚拟IP分配给对应的一个所述分配目标节点,或将所述IPV6分配结果中所述再分配节点对应的IPV6的虚拟IP中的一个虚拟IP分配给对应的一个所述分配目标节点。
本发明还提供了一种分布式存储设备,包括:
存储器,用于存储计算机程序;
处理器,用于执行所述计算机程序时实现如上述所述的CTDB虚拟IP的分配方法的步骤。
此外,本发明还提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上述所述的CTDB虚拟IP的分配方法的步骤。
本发明所提供的一种CTDB虚拟IP的分配方法,应用于分布式存储集群,通过获取IPV4的虚拟IP对应的IPV4已知虚拟IP参数和IPV4可用 虚拟IP参数与IPV6的虚拟IP对应的IPV6已知虚拟IP参数和IPV6可用虚拟IP参数,可以分别计算得到IPV4分配结果和IPV6分配结果,从而利用IPV4分配结果和IPV6分配结果对各正常节点进行虚拟IP分配,可以实现对IPV4和IPV6的虚拟IP的隔离分配,保证各正常节点分到的IPV4和IPV6的数量相对均衡,满足一些特定场景的使用要求,提高了用户体验。此外,本发明还提供了一种CTDB虚拟IP的分配装置、分布式存储设备及计算机可读存储介质,同样具有上述有益效果。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。
图1为本发明实施例所提供的一种CTDB虚拟IP的分配方法的流程图;
图2为本发明实施例所提供的另一种CTDB虚拟IP的分配方法中已知虚拟IP参数和可用虚拟IP参数的获取流程图;
图3为本发明实施例所提供的另一种CTDB虚拟IP的分配方法中已知虚拟IP参数和可用虚拟IP参数的分离流程图;
图4为本发明实施例所提供的一种CTDB虚拟IP的分配装置的结构框图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
请参考图1,图1为本发明实施例所提供的一种CTDB虚拟IP的分配方法 的流程图。该方法应用于分布式存储集群,可以包括:
步骤101:CTDB主节点获取IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数;其中,IPV4已知虚拟IP参数包括各正常节点对应的IPV4的已知虚拟IP。
其中,本步骤中的CTDB主节点可以为分布式存储集群中运行CTDB软件程序对正常节点进行虚拟IP分配的节点。本实施例并不限定CTDB主节点的具体选择,如可以采用与现有技术中CTDB主节点相同或相似的方式对应进行设置。
具体的,本步骤中的IPV4已知虚拟IP参数和IPV4可用虚拟IP参数可以为CTDB主节点进行IPV4的虚拟IP分配计算时主要用到的两个变量;IPV4已知虚拟IP参数可以包括各正常节点对应的IPV4的已知虚拟IP,IPV4可用虚拟IP参数可以包括各正常节点对应的IPV4的可用虚拟IP;本步骤中的IPV6已知虚拟IP参数和IPV6可用虚拟IP参数可以为CTDB主节点进行IPV6的虚拟IP分配计算时主要用到的两个变量;IPV6已知虚拟IP参数可以包括各正常节点对应的IPV6的已知虚拟IP,IPV6可用虚拟IP参数可以包括各正常节点对应的IPV6的可用虚拟IP。对于本步骤中IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数的具体内容,可以由设计人员自行设置,如可以采用与现有技术中不区分IPV4和IPV6的虚拟IP分配计算所需使用的已知虚拟IP参数和可用虚拟IP参数相同或相似的方式对应进行设置,只要保证通过现有技术中的虚拟IP分配计算方法,如调用虚拟IP分配算法,可以利用IPV4已知虚拟IP参数和IPV4可用虚拟IP参数可以对IPV4的虚拟IP进行虚拟IP分配计算,以及利用IPV6已知虚拟IP参数和IPV6可用虚拟IP参数可以对IPV6的虚拟IP进行虚拟IP分配计算,本实施例对此不做任何限制。
对应的,对于本步骤中CTDB主节点获取IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数的具体方式,可以由设计人员根据实用场景和用户需求自行设置,如CTDB主节点可以先获取已知虚拟IP参数和可用虚拟IP参数,再分别对已知虚拟IP参数和可用虚拟IP参数中的IPV4部分与IPV6部分进行分离,得到IPV4已知虚拟IP参 数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数,即本步骤可以包括:CTDB主节点获取已知虚拟IP参数和可用虚拟IP参数;其中,已知虚拟IP参数包括各正常节点对应的已知虚拟IP,可用虚拟IP参数包括各正常节点对应的可用虚拟IP;分别对已知虚拟IP参数和可用虚拟IP参数进行分离,得到IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数。CTDB主节点也可以按照与现有技术中获取已知虚拟IP参数和可用虚拟IP参数相似的方法,直接获取IPV4的虚拟IP对应的IPV4已知虚拟IP参数和IPV4可用虚拟IP参数以及IPV6的虚拟IP对应的IPV6已知虚拟IP参数和IPV6可用虚拟IP参数。
可以理解的是,上述已知虚拟IP参数和可用虚拟IP参数可以为现有技术中CTDB主节点进行虚拟IP分配时主要用到的两个变量。已知虚拟IP参数可以包括各正常节点对应的已知虚拟IP,可用虚拟IP参数可以包括各正常节点对应的可用虚拟IP;例如,已知虚拟IP参数为已知虚拟IP列表(known_ips)时,known_ips中的每个元素known_ips[i]都对应一个正常节点i上的已知虚拟IP列表(即节点已知虚拟IP列表),节点已知虚拟IP列表对应虚拟IP配置文件,即i号节点上配置了多少个虚拟IP,i号节点的节点已知虚拟IP列表中就有多少个虚拟IP。可用虚拟IP参数为可用虚拟IP列表(available_ips)时,available_ips里面的每个元素available_ips[i]对应一个正常节点上的可用虚拟IP列表(即节点可用虚拟IP列表),每个可用虚拟IP首先是这个正常节点上的已知虚拟IP,其次还要满足以下条件:1.当前CTDB正常运行,而不是处于刚启动的状态;2.该虚拟IP没有被删除,不是处于正在删除的状态;3.该虚拟IP对应的网卡是正常的,不是处于故障状态。
对应的,本实施例并不限定上述CTDB主节点获取已知虚拟IP参数和可用虚拟IP参数的具体方式,如2所示,已知虚拟IP参数为已知虚拟IP列表(known_ips),可用虚拟IP参数为可用虚拟IP列表(available_ips)时,首先,CTDB主节点可以向所有正常节点发消息获取各正常节点在启动CTDB时从虚拟IP配置文件中读出来的已知虚拟IP的列表(即节点已知虚拟IP列表)返回,CTDB主节点收到所有正常节点返回的数据(即节点已知虚拟IP 列表)后,将所有数据组织到known_ips中;其中known_ips[i].num可以表示第i号节点(正常节点)上的已知虚拟IP的数量,known_ips[i].ip可以表示第i号节点的节点已知虚拟IP列表,列表中每个元素(pnn,addr)都可以表示虚拟IP addr当前被节点pnn持有,known_ips[i].ip[j].pnn对应第j个元素的pnn,即节点号,known_ips[i].ip[j].addr对应第j个元素的addr,即虚拟IP。然后,CTDB主节点可以给所有正常节点发消息获取它们的节点可用虚拟IP列表,每个节点收到消息后就检查节点已知虚拟IP列表,将可用虚拟IP组成节点可用虚拟IP列表返回;CTDB主节点收到所有正常节点返回的数据(即节点可用虚拟IP列表)后,将所有数据组织到available_ips中;其中available_ips[i].num可以表示第i号节点上的可用虚拟IP的数量,available_ips[i].ip可以表示第i号节点的可用虚拟IP列表,列表中每个元素(pnn,addr)都表示虚拟IP addr当前被节点pnn持有,available_ips[i].ip[j].pnn对应第j个元素的pnn,即节点号,available_ips[i].ip[j].addr对应第j个元素的addr,即虚拟IP。
具体的,本实施例并不限定IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数、IPV6可用虚拟IP参数、上述已知虚拟IP参数和可用虚拟IP参数的存储格式,如已知虚拟IP参数为已知虚拟IP列表(known_ips)时,known_ips存储格式可以如下:
node1(num_ips,ips((pnn1,addr1),(pnn2,addr2),…,(pnnn1,addrn1)))
node2(num_ips,ips((pnn1,addr1),(pnn2,addr2),…,(pnnn2,addrn2)))
...
noden(num_ips,ips((pnn1,addr1),(pnn2,addr2),…,(pnnnn,addrnn)))
需要说明的是,CTDB主节点可以根据IPV4的虚拟IP与IPV6的虚拟IP的区别特征(如地址描述),得到与已知虚拟IP参数相似的IPV4已知虚拟IP参数和IPV6已知虚拟IP参数,以及与可用虚拟IP参数相似的IPV4可用虚拟IP参数和IPV6可用虚拟IP参数,如CTDB主节点可以根据IPV4的虚拟IP与IPV6的虚拟IP的区别特征(如地址描述),分离已知虚拟IP参数得到IPV4已知虚拟IP参数和IPV6已知虚拟IP参数,并分离可用虚拟IP参数得到IPV4可用虚拟IP参数和IPV6可用虚拟IP参数。
具体的,对于上述分别对已知虚拟IP参数和可用虚拟IP参数进行分离,得到IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数的具体方式,可以由设计人员根据实用场景和用户需求自行设置,如已知虚拟IP参数和可用虚拟IP参数分别为已知虚拟IP列表和可用虚拟IP列表时,CTDB主节点可以遍历已知虚拟IP列表中每个正常节点对应的全部已知虚拟IP,记录第一数量和第二数量;根据第一数量和第二数量,生成已知虚拟IP列表对应的IPV4已知虚拟IP列表(即IPV4已知虚拟IP参数)和IPV6已知虚拟IP列表(即IPV6已知虚拟IP参数);其中,第一数量为已知虚拟IP列表中的IPV4的已知虚拟IP的数量,第二数量为已知虚拟IP列表中的IPV6的已知虚拟IP的数量,IPV4已知虚拟IP列表的长度为第一数量,IPV6已知虚拟IP列表的长度为第二数量,IPV4已知虚拟IP列表和IPV6已知虚拟IP列表的结构与已知虚拟IP列表的结构相同,IPV4已知虚拟IP列表包括各正常节点对应的IPV4的已知虚拟IP;IPV6已知虚拟IP列表包括各正常节点对应的IPV6的已知虚拟IP;CTDB主节点可以遍历可用虚拟IP列表中每个正常节点对应的全部可用虚拟IP,记录第三数量和第四数量;根据第三数量和第四数量,生成可用虚拟IP列表对应的IPV4可用虚拟IP列表(IPV4可用虚拟IP参数)和IPV6可用虚拟IP列表(IPV6可用虚拟IP参数);其中,第三数量为可用虚拟IP列表中的IPV4的可用虚拟IP的数量,第四数量为可用虚拟IP列表中的IPV6的可用虚拟IP的数量,IPV4可用虚拟IP列表的长度为第三数量,IPV6可用虚拟IP列表的长度为第四数量,IPV4可用虚拟IP列表和IPV6可用虚拟IP列表的结构与可用虚拟IP列表的结构相同,IPV4可用虚拟IP列表包括各正常节点对应的IPV4的可用虚拟IP;IPV6可用虚拟IP列表包括各正常节点对应的IPV6的可用虚拟IP。
如图3所示,从已知虚拟IP列表(known_ips)分理出IPV4已知虚拟IP列表(known_ips_ipv4)和IPV6已知虚拟IP列表(known_ips_ipv4)的过程可以如下:
S1:遍历known_ips中的每个元素known_ips[i](从第i号节点上得到的节点已知虚拟IP列表),针对每个元素known_ips[i],执行步骤S2;
S2:遍历known_ips[i].ip[j](i号节点上的第j个已知虚拟IP),针对i号 节点上的每个已知虚拟IP known_ips[i].ip[j],执行步骤S3;
S3:若当前第j个已知虚拟IP是IPV4,则记录i号节点的已知虚拟IP列表中IPV4的数量(num_ipv4)加一,若是IPV6,则记录i号节点的已知虚拟IP列表中IPV6的数量(num_ipv6)加一,在遍历完i号节点上的所有已知虚拟IP后,执行步骤S4;其中,IPV4的虚拟IP的地址描述是AF_INET,IPV6的虚拟IP的地址描述是AF_INET6;
S4:得到了i号节点上的节点已知虚拟IP列表中IPV4和IPV6的数量后,从known_ips[i]中分离出knows_ips_ipv4[i]和known_ips_ipv6[i]两个列表,其结构与known_ips[i]一致,长度分别为num_ipv4和num_ipv6,具体如步骤S5;
S5:遍历known_ips[i].ip[j](i号节点上的第j个已知虚拟IP),针对i号节点上的每个已知虚拟IP known_ips[i].ip[j],执行步骤S6;
S6:若当前第j个已知虚拟IP是IPV4,就把它添加到known_ips_ipv4[i]列表中,若是IPV6,就把它添加到known_ips_ipv6[i]列表中;
S7:以上步骤S1到步骤S6,遍历完所有正常节点的节点已知虚拟IP列表后,即从known_ips分离得到known_ips_ipv4和known_ips_ipv6。
对应的,从可用虚拟IP列表(available_ips)分理出IPV4可用虚拟IP列表(available_ips_ipv4)和IPV6可用虚拟IP列表(available_ips_ipv4)的过程与上述步骤S1至步骤S7相对应,在此不再赘述。
步骤102:利用IPV4已知虚拟IP参数和IPV4可用虚拟IP参数进行虚拟IP分配计算,得到IPV4分配结果。
可以理解的是,本步骤的目的可以为CTDB主节点利用各正常节点的IPV4的已知虚拟IP对应的参数(IPV4已知虚拟IP参数)和可用虚拟IP对应的参数(IPV4可用虚拟IP参数),调用虚拟IP分配算法进行虚拟IP分配计算,得到IPV4的虚拟IP的分配结果(IPV4分配结果)。
对应的,对于本步骤中利用IPV4已知虚拟IP参数和IPV4可用虚拟IP参数进行虚拟IP分配计算,得到IPV4分配结果的具体方式,可以由设计人员自行设置,如可以采用与现有技术中根据已知虚拟IP参数和可用虚拟IP参数,调用虚拟IP分配算法计算得到虚拟IP的分配结果相同或相似的方式实现,只是将已知虚拟IP参数和可用虚拟IP参数替换为了IPV4已知虚拟IP参 数和IPV4可用虚拟IP参数,调用虚拟IP分配算法所需使用其他参数可以不变或对应变化,从而计算得到IPV4的虚拟IP的分配结果,本实施例对此不做任何限制。
具体的,本步骤中的虚拟IP分配算法可以为现有技术中CTDB主节点进行虚拟IP分配时所使用的算法,如ipalloc函数。本步骤中CTDB主节点可以先检测是否满足进行IPV4的虚拟IP分配的条件:1.至少从一个正常节点上得到了节点已知虚拟IP列表且列表中有IPV4,且该正常节点当前至少持有一个IPV4的虚拟IP。2.至少从一个正常节点上得到了节点可用虚拟IP列表且列表中有IPV4。以上条件满足一个即可;若满足进行IPV4的虚拟IP分配的条件,将knonw_ips_ipv4(IPV4已知虚拟IP参数)和available_ips_ipv4(IPV4可用虚拟IP参数)传入ipalloc函数进行分配得到all_ips_ipv4(IPV4分配结果)。all_ips_ipv4里的每个元素(pnn、addr)都表示节点号pnn的节点应当持有虚拟IP addr。
也就是说,本步骤之前还可以包括:判断是否满足IPV4已知虚拟IP参数中包括目标节点对应的IPV4的已知虚拟IP,或IPV4可用虚拟IP参数中包括任一正常节点对应的IPV4的可用虚拟IP的步骤;其中,目标节点为任一正常节点,目标节点当前持有IPV4的虚拟IP;若是,则进行本步骤;若否,则进行步骤103。
步骤103:利用IPV6已知虚拟IP参数和IPV6可用虚拟IP参数进行虚拟IP分配计算,得到IPV6分配结果。
可以理解的是,本步骤的目的可以为CTDB主节点利用各正常节点的IPV6的已知虚拟IP对应的参数(IPV6已知虚拟IP参数)和可用虚拟IP对应的参数(IPV6可用虚拟IP参数),调用虚拟IP分配算法,得到IPV6的虚拟IP的分配结果(IPV6分配结果)。
对应的,本步骤之前也可以包括:判断是否满足IPV6已知虚拟IP参数中包括IPV6目标节点对应的IPV6的已知虚拟IP,或IPV6可用虚拟IP参数中包括任一正常节点对应的IPV6的可用虚拟IP的步骤;其中,IPV6目标节点为任一正常节点,IPV6目标节点当前持有IPV6的虚拟IP;若是,则进行本步骤;若否,则进行步骤104。
具体的,本实施例并不限定本步骤与步骤102的逻辑顺序,可以如本实施例所示先进行步骤102再进行本步骤,也可以先进行本步骤再进行步骤102,还可以两个步骤并行进行。
步骤104:根据IPV4分配结果和IPV6分配结果,对各正常节点进行虚拟IP分配。
可以理解的是,本步骤的目的可以为CTDB主节点利用调用虚拟IP分配算法得到的IPV4的虚拟IP的分配结果(IPV4分配结果)和IPV6的虚拟IP的分配结果(IPV6分配结果),对各正常节点进行虚拟IP分配,以实现对IPV4和IPV6的虚拟IP的隔离分配,保证各正常节点分到的IPV4和IPV6的数量相对均衡。
具体的,对于本步骤中根据IPV4分配结果和IPV6分配结果,对各正常节点进行虚拟IP分配的具体方式,可以由设计人员自行设置,如可以先根据IPV4分配结果和IPV6分配结果,生成最终分配结果;再按照最终分配结果对各正常节点进行虚拟IP分配,即CTDB主节点按照最终分配结果发消息给每个正常节点去释放其不该持有的虚拟IP、并持有其应当持有的虚拟IP。例如若IPV4分配结果(all_ips_ipv4)为空,则将IPV6分配结果作为最终分配结果(all_ips),即all_ips=all_ips_ipv6,并按照最终分配结果对各正常节点进行虚拟IP分配;若IPV6分配结果(all_ips_ipv6)为空,则将IPV4分配结果作为最终分配结果,即all_ips=all_ips_ipv4,并按照最终分配结果对各正常节点进行虚拟IP分配;若IPV4分配结果和IPV6分配结果均不为空,则将IPV6分配结果连接到IPV4分配结果之后,生成最终分配结果,即all_ips=all_ips_ipv4,并按照最终分配结果对各正常节点进行虚拟IP分配。
对应的,IPV4分配结果和IPV6分配结果均不为空时,也可以将IPV4分配结果连接到IPV6分配结果之后,生成最终分配结果,即all_ips=all_ips_ipv6,并按照最终分配结果对各正常节点进行虚拟IP分配。
具体的,本实施例并不限定IPV4分配结果、IPV6分配结果和上述最终分配结果(all_ips)的存储格式,如all_ips存储格式可以如下:
(pnn1,addr1)
(pnn2,addr2)
(pnnn,addrn)
需要说明的是,本实施例中通过步骤102和步骤103可以对IPV4和IPV6的虚拟IP进行相对隔离的分配计算,从而可以使各正常节点分到的IPV4和IPV6的虚拟IP的数量相对均衡,即任意两个正常节点持有的IPV4或IPV6的虚拟IP数量最多相差1。为了进一步保证各正常节点持有的虚拟IP数量的均衡,避免两个正常节点持有的虚拟IP数量相差2的情况发生,即一个正常节点比另一正常节点持有的IPV4和IPV6的虚拟IP数量均多1的情况,本实施例中可以通过IPV4和/或IPV6的虚拟IP的设置数量实现虚拟IP分配的均衡,如可以设置需要进行分配的IPV4的虚拟IP和/或IPV6的虚拟IP的数量为正常节点的数量的整数倍,即IPV4已知虚拟IP参数中IPV4的已知虚拟IP的数量为正常节点数量的整数倍,和/或IPV6已知虚拟IP参数中IPV6的已知虚拟IP的数量为正常节点数量的整数倍;从而避免虚拟IP分配后,出现一个正常节点比另一正常节点持有的IPV4和IPV6的虚拟IP数量均多1的情况。
对应的,本实施例也可以通过对IPV4分配结果和IPV6分配结果的分析和调整,保证各正常节点持有的虚拟IP数量的均衡,如在IPV4分配结果和IPV6分配结果均不为空的情况下,可以根据IPV4分配结果和IPV6分配结果,判断正常节点中是否存在再分配节点,即确定是否存在一个正常节点(再分配节点)比另一正常节点(分配目标节点)对应的IPV4和IPV6的数量均多1;其中,再分配节点对应的虚拟IP的数量比分配目标节点对应的虚拟IP的数量多2个,分配目标节点为任一正常节点;若否,则可以直接根据IPV4分配结果和IPV6分配结果,对各正常节点进行虚拟IP分配;若是,则将IPV4分配结果中再分配节点对应的IPV4的虚拟IP中的一个虚拟IP分配给对应的一个分配目标节点,或将IPV6分配结果中再分配节点对应的IPV6的虚拟IP中的一个虚拟IP分配给对应的一个分配目标节点,即通过调整IPV4分配结果和/或IPV6分配结果,将每个再分配节点对应的一个IPV4或IPV6的虚拟IP分配给各自对应的一个分配目标节点,避免虚拟IP分配后,出现一个正常节点比另一正常节点持有的IPV4和IPV6的虚拟IP数量均多1的情况;其中,每个再分配节点所对应的一个分配目标节点各不相同,若再分 配节点的数量大于分配目标节点,则需要调整的再分配节点的数量为分配目标节点的数量。
本实施例中,本发明实施例通过获取IPV4的虚拟IP对应的IPV4已知虚拟IP参数和IPV4可用虚拟IP参数与IPV6的虚拟IP对应的IPV6已知虚拟IP参数和IPV6可用虚拟IP参数,可以分别计算得到IPV4分配结果和IPV6分配结果,从而利用IPV4分配结果和IPV6分配结果对各正常节点进行虚拟IP分配,可以实现对IPV4和IPV6的虚拟IP的隔离分配,保证各正常节点分到的IPV4和IPV6的数量相对均衡,满足一些特定场景的使用要求,提高了用户体验。
请参考图4,图4为本发明实施例所提供的一种CTDB虚拟IP的分配装置的结构框图。该装置应用于分布式存储集群,可以包括:
获取模块10,用于获取IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数;其中,IPV4已知虚拟IP参数包括各正常节点对应的IPV4的已知虚拟IP;
第一分配计算模块20,用于利用IPV4已知虚拟IP参数和IPV4可用虚拟IP参数进行虚拟IP分配计算,得到IPV4分配结果;
第二分配计算模块30,用于利用IPV6已知虚拟IP参数和IPV6可用虚拟IP参数进行虚拟IP分配计算,得到IPV6分配结果;
分配模块40,用于根据IPV4分配结果和IPV6分配结果,对各正常节点进行虚拟IP分配。
可选的,获取模块10,可以包括:
获取子模块,用于获取已知虚拟IP参数和可用虚拟IP参数;其中,已知虚拟IP参数包括各正常节点对应的已知虚拟IP,可用虚拟IP参数包括各正常节点对应的可用虚拟IP;
分离子模块,用于分别对已知虚拟IP参数和可用虚拟IP参数进行分离,得到IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数。
可选的,已知虚拟IP参数和可用虚拟IP参数分别为已知虚拟IP列表和 可用虚拟IP列表时,分离子模块,可以包括:
第一遍历单元,用于遍历已知虚拟IP列表中每个正常节点对应的全部已知虚拟IP,记录第一数量和第二数量;其中,第一数量为已知虚拟IP列表中的IPV4的已知虚拟IP的数量,第二数量为已知虚拟IP列表中的IPV6的已知虚拟IP的数量;
第一生成单元,用于根据第一数量和第二数量,生成已知虚拟IP列表对应的IPV4已知虚拟IP列表和IPV6已知虚拟IP列表;其中,IPV4已知虚拟IP列表的长度为第一数量,IPV6已知虚拟IP列表的长度为第二数量,IPV4已知虚拟IP列表和IPV6已知虚拟IP列表的结构与已知虚拟IP列表的结构相同,IPV4已知虚拟IP列表包括各正常节点对应的IPV4的已知虚拟IP;IPV6已知虚拟IP列表包括各正常节点对应的IPV6的已知虚拟IP;
第二遍历单元,用于遍历可用虚拟IP列表中每个正常节点对应的全部可用虚拟IP,记录第三数量和第四数量;其中,第三数量为可用虚拟IP列表中的IPV4的可用虚拟IP的数量,第四数量为可用虚拟IP列表中的IPV6的可用虚拟IP的数量;
第二生成单元,用于根据第三数量和第四数量,生成可用虚拟IP列表对应的IPV4可用虚拟IP列表和IPV6可用虚拟IP列表;其中,IPV4可用虚拟IP列表的长度为第三数量,IPV6可用虚拟IP列表的长度为第四数量,IPV4可用虚拟IP列表和IPV6可用虚拟IP列表的结构与可用虚拟IP列表的结构相同,IPV4可用虚拟IP列表包括各正常节点对应的IPV4的可用虚拟IP;IPV6可用虚拟IP列表包括各正常节点对应的IPV6的可用虚拟IP。
可选的,分配模块40,可以包括:
第一分配子模块,用于若IPV4分配结果为空,则将IPV6分配结果作为最终分配结果,并按照最终分配结果对各正常节点进行虚拟IP分配;
第二分配子模块,用于若IPV6分配结果为空,则将IPV4分配结果作为最终分配结果,并按照最终分配结果对各正常节点进行虚拟IP分配;
第三分配子模块,用于若IPV4分配结果和IPV6分配结果均不为空,则将IPV6分配结果连接到IPV4分配结果之后,生成最终分配结果,并按照最终分配结果对各正常节点进行虚拟IP分配。
可选的,IPV4已知虚拟IP参数中IPV4的已知虚拟IP的数量为正常节点数量的整数倍;IPV6已知虚拟IP参数中IPV6的已知虚拟IP的数量为正常节点数量的整数倍。
可选的,该装置还可以包括:
判断模块,用于根据IPV4分配结果和IPV6分配结果,判断正常节点中是否存在再分配节点;其中,再分配节点对应的虚拟IP的数量比分配目标节点对应的虚拟IP的数量多2个,分配目标节点为任一正常节点;若否,则执行根据IPV4分配结果和IPV6分配结果,对向分配模块40发送启动信号;
调整模块,用于若存在再分配节点,则将IPV4分配结果中再分配节点对应的IPV4的虚拟IP中的一个虚拟IP分配给对应的一个分配目标节点,或将IPV6分配结果中再分配节点对应的IPV6的虚拟IP中的一个虚拟IP分配给对应的一个分配目标节点。
可选的,该装置还可以包括:
IPV4分配判断模块,用于判断是否满足IPV4已知虚拟IP参数中包括目标节点对应的IPV4的已知虚拟IP,或IPV4可用虚拟IP参数中包括任一正常节点对应的IPV4的可用虚拟IP;其中,目标节点为任一正常节点,目标节点当前持有IPV4的虚拟IP;若是,则向第一分配计算模块20发送启动信号;若否,则向第二分配计算模块30发送启动信号。
本实施例中,本发明实施例通过获取模块10获取IPV4的虚拟IP对应的IPV4已知虚拟IP参数和IPV4可用虚拟IP参数与IPV6的虚拟IP对应的IPV6已知虚拟IP参数和IPV6可用虚拟IP参数,可以分别计算得到IPV4分配结果和IPV6分配结果,从而利用IPV4分配结果和IPV6分配结果对各正常节点进行虚拟IP分配,可以实现对IPV4和IPV6的虚拟IP的隔离分配,保证各正常节点分到的IPV4和IPV6的数量相对均衡,满足一些特定场景的使用要求,提高了用户体验。
本发明实施例还提供了一种分布式存储设备,包括:
存储器,用于存储计算机程序;
处理器,用于执行计算机程序时实现如上述实施例所提供的CTDB虚 拟IP的分配方法的步骤。
其中,本实施例中的存储器至少包括一种类型的可读存储介质,该可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器在一些实施例中可以是分布式存储设备(如分布式存储的服务器)的内部存储单元,例如服务器的硬盘。存储器在另一些实施例中也可以是分布式存储设备的外部存储设备,例如服务器上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digita,SD)卡,闪存卡(Flash Card)等。进一步地,存储器还可以既包括分布式存储设备的内部存储单元也包括外部存储设备。存储器不仅可以用于存储安装于分布式存储设备的应用软件及各类数据,例如:执行CTDB虚拟IP的分配方法的程序的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
本实施例中的处理器在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器中存储的程序代码或处理数据,例如执行CTDB虚拟IP的分配方法的程序的代码等。
此外,本发明实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上述实施例所提供的CTDB虚拟IP的分配方法的步骤。
其中,该计算机可读存储介质可以包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各 示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
以上对本发明所提供的一种CTDB虚拟IP的分配方法、装置、分布式存储设备及计算机可读存储介质进行了详细介绍。本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。

Claims (14)

  1. 一种CTDB虚拟IP的分配方法,其特征在于,应用于分布式存储集群,包括:
    CTDB主节点获取IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数;其中,所述IPV4已知虚拟IP参数包括各正常节点对应的IPV4的已知虚拟IP;
    利用所述IPV4已知虚拟IP参数和所述IPV4可用虚拟IP参数进行虚拟IP分配计算,得到IPV4分配结果;
    利用所述IPV6已知虚拟IP参数和所述IPV6可用虚拟IP参数进行虚拟IP分配计算,得到IPV6分配结果;
    根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配。
  2. 根据权利要求1所述的CTDB虚拟IP的分配方法,其特征在于,所述CTDB主节点获取IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数,包括:
    所述CTDB主节点获取已知虚拟IP参数和可用虚拟IP参数;其中,所述已知虚拟IP参数包括各所述正常节点对应的已知虚拟IP,所述可用虚拟IP参数包括各所述正常节点对应的可用虚拟IP;
    分别对所述已知虚拟IP参数和所述可用虚拟IP参数进行分离,得到所述IPV4已知虚拟IP参数、所述IPV6已知虚拟IP参数、所述IPV4可用虚拟IP参数和所述IPV6可用虚拟IP参数。
  3. 根据权利要求2所述的CTDB虚拟IP的分配方法,其特征在于,所述已知虚拟IP参数和所述可用虚拟IP参数分别为已知虚拟IP列表和可用虚拟IP列表时,所述分别对所述已知虚拟IP参数和所述可用虚拟IP参数进行分离,得到所述IPV4已知虚拟IP参数、所述IPV6已知虚拟IP参数、所述IPV4可用虚拟IP参数和所述IPV6可用虚拟IP参数,包括:
    遍历所述已知虚拟IP列表中每个所述正常节点对应的全部已知虚拟IP,记录第一数量和第二数量;其中,所述第一数量为已知虚拟IP列表中的IPV4的已知虚拟IP的数量,所述第二数量为已知虚拟IP列表中的IPV6 的已知虚拟IP的数量;
    根据所述第一数量和所述第二数量,生成所述已知虚拟IP列表对应的IPV4已知虚拟IP列表和IPV6已知虚拟IP列表;其中,所述IPV4已知虚拟IP列表的长度为所述第一数量,所述IPV6已知虚拟IP列表的长度为所述第二数量;
    遍历所述可用虚拟IP列表中每个所述正常节点对应的全部可用虚拟IP,记录第三数量和第四数量;其中,所述第三数量为可用虚拟IP列表中的IPV4的可用虚拟IP的数量,所述第四数量为可用虚拟IP列表中的IPV6的可用虚拟IP的数量;
    根据所述第三数量和所述第四数量,生成所述可用虚拟IP列表对应的IPV4可用虚拟IP列表和IPV6可用虚拟IP列表;其中,所述IPV4可用虚拟IP列表的长度为所述第三数量,所述IPV6可用虚拟IP列表的长度为所述第四数量。
  4. 根据权利要求1所述的CTDB虚拟IP的分配方法,其特征在于,所述根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配,包括:
    若所述IPV4分配结果为空,则将所述IPV6分配结果作为最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配;
    若所述IPV6分配结果为空,则将所述IPV4分配结果作为最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配;
    若所述IPV4分配结果和所述IPV6分配结果均不为空,则将所述IPV6分配结果连接到所述IPV4分配结果之后,生成所述最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配。
  5. 根据权利要求1所述的CTDB虚拟IP的分配方法,其特征在于,所述利用所述IPV4已知虚拟IP参数和所述IPV4可用虚拟IP参数进行虚拟IP分配,得到IPV4分配结果之前,还包括:
    判断是否满足所述IPV4已知虚拟IP参数中包括目标节点对应的IPV4的已知虚拟IP,或所述IPV4可用虚拟IP参数中包括任一所述正常节点对应的IPV4的可用虚拟IP;其中,所述目标节点为任一所述正常节点,所 述目标节点当前持有IPV4的虚拟IP;
    若是,则执行所述利用所述IPV4已知虚拟IP参数和所述IPV4可用虚拟IP参数进行虚拟IP分配,得到IPV4分配结果的步骤;
    若否,则执行所述利用所述IPV6已知虚拟IP参数和所述IPV6可用虚拟IP参数进行虚拟IP分配,得到IPV6分配结果的步骤。
  6. 根据权利要求1至5任一项所述的CTDB虚拟IP的分配方法,其特征在于,所述IPV4已知虚拟IP参数中IPV4的已知虚拟IP的数量为正常节点数量的整数倍;所述IPV6已知虚拟IP参数中IPV6的已知虚拟IP的数量为正常节点数量的整数倍。
  7. 根据权利要求1至5任一项所述的CTDB虚拟IP的分配方法,其特征在于,所述根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配之前,包括:
    根据所述IPV4分配结果和所述IPV6分配结果,判断所述正常节点中是否存在再分配节点;其中,所述再分配节点对应的虚拟IP的数量比分配目标节点对应的虚拟IP的数量多2个,所述分配目标节点为任一所述正常节点;
    若否,则执行所述根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配的步骤;
    若是,则将所述IPV4分配结果中所述再分配节点对应的IPV4的虚拟IP中的一个虚拟IP分配给对应的一个所述分配目标节点,或将所述IPV6分配结果中所述再分配节点对应的IPV6的虚拟IP中的一个虚拟IP分配给对应的一个所述分配目标节点。
  8. 一种CTDB虚拟IP的分配装置,其特征在于,应用于分布式存储集群,包括:
    获取模块,用于获取IPV4已知虚拟IP参数、IPV6已知虚拟IP参数、IPV4可用虚拟IP参数和IPV6可用虚拟IP参数;其中,所述IPV4已知虚拟IP参数包括各正常节点对应的IPV4的已知虚拟IP;
    第一分配计算模块,用于利用所述IPV4已知虚拟IP参数和所述IPV4可用虚拟IP参数进行虚拟IP分配计算,得到IPV4分配结果;
    第二分配计算模块,用于利用所述IPV6已知虚拟IP参数和所述IPV6可用虚拟IP参数进行虚拟IP分配计算,得到IPV6分配结果;
    分配模块,用于根据所述IPV4分配结果和所述IPV6分配结果,对各所述正常节点进行虚拟IP分配。
  9. 根据权利要求8所述的CTDB虚拟IP的分配装置,其特征在于,所述获取模块,包括:
    获取子模块,用于获取已知虚拟IP参数和可用虚拟IP参数;其中,所述已知虚拟IP参数包括各所述正常节点对应的已知虚拟IP,所述可用虚拟IP参数包括各所述正常节点对应的可用虚拟IP;
    分离子模块,用于分别对所述已知虚拟IP参数和所述可用虚拟IP参数进行分离,得到所述IPV4已知虚拟IP参数、所述IPV6已知虚拟IP参数、所述IPV4可用虚拟IP参数和所述IPV6可用虚拟IP参数。
  10. 根据权利要求9所述的CTDB虚拟IP的分配装置,其特征在于,所述已知虚拟IP参数和所述可用虚拟IP参数分别为已知虚拟IP列表和可用虚拟IP列表时,所述分离子模块,包括:
    第一遍历单元,用于遍历所述已知虚拟IP列表中每个所述正常节点对应的全部已知虚拟IP,记录第一数量和第二数量;其中,所述第一数量为已知虚拟IP列表中的IPV4的已知虚拟IP的数量,所述第二数量为已知虚拟IP列表中的IPV6的已知虚拟IP的数量;
    第一生成单元,用于根据所述第一数量和所述第二数量,生成所述已知虚拟IP列表对应的IPV4已知虚拟IP列表和IPV6已知虚拟IP列表;其中,所述IPV4已知虚拟IP列表的长度为所述第一数量,所述IPV6已知虚拟IP列表的长度为所述第二数量;
    第二遍历单元,用于遍历所述可用虚拟IP列表中每个所述正常节点对应的全部可用虚拟IP,记录第三数量和第四数量;其中,所述第三数量为可用虚拟IP列表中的IPV4的可用虚拟IP的数量,所述第四数量为可用虚拟IP列表中的IPV6的可用虚拟IP的数量;
    第二生成单元,用于根据所述第三数量和所述第四数量,生成所述可用虚拟IP列表对应的IPV4可用虚拟IP列表和IPV6可用虚拟IP列表;其 中,所述IPV4可用虚拟IP列表的长度为所述第三数量,所述IPV6可用虚拟IP列表的长度为所述第四数量。
  11. 根据权利要求8所述的CTDB虚拟IP的分配装置,其特征在于,所述分配模块,包括:
    第一分配子模块,用于若所述IPV4分配结果为空,则将所述IPV6分配结果作为最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配;
    第二分配子模块,用于若所述IPV6分配结果为空,则将所述IPV4分配结果作为最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配;
    第三分配子模块,用于若所述IPV4分配结果和所述IPV6分配结果均不为空,则将所述IPV6分配结果连接到所述IPV4分配结果之后,生成所述最终分配结果,并按照所述最终分配结果对各所述正常节点进行虚拟IP分配。
  12. 根据权利要求8至11任一项所述的CTDB虚拟IP的分配装置,其特征在于,还包括:
    判断模块,用于根据所述IPV4分配结果和所述IPV6分配结果,判断所述正常节点中是否存在再分配节点;其中,所述再分配节点对应的虚拟IP的数量比分配目标节点对应的虚拟IP的数量多2个,所述分配目标节点为任一所述正常节点;若否,则向所述分配模块发送启动信号;
    再分配模块,用于若存在再分配节点,则将所述IPV4分配结果中所述再分配节点对应的IPV4的虚拟IP中的一个虚拟IP分配给对应的一个所述分配目标节点,或将所述IPV6分配结果中所述再分配节点对应的IPV6的虚拟IP中的一个虚拟IP分配给对应的一个所述分配目标节点。
  13. 一种分布式存储设备,其特征在于,包括:
    存储器,用于存储计算机程序;
    处理器,用于执行所述计算机程序时实现如权利要求1至7任一项所述的CTDB虚拟IP的分配方法的步骤。
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介 质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的CTDB虚拟IP的分配方法的步骤。
PCT/CN2020/098031 2020-03-12 2020-06-24 Ctdb虚拟ip的分配方法、装置及分布式存储设备 WO2021179476A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/910,083 US11757830B2 (en) 2020-03-12 2020-06-24 Method and apparatus for allocating CTDB-based virtual IP address, and distributed storage device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010172468.4A CN111416884B (zh) 2020-03-12 2020-03-12 Ctdb虚拟ip的分配方法、装置及分布式存储设备
CN202010172468.4 2020-03-12

Publications (1)

Publication Number Publication Date
WO2021179476A1 true WO2021179476A1 (zh) 2021-09-16

Family

ID=71494388

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/098031 WO2021179476A1 (zh) 2020-03-12 2020-06-24 Ctdb虚拟ip的分配方法、装置及分布式存储设备

Country Status (3)

Country Link
US (1) US11757830B2 (zh)
CN (1) CN111416884B (zh)
WO (1) WO2021179476A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040246991A1 (en) * 2003-06-06 2004-12-09 Hitachi Communication Technologies, Ltd. IP address translator and packet transfer apparatus
CN107465562A (zh) * 2017-09-25 2017-12-12 郑州云海信息技术有限公司 一种ctdb自定义分配虚拟ip的方法、装置、设备
CN108989476A (zh) * 2018-06-12 2018-12-11 新华三技术有限公司 一种地址分配方法以及装置
CN110519406A (zh) * 2019-08-16 2019-11-29 济南浪潮数据技术有限公司 一种虚拟地址分配方法、装置及ctdb集群和存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103475704B (zh) * 2013-09-06 2016-09-28 中国科学院计算技术研究所 一种面向虚拟机群应用的虚拟节点配置方法
FR3011424A1 (fr) * 2013-09-30 2015-04-03 Orange Procedes de configuration et de gestion d'un reseau ip, dispositifs et programmes d'ordinateur correspondants.
US9887937B2 (en) * 2014-07-15 2018-02-06 Cohesity, Inc. Distributed fair allocation of shared resources to constituents of a cluster
CN104486457B (zh) * 2014-12-11 2016-03-30 电信科学技术研究院 一种地址分配、获取方法及装置
CN106330610A (zh) * 2016-08-29 2017-01-11 浪潮(北京)电子信息产业有限公司 一种负载均衡处理系统及方法
CN107104844B (zh) * 2017-05-27 2020-05-26 苏州浪潮智能科技有限公司 一种ctdb迁移公共ip地址的方法及装置
CN108881512B (zh) * 2018-06-15 2021-06-29 郑州云海信息技术有限公司 Ctdb的虚拟ip均衡分配方法、装置、设备及介质
CN108848205B (zh) * 2018-07-27 2021-12-28 北京网瑞达科技有限公司 一种区分IPv4、IPv6的CNAME域名解析方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040246991A1 (en) * 2003-06-06 2004-12-09 Hitachi Communication Technologies, Ltd. IP address translator and packet transfer apparatus
CN107465562A (zh) * 2017-09-25 2017-12-12 郑州云海信息技术有限公司 一种ctdb自定义分配虚拟ip的方法、装置、设备
CN108989476A (zh) * 2018-06-12 2018-12-11 新华三技术有限公司 一种地址分配方法以及装置
CN110519406A (zh) * 2019-08-16 2019-11-29 济南浪潮数据技术有限公司 一种虚拟地址分配方法、装置及ctdb集群和存储介质

Also Published As

Publication number Publication date
US11757830B2 (en) 2023-09-12
CN111416884A (zh) 2020-07-14
CN111416884B (zh) 2021-08-31
US20230119782A1 (en) 2023-04-20

Similar Documents

Publication Publication Date Title
US11704144B2 (en) Creating virtual machine groups based on request
US11586673B2 (en) Data writing and reading method and apparatus, and cloud storage system
US9639402B2 (en) Systems and methods for automatic hardware provisioning based on application characteristics
WO2018059222A1 (zh) 一种文件切片上传方法、装置及云存储系统
EP3664372A1 (en) Network management method and related device
CN108881512B (zh) Ctdb的虚拟ip均衡分配方法、装置、设备及介质
WO2019052225A1 (zh) 开放平台控制方法、系统、计算机设备和存储介质
WO2014194869A1 (zh) 一种请求处理方法、装置及系统
CN110224943B (zh) 基于url的流量服务限流方法、电子设备及计算机存储介质
CN110225146B (zh) 内外网映射方法、装置、电子设备、介质及视频会议系统
US20210048956A1 (en) Storage system, and method and apparatus for allocating storage resources
CN108933829A (zh) 一种负载均衡方法及装置
CN111585887B (zh) 基于多个网络的通信方法、装置、电子设备及存储介质
CN113810230A (zh) 对容器集群中的容器进行网络配置的方法、装置及系统
CN109446062B (zh) 云计算服务中的软件调试的方法和装置
CN113361913A (zh) 一种通信业务编排方法、装置、计算机设备及存储介质
WO2015067005A1 (zh) 一种选择存储资源方法、装置及系统
CN115913937A (zh) 一种容器多网卡网络配置方法、装置、设备及存储介质
WO2021179476A1 (zh) Ctdb虚拟ip的分配方法、装置及分布式存储设备
WO2024103690A1 (zh) 一种数据请求方法、装置、设备及非易失性可读存储介质
CN112600765B (zh) 一种配置资源调度方法及装置
CN115174529A (zh) 一种网络处理方法、装置、电子设备及存储介质
CN110769020B (zh) 一种资源请求处理方法、装置、设备及系统
CN103973750A (zh) 一种云计算系统的用户验证系统
CN116155890B (zh) 分布式文件系统的实现方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20924906

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20924906

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20924906

Country of ref document: EP

Kind code of ref document: A1