Is it possible to define two databases for one installation?

What you’re talking about is a database fallback. It’s possible to set something like this up, but not directly with WordPress.

How it would work

Instead of accessing the database directly, you’d access a proxy. This proxy would sit in front of both your primary and backup databases and pass traffic through. Essentially, it would work as a load balancer for your databases.

If traffic spikes and your primary DB goes down, the proxy would forward traffic instead to your backup.

There are several problems with this approach, though, in terms of data consistency and maintenance. I recommend, if you intend to pursue this, to contract with a good sysadmin or host to configure everything for you.

A better way

If you’re concerned about a traffic hike killing the database, I recommend you instead set up a caching system. I use W3 Total Cache on my own sites. It caches requests to the database so that they don’t need to hit the database each time.

Unless I’m actively changing the site, serving cached data is find. It saves on DB traffic and insulates my sites from performance issues when traffic spikes.

Leave a Comment