Results 1 to 9 of 9
  1. #1

    * Database Question - How to run one DB on two servers?

    I have a popular site and wish to run one database on two servers.

    Is there a way to do this without changing the too much of the coding on my site?

    Is there a way 2 servers can act as one to house this database?

  2. #2
    Join Date
    Jan 2006
    Is this a PHP script which will run on each site and make a call to the database host on a single server ??? Is this a mysql db ?

    If so, the PHP script should have a config file which you can edit to point to a remote server hosting your db.

  3. #3
    It is one single site. Using PHP and MySQL.

    The config file allows me to configure the MySQL server host and all that.

  4. #4
    Join Date
    Jan 2004
    North Yorkshire, UK
    You can either:

    1) Put some tables on one server, and other tables on the other machine (will require quite a bit of modification to your code).
    2) Setup MySQL cluster (complicated & you will probably need a MySQL expert to configure it for you).



  5. #5
    Join Date
    Mar 2003
    California USA
    You can run a mysql replication slave and do reads from it and writes on the master which would require some php code changes.

    Or you could do a mysql cluster (my suggestion) as dan suggested.

    it would require a few servers but is very scalable. I have used them on a few big sites with success. The only downside is you have to have a TON of ram on the storage nodes.
    Steven Ciaburri | Proactive Linux Server Management -
    Managed Servers (AS62710), Server Management, and Security Auditing.

  6. #6
    Mysql clusters also requires alot of code changes as some code will bring up the load on the cluster for no reason. We are running a few and it takes alot of tweaking and trimming of your code as well as the database itself to make it work properly.

    Also as Steven said you need a TON of ram as it multiples the size of your database exponentially.

  7. #7
    Join Date
    Oct 2006
    why not just run the database on one server....and run the website on the other server.

  8. #8
    Join Date
    Apr 2005
    What is your current setup like? With that in mind we can probably give you a better way to improve your site speeds and be ready for more growth while avoiding having to make too many crazy changes.


  9. #9
    Join Date
    Nov 2006
    College Station, TX
    The way I've done this in the past is that I set up a MySQL slave and a master. In the database abstraction, (a script include that wraps around mysql_query and provides additional functionality) all updates go to the master, all selects get randomly sent to the master or the slave. Don't weight them more heavily towards the slave, because the slave still needs to update it's *own* database (replication) from the master and do the insert and update operations.

    The problem is that after you pass a master/slave duo, you start to lose capacity at an exponential rate because of the replication overhead. Google for 'livejournal cluster presentation', it describes what I mean.

    A better solution might be to use something like memcached to cache frequently used database responses.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts