CN108881512A - Virtual IP address equilibrium assignment method, apparatus, equipment and the medium of CTDB - Google Patents

Virtual IP address equilibrium assignment method, apparatus, equipment and the medium of CTDB Download PDF

Info

Publication number
CN108881512A
CN108881512A CN201810621502.4A CN201810621502A CN108881512A CN 108881512 A CN108881512 A CN 108881512A CN 201810621502 A CN201810621502 A CN 201810621502A CN 108881512 A CN108881512 A CN 108881512A
Authority
CN
China
Prior art keywords
virtual
address
memory node
allocated
distributed storage
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201810621502.4A
Other languages
Chinese (zh)
Other versions
CN108881512B (en
Inventor
孙业宽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
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 Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201810621502.4A priority Critical patent/CN108881512B/en
Publication of CN108881512A publication Critical patent/CN108881512A/en
Application granted granted Critical
Publication of CN108881512B publication Critical patent/CN108881512B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • 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/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1034Reaction to server failures by a load balancer
    • 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]

Abstract

The embodiment of the invention discloses virtual IP address equilibrium assignment method, apparatus, equipment and the computer readable storage mediums of a kind of CTDB.Wherein, method includes obtaining loaded virtual IP address and idle virtual IP address to be allocated in current distributed storage cluster when new memory node is added;Loaded virtual IP address is retained on the memory node of source and is not drifted about, and will be on each virtual IP address equilibrium assignment to be allocated to each memory node of distributed storage cluster.Technical solution provided by the present application can both guarantee that loaded virtual IP address did not drifted about, client traffic does not interrupt, again can balanced virtual IP address distribution, it avoids virtual IP address from being assigned to the same node and loads the case where being assigned to the same node accordingly, distributed storage company-data process performance is improved, the stability and High Availabitity characteristic of distributed storage cluster are improved.

Description

