December 23, 2020

Building a Database Menagerie...

Wouldn't it be nice to have a database that just runs and runs, no matter what? Let's create a geographically dispersible database, using cheap tiny computers - a menagerie of different PCs.

Building a Database Menagerie...
  • This is a work-in-progress: last change: 01/14/2021

Wouldn't it be nice to have a database that just runs and runs, no matter what? Let's create a geographically dispersible database, using cheap tiny computers - a menagerie of different PCs.

Why would I want to do this?  Well, databases are great, but if your server fails your database is usually stuck, and it's a mad scramble to fix it. It sucks. And getting it going again is always a mess.

What if we could have a database that just keeps running, even if one (or more) servers fail; what if they could all run on cheap hardware or in the cloud, and if they could be geographically spread around so a power or system failure in one is not a failure of the whole database, then we all win.

The database software choice

My choice of database software was a crucial part of this decision.

  • I needed something that could run on a variety of machines (and/or in the cloud).  
  • I like the simplicity of NoSQL, which scales very well.
  • But I kept coming back to SQL and relational databases - better transactions, better consistency, more transactional features, etc.
  • But most SQL system do not scale well, or scale only with add-ons and complex sharding techniques.  
  • I wanted software that scaled easily, and could run on more than one cloud provider at once.
  • I needed something that could automatically survive failure - both hardware and software failures. And I wanted it able to automatically recover from that failure once fixed.
  • It needed it to be easy-to-deploy and maintain (no maintenance is even better).
  • I needed something straddling the line between a relational and a NoSQL database - was I crazy?
  • This is really a religious discussion, and worthy of many articles.  :-)

In the end, I chose the awesome CockroachDB.  This easily scales to hundreds of servers, uses standard PCs and/or mega-core monsters, uses standard SQL, handles failure and recovery automatically, distributes workload for faster results, and has a free/open-source version. And it has worked extremely well in my setup.  Winner Winner Chicken Dinner.

These articles

I went through a number of trials over a year to get to the end result, so I needed to boil it all down.  We'll start with a blank computer and go from there to a working database cluster.

This will be a series of short articles, with this one the starting point to the details.  In other words, it's the...

Table of Contents

  1. Hardware Choices (with price & speed comparisons)
  2. Hardware Setup
  3. Operating System Setup
  4. Supporting Software Setup
  5. Database Software Setup
  6. Now what?

Let me know what you think!

Comments powered by Talkyard.

Buy Me A Coffee