CN106776891A - A kind of method and apparatus of file storage - Google Patents

A kind of method and apparatus of file storage Download PDF

Info

Publication number
CN106776891A
CN106776891A CN201611078444.2A CN201611078444A CN106776891A CN 106776891 A CN106776891 A CN 106776891A CN 201611078444 A CN201611078444 A CN 201611078444A CN 106776891 A CN106776891 A CN 106776891A
Authority
CN
China
Prior art keywords
disk
file
identification information
target disk
stored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201611078444.2A
Other languages
Chinese (zh)
Inventor
刘凯
谢恩鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Inspur Business System Co Ltd
Original Assignee
Shandong Inspur Business System Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Inspur Business System Co Ltd filed Critical Shandong Inspur Business System Co Ltd
Priority to CN201611078444.2A priority Critical patent/CN106776891A/en
Publication of CN106776891A publication Critical patent/CN106776891A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices

Abstract

The invention discloses a kind of method and apparatus of file storage.Wherein, the method includes:Obtain the file identification information of file to be stored;Target disk is determined from the disk of storage server by default storage algorithm according to file identification information;File to be stored is stored to target disk.The present invention solves the relatively low technical problem of prior art storage efficiency.

Description

A kind of method and apparatus of file storage
Technical field
The present invention relates to field of storage, in particular to a kind of method and apparatus of file storage.
Background technology
With storage file increase and visit capacity increase, single disk can not meet performance requirement with warp, and use The mode of raid arrays cannot fundamentally control file access strategy again, during especially for large amount of small documents, 1 file quilt Being distributed to can bring the substantial amounts of time waste for addressing and causing on the contrary when on multiple disks.And use and be randomly assigned and deposit index Enter the mode of database storage, be then likely to bring Single Point of Faliure or performance bottleneck problem, to sum up, existing storage efficiency It is relatively low.
For above-mentioned problem, effective solution is not yet proposed at present.
The content of the invention
A kind of method and apparatus of file storage are the embodiment of the invention provides, at least to solve prior art storage efficiency Relatively low technical problem.
A kind of one side according to embodiments of the present invention, there is provided method of file storage, including:Obtain text to be stored The file identification information of part;Determined from the disk of storage server by default storage algorithm according to the file identification information Target disk;The file to be stored is stored to the target disk.
Alternatively, the file identification information includes filename and file extension, described to be believed according to the file identification Breath determines that target disk includes by default storage algorithm:The target is obtained according to the filename and the file extension The identification information of disk;Determine that disk corresponding to the identification information is target disk.
Alternatively, the identification information bag that the target disk is obtained according to the filename and the file extension Include:Obtain the last figure of the first digital and described file extension of the filename;In determining the storage server Disk the first quantity;Calculate the first place it is digital with the last figure and, and acquire and with the disk The first quantity ratio the first remainder;Determine the identification information that first remainder is the target disk.
Alternatively, the file to be stored is stored to the target disk described, methods described also includes:It is determined that Whether the target disk damages;Described store to the target disk file to be stored includes:In the target magnetic When disk is not damaged, the file to be stored is stored to the target disk.
Alternatively, methods described also includes:When the target disk is damaged, do not damaged in the acquisition storage server Second quantity of disk;Second remainder of the ratio of the first quantity acquire and with the disk;Determine described second Remainder is the identification information of the target disk.
Another aspect according to embodiments of the present invention, additionally provides a kind of device of file storage, including:First obtains mould Block, the file identification information for obtaining file to be stored;First determining module, for being passed through according to the file identification information Default storage algorithm determines target disk from the disk of storage server;Memory module, for the file to be stored to be deposited Store up to the target disk.
Alternatively, the file identification information includes filename and file extension, first determining module, for root The identification information of the target disk is obtained according to the filename and the file extension, and determines the identification information correspondence Disk be target disk.
Alternatively, first determining module, the first digital and described file extent for obtaining the filename The last figure of name;Determine the first quantity of the disk in the storage server;Calculate the first place digital with the last position The sum of numeral, and acquire and the first quantity with the disk ratio the first remainder;Determine first remainder It is the identification information of the target disk.
Alternatively, described device also includes:Described device also includes:Judge module, for determining that the target disk is No damage;The memory module, for when the target disk is not damaged, the file to be stored being stored to the target Disk.
Alternatively, described device also includes:Second acquisition module, for when the target disk is damaged, obtaining described The second quantity of disk is not damaged in storage server;Processing module, for the first number acquiring and with the disk Second remainder of the ratio of amount;Second determining module, for determining identification information that second remainder is the target disk.
In embodiments of the present invention, the file identification information of file to be stored is obtained;It is logical according to the file identification information Cross default storage algorithm and target disk is determined from the disk of storage server;The file to be stored is stored to the target Disk.So, the disk of storage is determined by file identification information, without index is stored in database or file, it is to avoid Single Point of Faliure or performance bottleneck caused by file index, it is possible to will effectively access pressure distribution to each disk, so that Improve the efficiency of file storage.
Brief description of the drawings
Technical scheme in order to illustrate more clearly the embodiments of the present invention, below will be in embodiment or description of the prior art The required accompanying drawing for using is briefly described, it should be apparent that, drawings in the following description are only some realities of the invention Example is applied, for those of ordinary skill in the art, on the premise of not paying creative work, can also be according to these accompanying drawings Obtain other accompanying drawings.
Fig. 1 is the schematic flow sheet of the method for a kind of optional file storage according to embodiments of the present invention;
Fig. 2 is the structural representation of the device of a kind of optional file storage according to embodiments of the present invention;
Fig. 3 is the structural representation of the device of a kind of optional file storage according to embodiments of the present invention;
Fig. 4 is the structural representation of the device of a kind of optional file storage according to embodiments of the present invention.
Specific embodiment
In order that those skilled in the art more fully understand the present invention program, below in conjunction with the embodiment of the present invention Accompanying drawing, is clearly and completely described to the technical scheme in the embodiment of the present invention, it is clear that described embodiment is only The embodiment of a part of the invention, rather than whole embodiments.Based on the embodiment in the present invention, ordinary skill people The every other embodiment that member is obtained under the premise of creative work is not made, should all belong to the model of present invention protection Enclose.
It should be noted that term " first ", " in description and claims of this specification and above-mentioned accompanying drawing Two " it is etc. for distinguishing similar object, without for describing specific order or precedence.It should be appreciated that so using Data can exchange in the appropriate case, so as to embodiments of the invention described herein can with except illustrating herein or Order beyond those of description is implemented.Additionally, term " comprising " and " having " and their any deformation, it is intended that cover Lid is non-exclusive to be included, for example, the process, method, system, product or the equipment that contain series of steps or unit are not necessarily limited to Those steps or unit clearly listed, but may include not list clearly or for these processes, method, product Or other intrinsic steps of equipment or unit.
According to embodiments of the present invention, there is provided a kind of embodiment of the method for file storage, it is necessary to explanation, in accompanying drawing The step of flow is illustrated can perform in the such as one group computer system of computer executable instructions, and, although Logical order is shown in flow chart, but in some cases, can be performing shown different from order herein or retouch The step of stating.
Fig. 1 is a kind of method of file storage according to embodiments of the present invention, as shown in figure 1, the method includes following step Suddenly:
S101, the file identification information for obtaining file to be stored.
In this step, this document identification information can include file name and file extension, for example, file " 2015001/11.ts ", wherein, " 2015001 " are file name, and " 11 " are file extension, and " ts " is file type.
S102, target magnetic is determined from the disk of storage server by default storage algorithm according to this document identification information Disk.
Wherein, the disk in storage server is disposed with identification information, and the mark can be numbering, for example, service There are 5 disks in device, then 5 disks are numbered and are respectively:Disk 0, disk 1, disk 2, disk 3 and disk 4.
The default storage algorithm can be hash algorithm, or, file ranking method successively, this is not limited by the present invention, Can also be other special Distribution Algorithms carried out for regular filename etc..
In a kind of possible implementation of the present invention, the target can be obtained according to file name and this document extension name The identification information of disk, and determine that disk corresponding to the identification information is target disk.
Specifically, the first place numeral of file name and the last figure of this document extension name can be obtained, it is determined that this is deposited Storage server in disk the first quantity, and calculate first place numeral and the last figure and, and acquire and with First remainder of the ratio of the first quantity of the disk, and determine the identification information that first remainder is the target disk.
Illustratively, illustrated by taking file " 2015001/11.ts " as an example, if the quantity in storage server is 5, file The first place numeral of name is 2, and the last figure of file extension is 1, then first place numeral and the last figure and be 3, then the One remainder is 3, it is determined that the numbering of target disk(That is identification information)It is 3, so that it is determined that target disk is disk 3.
S103, the file to be stored is stored to the target disk.
In view of disk may due to damage cannot storage file, therefore, in an alternative embodiment of the invention, at this Before step S103, it may be determined that whether the target disk damages, if the target disk is not damaged, the file to be stored is deposited Store up to the target disk.
If the target disk is damaged, need to redefine target disk, specifically, obtain and do not damage in the storage server Second quantity of bad disk, and acquire and the first quantity with the disk ratio the second remainder, and determine this Two remainders are the identification information of the target disk.
Illustratively, still illustrated by taking above-mentioned file " 2015001/11.ts " as an example, however, it is determined that target disk be magnetic Disk 3, and the disk 3 damages, it is determined that for the number of disks damaged is 4, then the second remainder is 3, now, because disk 3 is damaged, Then determine that target disk is next disk of disk 3, i.e. disk 4.
It should be noted that it is determined that after target disk, the identification information of the target disk can be marked at into this document On identification information, for example, still illustrated by taking above-mentioned file " 2015001/11.ts " as an example, if target disk is disk 3, Then file identification information can be "/3/2015001/11.ts ", wherein, "/3/ " is the identification information of target disk.
If in addition, the target disk is damaged, and after determining new target disk, retaining the mark of the target disk of the damage Information, and the identification information of new target disk is added, if for example, the target disk for damaging is disk 3, file identification information It is "/3/2015001/11.ts ", however, it is determined that new target disk is disk 4, then file identification information is "/4/3/2015001/ 11.ts”。
Further, after the target disk for damaging is normal, can will be stored under other disks and file identification information The file of the identification information of the target disk including damage, is moved to the target disk, and the target disk is labeled as normally, For example, when damage disk 3 be replaced by normal disk after, by every other disk/3/ path under file move to disk 3 Under, after the completion of movement, by disk 3 labeled as normal.
Using the above method, the disk of storage is determined by file identification information, without will index storage in database or In file, it is to avoid Single Point of Faliure or performance bottleneck caused by file index, it is possible to will effectively access pressure distribution to respectively Individual disk, so as to improve the efficiency of file storage.
Fig. 2 is a kind of device of file storage provided in an embodiment of the present invention, as shown in Fig. 2 the device includes:
First acquisition module 201, the file identification information for obtaining file to be stored;
First determining module 202, for storing disk of the algorithm from storage server by default according to this document identification information Middle determination target disk;
Memory module 203, for the file to be stored to be stored to the target disk.
Alternatively, this document identification information includes filename and file extension, first determining module 202, for root The identification information of the target disk is obtained according to file name and this document extension name, and determines that disk corresponding to the identification information is Target disk.
Alternatively, first determining module 202, the first place for obtaining file name is digital and this document extension name Last figure;Determine the first quantity of the disk in the storage server;Calculate the first place numeral with the last figure and, and First remainder of the ratio of the first quantity acquire and with the disk;Determine the mark that first remainder is the target disk Knowledge information.
Alternatively, as shown in figure 3, the device also includes:
Judge module 204, for determining whether the target disk damages;
The memory module 203, for when the target disk is not damaged, the file to be stored being stored to the target disk.
Alternatively, as shown in figure 4, the device also includes:
Second acquisition module 205, do not damage the second of disk in the storage server for when the target disk is damaged, obtaining Quantity;
Processing module 206, for the second remainder of the ratio of the first quantity acquiring and with the disk;
Second determining module 207, for determining identification information that second remainder is the target disk.
Using said apparatus, the disk of storage is determined by file identification information, without will index storage in database or In file, it is to avoid Single Point of Faliure or performance bottleneck caused by file index, it is possible to will effectively access pressure distribution to respectively Individual disk, so as to improve the efficiency of file storage.
The embodiments of the present invention are for illustration only, and the quality of embodiment is not represented.
In the above embodiment of the present invention, the description to each embodiment all emphasizes particularly on different fields, and does not have in certain embodiment The part of detailed description, may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed technology contents, can be by other Mode is realized.Wherein, device embodiment described above is only schematical, such as division of described unit, Ke Yiwei A kind of division of logic function, can there is other dividing mode when actually realizing, such as multiple units or component can combine or Person is desirably integrated into another system, or some features can be ignored, or does not perform.Another, shown or discussed is mutual Between coupling or direct-coupling or communication connection can be the INDIRECT COUPLING or communication link of unit or module by some interfaces Connect, can be electrical or other forms.
The unit that is illustrated as separating component can be or may not be it is physically separate, it is aobvious as unit The part for showing can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple On unit.Some or all of unit therein can be according to the actual needs selected to realize the purpose of this embodiment scheme.
In addition, during each functional unit in each embodiment of the invention can be integrated in a processing unit, it is also possible to It is that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.Above-mentioned integrated list Unit can both be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.
If the integrated unit is to realize in the form of SFU software functional unit and as independent production marketing or use When, can store in a computer read/write memory medium.Based on such understanding, technical scheme is substantially The part for being contributed to prior art in other words or all or part of the technical scheme can be in the form of software products Embody, the computer software product is stored in a storage medium, including some instructions are used to so that a computer Equipment(Can be personal computer, server or network equipment etc.)Perform each embodiment methods described of the invention whole or Part steps.And foregoing storage medium includes:USB flash disk, read-only storage(ROM, Read-Only Memory), arbitrary access deposits Reservoir(RAM, Random Access Memory), mobile hard disk, magnetic disc or CD etc. are various can be with store program codes Medium.
The above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications also should It is considered as protection scope of the present invention.

Claims (10)

1. a kind of method that file is stored, it is characterised in that including:
Obtain the file identification information of file to be stored;
Target disk is determined from the disk of storage server by default storage algorithm according to the file identification information;
The file to be stored is stored to the target disk.
2. method according to claim 1, it is characterised in that the file identification information includes filename and file extent Name, it is described to determine that target disk includes by default storage algorithm according to the file identification information:
The identification information of the target disk is obtained according to the filename and the file extension;
Determine that disk corresponding to the identification information is target disk.
3. method according to claim 2, it is characterised in that described to be obtained according to the filename and the file extension The identification information for taking the target disk includes:
Obtain the last figure of the first digital and described file extension of the filename;
Determine the first quantity of the disk in the storage server;
Calculate the first place it is digital with the last figure and, and acquire and the first quantity with the disk ratio First remainder of value;
Determine the identification information that first remainder is the target disk.
4. method according to claim 3, it is characterised in that store to the target file to be stored described Before disk, methods described also includes:
Determine whether the target disk damages;
Described store to the target disk file to be stored includes:
When the target disk is not damaged, the file to be stored is stored to the target disk.
5. method according to claim 4, it is characterised in that methods described also includes:
When the target disk is damaged, the second quantity of disk is not damaged in the acquisition storage server;
Second remainder of the ratio of the first quantity acquire and with the disk;
Determine the identification information that second remainder is the target disk.
6. the device that a kind of file is stored, it is characterised in that including:
First acquisition module, the file identification information for obtaining file to be stored;
First determining module, for according to the file identification information by default storage algorithm from the disk of storage server Determine target disk;
Memory module, for the file to be stored to be stored to the target disk.
7. device according to claim 6, it is characterised in that the file identification information includes filename and file extent Name, first determining module, the mark for obtaining the target disk according to the filename and the file extension Information, and determine that disk corresponding to the identification information is target disk.
8. device according to claim 7, it is characterised in that first determining module, for obtaining the filename The first digital and described file extension last figure;Determine the first quantity of the disk in the storage server; Calculate the first place it is digital with the last figure and, and acquire and the first quantity with the disk ratio First remainder;Determine the identification information that first remainder is the target disk.
9. device according to claim 8, it is characterised in that described device also includes:
Judge module, for determining whether the target disk damages;
The memory module, for when the target disk is not damaged, the file to be stored being stored to the target magnetic Disk.
10. device according to claim 9, it is characterised in that described device also includes:
Second acquisition module, for when the target disk is damaged, obtains and the of disk is not damaged in the storage server Two quantity;
Processing module, for the second remainder of the ratio of the first quantity acquiring and with the disk;
Second determining module, for determining identification information that second remainder is the target disk.
CN201611078444.2A 2016-11-30 2016-11-30 A kind of method and apparatus of file storage Pending CN106776891A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611078444.2A CN106776891A (en) 2016-11-30 2016-11-30 A kind of method and apparatus of file storage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611078444.2A CN106776891A (en) 2016-11-30 2016-11-30 A kind of method and apparatus of file storage

