Jump to content

Server Management


Brendan

Recommended Posts

I have a question involving database and server management. I have a community website in which songs and pictures can be uploaded, and blogs can be created with mysql. Eventually if all goes well, there will be need for multiple servers. Now i need to know how to prepare in advance for an increase in servers, so when people upload files to the servers, i will know which server each file is on, and also i need to know if i would need multiple sql databases if it were to get very big?

When you go to big sites such as myspace, you will see that pictures and songs are stored on seperate servers such as imageserver1.domain.com, imageserver2.domain.com. Now i need to know how to store the pictures on different servers when i upload it with php, and when the pictures are viewed how to look at the right server to view the picture.

How do these proffesional websited do it? I want to do it in the most practicle way possible.

Thanks
Link to comment
Share on other sites

Well about the how to know what server its on would be easy i think. I don't know how big sites do it, but this is how I would do it:

create a .txt file with my servers in it like so

image1.yourdomain.com
image2.yourdomain.com
image3.yourdomain.com
image4.yourdomain.com

Then I would pick a random server from that with php, so it divides up the pictures across the server:
$servers = "servers.txt";

$all_servers = file("$servers");
$ran_server = rand(0, sizeof($all_servers)-1);
$random_server = $ran_servers[$all_servers];

then $random_server would hold whatever server it chose and you could use that in your upload script and also put it into the database so you would know what server to use to link the image later.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.