Testing Couchbase as a NoSQL Server

At home, I’m now running an auto failover cluster of Couchbase servers. It sounds impressive, but I actually have two networked desktop PCs, one a Windows 7 and the other a Linux Mint (a popular Ubuntu-derived Distro) box, each running Couchbase and working together as one. Failover means if one server stops working, the other takes the load.

The relative pros and cons of NoSQL v RDBMS (Relational Databases, e.g. MySQL) were discussed in Does Web Game Scalability Demand NoSQL? After writing that article, I decided to learn how to write software/websites that use NoSQL. As I’d looked at MemBase in that article, Couchbase (which has now replaced it) seemed a good place to start. There are, of course, others.

Setting up Couchbase is straightforward, but you must use a static network IP address or else Couchbase will go badly wrong when the IP address is changed.  You’ll lose all your data just like I did. That’s because the IP addresses were given out by DHCP and periodically change.

On my home network, I set the individual computers to have a static address of 192.168.1.x where x is a unique number between 1 and 255 for each computer. The DSL router/switch picked this up, so DHCP wasn’t used. So, it’s all safe.

Once it was up and running on one PC, the “getting started” setup created a default bucket for me. Bucket is a generic computing term for storage, but here it means the equivalent of a database.

There are two bucket types − memcached or Couchbase. The first bucket holds in-memory, quickly accessed data that is not persisted (saved to disk) or replicated between nodes. You’d use memcached for temporary storage − nothing that needs to be saved, such as session ids. The Couchbase buckets, though, are for real data that must be saved and retrieved.

There are five different SDKs (Software Development Kits): one each for the Java, .NET, PHP, Ruby and C languages that are supported in Couchbase 1.8, the current stable release. A Python SDK will be added to Couchbase version 2.0, which is nearly ready for release.

For the PHP client, you must install the C client library first and then the PHP. Note that currently there isn’t a Couchbase client library for PHP on Windows. I’ll be using my Linux Mint server for writing the PHP/Couchbase.

In my next article on Couchbase, I’ll show how to store and retrieve data so you can access it from PHP. If you’re impatient, I’ve written Couchbase C# tutorials with source code in the second tutorial.

I had been hoping to use Couchbase for my games projects, which run on Windows/PHP, so that’s now unlikely. Plan B is to go Linux, which would work, and use Mono for the main processing. There’s also Plan C, which is to stay on Windows and use MongoDB instead. I’m more and more leaning toward Linux.

Related Links

Comments

  1. Pingback: A NoSQL Alternative: Disk Folders - Dice News

Post a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>