2

I have two Raspberry Pi's, and an old Linux box. Out of these three I want to create a reliable web server and a reliable MySQL server - however I need one of the Raspberry Pi's to be the main web server.

After having done some research, I have come up with a few scenarios that would provide both of those:

  1. Primary Raspberry Pi hosting web, Second Raspberry Pi hosting MySQL, Linux box backing up both every 15 minutes.

  2. Primary Raspberry Pi hosting web, Secondary Raspberry Pi hosting backup web, Linux box load balancing (some how?) and also hosting MySQL, then periodically backing MySQL up to an FTP server "in the cloud", should anything go wrong.

Which one of these two is the better idea, or can you think of something better yourself? How would I even start setting up a load balancer? I'd prefer to cut down CPU usage on the Linux box, as is is also used as a personal streaming server.

I also want to make the website as fast as possible, and would separating MySQL and Apache across a local network make that slower?

This is just for a personal site - I'm not expecting too much traffic. Thanks to anyone who can help.

Edit:

I forgot to mention - I'm serving Dynamic content through PHP, which is what is connecting to MySQL. The specs of the Linux box are OK-ish - it was a media centre Windows PC from about 2004, so it can handle stuff like live transcoding for Plex Media Centre. As far as I can remember it's a Core 2 Duo with 512 MB of DDR2 RAM.

1 Answer 1

1

Id host the database on the 'linux server', and host websites and php on both Pi's, loadbalancing with haproxy, it might be overkill for you, but its a great product to learn.

The database will work as hard as php demands, if the database takes too long to respond, php and apache will suffer.

HAProxy wont use much memory, and if your traffic is low, its CPU demand will be light, Id suggest running that on the linux server too.

Do you need to backup so often? If the content is dynamic, you might want to think about deploying it from a central location (your linux server), and use something like Git for source control, do incremental backups daily, full once a week perhaps?

4
  • I've updated my post for you.
    – Alfo
    Jul 16, 2012 at 12:34
  • Oh and why wouldn't you host a database on a Raspberry Pi? Given that it has a flash architecture wouldn't that make it faster than the Linux box that has a HDD?
    – Alfo
    Jul 16, 2012 at 12:43
  • Well I dont know what you are doing, so im guessing, but I thought that your linux server would have more physical memory, and that mysql would prefer to use that... Still very much depend on what you are doing with it. But yes if you arent doing much and the tables in memory are small, then the flash disks will be faster than HDDs...
    – Sirch
    Jul 16, 2012 at 12:54
  • I'm not sure how big the DB will turn out, but there are going to be a fair amount of queries for each page load (checking session tokens), as it's actually a personal web app that I might end opening up to a few friends.
    – Alfo
    Jul 16, 2012 at 13:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .