CN104601724B - Upload and download the method and system of file - Google Patents

Upload and download the method and system of file Download PDF

Info

Publication number
CN104601724B
CN104601724B CN201510057145.XA CN201510057145A CN104601724B CN 104601724 B CN104601724 B CN 104601724B CN 201510057145 A CN201510057145 A CN 201510057145A CN 104601724 B CN104601724 B CN 104601724B
Authority
CN
China
Prior art keywords
file
magnetic disc
request
path
server
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.)
Active
Application number
CN201510057145.XA
Other languages
Chinese (zh)
Other versions
CN104601724A (en
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.)
Beijing Jinher Software Co Ltd
Original Assignee
Beijing Jinher Software 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 Beijing Jinher Software Co Ltd filed Critical Beijing Jinher Software Co Ltd
Priority to CN201510057145.XA priority Critical patent/CN104601724B/en
Publication of CN104601724A publication Critical patent/CN104601724A/en
Application granted granted Critical
Publication of CN104601724B publication Critical patent/CN104601724B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application data

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention belongs to file service field, specifically related to a kind of method and system for uploading and downloading file, client send download request respectively by CDN server, IIS Web servers, four levels of database server and disk server server, inquiry in layer is carried out to download, such server combination querying method so that the speed for downloading file greatly improves;Client sends upload request and is quickly uploaded specified file by IIS Web servers, database server and disk server;All support breakpoint to download and upload in addition, downloading and uploading, i.e., when file is especially big, because the big file fragmentation of the influences such as network reason is downloaded or is uploaded, big file download and the mortality uploaded can be substantially reduced.

Description

