Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hello guys i need some information on how to setup 2 servers for my website.

My website now runs on one remote dedicated server. apache, mysql, mail all in the same machine.

Traffic is growing and i think its time to get another remote dedicated server to handle the database.

I am an experienced programmer but i have little experience in hardware stuff so i could really use your helpfull information or you can point me to a good how-to article.

How the web-server will comunicate with the database server? They should be in lan so the web server can call the database like 127.0.0.x??? or the database server must have a separate ip address/domain ??

What are the basics concerns that i should know?? (security, remote administration, trusted connections)

i know its a big topic, i hope you can give me some brief details and/or give me some usefull links. i already tried googling but i couldnt find a good how-to.

thank you

share|improve this question

migrated from webmasters.stackexchange.com Nov 8 '10 at 12:42

This question came from our site for pro webmasters.

add comment

3 Answers

When you apply for the second dedicated server ask the admins to give you a local IP address(probably something like 192.168.x.y) and port for it, and just modify your current connection setting to use the new host and port.

But my real advice is to first try to locate were your bottlenecks are. A code optimization may be more worthy than taking new server. It may appear that the problem is not in the DB but in the files serving (just an example) or you have some slow queries that can be speeded up.

I`ll be glad to if you do a check and tell me the results.

share|improve this answer
    
code is light, optimization in code is in really good levels, i am working on some tuning on mysql right now but traffic is growing very quickly i think next week server will start to fail if i dont get a db server. thank you a lot for your answer, i know its a big topic, and i would be glad if you can point me to a good article/how-to so i can read and so i will not trouble you :) :) –  kari_kari Nov 8 '10 at 10:58
    
As you haven`t said what is your system php, python, java etc. I can not give you a specific tool for profiling but try these things: profile to see which parts of your code are slow, and also check for "fast" piece of code that are frequently executed. You can use even a tool like Google Analytics to check for heavy loaded pages. You can also try some caching methods. Hope this helps. –  Ilian Iliev Nov 8 '10 at 11:33
add comment

Hey kari_kari, I think this question would be better fit into server fault community.

share|improve this answer
    
you are correct im re-posting this to server fault. how can i delete it from here? –  kari_kari Nov 8 '10 at 10:55
    
or maybe it should not be deleted, Ilian Iliev answer is helpfull i dont think its good to lose this answer maybe it can help other people also :) –  kari_kari Nov 8 '10 at 11:02
    
@kari_kari Yes, let it here. I also think you can keep a link in server fault's question to this question with a short mention to about what you've got so far =] –  Dave Nov 8 '10 at 11:03
add comment

kari_kari: its impossible to give a detailled answer without knowing what OS this runs on and what software you are using. But.....

Moving to a clustered solution from a single server setup you are going to find that's there's lots of stuff you need to think about - not least keeping your configs, data and code in sync. But with only 2 machines, its probably not worth the effort of using cluster management software.

I'd strongly recommend that you start by setting up a couple of virtual machines on your local machine so you can try out deploying and managing the 2 systems.

Next thing to think about is what software you run where. splitting the web and DB functionality across 2 machines means that you actually double the probability of a complete outage. OTOH if you set up the 2 machines as both a webserver and database server (with appropriate replication) then the resultant probability of failure is massively reduced - putting some hard numbers on this, if PF=0.001 (or 0.1%) then the architecture you propose has a net PF = 0.001 + 0.001. OTOH if both systems are capable of running in the event of the failure of its counter-part, the net PF =0.001 X 0.001 = 0.000001, or 2000 times more reliable!

But you do need to put some thought into session replication, and mysql replication (master-master is preferable, but master-slave may be more appropriate in some cases).

Regarding mail - I would recommend setting up the second machine as the secondary MX - but only run POP/IMAP services on the primary MX.

Do configure individual ip names for each service/machine combination (this will give you some flexibility later).

For the database failover - until you're very sure that you can automate it fully, do not allow automatic recovery from a failover - however the initial failover should occur quickly and preferably fully automated. Switching ip addresses on a hosted system is not something that most hosting companies will be comfortable with, let alone facilitate - I'd go with implementing the failover (though not necessarily the failover detection) in the application (you don't say what language(s) the site is developed in).

There are lots of guides and discussion of mysql replication elsewhere on the internet. Similar for a secondary MX. As for the webservers - its just a matter of running the same config on both machines and referencing both address in the webservers A DNS records. (Google for Round Robin DNS)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.