Publications (1)

Publication Number Publication Date
CN106776891A true CN106776891A (en) 2017-05-31

Family

ID=58898840

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611078444.2A Pending CN106776891A (en) 2016-11-30 2016-11-30 A kind of method and apparatus of file storage

Country Status (1)

Country Link
CN (1) CN106776891A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107562786A (en) * 2017-07-27 2018-01-09 平安科技(深圳)有限公司 File memory method, terminal and computer-readable recording medium
CN107888678A (en) * 2017-11-08 2018-04-06 北京奇艺世纪科技有限公司 A kind of control method and device of file download
CN111803917A (en) * 2020-06-30 2020-10-23 北京金山云网络技术有限公司 Resource processing method and device
CN112416858A (en) * 2020-11-09 2021-02-26 深圳市珍爱捷云信息技术有限公司 Document storage method and device, electronic equipment and computer readable storage medium
CN112835864A (en) * 2021-02-03 2021-05-25 北京联创信安科技股份有限公司 File storage method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101526965A (en) * 2009-04-29 2009-09-09 成都市华为赛门铁克科技有限公司 Locating method of index nodes of disk file and device thereof
CN101996217A (en) * 2009-08-24 2011-03-30 华为技术有限公司 Method for storing data and memory device thereof
CN102004797A (en) * 2010-12-24 2011-04-06 深圳市同洲电子股份有限公司 Method, device and system for processing data
CN103384256A (en) * 2012-05-02 2013-11-06 天津书生投资有限公司 Cloud storage method and device
CN103501319A (en) * 2013-09-18 2014-01-08 北京航空航天大学 Low-delay distributed storage system for small files

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101526965A (en) * 2009-04-29 2009-09-09 成都市华为赛门铁克科技有限公司 Locating method of index nodes of disk file and device thereof
CN101996217A (en) * 2009-08-24 2011-03-30 华为技术有限公司 Method for storing data and memory device thereof
CN102004797A (en) * 2010-12-24 2011-04-06 深圳市同洲电子股份有限公司 Method, device and system for processing data
CN103384256A (en) * 2012-05-02 2013-11-06 天津书生投资有限公司 Cloud storage method and device
CN103501319A (en) * 2013-09-18 2014-01-08 北京航空航天大学 Low-delay distributed storage system for small files

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107562786A (en) * 2017-07-27 2018-01-09 平安科技(深圳)有限公司 File memory method, terminal and computer-readable recording medium
CN107888678A (en) * 2017-11-08 2018-04-06 北京奇艺世纪科技有限公司 A kind of control method and device of file download
CN107888678B (en) * 2017-11-08 2020-11-13 北京奇艺世纪科技有限公司 Method and device for controlling file downloading
CN111803917A (en) * 2020-06-30 2020-10-23 北京金山云网络技术有限公司 Resource processing method and device
CN112416858A (en) * 2020-11-09 2021-02-26 深圳市珍爱捷云信息技术有限公司 Document storage method and device, electronic equipment and computer readable storage medium
CN112835864A (en) * 2021-02-03 2021-05-25 北京联创信安科技股份有限公司 File storage method, device, equipment and storage medium
CN112835864B (en) * 2021-02-03 2024-02-20 北京联创信安科技股份有限公司 File storage method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN106776891A (en) A kind of method and apparatus of file storage
CN104506619B (en) A kind of data backup, restoration methods and its device, server
US7660956B1 (en) Save set bundling for staging
CN106874522A (en) Information recommendation method, device, storage medium and processor
CN106844132A (en) The fault repairing method and device of cluster server
CN106657192A (en) Method used for presenting service calling information and equipment thereof
CN107707600A (en) A kind of date storage method and device
CN107506145A (en) A kind of physical store dispatching method and cloud main frame creation method
CN106372115A (en) Data reading/writing method and system, and database system
CN106648445A (en) Data storage method and apparatus used for crawler
CN108241531A (en) A kind of method and apparatus for distributing resource for virtual machine in the cluster
CN107678906A (en) Hard disk management method and system
CN109213447A (en) A kind of SAN storage volume carry, discharging method and system
CN109213745A (en) A kind of distributed document storage method, device, processor and storage medium
CN107368569A (en) Data difference control methods and device, storage medium and processor
CN108597563A (en) Dynamic random group technology and system
CN106487833A (en) The statistical method of isolated user number and device in network monitor
CN105354149B (en) A kind of internal storage data lookup method and device
CN107659652A (en) A kind of method and device of cloud backup
CN107463450A (en) The data processing method and device of container
CN104317675B (en) The disaster tolerance treating method and apparatus of application
CN106354828A (en) Data fragmentation method and device for distributed database
CN115309707A (en) Information interaction method based on warranty service
CN106960052A (en) A kind of collage-credit data acquisition method and system
CN105701047B (en) A kind of multi-channel data transmission and virtual restoration method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170531