Summary of the invention
The object of the present invention is to provide a kind of storage of meta data server and resource of transmission data of saving, can effectively guarantee again global profile mark generating method, generating apparatus and the corresponding distributed file system of the mark uniqueness of each file; The global profile mark capacity that has solved existing distributed file system causes too greatly storage and transmits the excessive technical matters of this global profile mark cost.
For addressing the above problem, technical scheme provided by the invention is as follows:
The present invention relates to a kind of global profile mark generating method of distributed file system, wherein, described distributed file system comprises at least one pivot data server and multiple meta data server, described meta data server is for storage and reading and writing of files, described pivot data server is for generating corresponding global profile mark according to the metamessage of described file, described global profile mark generating method comprises step:
While receiving document creation request, generate the server number field of described global profile mark according to the numbering that is created file place meta data server; And
The establishment numbering being identified in described pivot data server according to described global profile generates the document order field that described global profile identifies;
Different described global profiles is identified at the establishment numbering difference in described pivot data server.
In the global profile mark generating method of distributed file system of the present invention, described document order field is according to the actual creation time strictly increasing of described global profile mark.
In the global profile mark generating method of distributed file system of the present invention, be describedly identified at according to described global profile the step that establishment in described pivot data server numbering generates the document order field of described global profile mark and comprise:
Be identified at creation-time in described pivot data server and generate the creation-time son field of described document order field according to described global profile; And
Generate the establishment order son field of described document order field according to the establishment numbering of the identical described global profile mark of described creation-time son field.
In the global profile mark generating method of distributed file system of the present invention, the establishment order son field that the quantity A1 that creates the global profile mark of file as current time is less than or equal to current time can represent the quantity A2 of global profile mark, represents that according to use in order creation-time son field and the corresponding establishment order son field of current time of the establishment of described global profile mark the described global profile of file that current time creates identifies;
The quantity A1 that creates the global profile mark of file as current time is greater than the quantity A2 that global profile that the establishment order son field of current time can represent identifies, and the maximum quantity of the global profile that the establishment of identical creation-time son field order son field can represent mark is A3, the creation-time son field using in order the creation-time son field of current time and corresponding establishment order son field and lower n second according to the establishment of described global profile mark and establishment accordingly sequentially son field represent that the described global profile of file that current time creates identifies; What wherein n was [(A1-A2)/A3] rounds up.
In the global profile mark generating method of distributed file system of the present invention, the global profile mark generating method of described distributed file system also comprises step:
In described global profile mark, growth data field is set, described growth data field is for carrying out the data expansion of described global profile mark;
Described global profile mark is included as described growth data field, described server number field, described creation-time son field and described establishment order son field successively.
In the global profile mark generating method of distributed file system of the present invention, the length range of described growth data field is 8-16 bit, the length range of described server number field is 8-16 bit, the length of described creation-time son field is 32-64 bit, and the length of described establishment order son field is 16-32 bit.
In the global profile mark generating method of distributed file system of the present invention, the length of described growth data field is 8 bits, the length of described server number field is 8 bits, the length of described creation-time son field is 32 bits, and the length of described establishment order son field is 16 bits.
The invention still further relates to a kind of global profile mark generating apparatus of distributed file system, wherein said distributed file system comprises at least one pivot data server and multiple meta data server, described meta data server is for storage and reading and writing of files, described pivot data server is for generating corresponding global profile mark according to the metamessage of described file, described global profile mark generating apparatus comprises:
Server number field module, for being used server number field to describe the meta data server that identifies corresponding file place with described global profile; And
Document order field module, for being used global profile described in document order field description to be identified at the establishment numbering of described pivot data server;
Different described global profiles is identified at the establishment numbering difference in described pivot data server.
In the global profile mark generating apparatus of distributed file system of the present invention, the described document order field in described document order field module is according to the actual creation time strictly increasing of described global profile mark.
In the global profile mark generating apparatus of distributed file system of the present invention, described document order field module comprises:
Creation-time son field unit, is identified at the creation-time of described pivot data server for using creation-time son field to describe described global profile; And
Establishment order son field unit, for using establishment order son field to describe the establishment numbering of the described global profile mark that described creation-time son field is identical.
In the global profile mark generating apparatus of distributed file system of the present invention, described global profile mark generating apparatus also comprises:
Growth data field module, for being used growth data field to carry out the data expansion of described global profile mark.
In the global profile mark generating apparatus of distributed file system of the present invention, described global profile mark comprises described growth data field, described server number field, described creation-time son field and described establishment order son field successively.
In the global profile mark generating apparatus of distributed file system of the present invention, the length range of described growth data field is 8-16 bit, the length range of described server number field is 8-16 bit, the length of described creation-time son field is 32-64 bit, and the length of described establishment order son field is 16-32 bit.
In the global profile mark generating apparatus of distributed file system of the present invention, the length of described growth data field is 8 bits, the length of described server number field is 8 bits, the length of described creation-time son field is 32 bits, and the length of described establishment order son field is 16 bits.
The invention still further relates to a kind of distributed file system, it comprises at least one pivot data server and multiple meta data server, described meta data server is for storage and reading and writing of files, described pivot data server, according to the metamessage of described file, uses above-mentioned global profile mark generating apparatus to generate corresponding global profile mark.
Compared to prior art, global profile mark generating method of the present invention, generating apparatus and corresponding distributed file system can be saved the storage of meta data server and the resource of transmission data, can effectively guarantee again the mark uniqueness of each file; The global profile mark capacity that has solved existing distributed file system causes too greatly storage and transmits the excessive technical matters of this global profile mark cost.
For foregoing of the present invention can be become apparent, preferred embodiment cited below particularly, and coordinate appended graphicly, be described in detail below:
Embodiment
The explanation of following embodiment is graphic with reference to what add, can be in order to the specific embodiment of implementing in order to illustrate the present invention.The direction term that the present invention mentions, for example " on ", D score, 'fornt', 'back', " left side ", " right side ", " interior ", " outward ", " side " etc., be only the direction with reference to annexed drawings.Therefore, the direction term of use is in order to illustrate and to understand the present invention, but not in order to limit the present invention.
In the drawings, the unit of structural similarity is to represent with same numeral.
The present invention relates to a kind of global profile mark generating method of distributed file system, as shown in Figure 1, the process flow diagram of the preferred embodiment of the global profile mark generating method that Fig. 1 is distributed file system of the present invention.This distributed file system comprises at least one pivot data server and multiple meta data server, meta data server is for storage and reading and writing of files, pivot data server is for generating corresponding global profile mark according to the metamessage of file, the global profile mark generating method of this distributed file system comprises:
Step 101, while receiving document creation request, generates the server number field of global profile mark according to the numbering that is created file place meta data server;
Step 102, is identified at the creation-time son field of the creation-time spanned file sequence field in pivot data server according to global profile;
Step 103, according to the establishment order son field of the establishment numbering spanned file sequence field of the identical global profile mark of creation-time son field;
Here different global profiles is identified at the establishment numbering difference in pivot data server.
Below by the detailed process of each step of the global profile mark generating method of the distributed file system of the detailed explanation embodiment of the present invention.
In step 101, while receiving document creation request, generate the server number field of global profile mark according to the numbering that is created file place meta data server, thereby this server number field this can be described is created the numbering of the meta data server at file place.
In step 102, be identified at the creation-time son field of the creation-time spanned file sequence field in pivot data server according to global profile.The creation-time son field generating according to the creation-time of file can be distinguished different establishment files preferably, can also identify by global profile the attribute of the creation-time of reflection file simultaneously.Here in order to guarantee the uniqueness of each global profile mark that is created file, the creation-time son field of document order field is according to the actual creation time strictly increasing of global profile mark.The strictly increasing here refers to that the creation-time son field after creation-time is necessarily greater than the creation-time son field (creation-time son field that creation-time adjacent can not equate) of creation-time before.
In step 103, according to the establishment order son field of the establishment numbering spanned file sequence field of the identical global profile mark of creation-time son field.Within the time of same second, multiple meta data servers may create multiple files, at this moment in order to meet, the file (being that the global profile that creation-time son field is identical identifies represented file) of establishment in same second is distinguished, can generate establishment order son field according to the establishment numbering of file, this establishment numbering preferably generates according to the establishment order of file, be that the establishment order son field of identical creation-time son field is according to the actual creation time strictly increasing of global profile mark, to guarantee the uniqueness of each file identification.
Further, the global profile mark generating method of the distributed file system of the embodiment of the present invention also comprises step: in global profile mark, growth data field is set.Growth data field, server number field, creation-time son field and establishment order son field are arranged in order and have formed global profile mark.Wherein growth data field is for carrying out the data expansion of global profile mark, this growth data field can be numbered (version of such as file etc.) to certain attribute of existing file, also can reserve the server of expansion is in the future numbered, even can reserve certain extended attribute of future file is numbered, growth data field also can be set certainly here.
Further, when the global profile mark of distributed file system generates, in order to guarantee the uniqueness of mark of each file, document order field is according to the actual creation time strictly increasing of global profile mark, and the document order field of the global profile in evening actual creation time mark is necessarily greater than the document order field of actual creation time global profile mark early.
Further, the length range of the growth data field in this global profile mark is 8-16 bit, and the length range of server number field is 8-16 bit, and the length of creation-time son field is 32-64 bit, and the length of establishment order son field is 16-32 bit.
For example the length of the growth data field in global profile mark is preferably 8 bits (i.e. 1 byte), the length of server code field is preferably 8 bits, the length of creation-time son field is preferably 32 bits, and the length of establishment order son field is preferably 16 bits.Server code field can support 256 meta data servers to be numbered like this, and creation-time son field, can be to 2 take second as least count unit
32file in second (more than 130 year) is numbered, and establishment order son field can be to 2 in 1 second
16(65536) individual file carries out different numberings.The total length of global profile mark is 64 bits like this, and in realizing preferably uniqueness mark, it is also less that global profile identifies the storage space taking.Certainly in global profile mark, the concrete length of each field can be adjusted according to user's concrete needs.
While using the global profile mark generating method generation global profile mark of distributed file system of the embodiment of the present invention, the quantity A1 that creates the global profile mark of file as current time is less than or equal to the quantity A2 of the global profile mark that the establishment order son field of current time (current second) can represent, according to the establishment of global profile mark use in order the creation-time son field of current time and establishment accordingly sequentially son field represent that the global profile of file that current time creates identifies.
The quantity A1 that creates the global profile mark of file as current time is greater than the quantity A2 that global profile that the establishment order son field of current time can represent identifies, and the maximum quantity of the global profile that the establishment of identical creation-time son field order son field can represent mark is A3, the creation-time son field using in order the creation-time son field of current time and corresponding establishment order son field and lower n second according to the establishment of global profile mark and establishment accordingly sequentially son field represent that the global profile of file that current time creates identifies; What wherein n was [(A1-A2)/A3] rounds up.
Generation below by the global profile mark of describing the file in three second time illustrates creation-time son field and the sequentially generation (because server number field directly generates according to the preset numbers of meta data server, no longer elaborating) of son field of corresponding establishment here.
First second, as A2=A3=2
16=65536, A1=70000, at this moment because A1 is greater than A2, the creation-time son field of current time (current second) and corresponding establishment order son field can not represent the global profile mark of all files of current time generation, therefore represent that by creation-time son field and the corresponding establishment order son field of next second the global profile of A1-A2=4464 file identifies.The document order field of the global profile of these 70000 files mark is according to the actual creation time strictly increasing of global profile mark simultaneously, wherein the global profile of front 65536 files is identified at the actual creation time strictly increasing that the establishment order son field under same creation-time son field identifies according to global profile, and the global profile of rear 4564 files is identified at the actual creation time strictly increasing that the establishment order son field under same creation-time son field identifies according to global profile.
Second second, as A3=65536, A2=65536-4464=61072, A1=70000, at this moment A1 is still greater than A2, the creation-time son field of current time and corresponding establishment order son field can not represent the global profile mark of all files of current time generation, therefore represent that by creation-time son field and the corresponding establishment order son field of next second the global profile of A1-A2=8928 file identifies.The document order field of the global profile of these 70000 files mark is according to the actual creation time strictly increasing of global profile mark simultaneously, wherein the global profile of front 61072 files is identified at the actual creation time strictly increasing that the establishment order son field under same creation-time son field identifies according to global profile, and the global profile of rear 8928 files is identified at the actual creation time strictly increasing that the establishment order son field under same creation-time son field identifies according to global profile.
The 3rd second, as A3=65536, A2=65536-8928=56608, A1=50000, at this moment A1 is less than A2, the creation-time son field of useful current time and corresponding establishment sequentially son field represent that the global profile of the file of current time establishment identifies, and the global profile of above-mentioned 8928 files and these 50000 files is identified at the actual creation time strictly increasing that the establishment order son field under same creation-time son field identifies according to global profile.
Further, while carrying out active and standby switching as pivot data server, pivot data server for subsequent use may with the Time Inconsistency of former pivot data server, at this moment the uniqueness in order to guarantee that the global profile of each file identifies, the document order field after switching is still according to the actual creation time strictly increasing of global profile mark.
As the time of pivot data server for subsequent use is later than time of former pivot data server, directly adopt the time of pivot data server for subsequent use to carry out the generation of creation-time son field; If the time of pivot data server for subsequent use is early than the time of former pivot data server, generate creation-time son field according to the embodiment of the generation of above-mentioned creation-time son field and corresponding establishment order son field, adopt the creation-time son field of follow-up time to represent that the global profile of the file of current time establishment identifies, to guarantee that document order field is still according to the actual creation time strictly increasing of global profile mark.
When the global profile mark of distributed file system is used, the global profile that user obtains this file by the path of file from pivot data server identifies; Then the server number field from the global profile mark of file is obtained the numbering (being the IP of meta data server) of the meta data server at file place; User is connected to corresponding meta data server according to the numbering of this meta data server; End user carries out read-write operation according to the document order field in global profile mark to corresponding file.
Simple in structure due to this global profile mark, distributed file system is used this global profile mark, can effectively reduce the volume of transmitted data between user and meta data server, guarantees the uniqueness of the mark of each file simultaneously.
The invention still further relates to a kind of global profile mark generating apparatus of distributed file system, please refer to Fig. 2 and Fig. 3, Fig. 2 is the schematic diagram of the global profile mark of the preferred embodiment generation of the global profile mark generating apparatus of distributed file system of the present invention, the structural representation of the preferred embodiment that Fig. 3 is distributed file system of the present invention.This distributed file system comprises at least one pivot data server 11 and multiple meta data server 12, this meta data server 12 is for storage and reading and writing of files, this pivot data server 11, for according to the metamessage of file, uses global profile mark generating apparatus 13 to generate corresponding global profile mark.Pivot data server 11 is connected with each meta data server 12, and user is connected with pivot data server 11 and each meta data server 12 simultaneously.
The global profile mark generating apparatus 13 of the embodiment of the present invention comprises server number field module 131, document order field module 132 and growth data field module 133.Server number field module 131 is for generation server number field, and document order field module 132 is for spanned file sequence field, and growth data field module 133 is for generating growth data field.This file sequence field module 132 comprises creation-time son field unit for generating creation-time son field and for generating the establishment order son field unit of establishment order son field.
The global profile that describes this preferred embodiment below in detail identifies the global profile mark that generating apparatus 13 generates.This global profile mark comprises server number field and document order field, and this server number field is the numbering of respective meta-data server 12 for describing the meta data server 12(that identifies corresponding file place with global profile); This file sequence field is identified at the establishment numbering of pivot data server 11 for describing global profile, it is all not identical that each global profile is identified at document order field in pivot data server 11.
As shown in Figure 2, global profile mark also comprises growth data field, document order field comprises creation-time son field and establishment order son field, and growth data field, server number field, creation-time son field and establishment order son field are arranged in order and have formed global profile mark.Wherein growth data field is for carrying out the data expansion of global profile mark, this growth data field can be numbered (version of such as file etc.) to certain attribute of existing file, also can reserve the server of expansion is in the future numbered, even can reserve certain extended attribute of future file is numbered, growth data field also can be set certainly here.
Creation-time son field is identified at the creation-time of pivot data server 11 for describing global profile; Establishment order son field is for describing the establishment numbering of the global profile mark that creation-time son field is identical.Because the creation-time of file can be distinguished different establishment files preferably, can also identify by global profile the attribute of the creation-time of reflection file simultaneously, therefore by creation-time son field, the file in certain meta data server 12 is carried out to uniqueness mark and can simplify greatly the field length that global profile identifies, thereby the resource of global profile mark is stored and transmitted to saving pivot data server 11.Establishment order son field is further distinguished the file (being that the global profile that creation-time son field is identical identifies represented file) of establishment in same second, with the uniqueness that guarantees that the global profile of each file identifies.Certainly the document order field here also can adopt other mode to represent, all belongs to protection scope of the present invention as long as can realize the document order field that the file in each meta data server 12 is carried out to uniqueness mark (can reflect the establishment numbering of file in meta data server 12).
Further, in order to guarantee the uniqueness of mark of each file, document order field is according to the actual creation time strictly increasing of global profile mark, and the document order field of the global profile in evening actual creation time mark is necessarily greater than the document order field of actual creation time global profile mark early.
Further, the length range of the growth data field in this global profile mark is 8-16 bit, and the length range of server number field is 8-16 bit, and the length of creation-time son field is 32-64 bit, and the length of establishment order son field is 16-32 bit.
With reference to Fig. 2, for example the length of the growth data field in this global profile mark is preferably 8 bits (i.e. 1 byte), the length of server code field is preferably 8 bits, and the length of creation-time son field is preferably 32 bits, and the length of establishment order son field is preferably 16 bits.Server code field can support 256 meta data servers 12 to be numbered like this, and creation-time son field, can be to 2 take second as least count unit
32file in second (more than 130 year) is numbered, and establishment order son field can be to 2 in 1 second
16(65536) individual file carries out different numberings.The total length of global profile mark is 64 bits like this, and in realizing preferably uniqueness mark, it is also less that global profile identifies the storage space taking.Certainly in global profile mark, the concrete length of each field can be adjusted according to user's concrete needs.
The invention still further relates to a kind of distributed file system, this distributed file system comprises at least one pivot data server and multiple meta data server, this meta data server is for storage and reading and writing of files, pivot data server is used for according to the metamessage of file, use above-mentioned global profile mark generating apparatus to generate corresponding global profile mark, this distributed file system is used above-mentioned global profile mark to carry out establishment and the read-write of file on meta data server simultaneously, global profile mark generating apparatus and corresponding using method that this distributed file system is used refer to the global profile mark generating method of above-mentioned distributed file system and the specific embodiment of generating apparatus.
Global profile mark generating method of the present invention, generating apparatus and corresponding distributed file system can be saved the storage of pivot data server and the resource of transmission data, can effectively guarantee again the mark uniqueness of each file; The global profile mark capacity that has solved existing distributed file system causes too greatly storage and transmits the excessive technical matters of this global profile mark cost.
In sum; although the present invention discloses as above with preferred embodiment; but above preferred embodiment is not in order to limit the present invention; those of ordinary skill in the art; without departing from the spirit and scope of the present invention; all can do various changes and retouching, the scope that therefore protection scope of the present invention defines with claim is as the criterion.