开发者

Should data files be stored on the same computer (server) the database is stored in?

开发者 https://www.devze.com 2023-03-08 07:19 出处:网络
Currently in our research group, we have many \"data files\" stored on three servers and a couple of personal computers running different operating systems.

Currently in our research group, we have many "data files" stored on three servers and a couple of personal computers running different operating systems.

We want to build a database, which would store some information in addition to the URLs of those various "data files". My question is, do we have to copy all the data files and put them in a directory in the same server the database is开发者_运维技巧 in? Or can they be left as they are on the different computers? If the second case is ok, what would be the format of the url of the "data files"?


It really depends on what your intended goal is and what your current setup is like

  • If the files are currently sitting somewhere on the network, and you need a path that the application can use to access them, you just need to store the network path (\\server\share\file for Windows environments) in the database, then read it and access that path to access the files. You'll need to make sure everyone has read access to them.

  • If the files are currently accessible through a website URL, internal or external, then again, you just need to store that URL (or some portion thereof) (http://mywebsite.com/myfile or http://servername/myfile) and access that.

  • If either of the above are not currently true, but you want them to be, then you'll need to set up a new share/webserver and put the files there. There's no requirement that this be the same server as the database, but it'd make for better backups if it was.

  • If you want the files themselves to be in the database, you should check out Bob Fanger's link.


Not sure what you're asking here but...

If you want your database engine to read files filled with data, it probably doesn't matter where they are stored - though this may depend on the database you are using. Are you using MySQL? MS-SQL Server? Oracle?

Many database vendors provide relatively easy-to-use admin tools that would let you choose a file to be loaded, and usually the file chooser dialoge lets you browse networks so you could load a file over the network. Details on how to do this vary so consult the manual for your database engine for loading data from a pre-existing file.

Be aware that if the database is on Computer A and the data is being loaded from Computer B over the network, it will probably be slower than if the data was on the same computer as the database.


It doesn't really matter if the files are stored outside the database anyway.

See Storing Images in DB - Yea or Nay? for more thoughts on that one.

If the files accessible by an url, you can store that with the meta data, like
http://server1/folder/file.ext, file://\server1\folder\file.ext or "file://P:\folder\file.ext"

Things to consider:

  • Backups
  • Performance
  • Synchronisation between the meta-data and the data
0

精彩评论

暂无评论...
验证码 换一张
取 消