Background technology
Distributed file system (Distributed File System, DFS) can allow system operator simplify the user to being dispersed in the access of the file in network, utilize distributed file system, can make a plurality of integrating documents that are dispersed on a plurality of servers, concerning the user, those files are as in the same position that is stored on network.The user does not need to understand the actual storage locations of these files when these files of access, can carry out access to these files simultaneously, and is quite convenient.
In a distributed file system, usually have a plurality of network switch (Switch), and each network switch connects respectively multiple servers, by this, multiple servers is planned and is integrated into an independently large scale system.As long as the user is connected to this system, can carry out access to these files in respectively this server under this system, do not need to know respectively actual address and the connection state of this server.
Generally speaking; in order to improve the fail safe of these files; cause these files can not lose because of the damage of server; distributed file system can be used file copy service (File Replication Service usually; FRS) come automatically to produce a at least backup file (Replica, or be called duplicate) for every a file.
Distributed file system draws a server via algorithm usually at random when setting up backup file, or configures a configuration file by the manager and select a server, so that this backup file is stored in this server.And in general, store the server of this backup file, be different from the server of this original document of storage.By this, when the server of storage original document damaged, distributed file system can directly change user's read path, makes the user be connected to another server to read this backup file.For the user, fully can discovery server damage, what also can not know that it reads is original document or backup file, quite convenient concerning the user.
Yet, except server, also may be because a variety of causes damage in order to the network switch of connection server, when a network switch damaged, a plurality of servers that connect under this network switch will simultaneously can't access.For instance, if an original document is stored in a first server, and the backup file of this original document is stored in a second server, and this first server and this second server are connected in a first network switch simultaneously, when this first network switch damaged, this first server and this second server can't be accessed simultaneously, thus, this original document and this backup file can't be read simultaneously, and the foundation of this backup file has namely lost meaning.
For preventing that said circumstances from occuring; distributed file system on market is normally set up protection mechanism by extra software or hardware, protects each network switch can not break down easily; or sending alert news in the very first time that fault occurs, the manager processes as early as possible with reporting system.Only, real in a distributed file system have a plurality of network switchs, does protection if each network switch all arranges extra mechanism, and what its maintenance cost will be suitable is considerable.
Because above-mentioned problem, the real mechanism that a kind of novelty should be provided on market, make distributed file system when the storage backup file, can automatically select a best, safest memory location, in the situation that the network switch damages, the user still can read one of them of original document or backup file to guarantee.And, needn't set up extra protection mechanism for the network switch, use the setup cost of reduction system.
Embodiment
Hereby with regard to a preferred embodiment of the present invention, coordinate accompanying drawing, be described in detail as follows.
Head sees also Fig. 1, is the system architecture diagram of a preferred embodiment of the present invention.The person is the system cabinet 1 of a distributed file system as shown in the figure, has a plurality of server slots 11 on this system cabinet 1, and respectively this server slot 11 is pegged graft for a station server 4 respectively.This system cabinet 1 inside is provided with a plurality of network switchs (master network switch 2 as shown in Figure 2, first network switch 31, second network switch 32, and the N network switch 33 etc.), respectively in order to connect respectively this server 4, use, this server 4 respectively can be integrated into data centers (data center).
As shown in fig. 1, every one deck of this system cabinet 1 all is divided at least ten two these server slots 11 (each six of front and rear rows), and this system cabinet 1 has altogether 40 layers, be with, this system cabinet 1 altogether can accommodating 12*40=480 this server 4.Yet the above is only of the present invention one better concrete enforcement, and this system cabinet 1 is decided by reality is required, is set to various form and capacity, should not limited.
In the present embodiment, this distributed file system mainly adopts the framework of a kind of two-tier network switch (Layer 2), be positioned on a plurality of bottom-layer network switches 3 (this first network switch 31 as shown in Figure 2, this second network switch 32, and this N network switch 33) of bottom (or claim second layer) and have a plurality of connectivity ports, and each this connectivity port is assigned with respectively a procotol (Internet Protocol, IP) address.Wherein this IP address can be fixedly IP or by DHCP (Dynamic Host Configuration Protocol, DHCP) the server dynamic IP of distributing, and respectively in a single day this IP address is assigned with, to can not change again, that is, this IP address is held together with this connectivity port.When one of them this server slot 11 in this server 4 these system cabinets 1 of insertion, this server 4 can be by the connection line in this server slot 11, connect one of them connectivity port on one of them this bottom-layer network switch 3, by this, interconnection network is come in this server 4 IP address that can be assigned to this connectivity port.
Yet, although respectively the IP address that is assigned with, respectively this connectivity port on this bottom-layer network switch 3 is can be not reformed, but still can look the difference of the topological structure (Topology) that this distributed file system adopts and difference to some extent, the network switch under different topological structures, it can be assigned to IP address is different.Therefore, in the situation that the topological structure of not knowing this distributed file system why, the manager can't judge directly in fact that each connectivity port is assigned with IP address why.
Continuous Fig. 2, Fig. 3, and Fig. 4 of please consulting simultaneously is respectively a preferred embodiment of the present invention, another preferred embodiment, and the topological schematic diagram of another preferred embodiment.That shown in Figure 2 is a tree topology framework, and in the present embodiment, this distributed file system mainly has this master network switch 2, and this master network switch 2 connects a plurality of these bottom-layer network switches 3 by a plurality of connectivity ports on it.And respectively this bottom-layer network switch 3 by a plurality of connectivity ports on it, connects respectively this a plurality of servers 4 again.(for example shown in figure, these first network switch 31 connection servers 411,412,413; These second network switch 32 connection servers 421,422,423; The 3rd network switch 33 connection servers 431,432,433).
In this Fig. 2, mainly connect three these bottom-layer network switches 3 as example take this master network switch 2, and respectively this bottom-layer network switch 3 is respectively to connect three these servers 4 as example, yet the actual quantity of these a plurality of bottom-layer network switches 3, depending on the quantity of the connectivity port of this master network switch 2, and respectively this bottom-layer network switch 3 can connect respectively this servers 4 of how many platforms, also depending on the connectivity port quantity of itself, should not limited.
That shown in Figure 3 is mainly a kind of trunking tree topology (Tree topology with trunking) framework.Tree topology framework shown in the similar Fig. 2 of trunking tree topology framework, difference are that respectively this bottom-layer network switch 3 is combined into two or more connectivity ports on it in path of a logic, use to be connected to this master network switch 2.Thus, the frequency range of described connectivity port can be merged, using increases this master network switch 2 and the transmitting bandwidth between this bottom-layer network switch 3 respectively.Be with, by trunking tree topology framework, can provide distributed file system better transmission speed.
That shown in Figure 4 is mainly a kind of mesh topology (Mesh topology) framework.If distributed file system adopts the mesh topology framework, a plurality of this master network switch 2 and a plurality of these bottom-layer network switches 3 that are positioned at the second layer that are positioned at ground floor need be arranged, and respectively this master network switch 2 is connected with whole this bottom-layer network switch 3 respectively, and respectively this bottom-layer network switch 3 also connects respectively this master network switch 2 simultaneously.
As mentioned above, adopt the benefit of mesh topology to be, by connection in many ways, can reach higher data transmission efficiency, and there is no the problem of signal attenuation.Moreover, because respectively this master network switch 2 of ground floor respectively this bottom-layer network switch 3 with the second layer all is connected to each other, therefore for administrative staff, also comparatively easy on safeguarding.
In general, in order to ensure the fail safe and stability of file, distributed file system can be by file copy service (File Replication Service when a original document of storage, FRS) function produces a at least backup file (Replica).Yet in distributed file system, the memory location of this backup file is quite important, not only need to be stored in the server different from this original document position, also need guarantee it is no matter this server 4 or when respectively one of them of this bottom-layer network switch 3 damaged respectively, not have the situation that this original document and this backup file can't be read simultaneously and occur.
The present invention proposes a kind of perfect solution and avoids above-mentioned situation to occur, be mainly first to obtain the topological structure that this distributed file system adopts, then extrapolate respectively this server 4 and the connection state of this bottom-layer network switch 3 respectively and respectively this server 4 IP address of using is why by this topological structure.By this, when selecting the memory location of this backup file, can be with reference to respectively this server 4 and the respectively connection state of this bottom-layer network switch 3, to avoid the server of this original document of storage, the situation that is connected to same this bottom-layer network switch 3 with the server of storing this backup file produces.
For example this original document is stored in this server 411, this backup file is stored in this server 413, and this server 411 and 413 all is connected to this first network switch 31, in in the case, if this first network switch 31 damages, the user will be simultaneously can't this server 411 and 413 of access, that is, this original document and this backup file can't be read simultaneously.Be with, distributed file system of the present invention is when selecting the memory location of this backup file, can by backup location decision-making technique of the present invention, avoid this backup file is stored to beneath arbitrary this server 411,412,413 of this first network switch 31.
See also Fig. 5, be the flow chart of a preferred embodiment of the present invention.At first, by a program implementation, search the topological structure (step S50) that this distributed file system adopts, use, learn under this distributed file system respectively this bottom-layer network switch 3 and the respectively annexation between this server 4.It is worth mentioning that, this program mainly can be Cisco's exploration agreement (Cisco Discovery Protocol is called for short CDP) program that Cisco (Cisco) proposes, but is not limited.
Then, after the topological structure of learning this distributed file system, can be with reference to this topological structure, obtain the IP address (step S52) that respectively this connectivity port on this bottom-layer network switch 3 respectively is assigned with.At last, after this step S52, will be respectively this IP address correspond to respectively and interconnected respectively this server 4 (step S54) in this connectivity port respectively.
After step S54, system can learn this server 4 respectively is connected to respectively which connectivity port on which this bottom-layer network switch 3, and can learn that respectively this server 4 uses respectively which IP address.Then, namely produce comparison list according to this server 4 respectively and the corresponding states of this IP address respectively, and this table of comparisons writes in this distributed file system, with the configuration file (step S56) as this distributed file system through after configuring (Config).Thus, even respectively this server 4 is through changing, the IP address that this distributed file system will learn forever that respectively this server 4 after replacing uses why.Be with, this configuration file write complete after, when this distributed file system is that original document produces a at least backup file and will store the time, can be according to the IP address of this server 4 respectively, or direct this configuration file of frame of reference inside, for this backup file determines a best, safest memory location.
It is worth mentioning that, above-mentioned this configuration file is mainly understood for this distributed file system, the content that the manager of this distributed file system can't this configuration file of direct viewing.And, even manually opened this configuration file of manager also is difficult to direct content by this configuration file, learn respectively this server 4 and the respectively annexation between this bottom-layer network switch 3.
Be with, after step S56, system optionally produces a corresponding list, and should the correspondence list in upper show (the step S58) of display unit (indicating in figure) of one of them this server 4.Wherein, this correspondence list essential record respectively this server 4 IP address of using through the content after word or digitlization, use making IP address that the manager can directly learn this server 4 respectively by naked eyes why, so directly judgement respectively this server 4 be connected to respectively which this bottom-layer network switch 3.Yet this step S58 decides by the manager of this distributed file system is required, must not carry out.
For example shown in Figure 7, be the IP address assignment schematic diagram of a preferred embodiment of the present invention.The IP address that the user can learn that this bottom-layer network switch 3 respectively is assigned with by the topological structure of this distributed file system is why, the IP address that is assigned with, each connectivity port on this first network switch 31 for example, and wherein third yard is all " 1 "; The IP address that each connectivity port on this second network switch 32 is assigned with, wherein third yard is all " 2 "; And by that analogy, the IP address that each connectivity port on this N network switch 33 is assigned with, wherein third yard is all " N ".Thus, if should the correspondence list take IP address that word or numeral show this server 411 as the IP address of " X.X.1.1 ", this server 412 as the IP address of " X.X.1.2 ", this server 413 as " X.X.1.M ", the user can judge easily from this correspondence list, this three server 411,412,413 real connections are to same the network switch, i.e. this first network switch 31.
Again for example, if should the correspondence list show that the IP address of this server 421 is " X.X.2.1 ", and the IP address of this server 432 is " X.X.N.2 ", so represent that namely this server 421 and 432 is connected to this different bottom-layer network switches 3, if therefore this initial data is stored in this server 421, this server 432 can be selected to be used for storing this Backup Data by system or manager.Yet above-described IP address configuration is only a preferred embodiment of the present invention, can not be limited.
Moreover, system also can be by this configuration file configuration one cover backup rules, for example, when the IP address is this server 411 this initial data of storage of " X.X.1.1 ", being about to this backup data store to IP address is " X.X.1+1.1 ", and namely the IP address is in this server 421 of " X.X.2.1 "; When the IP address was this server 412 this initial data of storage of " X.X.1.2 ", being about to this backup data store to IP address was " X.X.1+1.2 ", and namely the IP address is in this server 422 of " X.X.2.2 "; And when the IP address for the server (indicating in figure) of " X.X.N-1.M " when storing this initial data, being about to this backup data store to IP address is in this server 433 of " X.X.N.M ".Yet above-mentioned is only of the present invention one better backup rules, but not as limit.
Continuous see also Fig. 6, be the flow chart of another preferred embodiment of the present invention.When the user wants to write a file, this distributed file system is considered as an original document with this document, and this original document is stored in one of them this server 4 (step S60), then, for this original document produces a at least this backup file (step S62).
After step S62, the IP address that system uses according to this server 4 respectively, or directly with reference to this configuration file, this backup file is stored in another this server 4 different from the position of this original document (step S64).And, system is according to the IP address of this server 4 respectively or according to this configuration file automatic screening, or the manager transfers according to this correspondence list manual school, guaranteeing to store this server 4 of this original document, and be connected to this different bottom-layer network switches 3 (step S66) in order to this server 4 of storing this backup file.
Thus, this server 4 of one of them in this distributed file system damages, and when causing this original document to be lost, the user still can read this backup file that is present in another this server 4; And if one of them this bottom-layer network switch 3 damages, when causing these bottom-layer network switch 3 beneath a plurality of these servers 4 to be accessed, will not be connected to same this bottom-layer network switch 3 with the server of this backup file of storage because store the server of this original document, therefore never have the facts generation that this original document and this backup file can't be read simultaneously.
The above is only preferred embodiments of the present invention, and is non-so namely limit to the scope of the claims of the present invention, therefore the equivalent variations of such as using content of the present invention to do all in like manner all is contained in scope of the present invention, closes and gives Chen Ming.