Professional Web Applications Themes

Storage strategies/NAS/NFS - MySQL

Hi all, we are faced with a little problem that, I'm sure, had some others before. Short description: We run a webserver and currently it's a single-machine-server. Soon we want to switch to a two-machine-systeme with a load balancer. All static data will be stored on a NAS. So far, no problems. The trouble begins with mysql. In the single server enviroment there is no problem, but what to do with two servers. First idea: a "global" data directory on the NAS. Performance-wise that wouldn't be a problem. The bandwith needed for the db-apps is quite small (DB-Connects occurs only ...

  1. #1

    Default Storage strategies/NAS/NFS

    Hi all,


    we are faced with a little problem that, I'm sure, had some others before.

    Short description: We run a webserver and currently it's a
    single-machine-server. Soon we want to switch to a two-machine-systeme
    with a load balancer. All static data will be stored on a NAS.
    So far, no problems.

    The trouble begins with mysql.
    In the single server enviroment there is no problem, but what to do with
    two servers.

    First idea: a "global" data directory on the NAS. Performance-wise that
    wouldn't be a problem. The bandwith needed for the db-apps is quite
    small (DB-Connects occurs only within the Content Management System,
    which writes complete files for the web services), But two
    mysql-machines writing in one nfs-directory? Doesn't sound like a good
    idea to me :-( (Or is it possible?)

    Second idea: data directory remains on the NAS, but only one server
    holds a mysql-server. The load balancer would switch db-related services
    only to this machine. But that isn't a good idea either, because the two
    servers should provide reliability. But if the server with mysql cracks,
    the second would be without mysql-support.

    First conclusion: On the second machine a mysql runs "on demand". If the
    first one (on the other server) stops running, it would take over the
    mysql-work. Possible? If yes, how?

    Second Conclusion: mysql cluster. In this case, the data directory
    wouldn't be on NAS, but on the two servers. Problem: We'd need a
    management node. But on what machine? Second problem: Our databases
    aren't that big, but it's still enough to "steal" valuable memory with
    the "shared nothing" strategy and database only in memory. Since 5.1 it
    can be disk-based, but we don't want to run a beta version on a
    productive system.

    So, any hints how we can solve this delimma?
    Marco Guest

  2. #2

    Default Re: Storage strategies/NAS/NFS

    Hi Marco,

    What I would do is the following since you have to grow and you
    mentioned you need a second web-server:

    -2 webservers in the DMZ with the load balancer in front of them.
    -one firewall between your DMZ and your "back-end"
    -1 server sunning your DB (keep the files on your NAS)

    Configure both webservers to connect remotely to the MYSQL server.

    THis allows you to grow the "web-server" part of your app without
    affecting your back-end. So you can add a 3rd, 4rth, 5th without a hitch
    in the future.

    Now as for the DB end its a standalone server just running your DB.
    Seeing as its dedicated to DB stuff, it should serve you for a while.
    (We have 5 apps from 4 different web-servers running their DB stuff on a
    2CPU 4GB DB-server). However, if you ever believe you need more power,
    then you can look into mysql clustering..etc...


    Christos Kalantzis
    Senior Database Administrator, System Administrator
    Intertrade Systems Inc.

    Marco Helgert wrote: 
    Christos Guest

  3. #3

    Default Re: Storage strategies/NAS/NFS

    Thank you Christos

    since authoring the post I found out some other aspects.
    We will go exactly the way you mentioned, so one server is for the
    database alone.
    But with one important difference:
    Another Server (the most powerfull) runs mysqld, too, but as slave. If
    the DB-server cracks, this machine runs as DB-Server. It's a bit tricky
    to get it work with die changing ips, but it's running ;)

    Thanks again,
    Marco

    Christos Kalantzis schrieb: [/ref]
    Marco Guest

  4. #4

    Default Re: Storage strategies/NAS/NFS

    Hey Marco,

    Yup, a "warm-spare" is a great idea..we are going to implement that too.
    Plus if you want to balance some of the load, you can have "SELECT"
    only queries, such as reports, run off of the slave, that way your LIVE
    server doesn't get affected by long complex reports that some companies
    (such as mine :-( ) runs.

    Cheers

    Christos



    Marco Helgert wrote: [/ref][/ref]
    Christos Guest

  5. #5

    Default Re: Storage strategies/NAS/NFS

    Marco Helgert <com> wrote: 

    There are several possible setups. Which one is best, depends on
    your needs. Do you want more performance, more reliability or both?
    Do you experience problems now?
     

    Putting MySQLs datadir on NAS is not recommended. MySQL uses the
    file system in a very NAS-infriendly way. You may experience heavy
    performance degradation.
     

    You cannot have two mysqld processes working on the same datadir
    (if that was your question).
     

    If you want maximum reliability, you should avoid single points of
    failure. Both your load balancer and your NAS box are SPOFs.

    If your goal is availability, you can configure the two machines as
    a cluster. Just put *all* your data onto the NAS box and access it by
    only one of the servers. In case of failure, switch to the second one.
    If you're running Linux, you could use the Heartbeat [1] stuff. All
    your tables *must* be InnoDB, otherwise the failover would take very
    long (the second mysqld has to recover from a dirty tablespace).
    If you want to avoid the NAS SPOF, you can use DRBD [2] to share the
    data between the two servers. The load balancer ist not neccessary
    anyway (heartbeat will put the service IP address on the active node)


    [1] http://www.linux-ha.org/
    [2] http://www.drbd.org/


    XL
    --
    Axel Schwenke, Senior Software Developer, MySQL AB

    Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
    MySQL User Forums: http://forums.mysql.com/
    Axel Guest

Similar Threads

  1. flexible scope strategies for include()
    By lawrence in forum PHP Development
    Replies: 0
    Last Post: October 23rd, 07:52 PM
  2. Performance / Design Strategies
    By Mike D in forum FileMaker
    Replies: 4
    Last Post: October 18th, 06:24 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139