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.

I am currently looking to autoscale my wordpress installation on Amazon EC2. Everything is working, I can bundle my EBS instance, put some policy and then amazon run automatically instances behind my loadbalancer if needed.

But If i had a plugin on wordpress, it will not be installed on every instance. My wish is that when I install a plugin for it to also installed automatically on the others servers.

What can I do you for this? Have you any idea ?

share|improve this question

2 Answers 2

There are two aspects to your question:

  1. How do you keep data/files in sync across multiple instances
  2. How do you bring up new nodes that follow the same 'rules'.

Syncing:

Installing a Wordpress plugin makes changes to the files and database. Therefore, to mimic the changes across all your servers, you will need to modify both the files and databases of each instance. The specific implementation will be dependent on whether all your instances are identical (i.e. all run both a web server and database server) or if you run your web servers and database servers on different instances.

There is likely a good argument to be made for running one instance with your web server (and then autoscaling that instance) and another instance with your database server (e.g. http://www.mysqlperformanceblog.com/2006/10/16/should-mysql-and-web-server-share-the-same-box/ ). Of course, as soon as you autoscale databases, you run into the issue of keeping the data consistent across all instances.

Syncing Files: The simplest solution to synchronizing the data is to use rsync. You can have it run periodically (via cron), or can trigger it using incron, which will allow it to run when the contents of directories change. Another option lsyncd which uses inotify to monitor changes to a directory and trigger rsync.

Another approach to file synchronization is to use network/distributed/cluster file systems. For instance, you can use Gluster to keep replicated (multiple copies) and/or distributed (spread out).

You will also probably want to share your PHP sessions between your nodes.

Syncing Databases: Arguably, keeping the files in sync is the easy part. Keeping databases in sync is more of a challenge. When used with a varying number of nodes, the difficulty increases.

  • The simplest solution is to just have your databases on a separate instance.
  • Replication is the common solution - but maintaining a master node when you are not certain which instance will be terminated is a problem. If you are using a configuration framework, you may have an easier time controlling this. Using something such as 'pacemaker' (from Linux-HA) may also help on this front. Or just keep the master node out of the auto-scaling group (but that would make it a single point of failure).
  • MySQL cluster has some promise, but I don't know if WordPress will run on NDBCluster (it also requires a management node).
  • There are some claims of MySQL running on a shared file system (specifically Gluster) - it may work, but I wouldn't put a lot of faith in it.

I would recommend using a separate MySQL instance, and one of the rsync based scripts (probably lsyncd) to keep the files in sync. Autoscale your web servers, and it will probably be a while before you need to worry about the database server. If you autoscale the database, keep the master node out of the group, and scale the slaves.

Deployment:

On this front, you may want slight differences in each node (e.g. one a master, one a slave, etc). Frameworks (as mentioned in voretaq7's answer) would be the way to go here. In many ways, the better your implementation, the less need you have for auto-scaling though. One setup might include Corosync and Pacemaker to monitor the state of each node and the services running on it - to choose a master node, and then to run a script to scale your cluster as needed.

share|improve this answer

Investigate deployment and configuration management frameworks (Puppet, Chef, radmind).
Manage your back-end instances so they are identical, and let the elastic load balancer figure out which client goes where.

share|improve this answer
    
Ok so there is no other solution... Do you know also Cfengine ? is it better than Puppet ? Thanks ! –  Clabman Dec 6 '11 at 20:10
2  
There are lots of other solutions -- This is the one I chose to suggest. Your mileage may vary. Offer permitted where void. :) –  voretaq7 Dec 6 '11 at 20:58

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.