2

I'm setting up load balacing for the first time and have some questions about syncing codes, static files and database. My server is Ubuntu 12.4 and going to use rackspace cloud load balancing.

  1. For code, I can probably use git to sync all files. Also read about using rsync to run automatically and sync code files in different servers.

  2. Static files: I'm planning on using S3, so they are shared among servers. Another option is to use rsync to sync static files stored in servers.

  3. My question is syncing database. If there are two separate servers running MySQL, how can I sync them? My guess is that I should have a remote SQL server so both servers can have access to them. Is this the only way or the recommended way to make database to work with different servers?

DavidL
  • 1,260
  • 2
  • 17
  • 35

2 Answers2

1

My organization uses a similar setup, but we have a server dedicated to be the MySQL server, all others connect to it as needed and there's no need to sync.

For files between the servers, we use lsync. Rackspace can set this up for you if you have Managed service

Edit:

Another thing, I forgot to mention, we use an NFS share for a portion of the filesystem that needs to remain identical at all times, and cannot wait for lsync to figure out that it has changed. For everything else, lsync works fine.

lsync uses rsync to do transfers and inotify to catch changes

MySQL does have a way to sync 2 databases, but we prefer the above setup because it is easier to maintain.

David Wilkins
  • 574
  • 4
  • 19
0

Set up a different server for your database.

As you're using Rackspace, use a Rackspace Cloud Database.

We've got the same setup as you've described, Cloud Servers behind a Load Balancer using S3 for shared files and a cloud DB accessed by all servers

Pete
  • 4,542
  • 9
  • 43
  • 76