Database Servers and File Storage Servers

I am creating a web application with the ability to download some static data and need some advice.

In the beginning I would like to use the internal disk, however, if the data grows, I plan to use Amazon S3 as a file storage, I believe that I will need several containers for storing files - maybe I will use some other CDN providers.

In addition, I have the following database structure:

CREATE TABLE IF NOT EXISTS `storage_servers` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) NOT NULL , `ip` INT(20) NOT NULL , `access_url` LONGTEXT NULL DEFAULT NULL , // storing server access URL `username` LONGTEXT NULL DEFAULT NULL , //storing server username `password` LONGTEXT NULL DEFAULT NULL , // storing server password `token` LONGTEXT NULL DEFAULT NULL , // storing server access token, if any PRIMARY KEY (`id`) ) ENGINE = InnoDB;' CREATE TABLE IF NOT EXISTS .`storage_servers_files` ( `server_id` INT NOT NULL , `file_id` BIGINT(25) NOT NULL , INDEX `fk_servers_files_1` (`file_id` ASC) , INDEX `fk_servers_files_2` (`server_id` ASC) , CONSTRAINT `fk_servers_files_1` FOREIGN KEY (`file_id` ) REFERENCES `files` (`id` ) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_servers_files_2` FOREIGN KEY (`server_id` ) REFERENCES `storage_servers` (`id` ) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; 

However, I am not a user if my approach is fair in this matter.

As far as I know, I need to create subdomains for each individual storage container (cdn1.example.com, cdn2.example.com ... cdn15.example.com). How could you create tables for this?

My other thought was to completely delete the storage_servers and storage_servers_files and just ... create a server field in the files table and then save the subdomain name. The configuration should then be stored in the configuration file.

Isn't that too hard?

+4
source share
2 answers

A few suggestions -

With S3, you do not need several containers or buckets just to grow in size. S3 Buckets contain an unlimited number of objects (for unlimited, I mean that you probably do not have enough storage items or money to pay before AWS runs out of space). The reason for creating multiple buckets for different areas of applications or security. Using AWS IAM, you can restrict access to buckets to specific applications or users.

In this case, if you have only one application with one bucket, you may want to save your security settings in the configuration.

In addition, in my experience, over time, many people can access your database (developers, analysts, project managers, database administrators, etc.). Access to the control source and servers are generally more limited, and changes are tracked better. For this reason, I prefer to store passwords and tokens from the database where possible.

If you switch to CDN in the future, you will still need a source for your CDN files.

Not sure what your ip column is for, but you can use DnsName instead of ip, as the IP address can change a lot (especially with AWS).

+1
source

No, he is not overloaded. It looks like your design is fine with me.

0
source

All Articles