Embodiment
For making the object of the invention, technical scheme and advantage clearer, will combine accompanying drawing and specific embodiment that the present invention is done to describe in detail further below.
Core concept of the present invention is: based on the meta data server cluster metadata is managed, when storing metadata, utilize hash function to confirm the address of storing metadata file, guarantee the load balancing of cluster; When carrying out metadata store, simultaneously the corresponding wave file of storage in other servers is also made amendment to its copy when metadata is revised, when a server breaks down, carries out the Coordination Treatment of fault through the server that is used to coordinate preset.So, can guarantee the load balancing of consistance, integrality and the cluster server of metadata under the concurrent visit.
Fig. 1 is the schematic flow sheet of the embodiment of the invention one, and is as shown in Figure 1, and this embodiment one mainly may further comprise the steps:
Step 101, distributed file system are set up M collection of metadata in advance, and according to the first preset hash function, the mode of employing Hash hash is closed said first manifold and disperseed to be arranged in each meta data server in the metadata service cluster.
Said metadata (metadata); Be meant the metadata information of file or catalogue; Comprise the information such as name, size, modification time, access limit, the owner of file, for concrete file or catalogue, (inode) preserves these metadata informations by index node.Here; Said meta data server is preserved a global set mapping table separately; Said global set mapping table is used for the mapping relations of the metadata that each collection of metadata that the minute book server is provided with comprises with it, and all are not arranged on each collection of metadata and the mapping relations of meta data server under it in the book server.Particularly; The global set mapping table will be preserved the mapping relations of the global index number of file to affiliated collection of metadata; Particularly; As Hash table,, search the positional information that this global set mapping table can obtain collection of metadata under this file metadata with this global set mapping table with the high H position of file global index number parameter as hash function.
Said collection of metadata (set); By the aggregation units that the metadata of many files is formed, will preserve state and the metadata mapping table of this set of set in the set, this metadata mapping table is used for writing down the global index number of each file of collection of metadata and the corresponding relation of its index node position; Particularly; With this metadata mapping table is Hash table, with the low L position of the file global index number parameter as hash function, searches this metadata mapping table; Can obtain the position of index node at the metadata place of this document, on the position of this index node with the metadata of in store file.
In this step,, can realize effectively that metadata set is combined in the equiblibrium mass distribution on each meta data server, help realizing the load balancing of cluster under the concurrent visit through the mode of Hash hash.
Step 102, when file is preserved in the meta data server S_1 request of client in the metadata service cluster; Said meta data server S_1 is global index of said file allocation number; And according to this global index number; Adopt the mode of Hash hash; Confirm the affiliated collection of metadata W of metadata of said file; And this metadata leaves the index node position D among the said collection of metadata W in, and said meta data server S_1 confirms the meta data server S_i at said collection of metadata W place according to the global set mapping table of self preserving, and triggers said meta data server S_i the metadata of said file is kept among the said meta data server S_i.
Here, said global index number is the unique identification of the metadata of each file in the distributed file system, is used for locating the set at this document metadata place and in the concrete preservation position of set.
Preferably, the collection of metadata W under the said metadata of confirming said file, and this metadata leave among the said collection of metadata W index node position D specifically can for:
Said global index number is divided into high H position and low L position two parts, wherein, L+H=Z, said Z is the number of bits of preset said global index number;
For the high H position of said global index number, carry out hash calculation through the second preset hash function, utilize resulting cryptographic hash to search said global set mapping table, obtain the positional information of said collection of metadata W; According to the positional information of said collection of metadata W, find said collection of metadata W;
For the low L position of said global index number, carry out hash calculation through the 3rd preset hash function, with resultant cryptographic hash as said index node position D.
Here, the setting of said H and L can be provided with by those skilled in the art according to actual needs, preferably, can be: H=16, L=16.
Preferably, with the metadata of said file be kept among the said meta data server S_i specifically can for:
Meta data server S_i is the allocation index node on the D of index node position, and the metadata of said file is kept in the index node of the said index node position D in the book server;
The mapping relations of the global index of meta data server S_i said metadata of record in the said global set mapping table that self preserves number and the position of said collection of metadata W;
The mapping relations of the global index of meta data server S_i said metadata of record in the metadata mapping table of this collection of metadata W that self preserves number and the index node of said metadata.
Further, can also realize the backup of data,, particularly, can further comprise in the said step 101 with safety and the integrality of guaranteeing data through set up the mode of copy for each collection of metadata:
Said distributed file system is that a said M collection of metadata is set up the copy set respectively; And according to the principle of load balancing; The copy set of a said M collection of metadata is arranged in each meta data server in the said metadata service cluster; And it is inequality to guarantee that said collection of metadata and its copy are gathered the place meta data server; Preserve the former copy mapping table of a set in said each meta data server respectively; The former copy mapping table of said set is used for preserving each collection of metadata that is arranged on book server and belongs to the mapping relations of meta data server with its copy set, and each copy that is arranged in the book server is gathered the mapping relations that each collection of metadata corresponding with it belongs to meta data server originally.
After setting up that metadata set is fashionable and setting up copy set for it, operations such as the follow-up storage of carrying out file, visit the time, also need carry out synchronous operation, to guarantee the consistance of data to the copy set.Particularly, when carrying out the preservation of file in the step 102, also need carry out following steps:
Said meta data server S_i is according to the former copy mapping table of self preserving of set; Confirm the meta data server W_copy at the copy set place of said collection of metadata W, trigger said meta data server W_copy preserves said file in the copy set of said collection of metadata W metadata.
Here; The concrete grammar of in the copy set, preserving metadata is identical with aforementioned metadata store method to its former set; The meta data server of promptly depositing copy set also need be safeguarded the mapping table of mapping table, a copy that a copy set and its institute comprise the global index number of metadata index node address and file global index in gathering number; When carrying out the preservation of copy set, then need on these mapping tables, write down corresponding information.
Further, client can conduct interviews to file after being kept at file in the distributed file system as required; At this moment; Also need carry out corresponding process operations to the metadata of this document, particularly, following method capable of using realizes the visit to metadata:
When client need ask to visit the file F of appointment, described request is sent to the arbitrary meta data server A in the said metadata service cluster, carry the ino of global index of said file F and the type of request visit in the described request;
Said meta data server A is according to the said ino of global index; Confirm the affiliated collection of metadata J of metadata of said file F; According to the said global set mapping table of self preserving; Confirm the meta data server S_J at said collection of metadata J place, if this meta data server S_J is a book server, the metadata mapping table of the said collection of metadata J of the type of then visiting, the said ino of global index and self preservation according to described request; Visit the metadata of said file F and carry out corresponding process operations; And, confirm the meta data server at the copy set place of said collection of metadata J according to the former copy mapping table of self preserving of said set, the copy set that said processing operation is synchronized to the said collection of metadata J on this meta data server closes; Otherwise; The meta data server S_J at said collection of metadata J place notifies to said client; Trigger said client and send described request to said meta data server S_J; Said meta data server S_J is according to the metadata mapping table of the said collection of metadata J of the type of described request visit, the said ino of global index and self preservation; Visit the metadata of said file F and carry out corresponding process operations; And, confirm the meta data server at the copy set place of said collection of metadata J according to the former copy mapping table of self preserving of said set, the copy set that said processing operation is synchronized to the said collection of metadata J on this meta data server closes.
Here,, confirm the concrete grammar of the collection of metadata J under the metadata of said file F according to the said ino of global index, ditto said.
According to the metadata mapping table of the type of described request visit, the said ino of global index and the said collection of metadata J that self preserves, the metadata of visiting said file F specifically can for:
Metadata mapping table with collection of metadata J is a Hash table; Low L position with the said ino of global index is the parameter of said the 3rd hash function; Carry out hash calculation, utilize resulting cryptographic hash to search said metadata mapping table, obtain the position of the corresponding index node of the metadata of said file F; Can find the metadata of said file F based on this position, and can operate accordingly according to the type of described request visit.Concrete access type and the same existing system of corresponding process operations repeat no more at this.
Preferably; Can preset a coordination server in the metadata service cluster of said distributed file system; This coordination server can be monitored each meta data server in the said metadata service cluster, so that know out of order meta data server immediately through sending heartbeat message termly; And then can in time carry out fault handling, guarantee the integrality that distributed file system is preserved metadata.Concrete grammar is following:
When said coordination server monitors arbitrary meta data server B when breaking down, said failure message is notified to other each meta data servers except that said meta data server B in the said metadata service cluster;
Receive each meta data server of said notice; According to said notice and the former copy mapping table of self preserving of said set; Judge the copy set of self whether having preserved the collection of metadata on the said meta data server B; If, from other meta data servers that other do not break down, confirm to be used to preserve the new meta data server of said copy set then according to the principle of load balance; Trigger said new meta data server said copy set is preserved, and said copy set cooperation is arranged in the book server for its corresponding set originally.
Preferably, a said M collection of metadata with and copy set close also and can set up by above-mentioned coordination server.
Preferably, can be through a meta data server that adopts electoral machinery to elect in the meta data server in the metadata service cluster, as said coordination server.Said coordination server is a service routine, and itself does not preserve metadata information, and it accepts the meta data server registration, and passes through the status information of the dynamic generator data server of the log-on message cluster of meta data server.More excellent ground is seen from the angle of disposing, this coordination server can with the shared same hardware server of any meta data server.
From technique scheme, can find out; Adopt the present invention can guarantee the load balancing of cluster under the consistance of metadata under the concurrent visit, the concurrent visit, when single metadata node breaks down; Information synchronization problem when metadata integrity and metadata access; Thereby can satisfy the demand of the concurrent visit of a large amount of clients, realize based on effective management of server cluster to metadata in the distributed file system.
In sum, more than being merely preferred embodiment of the present invention, is not to be used to limit protection scope of the present invention.All within spirit of the present invention and principle, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.