Upload and download the method and system of file
Technical field
The invention belongs to file service field, and in particular to a kind of method and system for uploading and downloading file.
Background technology
In in general is downloaded and uploads File Technology, some technologies directly read file from disk server, so as under Load or upper transmitting file, so that speed of download and uploading speed are very slow;Although CDN server can be by closest to user's The shortcomings that node address is supplied to user, but when visit capacity is more, and single CDN server still has underloading;Its Its single server is also not enough to the network hotspot resource for not having cache user often to download while undertaking more visit capacities, So that still speed is very slow for the download and upload of next time;In addition, existing upload and method for down loading, are not all to support under breakpoint Carry and upload so that the file of Large Copacity is once downloaded or uploaded unsuccessful, and next time must re-download and upload, and wastes and uses The family time.
The content of the invention
It is an object of the present invention to provide a kind of upload and method for down loading and system, can quickly upload and lower carrying File required for family.
To achieve these goals, the invention provides a kind of method for downloading file, including:
Client sends download request, the corresponding request path of the download request;
CDN server receives the download request, and judges whether caching and the download content of download request requirement, If caching, returns to client by the content, if not caching, the download request is sent into IIS Web servers;
The IIS Web servers receive the download request that the CDN server is sent, and to the download request Parsed, judge the caching of the whether existing download request of the IIS Web servers, if in the presence of directly by institute State download request and correspond to cache contents return client;If being not present, the parameter value of the request path is further parsed, is obtained The magnetic disc ID into file path, and the magnetic disc ID is sent to database server;
The database server receives the magnetic disc ID that the IIS Web servers are sent, and whether searching data storehouse Comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, then returning to the magnetic disc shares path, IIS Web server parses the magnetic disc shares path again, obtains the specific path request of file, and send it to disk server; If it is not, then sending this file to client is not present message;
The disk server receives the specific path request of file that the IIS Web servers are sent, according to the text The specific path searching this document of part whether there is, if so, this document corresponding content is then returned to client, if it is not, then returning to text Message is not present in part.
Preferably, wherein, the database server receives the magnetic disc ID that the IIS Web servers are sent, Search whether that caching and the magnetic disc ID have the magnetic disc shares path of mapping relations in Redis cache databases first, if so, The magnetic disc shares path is then returned into IIS Web servers, it parses the magnetic disc shares path again, obtains the specific road of file Footpath is asked, and is sent it to disk server and is carried out file download operation;
If there is no magnetic disc ID corresponding data in the Redis cache databases, SqlServer relational databases are inquired about Whether comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, then the magnetic disc shares path is returned To IIS Web servers, it parses the magnetic disc shares path again, obtains the specific path request of file, sends it to disk clothes Business device carries out file download operation;If it is not, then sending this file to client is not present message;
If do not found in the Redis cache databases and the SqlServer relational databases with it is described Magnetic disc ID has the magnetic disc shares path of mapping relations, then sending this file to the client is not present message.
Wherein, the down operation supports breakpoint to download.
Preferably, wherein, IIS Web servers are divided into polytype file server according to business, and it is right respectively Different domain name addresses is answered, the download request obtains corresponding IP by domain name mapping, IP mapping domain names address, then The download request is sent to the file server of corresponding domain name addresses;
The file server parses to the download request, judges that whether existing file server internal memory is described The caching of download request, if so, download request directly then is corresponded into cache contents returns to client;If it is not, then further parsing Request path parameter value, magnetic disc ID in file path is obtained, and the magnetic disc ID is sent to the database server.
A kind of file download system, including:
Client, it is used to send download request;
CDN server, it is used to receive the download request, and judges whether under caching and download request requirement Content is carried, if caching, returns to client by the content, if not caching, the download request is sent into IIS Web Server;
The IIS Web servers connect, and it is used to receive the download request that the CDN server is sent, and to institute State download request to be parsed, judge the caching of the whether existing download request of the IIS Web servers, if in the presence of, The download request is directly then corresponded into cache contents and returns to client;If being not present, the request path is further parsed Parameter value, obtain magnetic disc ID in file path, and the magnetic disc ID is sent to database server;
The database server, it is used to receive the magnetic disc ID that the IIS Web servers are sent, searching data Whether storehouse is comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, the magnetic disc shares path is then returned to, IIS Web servers parse the magnetic disc shares path again, obtain the specific path request of file, and send it to disk service Device;If it is not, then sending this file to client is not present message;
The disk server, it is used to receive the specific path request of file that the IIS Web servers are sent, according to Described specific path searching this document of file whether there is, if so, this document corresponding content is then returned to client, if it is not, then Return to file and message is not present.
Preferably, wherein, the database server includes that Redis is data cached and SqlServer relation datas Storehouse;
Wherein, the database server receives the magnetic disc ID that the IIS Web servers are sent, and exists first Redis cache databases search whether that caching and the magnetic disc ID have the magnetic disc shares path of mapping relations, if so, then by institute State magnetic disc shares path and return to IIS Web servers, it parses the magnetic disc shares path again, and obtaining the specific path of file please Ask, send it to disk server and carry out file download operation;
If there is no magnetic disc ID corresponding data in the Redis cache databases, SqlServer relational databases are inquired about Whether comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, then the magnetic disc shares path is returned To IIS Web servers, it parses the magnetic disc shares path again, obtains the specific path request of file, sends it to disk clothes Business device carries out file download operation;If it is not, then sending this file to client is not present message;
If do not found in the Redis cache databases and the SqlServer relational databases with it is described Magnetic disc ID has the magnetic disc shares path of mapping relations, then sending this file to the client is not present message;
Wherein, the down operation supports breakpoint to download.
Preferably, wherein, in addition to:
First detection means, its be used to monitoring the IIS Web servers whether normal operation;
Second detection device, its be used to monitoring the database server whether normal operation;
Multiple file servers, it is the file server that IIS Web servers separate according to business service, and it is right respectively Different domain name addresses is answered, the download request obtains corresponding IP by domain name mapping, IP mapping domain names address, then The download request is sent to the file server of corresponding domain name addresses;
The file server parses to the download request, judges that whether existing file server internal memory is described The caching of download request, if so, download request directly then is corresponded into cache contents returns to client;If it is not, then further parsing Request path parameter value, magnetic disc ID in file path is obtained, and the magnetic disc ID is sent to the database server.
A kind of method of upper transmitting file, including:
Client sends upload request;
IIS Web servers receive the upload request, and the upload request, which is submitted, uploads file-related information, IIS clothes Whether business device meets agreement to relevant information analysis judgment, if it is not, then returning;Taken if so, then sending inquiry request to database Business device;
The database server receives the inquiry request that the IIS Web servers are sent, if not preassigning, Then search the writeable magnetic disc ID collection included in the database server, therefrom randomly select a magnetic disc ID corresponding to disk be total to Enjoy path and be back to IIS Web servers;If having preassigned magnetic disc ID, search the database server and whether there is There is the magnetic disc shares path of mapping relations with the magnetic disc ID, if it is not, then to client send this file can not upload message, If so, shared disk path corresponding to the magnetic disc ID then is returned into IIS Web servers, IIS Web servers obtain disk Write request is sent after overlapping trees to disk server;
The disk server receives write request, completes file write operations, returns to file path and is serviced to IIS Device, upload and complete;
Preferably, wherein, described upload information include filename, file content, file whether breakpoint transmission, file Upload the information such as original position;
Upload request can also upload the magnetic disc ID that path parameter preassigns file and write by specified file;
Wherein, the database server receives the inquiry request that the IIS Web servers are sent, if the inquiry Ask to ask for inquiry writable disc, search whether to include writeable disk first in Redis cache databases, if so, then random choosing A corresponding magnetic disc shares path is taken to return to IIS Web servers;If it is not, then whether inquire about SqlServer relational databases Comprising writeable disk, if do not included, return file can not upload message, if comprising random from corresponding result set Choose a corresponding magnetic disc shares path and return to IIS Web servers;IIS Web servers are sent out after obtaining magnetic disc shares path Write request is sent to disk server;It receives write request, completes file write operations, returns to file path and is taken to IIS Business device, uploads and completes;
Wherein, described upload supports breakpoint transmission.
If the inquiry request is the ID requests of inquiry designated disk, whether deposited in the data cached library inquiries of Redis first In the magnetic disc shares path for having mapping relations with the magnetic disc ID, if so, the magnetic disc shares path then is returned into IIS Web services Device, if it is not, then being searched in SqlServer database, if existing in the SqlServer database, by the magnetic disc shares road Footpath returns to IIS Web servers;IIS Web servers obtain magnetic disc shares path and send write-in file request to disk service Device;IIS Web servers send write request to disk server after obtaining magnetic disc shares path;It receives write request, File write operations are completed, file path is returned and gives IIS servers, upload and complete;
Wherein, described upload supports breakpoint transmission.
If do not found in the Redis cache databases and the SqlServer database and have the disk ID has the magnetic disc shares path of mapping relations, then sending this file to client can not upload message.
A kind of system of upper transmitting file, including:
Client, it is used to send upload request;
IIS Web servers, it is used to receive the upload request, and the upload request submits the related letter of upper transmitting file Breath, whether IIS servers meet agreement to relevant information analysis judgment, if it is not, then returning;If so, then send inquiry request to Database server;
The database server, it receives the inquiry request that the IIS Web servers are sent, if not finger in advance It is fixed, then the writeable magnetic disc ID collection included in the database server is searched, therefrom randomly selects magnetic corresponding to a magnetic disc ID Disk overlapping trees are back to IIS Web servers;If having preassigned magnetic disc ID, whether the database server is searched In the presence of the magnetic disc shares path with the magnetic disc ID with mapping relations, if it is not, then sending this file to client can not upload Message, if so, shared disk path corresponding to the magnetic disc ID then is returned into IIS Web servers, IIS Web servers obtain Write request is sent behind magnetic disc shares path to disk server;
The disk server, it receives write request, completes file write operations, returns to file path and gives IIS servers, upload and complete;
Preferably, wherein, in addition to:
First detection means, its be used to monitoring the IIS Web servers whether normal operation;
Second detection device, its be used to monitoring the database server whether normal operation;
The database includes Redis cache databases and SqlServer relational databases;
Wherein, the database server receives the inquiry request that the IIS Web servers are sent, if the inquiry Ask to ask for inquiry writable disc, search whether to include writeable disk first in Redis cache databases, if so, then random choosing A corresponding magnetic disc shares path is taken to return to IIS Web servers;If it is not, then whether inquire about SqlServer relational databases Comprising writeable disk, if it is not, then return file can not upload message, if so, then randomly selected from corresponding result set one it is right The magnetic disc shares path answered returns to IIS Web servers;IIS Web servers send write request after obtaining magnetic disc shares path To disk server;It receives write request, completes file write operations, returns to file path and gives IIS servers, has uploaded Into;
Wherein, described upload supports breakpoint transmission.
If the inquiry request is the ID requests of inquiry designated disk, whether deposited in the data cached library inquiries of Redis first In the magnetic disc shares path for having mapping relations with the magnetic disc ID, if so, the magnetic disc shares path then is returned into IIS Web services Device, if it is not, then being searched in SqlServer database, if existing in the SqlServer database, by the magnetic disc shares road Footpath returns to IIS Web servers;IIS Web servers obtain magnetic disc shares path and send write-in file request to disk service Device;IIS Web servers send write request to disk server after obtaining magnetic disc shares path;It receives write request, File write operations are completed, file path is returned and gives IIS servers, upload and complete;
Wherein, described upload supports breakpoint transmission.
If do not found in the Redis cache databases and the SqlServer database and have the disk ID has the magnetic disc shares path of mapping relations, then sending this file to client can not upload message.
Beneficial effects of the present invention
1st, CDN server provided by the invention, the speed downloaded and uploaded is speeded;
2nd, it is provided by the invention according to the distributed multiple kind of document of type of service, and multiple storage servers are loaded, Performance is more preferable, more flexible, enhances service stability;
3rd, the first detection means provided by the invention and second detection device, ensure that the stability of service operation state;
4th, Redis cache databases provided by the invention, the download made and the speed of upload are faster;
5th, shared disk reading manner provided by the invention is flexible, and disk server autgmentability is more preferable, and LAN is special User right control is safer;
6th, CDN server, IIS Web servers, database server and the disk server that the present invention uses carry jointly Supplied download and upload so that download and upload speed faster.
Brief description of the drawings
Fig. 1 is upload of the present invention and method for down loading and the Organization Chart of system;
Embodiment
The present invention is described in further detail below in conjunction with the accompanying drawings, to make those skilled in the art with reference to specification text Word can be implemented according to this.
As shown in Figure 1, solid line therein is the method for download request, and dotted line is the method for upload request.
Client/Application is client;
Server1, Server2 etc. are the citing of multiple storage servers;
Fielserver (image-text), APPFielserver (applying class), MVPFielserver (multimedia class), BTPFielserver (commerce and trade class), CCPFielserver (communication class) are the kind of document by service distribution;
Server monitoring is the first detection means, and Redis monitoring is second detection device;
Client sends download request, the corresponding request path of the download request;
CDN server receives the download request, and judges whether caching and the download content of download request requirement, If caching, returns to client by the content, if not caching, the download request is sent into IIS Web servers;
The IIS Web servers receive the download request that the CDN server is sent, and to the download request Parsed, judge the caching of the whether existing download request of the IIS Web servers, if in the presence of directly by institute State download request and correspond to cache contents return client;If being not present, the parameter value of the request path is further parsed, is obtained The magnetic disc ID into file path, and the magnetic disc ID is sent to database server;
The database server receives the magnetic disc ID that the IIS Web servers are sent, and whether searching data storehouse Comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, then returning to the magnetic disc shares path, IIS Web server parses the magnetic disc shares path again, obtains the specific path request of file, and send it to disk server; If it is not, then sending this file to client is not present message;
The disk server receives the specific path request of file that the IIS Web servers are sent, according to the text The specific path searching this document of part whether there is, if so, this document corresponding content is then returned to client, if it is not, then returning to text Message is not present in part.
To ensure that secure file system creates special shared user and creates password, read-write share dish are being required for providing just True user name and password.Because file is more, for convenience of managing, file directory is produced by certain rule, at present comprising per diem Phase (such as 2014112618 during the date) and by file type name (such as img/apk) two class.
CDN is to build a kind of distributed content delivery network over data networks.CDN effect is taken using Streaming Media Be engaged in device Clustering, the shortcomings that overcoming one-of-a-kind system output bandwidth and concurrent capability deficiency, can significant increase system support and Flow amount is sent out, the harmful effect that single point failure is brought is reduced or avoided.
The present invention allows download request to first pass through CDN server, and CDN is referred to the access of user using GSLB technology To on the working properly streaming media server nearest from user, the request by streaming media server directly in response to user.Service If no user content to be accessed in device, then underlying services device provided by the present invention provides download, such one layer one Layer is searched, and without directly being searched in the various file of disk server, can greatly improve speed of download.
In one embodiment, on the basis of the above situation,
The database server receives the magnetic disc ID that the IIS Web servers are sent, and is cached first in Redis Whether database lookup caches the magnetic disc shares path for having mapping relations with the magnetic disc ID, if so, being then total to the disk Enjoy path and return to IIS Web servers, it parses the magnetic disc shares path again, obtains the specific path request of file, is sent out It is sent to disk server and carries out file download operation;
If there is no magnetic disc ID corresponding data in the Redis cache databases, SqlServer relational databases are inquired about Whether comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, then the magnetic disc shares path is returned To IIS Web servers, it parses the magnetic disc shares path again, obtains the specific path request of file, sends it to disk clothes Business device carries out file download operation;If it is not, then sending this file to client is not present message;
If do not found in the Redis cache databases and the SqlServer relational databases with it is described Magnetic disc ID has the magnetic disc shares path of mapping relations, then sending this file to the client is not present message.
Wherein, the down operation supports breakpoint to download.
Redis is a key-value storage system.It supports that the value types of storage are relatively more, including string (character string), list (chained list), set (set), zset (sorted set-- ordered sets) and hash (Hash type).These Data type all supports push/pop, add/remove and takes common factor union and difference set and more rich operation, and these are grasped All it is atomicity.On this basis, Redis supports the sequence of various different modes.For guaranteed efficiency, data are all slow Exist in internal memory.The data of renewal periodically can be write disk or modification is operated the additional record text of write-in by Redis Part, and it is synchronous to realize master-slave (principal and subordinate) on this basis.
Redis is a high performance key-value database.Redis appearance, largely compensate for The deficiency of this kind of key/value storages of memcached, in part, occasion can play supplement well to relational database and make With.It provides the visitors such as Java, C/C++, C#, PHP, JavaScript, Perl, Object-C, Python, Ruby, Erlang Family end, using very convenient.
Redis supports master-slave synchronisation.Data can be from master server to any number of synchronization from server, from service Device can associate other master servers from server.This causes Redis to can perform individual layer tree copying.Deposit can intentional nothing Meaning carries out write operation to data.Due to fully achieving publish/subscribe mechanism so that from database anywhere synchronization tree When, a channel can be subscribed to and receive the complete news release record of master server.Synchronous scalability to read operation and Data redundancy is helpful.
Breakpoint is supported to download in addition, downloading, i.e., when file is especially big, due under the big file fragmentation of the influences such as network reason Load can substantially reduce big file download mortality;
Further embodiment, on the basis of above-described embodiment, the IIS Web servers are divided into multiple types according to business The file server of type, it corresponds to different domain name addresses respectively, and the download request obtains corresponding IP by domain name mapping, The IP maps domain name address, then the download request is sent to the file server of corresponding domain name addresses;
The file server parses to the download request, judges that whether existing file server internal memory is described The caching of download request, if so, download request directly then is corresponded into cache contents returns to client;If it is not, then further parsing Request path parameter value, magnetic disc ID in file path is obtained, and the magnetic disc ID is sent to the database server.
To support that bigger each service scripts service of visit capacity is loaded using multiple servers again, can increase described The visit capacity of IIS Web servers, the speed of download made is faster.
A kind of file download system, including:
Client, it is used to send download request;
CDN server, it is used to receive the download request, and judges whether under caching and download request requirement Content is carried, if caching, returns to client by the content, if not caching, the download request is sent into IIS Web Server;
The IIS Web servers connect, and it is used to receive the download request that the CDN server is sent, and to institute State download request to be parsed, judge the caching of the whether existing download request of the IIS Web servers, if in the presence of, The download request is directly then corresponded into cache contents and returns to client;If being not present, the request path is further parsed Parameter value, obtain magnetic disc ID in file path, and the magnetic disc ID is sent to database server;
The database server, it is used to receive the magnetic disc ID that the IIS Web servers are sent, searching data Whether storehouse is comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, the magnetic disc shares path is then returned to, IIS Web servers parse the magnetic disc shares path again, obtain the specific path request of file, and send it to disk service Device;If it is not, then sending this file to client is not present message;
The disk server, it is used to receive the specific path request of file that the IIS Web servers are sent, according to Described specific path searching this document of file whether there is, if so, this document corresponding content is then returned to client, if it is not, then Return to file and message is not present.
To ensure that secure file system creates special shared user and creates password, read-write share dish are being required for providing just True user name and password.Because file is more, for convenience of managing, file directory is produced by certain rule, at present comprising per diem Phase (such as 2014112618 during the date) and by file type name (such as img/apk) two class.
In one embodiment, on the basis of the above situation, the database server include Redis it is data cached and SqlServer relational databases;
Wherein, the database server receives the magnetic disc ID that the IIS Web servers are sent, and exists first Redis cache databases search whether that caching and the magnetic disc ID have the magnetic disc shares path of mapping relations, if so, then by institute State magnetic disc shares path and return to IIS Web servers, it parses the magnetic disc shares path again, and obtaining the specific path of file please Ask, send it to disk server and carry out file download operation;
If there is no magnetic disc ID corresponding data in the Redis cache databases, SqlServer relational databases are inquired about Whether comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, then the magnetic disc shares path is returned To IIS Web servers, it parses the magnetic disc shares path again, obtains the specific path request of file, sends it to disk clothes Business device carries out file download operation;If it is not, then sending this file to client is not present message;
If do not found in the Redis cache databases and the SqlServer relational databases with it is described Magnetic disc ID has the magnetic disc shares path of mapping relations, then sending this file to the client is not present message;
Wherein, the down operation supports breakpoint to download;
Download and support breakpoint to download, i.e., when file is especially big, being downloaded due to the big file fragmentation of the influences such as network reason can To substantially reduce big file download mortality;
Further embodiment, on the basis of above-described embodiment, in addition to:
First detection means, its be used to monitoring the IIS Web servers whether normal operation;
Second detection device, its be used to monitoring the database server whether normal operation;
Multiple file servers, it is the file server that IIS Web servers separate according to business service, and it is right respectively Different domain name addresses is answered, the download request obtains corresponding IP by domain name mapping, IP mapping domain names address, then The download request is sent to the file server of corresponding domain name addresses;
The file server parses to the download request, judges that whether existing file server internal memory is described The caching of download request, if so, download request directly then is corresponded into cache contents returns to client;If it is not, then further parsing Request path parameter value, magnetic disc ID in file path is obtained, and the magnetic disc ID is sent to the database server.
A kind of method of upper transmitting file, including:
Client sends upload request;
IIS Web servers receive the upload request, and the upload request, which is submitted, uploads file-related information, IIS clothes Whether business device meets agreement to relevant information analysis judgment, if it is not, then returning;Taken if so, then sending inquiry request to database Business device;
The database server receives the inquiry request that the IIS Web servers are sent, if not preassigning, Then search the writeable magnetic disc ID collection included in the database server, therefrom randomly select a magnetic disc ID corresponding to disk be total to Enjoy path and be back to IIS Web servers;If having preassigned magnetic disc ID, search the database server and whether there is There is the magnetic disc shares path of mapping relations with the magnetic disc ID, if it is not, then to client send this file can not upload message, If so, shared disk path corresponding to the magnetic disc ID then is returned into IIS Web servers, IIS Web servers obtain disk Write request is sent after overlapping trees to disk server;
The disk server receives write request, completes file write operations, returns to file path and is serviced to IIS Device, upload and complete;
Further embodiment, on the basis of above-described embodiment, described upload information include filename, file content, Whether breakpoint transmission, file upload the information such as original position to file;
Upload request can also upload the magnetic disc ID that path parameter preassigns file and write by specified file;
Wherein, the database server receives the inquiry request that the IIS Web servers are sent, if the inquiry Ask to ask for inquiry writable disc, search whether to include writeable disk first in Redis cache databases, if so, then random choosing A corresponding magnetic disc shares path is taken to return to IIS Web servers;If it is not, then whether inquire about SqlServer relational databases Comprising writeable disk, if do not included, return file can not upload message, if comprising random from corresponding result set Choose a corresponding magnetic disc shares path and return to IIS Web servers;IIS Web servers are sent out after obtaining magnetic disc shares path Write request is sent to disk server;It receives write request, completes file write operations, returns to file path and is taken to IIS Business device, uploads and completes;
Wherein, described upload supports breakpoint transmission.
If the inquiry request is the ID requests of inquiry designated disk, whether deposited in the data cached library inquiries of Redis first In the magnetic disc shares path for having mapping relations with the magnetic disc ID, if so, the magnetic disc shares path then is returned into IIS Web services Device, if it is not, then being searched in SqlServer database, if existing in the SqlServer database, by the magnetic disc shares road Footpath returns to IIS Web servers;IIS Web servers obtain magnetic disc shares path and send write-in file request to disk service Device;IIS Web servers send write request to disk server after obtaining magnetic disc shares path;It receives write request, File write operations are completed, file path is returned and gives IIS servers, upload and complete;
Wherein, described upload supports breakpoint transmission.
If do not found in the Redis cache databases and the SqlServer database and have the disk ID has the magnetic disc shares path of mapping relations, then sending this file to client can not upload message.
Upper transmitting file supports breakpoint transmission, ensures big file fragmentation write-in disk.
A kind of system of upper transmitting file, including:
Client, it is used to send upload request;
IIS Web servers, it is used to receive the upload request, and the upload request submits the related letter of upper transmitting file Breath, whether IIS servers meet agreement to relevant information analysis judgment, if it is not, then returning;If so, then send inquiry request to Database server;
The database server, it receives the inquiry request that the IIS Web servers are sent, if not finger in advance It is fixed, then the writeable magnetic disc ID collection included in the database server is searched, therefrom randomly selects magnetic corresponding to a magnetic disc ID Disk overlapping trees are back to IIS Web servers;If having preassigned magnetic disc ID, whether the database server is searched In the presence of the magnetic disc shares path with the magnetic disc ID with mapping relations, if it is not, then sending this file to client can not upload Message, if so, shared disk path corresponding to the magnetic disc ID then is returned into IIS Web servers, IIS Web servers obtain Write request is sent behind magnetic disc shares path to disk server;
The disk server, it receives write request, completes file write operations, returns to file path and gives IIS servers, upload and complete;
To ensure that secure file system creates special shared user and creates password, read-write share dish are being required for providing just True user name and password.Because file is more, for convenience of managing, file directory is produced by certain rule, at present comprising per diem Phase (such as 2014112618 during the date) and by file type name (such as img/apk) two class.
Further embodiment, on the basis of above-described embodiment, the system of described upper transmitting file, in addition to:
First detection means, its be used to monitoring the IIS Web servers whether normal operation;
Second detection device, its be used to monitoring the database server whether normal operation;
The database includes Redis cache databases and SqlServer relational databases;
Wherein, the database server receives the inquiry request that the IIS Web servers are sent, if the inquiry Ask to ask for inquiry writable disc, search whether to include writeable disk first in Redis cache databases, if so, then random choosing A corresponding magnetic disc shares path is taken to return to IIS Web servers;If it is not, then whether inquire about SqlServer relational databases Comprising writeable disk, if it is not, then return file can not upload message, if so, then randomly selected from corresponding result set one it is right The magnetic disc shares path answered returns to IIS Web servers;IIS Web servers send write request after obtaining magnetic disc shares path To disk server;It receives write request, completes file write operations, returns to file path and gives IIS servers, has uploaded Into;
Wherein, described upload supports breakpoint transmission.
If the inquiry request is the ID requests of inquiry designated disk, whether deposited in the data cached library inquiries of Redis first In the magnetic disc shares path for having mapping relations with the magnetic disc ID, if so, the magnetic disc shares path then is returned into IIS Web services Device, if it is not, then being searched in SqlServer database, if existing in the SqlServer database, by the magnetic disc shares road Footpath returns to IIS Web servers;IIS Web servers obtain magnetic disc shares path and send write-in file request to disk service Device;IIS Web servers send write request to disk server after obtaining magnetic disc shares path;It receives write request, File write operations are completed, file path is returned and gives IIS servers, upload and complete;
Wherein, described upload supports breakpoint transmission.
If do not found in the Redis cache databases and the SqlServer database and have the disk ID has the magnetic disc shares path of mapping relations, then sending this file to client can not upload message.
Wherein, the first detection means analysis IIS server logs, (HTTP of 4 or 5 classes is wrong for abnormal information in daily record Mail alarm related personnel's timely processing can be sent out by mistake).The monitoring of service operation state more strengthens stability guarantee.
Wherein, second detection device detection cache database whether normal operation, can restart automatically if being closed.
To ensure that secure file system creates special shared user and creates password, read-write share dish are being required for providing just True user name and password.Because file is more, for convenience of managing, file directory is produced by certain rule, at present comprising per diem Phase (such as 2014112618 during the date) and by file type name (such as img/apk) two class.
Wherein, picture file, picture show to be exactly a download request;Audio-video document, broadcasting is exactly download request.
Although embodiment of the present invention is disclosed as above, it is not restricted in specification and embodiment listed With it can be applied to various suitable the field of the invention completely, can be easily for those skilled in the art Other modification is realized, therefore under the universal limited without departing substantially from claim and equivalency range, it is of the invention and unlimited In specific details and shown here as the legend with description.

Claims (8)

1. a kind of method for downloading file, including:
Client sends download request;The corresponding request path of the download request;
CDN server receives the download request, and judges whether caching and the download content of download request requirement, if slow Deposit, then the content is returned into client, if not caching, the download request is sent to IIS Web servers;
The IIS Web servers receive the download request that the CDN server is sent, and the download request is carried out Parsing, judge the caching of the whether existing download request of the IIS Web servers, if in the presence of, directly will be described under Carry the corresponding cache contents of request and return to client;If being not present, the parameter value of the request path is further parsed, obtains text Magnetic disc ID in part path, and the magnetic disc ID is sent to database server;
The database server receives the magnetic disc ID that the IIS Web servers are sent, and whether searching data storehouse includes There is the magnetic disc shares path of mapping relations with the magnetic disc ID, if so, the magnetic disc shares path is then returned to, IIS Web clothes Business device parses the magnetic disc shares path again, obtains the specific path request of file, and send it to disk server;If it is not, Then this file being sent to client, message is not present;
The disk server receives the specific path request of file that the IIS Web servers are sent, and is had according to the file Body path searching this document whether there is, if so, this document corresponding content is then returned to client, if it is not, then returning to file not Message be present;
Wherein, IIS Web servers are divided into polytype file server according to business, and it with corresponding to different domain names respectively Location, the download request obtain corresponding IP by domain name mapping, IP mapping domain names address, then the download request quilt It is sent to the file server of corresponding domain name addresses;
The file server parses to the download request, judges the whether existing download of file server internal memory The caching of request, if so, download request directly then is corresponded into cache contents returns to client;If it is not, then further analysis request Path parameter value, magnetic disc ID in file path is obtained, and the magnetic disc ID is sent to the database server.
2. the method for claim 1, wherein the database server receives what the IIS Web servers were sent The magnetic disc ID, search whether that caching is total to the disk that the magnetic disc ID has mapping relations in Redis cache databases first Path is enjoyed, if so, the magnetic disc shares path then is returned into IISWeb servers, it parses the magnetic disc shares path again, obtains To the specific path request of file, send it to disk server and carry out file download operation;
If not having magnetic disc ID corresponding data in the Redis cache databases, whether inquiry SqlServer relational databases Comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, the magnetic disc shares path then is returned into IIS Web server, it parses the magnetic disc shares path again, obtains the specific path request of file, sends it to disk server and enter Row file download operation;If it is not, then sending this file to client is not present message;
If do not found and the disk in the Redis cache databases and the SqlServer relational databases ID has the magnetic disc shares path of mapping relations, then sending this file to the client is not present message;
Wherein, the down operation supports breakpoint to download.
3. a kind of file download system, including:
Client, it is used to send download request;
CDN server, it is used to receive the download request, and judges whether in the download that caching requires with the download request Hold, if caching, returns to client by the content, if not caching, the download request is sent into IIS Web services Device;
The IIS Web servers connect, and it is used to receiving the download request that the CDN server is sent, and under described Carry request to be parsed, the caching of the whether existing download request of the IIS Web servers is judged, if in the presence of directly Connect and the download request is corresponded into cache contents return client;
If being not present, the parameter value of the request path is further parsed, obtains magnetic disc ID in file path, and by the magnetic Disk ID is sent to database server;
The database server, it is used to receive the magnetic disc ID that the IIS Web servers are sent, and searching data storehouse is It is no to include the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, then returning to the magnetic disc shares path, IIS Web server parses the magnetic disc shares path again, obtains the specific path request of file, and send it to disk server; If it is not, then sending this file to client is not present message;
The disk server, it is used to receive the specific path request of file that the IIS Web servers are sent, according to described The specific path searching this document of file whether there is, if so, this document corresponding content is then returned to client, if it is not, then returning Message is not present in file;
Also include:
First detection means, its be used to monitoring the IIS Web servers whether normal operation;
Second detection device, its be used to monitoring the database server whether normal operation;
Multiple file servers, it is the file server that IIS Web servers separate according to business service, and it is corresponded to not respectively Same domain name addresses, the download request obtain corresponding IP by domain name mapping, IP mapping domain names address, then described Download request is sent to the file server of corresponding domain name addresses;The file server solves to the download request Analysis, the caching of the whether existing download request of file server internal memory is judged, if so, then directly that download request is corresponding slow Deposit content and return to client;If it is not, then further analysis request path parameter value, magnetic disc ID in file path is obtained, and by institute State magnetic disc ID and be sent to the database server.
4. file download system as claimed in claim 3, wherein, it is data cached that the database server includes Redis With SqlServer relational databases;
Wherein, the database server receives the magnetic disc ID that the IIS Web servers are sent, and delays first in Redis Whether deposit data library lookup caches the magnetic disc shares path for having mapping relations with the magnetic disc ID, if so, then by the disk Overlapping trees return to IIS Web servers, and it parses the magnetic disc shares path again, the specific path request of file are obtained, by it It is sent to disk server and carries out file download operation;
If not having magnetic disc ID corresponding data in the Redis cache databases, whether inquiry SqlServer relational databases Comprising the magnetic disc shares path with the magnetic disc ID with mapping relations, if so, the magnetic disc shares path then is returned into IIS Web server, it parses the magnetic disc shares path again, obtains the specific path request of file, sends it to disk server and enter Row file download operation;If it is not, then sending this file to client is not present message;
If do not found and the disk in the Redis cache databases and the SqlServer relational databases ID has the magnetic disc shares path of mapping relations, then sending this file to the client is not present message;
Wherein, the down operation supports breakpoint to download.
5. a kind of method of upper transmitting file, including:
Client sends upload request;
IIS Web servers receive the upload request, and the upload request, which is submitted, uploads file-related information, IIS servers Whether agreement is met to relevant information analysis judgment, if it is not, then returning;If so, inquiry request is then sent to database server;
The database server receives the inquiry request that the IIS Web servers are sent, and if not preassigning, then looks into The writeable magnetic disc ID collection included is looked in the database server, therefrom randomly selects magnetic disc shares road corresponding to a magnetic disc ID Footpath is back to IIS Web servers;If having preassigned magnetic disc ID, search the database server and whether there is and institute Stating magnetic disc ID has the magnetic disc shares road of mapping relations, if it is not, then to client send this file can not upload message, if so, Shared disk path corresponding to the magnetic disc ID is then returned into IIS Web servers, IIS Web servers obtain magnetic disc shares road Write request is sent behind footpath to disk server;
The disk server receives write request, completes file write operations, returns to file path and gives IIS servers, on Pass and complete.
6. the method for the upper transmitting file of kind as claimed in claim 5, wherein, described upload information is including in filename, file Hold, whether breakpoint transmission, file upload the information such as original position to file;Upload request also can upload path by specified file and join The magnetic disc ID of the predesignated file write-in of number;Wherein, the database server receives looking into for the IIS Web servers transmission Request is ask, if the inquiry request is inquiry writable disc request, is searched whether first in Redis cache databases comprising writeable Disk, if so, then randomly selecting a corresponding magnetic disc shares path returns to IIS Web servers;If it is not, then inquire about Whether SqlServer relational databases include writeable disk, if do not included, return file can not upload message, if bag Contain, then a corresponding magnetic disc shares path is randomly selected from corresponding result set and returns to IIS Web servers;IIS Web take Business device sends write request to disk server after obtaining magnetic disc shares path;It receives write request, completes file write-in Operation, return to file path and give IIS servers, upload and complete;
Wherein, described upload supports breakpoint transmission;
If the inquiry request is inquiry designated disk ID request, first the data cached library inquiries of Redis whether there is with The magnetic disc ID has the magnetic disc shares path of mapping relations, if so, the magnetic disc shares path is then returned into IIS Web servers, If it is not, then being searched in SqlServer database, if existing in the qlServer databases, the magnetic disc shares path is returned Return IIS Web servers;IIS Web servers obtain magnetic disc shares path and send write-in file request to disk server;IIS Web server sends write request to disk server after obtaining magnetic disc shares path;It receives write request, completes file Write operation, return to file path and give IIS servers, upload and complete;
Wherein, described upload supports breakpoint transmission;
If do not found in the Redis cache databases and the SqlServer database and there is the magnetic disc ID to have The magnetic disc shares path of mapping relations, then sending this file to client can not upload message.
7. a kind of system of upper transmitting file, including:
Client, it is used to send upload request;
IIS Web servers, it is used to receive the upload request, and the upload request, which is submitted, uploads file-related information, IIS Whether server meets agreement to relevant information analysis judgment, if it is not, then returning;
If so, inquiry request is then sent to database server;
The database server, it receives the inquiry request that described IIS Web servers are sent, if not preassigning, Then search the writeable magnetic disc ID collection included in the database server, therefrom randomly select a magnetic disc ID corresponding to disk be total to Enjoy path and be back to IIS Web servers;If having preassigned magnetic disc ID, search the database server and whether there is There is the magnetic disc shares path of mapping relations with the magnetic disc ID, if it is not, then to client send this file can not upload message, If so, shared disk path corresponding to the magnetic disc ID then is returned into IIS Web servers, IIS Web servers obtain disk Write request is sent after overlapping trees to disk server;
The disk server, it receives write request, completes file write operations, returns to file path and is taken to IIS Business device, uploads and completes.
8. the system of upper transmitting file as claimed in claim 7, wherein, in addition to:
First detection means, its be used to monitoring the IIS Web servers whether normal operation;
Second detection device, its be used to monitoring the database server whether normal operation;
The database includes Redis cache databases and SqlServer relational databases;
Wherein, the database server receives the inquiry request that the IIS Web servers are sent, if the inquiry request For inquiry writable disc request, search whether to include writeable disk first in Redis cache databases, if so, then randomly selecting one Magnetic disc shares path returns to IIS Web servers corresponding to individual;If it is not, then whether inquiry SqlServer relational databases include Writeable disk, if it is not, then return file can not upload message, if so, then being randomly selected from corresponding result set corresponding to one Magnetic disc shares path returns to IIS Web servers;IIS Web servers send write request to magnetic after obtaining magnetic disc shares path Disk server;It receives write request, completes file write operations, returns to file path and gives IIS servers, uploads and complete; Wherein, described upload supports breakpoint transmission;
If the inquiry request is inquiry designated disk ID request, first the data cached library inquiries of Redis whether there is with The magnetic disc ID has the magnetic disc shares path of mapping relations, if so, the magnetic disc shares path is then returned into IIS Web servers, If it is not, then being searched in SqlServer database, if existing in the SqlServer database, the magnetic disc shares path is returned Return IIS Web servers;IIS Web servers obtain magnetic disc shares path and send write-in file request to disk server;IIS Web server sends write request to disk server after obtaining magnetic disc shares path;It receives write request, completes file Write operation, return to file path and give IIS servers, upload and complete;
Wherein, described upload supports breakpoint transmission;
If do not found in the Redis cache databases and the SqlServer database and there is the magnetic disc ID to have The magnetic disc shares path of mapping relations, then sending this file to client can not upload message.
CN201510057145.XA 2015-02-03 2015-02-03 Upload and download the method and system of file Active CN104601724B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510057145.XA CN104601724B (en) 2015-02-03 2015-02-03 Upload and download the method and system of file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510057145.XA CN104601724B (en) 2015-02-03 2015-02-03 Upload and download the method and system of file

Publications (2)

Publication Number Publication Date
CN104601724A CN104601724A (en) 2015-05-06
CN104601724B true CN104601724B (en) 2018-01-23

Family

ID=53127217

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510057145.XA Active CN104601724B (en) 2015-02-03 2015-02-03 Upload and download the method and system of file

Country Status (1)

Country Link
CN (1) CN104601724B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105391587B (en) * 2015-12-09 2018-06-19 上海斐讯数据通信技术有限公司 The Samba configuring management methods and system of a kind of network equipment
CN105763604B (en) * 2016-02-04 2019-03-19 四川长虹电器股份有限公司 Lightweight distributed file system and the method for restoring downloading file original name
CN106067896A (en) * 2016-05-30 2016-11-02 刘华英 File continuous transmission method and device
CN107122491B (en) * 2017-05-19 2020-12-15 深圳市优必选科技有限公司 Method for data interaction
WO2018218419A1 (en) * 2017-05-27 2018-12-06 福建联迪商用设备有限公司 Downloading method for improving download efficiency and downloading system thereof
CN109150998A (en) * 2018-08-01 2019-01-04 北京奇虎科技有限公司 Journal file processing system and method based on cloud test platform
CN109889568B (en) * 2018-12-29 2022-03-29 北京城市网邻信息技术有限公司 Data export method, server and system
CN111225032A (en) * 2019-12-19 2020-06-02 福建升腾资讯有限公司 Method, system, device and medium for separating application service and file service
CN111427724A (en) * 2020-03-20 2020-07-17 上海圣剑网络科技股份有限公司 Server security stabilization method and architecture thereof
CN114124925B (en) * 2020-08-25 2023-05-12 华为技术有限公司 E-mail synchronization method and electronic equipment
CN112437160B (en) * 2020-11-25 2022-06-07 中国电子科技集团公司第二十九研究所 Method and system for realizing real-time transmission processing of large file based on redis

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103078936A (en) * 2012-12-31 2013-05-01 网宿科技股份有限公司 Metadata hierarchical storage method and system for Global file system (GFS)-based distributed file system
EP2458506B1 (en) * 2010-11-30 2013-11-20 Open Text S.A. System and method for managing a cache using file system metadata
CN103986976A (en) * 2014-06-05 2014-08-13 北京赛维安讯科技发展有限公司 Content delivery network (CDN)-based transmission system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2458506B1 (en) * 2010-11-30 2013-11-20 Open Text S.A. System and method for managing a cache using file system metadata
CN103078936A (en) * 2012-12-31 2013-05-01 网宿科技股份有限公司 Metadata hierarchical storage method and system for Global file system (GFS)-based distributed file system
CN103986976A (en) * 2014-06-05 2014-08-13 北京赛维安讯科技发展有限公司 Content delivery network (CDN)-based transmission system and method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"StackOverflow的架构及存储,http://www.itpub.net/thread-1880348-1-1.html";jieforest;《ITPUB论坛》;ITPUB论坛;20140727;第1页 *
"The Achitecture of stackoverflow,https://speakerdeck.com/sklivvz/the-architecture-of-stackoverflow-developer-conference-2013";Marco Cecconi;《speakerdeck》;20131107;第7、24页 *

Also Published As

Publication number Publication date
CN104601724A (en) 2015-05-06

Similar Documents

Publication Publication Date Title
CN104601724B (en) Upload and download the method and system of file
CN102404378B (en) Streaming media distribution and transmission network system
US9575968B2 (en) Intelligent data delivery and storage based on data characteristics
US8880698B2 (en) Storage of content data in a peer-to-peer network
US8280987B2 (en) Cloud data persistence engine
US9165004B2 (en) Associated content system
US20150215405A1 (en) Methods of managing and storing distributed files based on information-centric network
US20090092124A1 (en) Network routing of endpoints to content based on content swarms
US20090063507A1 (en) Methods and apparatus for retrieving content
EP2410770A1 (en) Method, user node and server for requesting position information of resource on network
CN101449559A (en) Distributed storage
US20080275885A1 (en) Index server support to file sharing applications
EP2671165A1 (en) Asset management architecture for content delivery networks
US20230239376A1 (en) Request processing in a content delivery framework
US9253143B2 (en) Reverse subscriptions
US20150227534A1 (en) Method for processing data query using information-centric network
Lee et al. Towards a CDN over ICN.
CN110825838A (en) Object storage aggregation system and aggregation method thereof
Batista et al. Big videos on small networks. a hierarchical and distributed architecture for a video on demand distribution service
Korzun et al. Commercial Applications
KR20100055295A (en) System and method for contents delivery based on multiple content delivery network providers
KR20100054658A (en) System and method for contents delivery based on multiple content delivery network providers, and content server thereof
KR20100054657A (en) System and method for contents delivery based on multiple content delivery network providers, and content provider name server thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant