Answer the question
In order to leave comments, you need to log in
How to store references to static files when host, storage can be changed?
A conditional example, a mini startup, files on the local machine, the extension is going on, the files go to the cloud. There, most likely, not only the host will be changed, but also the entire or partial path and name of the file.
So it hardly makes sense to store a link in the database, most likely to generate dynamically constantly based on the name, format, host. The name is easier to save than the entire structure. That is, spit all the videos in the video folder and photos in the photo folder, then search by name and that's all. There will be something like FILE_SERVER_HOST + FILE_NAME + FILE_FORMAT
1 - How to keep a reference to a file when moving it to different storages?
2 - when there are 2+ servers and both have a file, we need to give the user a file from a server that is less loaded, where can we get a link to the file?
We are talking about video, then photos, and finally everything else.
Answer the question
In order to leave comments, you need to log in
1. Using the S3 protocol, store in different buckets. Bucket - storage. And the path to the file separately. When a bucket is replaced, replace all buckets of files (in RDBMS) or links to them if there is a link table.
2. Load balancing is used. S3 providers already have this built in.
Search by title in site search: using full-text engines. But the structure of the paths in the repository should not be based on the names of the files. The name and other meta-data should be stored in the DBMS, and the file name is better used for the convenience of using the hierarchy in the repository.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question