Disclosure of Invention
The invention aims to provide a network communication method and device of a distributed file system and a network communication system, and aims to solve the problems that the bandwidth of a front-end network and the bandwidth of a back-end network are unbalanced and the bandwidth utilization rate is low when the network transmission flow of the conventional distributed file system is large.
In order to solve the technical problems, the invention provides the following technical scheme:
a distributed file system network communication method comprises the following steps:
reading a network configuration file, and acquiring IP information of a back-end network, wherein the IP information comprises front-end network IP information and back-end network IP information;
selecting a first object storage device with a first preset number and a second object storage device with a second preset number from a plurality of object storage devices according to the object storage device information by using a preset IP selection algorithm;
and sending the front-end network IP information to the first object storage equipment, and sending the back-end network IP information to the second object storage equipment, so that the first object storage equipment is bound to the front-end network IP according to the front-end network IP information, and the second object storage equipment is bound to the back-end network IP according to the back-end network IP information and then carries out network communication.
Optionally, the reading the network configuration file, and the obtaining the IP information of the backend network including the front-end network IP information and the backend network IP information includes:
and reading the network configuration file, and acquiring the IP information of the back-end network, wherein the IP information comprises the front-end network IP information and the back-end network IP information.
Optionally, the selecting, by using a preset IP selection algorithm, a first preset number of first object storage devices and a second preset number of second object storage devices from the plurality of object storage devices according to the object storage device information includes:
according to the ID information in the object storage device information, performing remainder operation on the ID of each object storage device and a preset base number to obtain a remainder;
and taking the object storage device with the remainder being zero as the first object storage device, and taking the object storage device with the remainder being non-zero as the second object storage device.
Optionally, after the sending the front-end network IP information to the first object storage device and the sending the back-end network IP information to the second object storage device, the method further includes:
reading the modified network configuration file, and acquiring the unique IP information of the back-end network;
and sending the unique IP information to the object storage equipment so that the object storage equipment is bound to the back-end network IP corresponding to the unique IP information.
A distributed file system network communication device, comprising:
the first reading module is used for reading the network configuration file and acquiring the IP information of the back-end network, wherein the IP information comprises the front-end network IP information and the back-end network IP information;
the selection module is used for selecting a first preset number of first object storage devices and a second preset number of second object storage devices from the plurality of object storage devices according to the object storage device information by using a preset IP selection algorithm;
the first sending module is used for sending the front-end network IP information to the first object storage device and sending the back-end network IP information to the second object storage device, so that the first object storage device is bound to a front-end network IP according to the front-end network IP information, and the second object storage device is bound to a back-end network IP according to the back-end network IP information and then carries out network communication.
Optionally, the first reading module includes:
and the reading submodule is used for reading the network configuration file and acquiring the IP information of the back-end network, wherein the IP information comprises the front-end network IP information and the back-end network IP information.
Optionally, the selection module comprises:
the remainder taking submodule is used for carrying out remainder taking operation on the ID of each object storage device and a preset base number according to the ID information in the object storage device information to obtain a remainder;
and the screening submodule is used for taking the object storage device with the remainder being zero as the first object storage device and taking the object storage device with the remainder being non-zero as the second object storage device.
Optionally, the method further comprises:
the second reading module is used for reading the modified network configuration file and acquiring the unique IP information of the back-end network;
and the second sending module is used for sending the unique IP information to the object storage equipment so as to enable the object storage equipment to be bound to a back-end network IP corresponding to the unique IP information.
A network communication system is applied to a distributed file system and comprises a front-end network, a back-end network, a plurality of network cards, an object storage device management module and a plurality of object storage devices;
the object storage device management module is used for reading a network configuration file and acquiring IP information of a back-end network, wherein the IP information comprises front-end network IP information and back-end network IP information; selecting a first object storage device with a first preset number and a second object storage device with a second preset number from the plurality of object storage devices according to the object storage device information by using a preset IP selection algorithm; sending the front-end network IP information to the first object storage device, and sending the back-end network IP information to the second object storage device; and the second object storage device performs network communication after being bound to a back-end network IP according to the back-end network IP information.
Optionally, the number of the network cards is two.
The invention provides a network communication method of a distributed file system, which comprises the following steps: reading a network configuration file, and acquiring IP information of a back-end network, wherein the IP information comprises front-end network IP information and back-end network IP information; selecting a first object storage device with a first preset number and a second object storage device with a second preset number from a plurality of object storage devices according to the object storage device information by using a preset IP selection algorithm; and sending the front-end network IP information to the first object storage equipment, and sending the back-end network IP information to the second object storage equipment, so that the first object storage equipment is bound to the front-end network IP according to the front-end network IP information, and the second object storage equipment is bound to the back-end network IP according to the back-end network IP information and then carries out network communication.
Therefore, compared with the prior art that all the object storage devices are bound to the associated network card of the back-end network, the method can transfer part of the flow of the back-end network into the front-end network to realize data distribution. Therefore, when the network transmission flow is large, the bandwidth of the front-end network and the bandwidth of the back-end network can be balanced, the bandwidth utilization rate is improved, the network transmission rate is optimized, and the performance of the distributed file system is improved. The distributed file system network communication device and the network communication system have the beneficial effects.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating an embodiment of a distributed file system network communication method according to the present invention, where the method includes the following steps:
step 101: and reading the network configuration file, and acquiring the IP information of the back-end network, wherein the IP information comprises the front-end network IP information and the back-end network IP information.
It is to be understood that the network configuration file may refer to a network configuration file of a preconfigured distributed file system, which may include network configuration information of a front-end network and a back-end network, that is, it may include front-end network IP address information and back-end network IP address information, that is, a plurality of IP addresses are configured for the back-end network by using the network configuration file.
By reading the network configuration file, the IP information of the front-end network and the back-end network can be obtained, and the back-end network IP information here may specifically include the front-end network IP information and the back-end network IP information. That is, the back-end network IP information in the network configuration file includes a plurality of IP addresses, and some of the plurality of IP addresses are IP addresses of the front-end network and some are IP addresses of the back-end network. For example, the network configuration file includes front-end network IP information specifically: the public _ network is 192.168.0.0/23, and the backend network IP information specifically includes: 188.188.0.0/16, 192.168.0.0/23.
The distributed file system adopts two network card structures, namely, one network card is bound to the front-end network, and the other network card is bound to the back-end network. At this time, the backend network IP address information obtained by reading the network configuration file should include a front-end network IP and a backend network IP. In some embodiments, the process of reading the network configuration file and acquiring the IP information of the backend network including the front-end network IP information and the backend network IP information may specifically be: and reading the network configuration file, and acquiring the IP information of the back-end network, wherein the IP information comprises front-end network IP information and back-end network IP information.
Certainly, when the distributed file system adopts more than two network cards, the process is similar, and details are not described herein.
And 102, selecting a first preset number of first object storage devices and a second preset number of second object storage devices from the plurality of object storage devices according to the object storage device information by using a preset IP selection algorithm.
It should be noted that the object storage device information may specifically refer to ID information of an object storage device of the object storage device, and the ID information may specifically be a certain sequence of numbers.
The preset IP selection algorithm may be used to determine which object storage devices are bound to the front-end network and which object storage devices are bound to the back-end network according to the object storage device information. The algorithm can be set according to actual requirements and conditions, namely, part of the object storage devices are bound to the associated network card of the front-end network for ensuring the balance of the network bandwidth between the front-end network and the back-end network, and the bandwidth occupied by the bound part of the object storage devices does not influence the normal operation of the corresponding functions of the front-end network.
Therefore, the preset IP selection algorithm is mainly used to determine how many object storage devices to select an associated network card of which one object storage device is bound to the front-end network, for example, 5 object storage devices to select an associated network card of which one object storage device is bound to the front-end network. At this time, the specific values of the first preset number and the second preset number may be determined by a preset IP selection algorithm.
In particular, the first object storage device and the second object storage device may be screened according to parity of object storage device IDs. That is, the object storage devices with odd or even IDs are used as the first object storage device, and the object storage devices with even or odd IDs are used as the second object storage device, at this time, the first preset number and the second preset number are equal, that is, half of the object storage devices are bound to the front-end network, and the other half of the object storage devices are bound to the back-end network.
However, binding half of the object storage devices to the associated network card of the front-end network may occupy a large amount of bandwidth of the front-end network, thereby affecting the original functions of the front-end network. Therefore, preferably, a base number may be set, each object storage device performs a remainder operation on the base number, and the first object storage device and the second object storage device are screened according to the remainders. In some embodiments, the selecting, by using the preset IP selection algorithm and according to the object storage device information, a first preset number of first object storage devices and a second preset number of second object storage devices from the plurality of object storage devices may specifically be: according to the ID information in the object storage equipment information, carrying out remainder operation on the ID of each object storage equipment and a preset base number to obtain a remainder; and taking the object storage device with the remainder being zero as a first object storage device, and taking the object storage device with the remainder being non-zero as a second object storage device.
It is understood that the preset base number can be set according to actual requirements and situations, and for example, it can be specifically 3, 5 or 7. And carrying out remainder operation on the ID information of the object storage equipment and a preset base number, so that one object storage equipment is selected to be bound to the associated network card of the front-end network every a plurality of object storage equipment with the preset base number.
For example, there are currently 10 object storage devices, the IDs of which are 1 to 10, respectively, and the preset cardinality is 3. At this time, the remainder is 1 and is not zero by performing a remainder operation on 1 and 3, so that the device 1 is used as the second object storage device, and the remainder is 0 by performing a remainder operation on 3 and 3, so that the device 3 is used as the first object storage device. And in the same way, performing remainder operation on other object storage devices and the base number 3 in sequence. Finally, of the 10 object storage devices, the devices having IDs of 3, 6, and 9 serve as the first object storage device, and the others serve as the second object storage device.
It can be seen that, according to the preset base number, the first object storage device and the second object storage device are selected by using the preset IP selection algorithm, and the values of the first preset number and the second preset number can be determined reasonably, that is, the object storage devices of the reasonable number are selected to be bound to the associated network card of the front-end network, so that data distribution can be realized without occupying too much bandwidth of the front-end network.
Step 103: and sending the front-end network IP information to the first object storage equipment, and sending the back-end network IP information to the second object storage equipment, so that the first object storage equipment is bound to the front-end network IP according to the front-end network IP information, and the second object storage equipment is bound to the back-end network IP according to the back-end network IP information and then carries out network communication.
After determining whether each object storage device is bound to the front-end network or the back-end network, corresponding IP information can be sent to each object storage device, and thus each object storage device can be bound to a corresponding IP address according to the received IP information.
It should be noted that, the first object storage device is bound to an IP network segment (an associated network card of the front-end network) of the front-end network according to the front-end network IP information; and the second object storage device is bound to the back-end network IP (the associated network card of the back-end network) according to the back-end network IP information.
For example, the associated network card of the current front-end network is network card a, and the associated network card of the back-end network is network card B; in the prior art, all object storage devices are bound to the network card B. In this embodiment, a suitable part of the object storage devices is selected and bound to the network card a, and the remaining object storage devices are bound to the network card B. Therefore, the bandwidth flow of the object storage device can be optimized, namely, part of the object storage device utilizes the part of the bandwidth of the network card A to copy data, and the bandwidth pressure of the network card B is relieved. Meanwhile, when the network transmission flow is large, the bandwidths of the network card A and the network card B can be balanced, and the bandwidth utilization rate is improved.
In order to be compatible with the conventional mode, that is, the distributed file system needs to be switched back to the conventional mode, at this time, the cluster can be restarted by simply modifying the network configuration file, so that the conventional mode can be switched. In some embodiments, after sending the front-end network IP information to the first object storage device and sending the back-end network IP information to the second object storage device, the method further includes: reading the modified network configuration file, and acquiring the unique IP information of the back-end network; and sending the unique IP information to the object storage equipment so that the object storage equipment is bound to the back-end network IP corresponding to the unique IP information.
It can be understood that the backend network IP in the original network configuration file is configured as a single IP, and after the cluster is restarted, all the object storage devices are bound to the modified single IP. For example, the modified network configuration file specifically includes:
public_network=192.168.0.0/23,
cluster_network=188.188.0.0/16。
it can be seen that the network configuration file can be switched from the multi-IP mode to the traditional single-IP mode only by simply modifying the network configuration file, and the compatibility is strong.
To better illustrate the differences between the multi-IP approach and the conventional single-IP approach, the following description will be further described with reference to fig. 2 and 3. Fig. 2 is a schematic diagram of a conventional network communication of a distributed file system according to an embodiment of the present invention, and fig. 3 is a schematic diagram of a network communication of a distributed file system according to an embodiment of the present invention.
As shown in fig. 2, the Client interacts with the distributed file system through a Public network; mon (Monitor, monitoring module), MDS, OSD carry on the interaction through Public network, for the order, report state and diffuse osdmap, etc. of responding to Mon specifically; and data copying, heartbeat message processing and the like are carried out between the OSD and the OSD through a Cluster network.
As shown in fig. 3, some OSDs use Public networks for data copy operations. Mon and MDS still interact through a Public network, a part of OSD interacts through the Public network, and a part of OSD interacts through a Cluster network.
As shown in the conventional network structure of fig. 2, when a large amount of data is to be copied between the OSD and the OSD, the Cluster network becomes abnormally busy, and the network card bound by the Cluster network can reach the peak value of the bandwidth of a ten-gigabit network card. By using the network structure shown in fig. 3, the pressure of the Cluster network can be relieved, and the bandwidth of the Public network can be fully utilized, so that more data can be copied between the OSD and the OSD in unit time, and the system performance is improved.
In this embodiment, the method includes: reading a network configuration file, and acquiring IP information of a back-end network, wherein the IP information comprises front-end network IP information and back-end network IP information; selecting a first object storage device with a first preset number and a second object storage device with a second preset number from a plurality of object storage devices according to the object storage device information by using a preset IP selection algorithm; and sending the front-end network IP information to the first object storage equipment, and sending the back-end network IP information to the second object storage equipment, so that the first object storage equipment is bound to the front-end network IP according to the front-end network IP information, and the second object storage equipment is bound to the back-end network IP according to the back-end network IP information and then carries out network communication.
Therefore, compared with the prior art that all the object storage devices are bound to the associated network card of the back-end network, the method can transfer part of the flow of the back-end network into the front-end network to realize data distribution. Therefore, when the network transmission flow is large, the bandwidth of the front-end network and the bandwidth of the back-end network can be balanced, the bandwidth utilization rate is improved, the network transmission rate is optimized, and the performance of the distributed file system is improved.
In the following, the distributed file system network communication apparatus provided in the embodiment of the present invention is introduced, and the distributed file system network communication apparatus described below and the distributed file system network communication method described above may be referred to correspondingly.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a distributed file system network communication device according to an embodiment of the present invention, where the device may include:
the first reading module 41 is configured to read a network configuration file, and acquire IP information of a backend network, where the IP information includes front-end network IP information and backend network IP information;
a selecting module 42, configured to select, according to the object storage device information, a first preset number of first object storage devices and a second preset number of second object storage devices from the multiple object storage devices by using a preset IP selection algorithm;
the first sending module 43 is configured to send the front-end network IP information to the first object storage device, and send the back-end network IP information to the second object storage device, so that the first object storage device binds to the front-end network IP according to the front-end network IP information, and the second object storage device binds to the back-end network IP according to the back-end network IP information and then performs network communication.
In some embodiments, the first reading module 41 may include:
and the reading submodule is used for reading the network configuration file and acquiring the IP information of the back-end network, wherein the IP information comprises front-end network IP information and back-end network IP information.
In some embodiments, the selection module 42 may include:
the remainder taking submodule is used for carrying out remainder taking operation on the ID of each object storage device and a preset base number according to the ID information in the object storage device information to obtain a remainder;
and the screening submodule is used for taking the object storage device with the remainder being zero as a first object storage device and taking the object storage device with the remainder being non-zero as a second object storage device.
In some embodiments, the method may further include:
the second reading module is used for reading the modified network configuration file and acquiring the unique IP information of the back-end network;
and the second sending module is used for sending the unique IP information to the object storage equipment so as to enable the object storage equipment to be bound to the back-end network IP corresponding to the unique IP information.
In this embodiment, the apparatus selects, by using a preset IP selection algorithm, a first object storage device bound to a front-end network IP, and a second object storage device bound to a back-end network IP, that is, a part of object storage devices are bound to an associated network card of the front-end network, and another part of object storage devices are bound to an associated network card of the back-end network. Therefore, when the network transmission flow is large, the bandwidth of the front-end network and the bandwidth of the back-end network can be balanced, the bandwidth utilization rate is improved, the network transmission rate is optimized, and the performance of the distributed file system is improved.
The network communication system provided in this embodiment is described below, and is specifically applied to a distributed file system, which may include a front-end network, a back-end network, a plurality of network cards, an object storage device management module, and a plurality of object storage devices;
the object storage device management module is used for reading a network configuration file and acquiring IP information of a back-end network, wherein the IP information comprises front-end network IP information and back-end network IP information; selecting a first object storage device with a first preset number and a second object storage device with a second preset number from a plurality of object storage devices according to the object storage device information by using a preset IP selection algorithm; sending the front-end network IP information to a first object storage device, and sending the back-end network IP information to a second object storage device; and the second object storage device performs network communication after being bound to the back-end network IP according to the back-end network IP information.
Preferably, the number of network cards is two.
When the number of the network cards is two, one of the network cards is associated with the front-end network, and the other network card is associated with the back-end network. At this time, the first object storage device is bound to the front-end network IP network segment, namely the first object storage device is bound to the network card associated with the front-end network; the second object storage device is bound to the backend network IP network segment, i.e. the second object storage device is bound to a network card associated with the backend network.
It should be noted that similar parts between this embodiment and the above embodiments may be referred to each other, and are not described herein again.
Therefore, compared with the prior art that all the object storage devices are bound to the associated network card of the back-end network, the communication system can transfer part of the flow of the back-end network into the front-end network to realize data distribution. Therefore, when the network transmission flow is large, the bandwidth of the front-end network and the bandwidth of the back-end network can be balanced, the bandwidth utilization rate is improved, the network transmission rate is optimized, and the performance of the distributed file system is improved.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above detailed description describes the network communication method, device and network communication system of the distributed file system provided by the present invention. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.