Virtual IP address equilibrium assignment method, apparatus, equipment and the medium of CTDB
Technical field
The present embodiments relate to technical field of distributed memory, more particularly to the virtual IP address equilibrium assignment of CTDB a kind of Method, apparatus, equipment and computer readable storage medium.
Background technique
Distributed storage is the cluster that multiple memory node servers are constituted, and a data is supported to be stored in multiple storage sections On point, each memory node can get complete data by inter-node communication, when delay machine occurs in a memory node When, the recovery of partial data can be carried out according to the strategy of configuration.
CTDB is the High Availabitity management file system for relying on clustering, can be in all nodes for participating in CTDB cluster altogether It enjoys, for monitoring the distribution of clustered node state and virtual IP address.The virtual IP address meeting of the node is fitted over when the clustered node failure time-division Other nodes are floated to, the read-write business of malfunctioning node can also float to other nodes accordingly, so as to constitute cluster High-availability cluster.
The node of multiple starting CTDB constitutes a set of CTDB cluster, and all nodes can elect a host node in cluster, For the distribution of fault recovery and virtual IP address, i.e. CTDB virtual IP address distribution is distributed unitedly by CTDB host node.
In CTDB start-up course, the virtual IP address in configuration file averagely and can be assigned randomly on clustered node, when When nodes break down in cluster, CTDB can execute failover, and the virtual IP address distributed on malfunctioning node is discharged, then The IP is floated into other normal nodes, other normal nodes that corresponding read-write business can also float to;When the malfunctioning node When cluster is added in restarting, the virtual IP address that CTDB can randomly select on other nodes is assigned on the node.
The existing virtual IP address allocation algorithm of CTDB be equilibrium assignment, be randomly assigned, node restart after be added cluster CTDB with Machine chooses some or multiple virtual IP addresses are assigned to the node, when have on these virtual IP addresses client connect and have reading and writing data When, the business of client will appear the interruption of a period of time, even entire service disconnection.For requiring business in production environment The allocation algorithm of unbroken scene, the virtual IP address of CTDB open source software is obviously not suitable for.
Summary of the invention
The purpose of the embodiment of the present invention is that providing virtual IP address equilibrium assignment method, apparatus, equipment and the calculating of a kind of CTDB Machine readable storage medium storing program for executing, under the premise of the equilibrium assignment based on virtual IP address, it is ensured that the client for the virtual IP address connection for thering is business to read and write The business at end is not interrupted, and the stability and high availability of distributed storage cluster are improved.
In order to solve the above technical problems, the embodiment of the present invention provides following technical scheme:
On the one hand the embodiment of the present invention provides the virtual IP address equilibrium assignment method of CTDB a kind of, including:
When having the memory node being newly added in distributed storage cluster, obtaining in current distributed storage cluster has load Virtual IP address and idle virtual IP address to be allocated;
The virtual IP address for retaining the source memory node of loaded virtual IP address is constant, extremely by each virtual IP address equilibrium assignment to be allocated On each memory node of the distributed storage cluster.
Optionally, described to include when having the memory node being newly added in distributed storage cluster:
Judge the memory node number whether the memory node number in new virtual IP address table is greater than in old virtual IP address table;
If so, joined new memory node in the distributed storage cluster;If it is not, the then distributed storage collection There is no new memory node to be added in group;
Wherein, the new virtual IP address table is the virtual IP address table of the current distributed storage cluster generated in real time;The old void Quasi- IP table is the virtual IP address table of the distributed storage cluster after last virtual IP address distribution.
Optionally, loaded virtual IP address includes in the current distributed storage cluster of acquisition:
Each memory node into the old virtual IP address table, which is sent, obtains loaded virtual IP address request instruction;
The loaded virtual IP address instruction for receiving each memory node response, summarizes loaded virtual IP address.
Optionally, virtual IP address to be allocated idle in the current distributed storage cluster of acquisition includes:
After memory node starting is newly added, calculates virtual IP address in the distributed storage cluster and be assigned to each storage section The mean number of point, the mean number are virtual IP address total number and memory node total number in the distributed storage cluster Ratio;
Virtual IP address number is selected to be greater than the target storage node of the mean number from each memory node;
Judge whether the number of loaded virtual IP address on each target storage node is greater than the mean number;
If so, using space virtual IP all on the target storage node as virtual IP address to be allocated;
If not, retaining loaded virtual IP address and predetermined number free virtual all on the target storage node IP, using remaining free virtual IP as virtual IP address to be allocated, predetermined number=loaded virtual IP address of the mean number- Number.
Optionally, described will be on each memory node of each virtual IP address equilibrium assignment to be allocated to the distributed storage cluster Including:
It is followed successively by the memory node being newly added and distributes first several virtual IP address to be allocated;
Judge whether that there are also remaining virtual IP addresses to be allocated;
If so, each memory node by remaining virtual IP address equilibrium assignment to be allocated into the distributed storage cluster;
Wherein, the product of a numerical value of first several value and the memory node being newly added is total no more than virtual IP address to be allocated Number.
Optionally, the memory node first several virtual IP address to be allocated of distribution being newly added that are followed successively by include:
Virtual IP address number to be allocated and the new ratio that memory node number is added are calculated, as distribution base value;
After the memory node starting being newly added, calculates virtual IP address in the distributed storage cluster and be assigned to each storage The mean number of node, the mean number are virtual IP address total number and memory node total number in the distributed storage cluster Ratio;
If the distribution base value is less than the mean number, and virtual IP address number to be allocated is greater than the distribution base value The product of a numerical value for the memory node being newly added, using the distribution base value as first numerical value;
If the distribution base value be greater than the mean number, and virtual IP address number to be allocated be greater than the mean number and The product of a numerical value for the memory node being newly added, using the mean number as first numerical value.
Optionally, each storage by remaining virtual IP address equilibrium assignment to be allocated into the distributed storage cluster Node includes:
Remaining virtual IP address to be allocated is successively allocated according to the memory node being newly added, remaining each memory node.
On the other hand the embodiment of the present invention provides the virtual IP address equalizing distributor of CTDB a kind of, including:
Data obtaining module, for when having the memory node being newly added in distributed storage cluster, obtaining current distribution Loaded virtual IP address and idle virtual IP address to be allocated in formula storage cluster;
Virtual IP address reservation module, it is constant for retaining the virtual IP address of source memory node of loaded virtual IP address;
Virtual IP address distribution module, for by each virtual IP address equilibrium assignment to be allocated respectively depositing to the distributed storage cluster It stores up on node.
The embodiment of the invention also provides the virtual IP address equilibrium assignment equipment of CTDB a kind of, including processor, the processing Device realizes the virtual IP address equilibrium assignment side of the CTDB as described in preceding any one when being used to execute the computer program stored in memory The step of method.
The embodiment of the present invention finally additionally provides a kind of computer readable storage medium, the computer readable storage medium On be stored with the virtual IP address equilibrium assignment program of CTDB, it is real when the virtual IP address equilibrium assignment program of the CTDB is executed by processor Now as described in preceding any one the step of the virtual IP address equilibrium assignment method of CTDB.
The embodiment of the invention provides the virtual IP address equilibrium assignment methods of CTDB a kind of, when new memory node is added, Obtain loaded virtual IP address and idle virtual IP address to be allocated in current distributed storage cluster;Loaded virtual IP address is protected It stays on the memory node of source and does not drift about, and by each storage of each virtual IP address equilibrium assignment to be allocated to distributed storage cluster On node.
The advantages of technical solution provided by the present application is, when newly added node is added to distributed storage cluster, area Divide loaded virtual IP address and idle virtual IP address in current distributed storage cluster, retains loaded virtual IP address and deposited in Qi Yuan It does not drift about on storage node, it is ensured that the business for not influencing client in new node start-up course effectively prevents the prior art The generation that middle client traffic interrupts, solves the problems, such as failure switchback, meets and require the unbroken reality of business in production environment Demand;Then it utilizes idle virtual IP address equilibrium assignment to each memory node, avoids because of the unbalanced all industry of distribution of virtual IP address Business concentrates on a node, the i.e. generation of load imbalance problem, and the processing for substantially increasing distributed storage cluster is Statistical Can, improve the stability and High Availabitity characteristic of distributed storage cluster.
In addition, the embodiment of the present invention also directed to the virtual IP address equilibrium assignment method of CTDB provide corresponding realization device, Equipment and computer readable storage medium, further such that the method has more practicability, described device, equipment and computer Readable storage medium storing program for executing has the advantages that corresponding.
Detailed description of the invention
It, below will be to embodiment or existing for the clearer technical solution for illustrating the embodiment of the present invention or the prior art Attached drawing needed in technical description is briefly described, it should be apparent that, the accompanying drawings in the following description is only this hair Bright some embodiments for those of ordinary skill in the art without creative efforts, can be with root Other attached drawings are obtained according to these attached drawings.
Fig. 1 is a kind of flow diagram of the virtual IP address equilibrium assignment method of CTDB provided in an embodiment of the present invention;
Fig. 2 shows for the interaction flow that CTDB host node provided in an embodiment of the present invention obtains each memory node load virtual IP address It is intended to;
Fig. 3 is flow diagram of the virtual IP address equilibrium assignment provided in an embodiment of the present invention to each memory node;
Fig. 4 is the flow diagram of the virtual IP address equilibrium assignment method of another kind CTDB provided in an embodiment of the present invention;
Fig. 5 is a kind of specific embodiment structure of the virtual IP address equalizing distributor of CTDB provided in an embodiment of the present invention Figure.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, with reference to the accompanying drawings and detailed description The present invention is described in further detail.Obviously, described embodiments are only a part of the embodiments of the present invention, rather than Whole embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art are not making creative work premise Under every other embodiment obtained, shall fall within the protection scope of the present invention.
The description and claims of this application and term " first ", " second ", " third " " in above-mentioned attached drawing Four " etc. be for distinguishing different objects, rather than for describing specific sequence.Furthermore term " includes " and " having " and Their any deformations, it is intended that cover and non-exclusive include.Such as contain a series of steps or units process, method, System, product or equipment are not limited to listed step or unit, but may include the step of not listing or unit.
After describing the technical solution of the embodiment of the present invention, the various non-limiting realities of detailed description below the application Apply mode.
Referring first to Fig. 1, Fig. 1 is a kind of process of the virtual IP address equilibrium assignment method of CTDB provided in an embodiment of the present invention Schematic diagram, the embodiment of the present invention may include the following contents:
S101:When having the memory node being newly added in distributed storage cluster, obtain in current distributed storage cluster Loaded virtual IP address and idle virtual IP address to be allocated.
S102:The virtual IP address for retaining the source memory node of loaded virtual IP address is constant.
S103:It will be on each virtual IP address equilibrium assignment to be allocated to each memory node of distributed storage cluster.
The execution subject of the embodiment of the present invention can be the host node of CTDB.Virtual IP address is the one group of IP managed by CTDB software These IP can be evenly distributed on each memory node in distributed storage cluster, be connected to by address, CTDB management software Client on the memory node can connect these IP and be written and read to distributed type assemblies storing data.
CTDB host node can generate the virtual IP address table of current distributed storage cluster according to original algorithm.In distributed storage When cluster has the memory node being newly added, after virtual IP address table before is old virtual IP address table, namely last virtual IP address distributes The virtual IP address table of distributed storage cluster, after new memory node is added, the virtual IP address table of generation is new virtual IP address table, that is, is worked as The virtual IP address table of preceding distributed storage cluster.Memory node number in newer virtual IP address table in real time and old virtual IP address can be passed through The size of memory node number in table is to determine whether there is new memory node to be added.If the number of nodes of new table is greater than old table Number of nodes, then have new memory node that scene is added, otherwise, then not new memory node is added.
The process that CTDB host node obtains loaded virtual IP address in current distributed storage cluster can be as follows, please join It reads shown in Fig. 2, specifically may include:
Each memory node into old virtual IP address table, which is sent, obtains loaded virtual IP address request instruction;Receive each storage section The loaded virtual IP address instruction of point response, summarizes loaded virtual IP address.
CTDB host node other memory nodes (such as CTDB X node, CTDBY node, CTDB Z node) into cluster are sent out Request message is sent to obtain each loaded virtual IP address of node, each memory node upon receiving a request, passes through calling business service The related command (order is provided by specific business service, such as samba/ganesha) that process provides obtains present node Loaded virtual IP address, when the memory node does not have business read-write, i.e. order is returned as sky, when the memory node has multiple read-writes The virtual IP address of data, i.e. order return to multirow virtual IP address;Then loaded virtual IP address is constituted into response and returns to the main section of CTDB Point, CTDB host node are distinguished free virtual IP and loaded virtual IP address according to all virtual IP addresses in current cluster, are summarized All loaded virtual IP addresses.
After CTDB host node summarizes loaded virtual IP address and idle virtual IP address, the virtual IP address of equilibrium assignment free time, Distribution principle is that loaded virtual IP address does not drift about, and a kind of free virtual IP equilibrium assignment, specific assigning process sees Fig. 3 Shown, detailed process may include:
After memory node starting is newly added, calculates virtual IP address in distributed storage cluster and be assigned to each memory node Mean number AVG;
Virtual IP address number is selected to be greater than the target storage node of mean number from each memory node;
Judge whether the number of loaded virtual IP address on each target storage node is greater than mean number;If so, should All space virtual IP are as virtual IP address to be allocated on target storage node;If not, retaining institute on the target storage node The loaded virtual IP address and predetermined number free virtual IP having, using remaining free virtual IP as virtual IP address to be allocated, The number of the loaded virtual IP address of predetermined number=mean number-.
Mean number is the ratio of virtual IP address total number and memory node total number in distributed storage cluster, and citing comes It says, the currently stored node of distributed storage cluster is 6 (including 2 memory nodes being newly added), virtual IP address number in total It is 12, then the mean number that virtual IP address is assigned to each memory node is 2.
Optionally, when memory node in poll current cluster, normal node can be first selected, normal node is to work The memory node of state normal operation, chooses destination node from normal node.
When memory node in poll cluster, if the virtual IP address sum on the memory node is less than or equal to mean number AVG then keeps all virtual IP addresses of the memory node constant, that is to say, that virtual IP address sum is less than or equal to mean number AVG's Memory node is not destination node, and the virtual IP address sum on each destination node is greater than mean number AVG.
For each destination node, if the loaded virtual IP address number of the node is less than or equal to AVG, in addition to keeping this There is load virtual IP address constant outer, (AVG- business read-write virtual IP address number (loaded virtual IP address is also retained on the node Number)) a free virtual IP is constant, while remaining free virtual IP (virtual IP address to be allocated) is filled into virtual IP address to be allocated and is arranged In table left_ips, if the loaded virtual IP address number of the node is greater than AVG, these loaded virtual IP addresses are kept not Become, regard the available free virtual IP address of the node as virtual IP address to be allocated, be appended to virtual IP address list left_ to be allocated In ips, when carrying out equilibrium assignment virtual IP address, virtual IP address directly is chosen from virtual IP address list left_ips to be allocated.
Certainly, it should be noted that directly virtual IP address to be allocated can also be marked, do not put to virtual IP address to be allocated and arrange In table left_ips.
After obtaining all virtual IP addresses to be allocated, virtual IP address distribution preferentially can be carried out to the memory node being newly added, i.e., It is followed successively by the memory node being newly added and distributes first several virtual IP address to be allocated, first several value and the storage section being newly added The product of a numerical value of point distributes to the virtual IP address number of the memory node of each new addition no more than virtual IP address sum to be allocated Calculating process may include:
Virtual IP address number to be allocated and the new ratio that memory node number is added are calculated, as distribution base value;
After the memory node starting being newly added, calculates virtual IP address in distributed storage cluster and be assigned to each memory node Mean number, mean number be distributed storage cluster in virtual IP address total number and memory node total number ratio;
If distributing base value is less than mean number, and virtual IP address number to be allocated is greater than distribution base value and what is be newly added deposit The product for storing up a numerical value of node, using distribution base value as first numerical value;
If distributing base value is greater than mean number, and the storage that virtual IP address number to be allocated is greater than mean number and is newly added The product of a numerical value of node, using mean number as first numerical value.
For example, the currently stored node of distributed storage cluster is 6 (including 2 memory nodes being newly added), always Total virtual IP address number is 12, and virtual IP address number to be allocated is 8, and the mean number that virtual IP address is assigned to each memory node is 2, distribution base value is 4, then each new virtual IP address number that memory node distribution is added is 2.
Certainly, the number for distributing to each new virtual IP address that memory node is added can not also be calculated as procedure described above, Those skilled in the art can preset according to specific actual conditions.For example, if the memory node connection being newly added Client it is more or data to be treated are larger, the virtual IP address of more number can be distributed.
It is being preferably after new addition memory node distributes virtual IP address, if there are also residues for virtual IP address to be allocated, to surplus It can be preferably new storage section to be added when each memory node of the remaining virtual IP address equilibrium assignment to be allocated into distributed storage cluster Point is allocated, after being assigned, by remaining virtual IP address equilibrium assignment to be allocated to other normal storage nodes.
For example, the currently stored node of distributed storage cluster be 6 (including 2 memory node 5# being newly added and 6#), virtual IP address number in total is 12, and virtual IP address number to be allocated is 8, and virtual IP address is assigned to being averaged for each memory node Number is 2, and distribution base value is 4, then each new virtual IP address number that memory node distribution is added is 2.It is remaining Virtual IP address number to be allocated is 8-2*2=4, can preferentially distribute to 5# the and 6# memory node being newly added each one, there remains 2 A virtual IP address to be allocated can be randomly assigned to other four memory nodes for this 2, such as distribute to 1# and 3# memory node. Certainly, it can also be allocated according to the client terminal quantity of each node operation and the data volume of pending data, be preferably data volume Handle more memory node distribution virtual IP address.
In technical solution provided in an embodiment of the present invention, when newly added node is added to distributed storage cluster, area Divide loaded virtual IP address and idle virtual IP address in current distributed storage cluster, retains loaded virtual IP address and deposited in Qi Yuan It does not drift about on storage node, it is ensured that the business for not influencing client in new node start-up course effectively prevents the prior art The generation that middle client traffic interrupts, solves the problems, such as failure switchback, meets and require the unbroken reality of business in production environment Demand;Then it utilizes idle virtual IP address equilibrium assignment to each memory node, avoids because of the unbalanced all industry of distribution of virtual IP address Business concentrates on a node, the i.e. generation of load imbalance problem, and the processing for substantially increasing distributed storage cluster is Statistical Can, improve the stability and High Availabitity characteristic of distributed storage cluster.
Referring to fig. 4, Fig. 4 is that the process of the virtual IP address equilibrium assignment method of another kind CTDB provided in an embodiment of the present invention is shown It is intended to, it specifically may include the following contents that the embodiment of the present invention, which for example can be applied in distributed memory system,:
S401:Judge whether the memory node number in the new virtual IP address table of distributed storage cluster is greater than old virtual IP address table In memory node number, if so, execute S402.
New virtual IP address table is the virtual IP address table of the current distributed storage cluster generated in real time;Old virtual IP address table is the last time The virtual IP address table of distributed storage cluster after virtual IP address distribution
S402:Obtain loaded virtual IP address and idle virtual IP address to be allocated in current distributed storage cluster.
S403:The virtual IP address for retaining the source memory node of loaded virtual IP address is constant.
S404:It is followed successively by the memory node being newly added and distributes first several virtual IP address to be allocated.
The product of a numerical value of first several value and the memory node being newly added is no more than virtual IP address sum to be allocated.
S405:Judge whether that there are also remaining virtual IP addresses to be allocated, if so, executing S406.
S406:Remaining virtual IP address to be allocated is successively carried out according to the memory node being newly added, remaining each memory node Distribution.
From the foregoing, it will be observed that under the premise of the embodiment of the present invention is based on the equilibrium assignment of virtual IP address, it is ensured that the void for thering is business to read and write The business of the client of quasi- IP connection is not interrupted, and the stability and high availability of distributed storage cluster are improved.
The embodiment of the present invention provides corresponding realization device also directed to the virtual IP address equilibrium assignment method of CTDB, further So that the method has more practicability.The virtual IP address equalizing distributor of CTDB provided in an embodiment of the present invention is carried out below It introduces, the virtual IP address equalizing distributor of CTDB described below and the virtual IP address equilibrium assignment method of above-described CTDB can Correspond to each other reference.
Referring to Fig. 5, Fig. 5 is the virtual IP address equalizing distributor of CTDB provided in an embodiment of the present invention in a kind of specific implementation Structure chart under mode, the device may include:
Data obtaining module 501, for when having the memory node being newly added in distributed storage cluster, obtaining current point Loaded virtual IP address and idle virtual IP address to be allocated in cloth storage cluster.
Virtual IP address reservation module 502, it is constant for retaining the virtual IP address of source memory node of loaded virtual IP address.
Virtual IP address distribution module 503, for by each virtual IP address equilibrium assignment to be allocated to the distributed storage cluster On each memory node.
Optionally, in some embodiments of the present embodiment, the data obtaining module 501 may include:
Whether judging submodule, the memory node number in new virtual IP address table for judging distributed storage cluster are greater than Memory node number in old virtual IP address table;If so, joined new memory node in distributed storage cluster;If it is not, then There is no new memory node to be added in distributed storage cluster;Wherein, new virtual IP address table is that the current distribution generated in real time is deposited The virtual IP address table of accumulation;Old virtual IP address table is the virtual IP address table of the distributed storage cluster after last virtual IP address distribution.
Specifically, the data obtaining module 501 may include:
Sending submodule sends the loaded virtual IP address request of acquisition for each memory node into old virtual IP address table and refers to It enables;
Response submodule is received, for receiving the loaded virtual IP address instruction of each memory node response, summarizing has load Virtual IP address.
In addition, the data obtaining module 501 may also include:
First computational submodule, for calculating virtual IP address in distributed storage cluster after memory node starting is newly added It is assigned to the mean number of each memory node, mean number is virtual IP address total number and memory node in distributed storage cluster The ratio of total number;
Submodule is selected, the target for selecting virtual IP address number to be greater than mean number from each memory node stores section Point;
Judging submodule, for judging it is averagely a whether the number of loaded virtual IP address on each target storage node is greater than Number;
The number of virtual IP address statistical module to be allocated, loaded virtual IP address is greater than mean number, then stores the target All space virtual IP are as virtual IP address to be allocated on node;The number of loaded virtual IP address is not more than mean number, then Retain loaded virtual IP address and predetermined number free virtual IP all on the target storage node, it will be remaining idle empty Intend IP as virtual IP address to be allocated, the number of the loaded virtual IP address of predetermined number=mean number-.
Optionally, in other embodiments of the present embodiment, the virtual IP address distribution module 503 may include:
Distribution sub module distributes first several virtual IP address to be allocated for being followed successively by the memory node being newly added;First The product of a numerical value of the value of number and the memory node being newly added is no more than virtual IP address sum to be allocated;
Judging submodule, for judging whether that there are also remaining virtual IP addresses to be allocated;
Reallocation submodule, for by remaining virtual IP address equilibrium assignment to be allocated into the distributed storage cluster Each memory node.
Specifically, the distribution sub module may include:
Second computational submodule is made for calculating virtual IP address number to be allocated and the new ratio that memory node number is added To distribute base value;
Third computational submodule, for calculating virtual in distributed storage cluster after the memory node starting being newly added IP is assigned to the mean number of each memory node, and mean number is that virtual IP address total number and storage save in distributed storage cluster The ratio of point total number;
Determine submodule, if distribution base value is less than mean number, and virtual IP address number to be allocated is greater than distribution base value The product of a numerical value for the memory node being newly added, using distribution base value as first numerical value;If distribution base value is greater than Mean number, and virtual IP address number to be allocated is greater than the product of a numerical value of mean number and the memory node being newly added, and will put down Equal number is as first numerical value.
The function of each functional module of the virtual IP address equalizing distributor of CTDB described in the embodiment of the present invention can be according to above-mentioned Method specific implementation in embodiment of the method, specific implementation process are referred to the associated description of above method embodiment, this Place repeats no more.
From the foregoing, it will be observed that under the premise of the embodiment of the present invention is based on the equilibrium assignment of virtual IP address, it is ensured that the void for thering is business to read and write The business of the client of quasi- IP connection is not interrupted, and the stability and high availability of distributed storage cluster are improved.
The embodiment of the invention also provides the virtual IP address equilibrium assignment equipment of CTDB a kind of, specifically may include:
Memory, for storing computer program;
Processor realizes the virtual IP address equilibrium point of CTDB described in any one embodiment as above for executing computer program The step of method of completing the square.
The function of each functional module of the virtual IP address equilibrium assignment equipment of CTDB described in the embodiment of the present invention can be according to above-mentioned Method specific implementation in embodiment of the method, specific implementation process are referred to the associated description of above method embodiment, this Place repeats no more.
From the foregoing, it will be observed that under the premise of the embodiment of the present invention is based on the equilibrium assignment of virtual IP address, it is ensured that the void for thering is business to read and write The business of the client of quasi- IP connection is not interrupted, and the stability and high availability of distributed storage cluster are improved.
The embodiment of the invention also provides a kind of computer readable storage mediums, are stored with the virtual IP address equilibrium assignment of CTDB Program, CTDB's described in any one embodiment as above is virtual when the virtual IP address equilibrium assignment program of the CTDB is executed by processor The step of IP equilibrium assignment method.
The function of each functional module of computer readable storage medium described in the embodiment of the present invention can be according to above method reality The method specific implementation in example is applied, specific implementation process is referred to the associated description of above method embodiment, herein no longer It repeats.
From the foregoing, it will be observed that under the premise of the embodiment of the present invention is based on the equilibrium assignment of virtual IP address, it is ensured that the void for thering is business to read and write The business of the client of quasi- IP connection is not interrupted, and the stability and high availability of distributed storage cluster are improved.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with it is other The difference of embodiment, same or similar part may refer to each other between each embodiment.For being filled disclosed in embodiment For setting, since it is corresponded to the methods disclosed in the examples, so being described relatively simple, related place is referring to method part Explanation.
Professional further appreciates that, unit described in conjunction with the examples disclosed in the embodiments of the present disclosure And algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These Function is implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Profession Technical staff can use different methods to achieve the described function each specific application, but this realization is not answered Think beyond the scope of this invention.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can directly be held with hardware, processor The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology In any other form of storage medium well known in field.
It above can to a kind of virtual IP address equilibrium assignment method, apparatus, equipment and the computer of CTDB provided by the present invention Storage medium is read to be described in detail.Specific case used herein explains the principle of the present invention and embodiment It states, the above description of the embodiment is only used to help understand the method for the present invention and its core ideas.It should be pointed out that for this skill For the those of ordinary skill in art field, without departing from the principle of the present invention, several change can also be carried out to the present invention Into and modification, these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims (10)

1. the virtual IP address equilibrium assignment method of CTDB a kind of, which is characterized in that including:
When having the memory node being newly added in distributed storage cluster, loaded void in current distributed storage cluster is obtained Quasi- IP and idle virtual IP address to be allocated;
The virtual IP address for retaining the source memory node of loaded virtual IP address is constant, by each virtual IP address equilibrium assignment to be allocated to described On each memory node of distributed storage cluster.
2. the virtual IP address equilibrium assignment method of CTDB according to claim 1, which is characterized in that described to work as distributed storage Include when having the memory node being newly added in cluster:
Judge the memory node number whether the memory node number in new virtual IP address table is greater than in old virtual IP address table;
If so, joined new memory node in the distributed storage cluster;If it is not, then in the distributed storage cluster Not new memory node is added;
Wherein, the new virtual IP address table is the virtual IP address table of the current distributed storage cluster generated in real time;The old virtual IP address Table is the virtual IP address table of the distributed storage cluster after last virtual IP address distribution.
3. the virtual IP address equilibrium assignment method of CTDB according to claim 2, which is characterized in that the current distribution of acquisition Loaded virtual IP address includes in formula storage cluster:
Each memory node into the old virtual IP address table, which is sent, obtains loaded virtual IP address request instruction;
The loaded virtual IP address instruction for receiving each memory node response, summarizes loaded virtual IP address.
4. according to claim 1 to the virtual IP address equilibrium assignment method of CTDB described in 3 any one, which is characterized in that described Obtaining virtual IP address to be allocated idle in current distributed storage cluster includes:
After memory node starting is newly added, calculates virtual IP address in the distributed storage cluster and be assigned to each memory node Mean number, the mean number are the ratio of virtual IP address total number and memory node total number in the distributed storage cluster Value;
Virtual IP address number is selected to be greater than the target storage node of the mean number from each memory node;
Judge whether the number of loaded virtual IP address on each target storage node is greater than the mean number;
If so, using space virtual IP all on the target storage node as virtual IP address to be allocated;
If not, retain loaded virtual IP address and predetermined number free virtual IP all on the target storage node, it will Remaining free virtual IP is as virtual IP address to be allocated, the predetermined number=mean number-loaded virtual IP address number.
5. according to claim 1 to the virtual IP address equilibrium assignment method of CTDB described in 3 any one, which is characterized in that described To include on each memory node of each virtual IP address equilibrium assignment to be allocated to the distributed storage cluster:
It is followed successively by the memory node being newly added and distributes first several virtual IP address to be allocated;
Judge whether that there are also remaining virtual IP addresses to be allocated;
If so, each memory node by remaining virtual IP address equilibrium assignment to be allocated into the distributed storage cluster;
Wherein, the product of a numerical value of first several value and the memory node being newly added is no more than virtual IP address sum to be allocated.
6. the virtual IP address equilibrium assignment method of CTDB according to claim 5, which is characterized in that described to be followed successively by new addition Memory node distribute first several virtual IP address to be allocated include:
Virtual IP address number to be allocated and the new ratio that memory node number is added are calculated, as distribution base value;
After the memory node starting being newly added, calculates virtual IP address in the distributed storage cluster and be assigned to each memory node Mean number, the mean number be the distributed storage cluster in virtual IP address total number and memory node total number ratio Value;
If the distribution base value is less than the mean number, and virtual IP address number to be allocated is greater than the distribution base value and newly The product of a numerical value of the memory node of addition, using the distribution base value as first numerical value;
If the distribution base value is greater than the mean number, and virtual IP address number to be allocated is greater than the mean number and Xin Jia The product of a numerical value of the memory node entered, using the mean number value as first numerical value.
7. the virtual IP address equilibrium assignment method of CTDB according to claim 5, which is characterized in that it is described by it is remaining to point Each memory node with virtual IP address equilibrium assignment into the distributed storage cluster includes:
Remaining virtual IP address to be allocated is successively allocated according to the memory node being newly added, remaining each memory node.
8. the virtual IP address equalizing distributor of CTDB a kind of, which is characterized in that including:
Data obtaining module is deposited for when having the memory node being newly added in distributed storage cluster, obtaining current distribution Loaded virtual IP address and idle virtual IP address to be allocated in accumulation;
Virtual IP address reservation module, it is constant for retaining the virtual IP address of source memory node of loaded virtual IP address;
Virtual IP address distribution module, for saving each storage of each virtual IP address equilibrium assignment to be allocated to the distributed storage cluster Point on.
9. the virtual IP address equilibrium assignment equipment of CTDB a kind of, which is characterized in that including processor, the processor is deposited for executing The virtual IP address equilibrium assignment method of the CTDB as described in any one of claim 1 to 7 is realized when the computer program stored in reservoir The step of.
10. a kind of computer readable storage medium, which is characterized in that be stored with CTDB's on the computer readable storage medium Virtual IP address equilibrium assignment program realizes such as claim 1 when the virtual IP address equilibrium assignment program of the CTDB is executed by processor To any one of 7 CTDB virtual IP address equilibrium assignment method the step of.
CN201810621502.4A 2018-06-15 2018-06-15 CTDB virtual IP balance distribution method, device, equipment and medium Active CN108881512B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810621502.4A CN108881512B (en) 2018-06-15 2018-06-15 CTDB virtual IP balance distribution method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810621502.4A CN108881512B (en) 2018-06-15 2018-06-15 CTDB virtual IP balance distribution method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN108881512A true CN108881512A (en) 2018-11-23
CN108881512B CN108881512B (en) 2021-06-29

Family

ID=64339260

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810621502.4A Active CN108881512B (en) 2018-06-15 2018-06-15 CTDB virtual IP balance distribution method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN108881512B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110519406A (en) * 2019-08-16 2019-11-29 济南浪潮数据技术有限公司 A kind of virtual address distribution method, device and CTDB cluster and storage medium
CN110674095A (en) * 2019-09-27 2020-01-10 浪潮电子信息产业股份有限公司 CTDB cluster expansion method, device, equipment and readable storage medium
CN111416884A (en) * 2020-03-12 2020-07-14 苏州浪潮智能科技有限公司 CTDB virtual IP allocation method and device and distributed storage equipment
CN111770209A (en) * 2020-05-29 2020-10-13 苏州浪潮智能科技有限公司 Virtual IP redistribution method, terminal and storage medium
CN111866210A (en) * 2020-07-08 2020-10-30 苏州浪潮智能科技有限公司 Virtual IP balance distribution method, system, terminal and storage medium
CN111885112A (en) * 2020-06-24 2020-11-03 广东浪潮大数据研究有限公司 Node service exception handling method, device, equipment and storage medium
CN111901448A (en) * 2020-06-29 2020-11-06 苏州浪潮智能科技有限公司 CTDB virtual IP balance distribution method for cluster node fault scene
CN114285729A (en) * 2021-11-29 2022-04-05 苏州浪潮智能科技有限公司 Distributed cluster management node deployment method, device, equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110206052A1 (en) * 2010-02-25 2011-08-25 Gemtek Technology Co., Ltd Data transfer system enabling access to multiple subnets and method thereof
CN102497458A (en) * 2011-12-22 2012-06-13 北京华环电子股份有限公司 Allocation method for network element IP (Internet Protocol) address
CN103905531A (en) * 2014-03-14 2014-07-02 浪潮电子信息产业股份有限公司 Method for converting load balancing among nodes in cluster storage system
CN104283710A (en) * 2014-08-18 2015-01-14 四川长虹电器股份有限公司 Database cluster fault handling method and management server
CN104410557A (en) * 2014-12-25 2015-03-11 深圳中科讯联科技有限公司 Dynamic networking method and communication method based on RS-485
US20150244739A1 (en) * 2006-12-29 2015-08-27 Intel Corporation Network security elements using endpoint resources
CN105704256A (en) * 2014-11-26 2016-06-22 中国移动通信集团公司 Method, device and system for IP address management
CN106331210A (en) * 2016-08-19 2017-01-11 中国银联股份有限公司 IP address allocation method and device for cloud computing network
CN106453360A (en) * 2016-10-26 2017-02-22 上海爱数信息技术股份有限公司 Distributed block storage data access method and system based on iSCSI (Internet Small Computer System Interface) protocol
CN107329830A (en) * 2017-06-28 2017-11-07 郑州云海信息技术有限公司 A kind of method and device of distributed cluster system optimization

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150244739A1 (en) * 2006-12-29 2015-08-27 Intel Corporation Network security elements using endpoint resources
US20110206052A1 (en) * 2010-02-25 2011-08-25 Gemtek Technology Co., Ltd Data transfer system enabling access to multiple subnets and method thereof
CN102497458A (en) * 2011-12-22 2012-06-13 北京华环电子股份有限公司 Allocation method for network element IP (Internet Protocol) address
CN103905531A (en) * 2014-03-14 2014-07-02 浪潮电子信息产业股份有限公司 Method for converting load balancing among nodes in cluster storage system
CN104283710A (en) * 2014-08-18 2015-01-14 四川长虹电器股份有限公司 Database cluster fault handling method and management server
CN105704256A (en) * 2014-11-26 2016-06-22 中国移动通信集团公司 Method, device and system for IP address management
CN104410557A (en) * 2014-12-25 2015-03-11 深圳中科讯联科技有限公司 Dynamic networking method and communication method based on RS-485
CN106331210A (en) * 2016-08-19 2017-01-11 中国银联股份有限公司 IP address allocation method and device for cloud computing network
CN106453360A (en) * 2016-10-26 2017-02-22 上海爱数信息技术股份有限公司 Distributed block storage data access method and system based on iSCSI (Internet Small Computer System Interface) protocol
CN107329830A (en) * 2017-06-28 2017-11-07 郑州云海信息技术有限公司 A kind of method and device of distributed cluster system optimization

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110519406B (en) * 2019-08-16 2022-05-17 济南浪潮数据技术有限公司 Virtual address allocation method and device, CTDB cluster and storage medium
CN110519406A (en) * 2019-08-16 2019-11-29 济南浪潮数据技术有限公司 A kind of virtual address distribution method, device and CTDB cluster and storage medium
CN110674095A (en) * 2019-09-27 2020-01-10 浪潮电子信息产业股份有限公司 CTDB cluster expansion method, device, equipment and readable storage medium
CN110674095B (en) * 2019-09-27 2022-06-10 浪潮电子信息产业股份有限公司 CTDB cluster expansion method, device and equipment and readable storage medium
CN111416884A (en) * 2020-03-12 2020-07-14 苏州浪潮智能科技有限公司 CTDB virtual IP allocation method and device and distributed storage equipment
US11757830B2 (en) 2020-03-12 2023-09-12 Inspur Suzhou Intelligent Technology Co., Ltd. Method and apparatus for allocating CTDB-based virtual IP address, and distributed storage device
CN111770209A (en) * 2020-05-29 2020-10-13 苏州浪潮智能科技有限公司 Virtual IP redistribution method, terminal and storage medium
CN111885112A (en) * 2020-06-24 2020-11-03 广东浪潮大数据研究有限公司 Node service exception handling method, device, equipment and storage medium
CN111901448A (en) * 2020-06-29 2020-11-06 苏州浪潮智能科技有限公司 CTDB virtual IP balance distribution method for cluster node fault scene
CN111901448B (en) * 2020-06-29 2022-06-14 苏州浪潮智能科技有限公司 CTDB virtual IP balance distribution method for cluster node fault scene
CN111866210A (en) * 2020-07-08 2020-10-30 苏州浪潮智能科技有限公司 Virtual IP balance distribution method, system, terminal and storage medium
CN114285729A (en) * 2021-11-29 2022-04-05 苏州浪潮智能科技有限公司 Distributed cluster management node deployment method, device, equipment and storage medium
CN114285729B (en) * 2021-11-29 2023-08-25 苏州浪潮智能科技有限公司 Distributed cluster management node deployment method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN108881512B (en) 2021-06-29

Similar Documents

Publication Publication Date Title
CN108881512A (en) Virtual IP address equilibrium assignment method, apparatus, equipment and the medium of CTDB
US11586673B2 (en) Data writing and reading method and apparatus, and cloud storage system
CN108287660B (en) Data storage method and device
US8468548B2 (en) Multi-tenant, high-density container service for hosting stateful and stateless middleware components
CN102137133B (en) Method and system for distributing contents and scheduling server
EP2710470B1 (en) Extensible centralized dynamic resource distribution in a clustered data grid
CN101984632A (en) Load distributing method, device and server in distributed cache system
CN110377395A (en) A kind of Pod moving method in Kubernetes cluster
CN105337780B (en) A kind of server node configuration method and physical node
CN102577241A (en) Method, device and system for scheduling distributed buffer resources
CN104468651B (en) Distributed more copy data storage methods and device
CN110569302A (en) method and device for physical isolation of distributed cluster based on lucene
CN109873714A (en) Cloud computing node configures update method and terminal device
CN106385330A (en) Network function virtualization composer realization method and device
CN1330124C (en) Method and apparatus for virtualizing network resources
CN111309259A (en) Data migration method, system, storage medium and data migration terminal
CN110519354A (en) A kind of distributed objects storage system and its method for processing business and storage medium
CN109871365A (en) A kind of distributed file system
CN109298977A (en) A kind of virtual machine business quick recovery method, system, device and storage medium
CN110493060A (en) A kind of virtual IP address distribution method and relevant apparatus
CN111866210A (en) Virtual IP balance distribution method, system, terminal and storage medium
CN114338670B (en) Edge cloud platform and network-connected traffic three-level cloud control platform with same
CN111901448B (en) CTDB virtual IP balance distribution method for cluster node fault scene
CN116635831A (en) Data storage method and device and related equipment
CN102769675B (en) Method used for keeping host resource stable and based on cloud computing platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant