Brendan Posted June 27, 2006 Share Posted June 27, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/13045-server-management/ Share on other sites More sharing options...
adamwhiles Posted June 27, 2006 Share Posted June 27, 2006 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 soimage1.yourdomain.comimage2.yourdomain.comimage3.yourdomain.comimage4.yourdomain.comThen 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. Quote Link to comment https://forums.phpfreaks.com/topic/13045-server-management/#findComment-50194 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.