Subscribe to RSS Subscribe to Comments

My So-Called Blog

ISBN 978-1-8479-9168-3

A little over a year since the project to write this book began, the MySQL 5.1 Cluster Certification Study Guide is now at long last available. It covers everything you’ll need to know to pass the Certified MySQL Cluster 5.1 Database Administrator exam, including MySQL Cluster Concepts, Architecture, Configuration, Deployment, NDB Internals basics, High Availability techniques, Security Issues, and more.

(It does not cover MySQL Cluster 5.1 Carrier Grade Edition, for the simple reason that MCCGE features are not part of the official mainline MySQL 5.1 release. However, those features will be part of MySQL 6.0 [yes, MySQL 6.0 is already starting to happen, and there are already some cool new Cluster, Replication, and XML features in the 6.0 tree, but I’m starting to get off-topic here…], and there’s a good chance that there will be a 6.0 version of the certification course and book in a year or so.)

In addition to yours truly, the authors include NDB developer Stewart Smith, Pro MySQL author Mike Kruckenberg, and MySQL training course developer (and former MySQL certification exam developer) Roland Bouman. Roland also helped me edit and index. (Did I mention that this is my first official Editor credit? Yay.)

You can order your copy here, and still have time to read it and then get certified on MySQL 5.1 Cluster before MySQL 5.1 is GA.

Prototype NDB API Binding for Perl

Ross McFarland recently posted to the Cluster mailing list about a Perl binding that he’s been working on for the NDB API. Ross says that it’s just a proof of concept, and at this point nowhere near complete, but is inviting folks to download it and take it for a spin. I’m not a Perl hacker myself, but I’d be interested in hearing your reaction or if you’re doing something interesting with this.

Of course, if you’re working on your own port of the NDB API to some other language - say, PHP, Python, or (heh) even JavaScript - I’d love to hear about it.

How to Generate a Connectstring with ndb_config

As I mentioned a few days ago, I’ve been working recently on documenting the Cluster utilities; I’m still working on ndb_config, but should get that into the Manual Real Soon Now™. In the meantime, here’s a tip I received from one of the developers. This generates a connectstring for use with data, SQL, or API nodes, using ndb_config, which you should be able to find in your mysql/bin directory:

ndb_config −−config-file=path/to/config.ini −−query=hostname,portnumber −−fields=: −−rows=, −−type=ndb_mgmd

For this to work, you need to have the Cluster management server running, with a viable config.ini at the location specified by path/to/config.ini.

Hope that someone finds this useful.

International PHP Cluster Disk Data Article

International PHP Magazine - Sept. '06 (cover)I’ve had an introductory article to MySQL Cluster 5.1 Disk Data published in the September 2006 issue of International PHP Magazine.

If you’re using Cluster or you’re interested in doing so, and you’ve not yet tried out MySQL 5.1, you’ll find that disk data storage makes MySQL Cluster more flexible, scalable, and cheaper to run than MySQL 4.1 and 5.0 Cluster. In the article, I’ve outlined some reasons why this is so. The article covers the basics of creating disk-based Cluster tables, and discusses some Disk Data do’s and dont’s. There’s also some info about some other improvements to MySQL Cluster that are being made in 5.1, as well as some diagrams and sample PHP5 code for accessing a MySQL Cluster. Just in case you’re not that familiar with setting up a MySQL Cluster, I’ve also included a quick setup guide to help you get started.

You can read more about the article or download the PDF version from the International PHP September TOC page. A single issue is €4.00 or you can get a year’s subscription for €42.00.

NDB API Examples Updated and Expanded

Recently, MySQL Cluster developer and team leader Martin Sköld committed some major revisions and additions in the storage/ndb/ndbapi-examples directory of the MySQL 5.1 source. Although I don’t think these have yet been pushed out to the public 5.1 tree, I went ahead late last week and added them to the Practical Examples section of the NDB API Guide so that interested parties can take advantage of a number of corrections and other improvelements that Martin’s made.

There’s two new additions, also — here and here — these demonstrate for the first time in the Guide the use of the API with multiple clusters. You might find these particularly useful if you’re interested in rolling your own application-level partitioning and/or replication for Cluster.

Martin’s also updated the makefiles for all of the examples. These aren’t currently included in the Guide, but if you’re interested in having them added, let me know in a comment and I’ll see what I can do about it.

Cluster Utilities Revealed

Ever wonder what all those binaries with names starting in “ndb” were doing in mysql/bin? Not surprisingly, they’re MySQL Cluster monitoring, utility, and demonstration programs, and after a couple of fun-filled weeks of experimenting with them (and asking a few of the usual sorts of silly questions I’m know for asking in the right quarters) I’ve been able to document most of them in a new Cluster Utility Programs section of the MySQL Manual (I’ve linked to the 5.1 version, but they’re available in 4.1 and 5.0, too).

If you’ve not looked at these before, check them out. A couple of them — like ndb_waiter and ndb_desc — are handy for monitoring a MySQL Cluster or getting information about NDB tables and other Cluster data objects; others — such as ndb_select_all and ndb_delete_all — can accomplish some basic maintenance tasks on large tables, sometimes faster than can be done using mysqld. And if you’re interested in writing Cluster apps against the NDB API, you’ll find that these might provide some nice examples to help get you started.

I’ve not yet added a description of ndb_config to the Manual, but I’ll try my best to do so in the next day or two. Otherwise, the list of utilities that have been documetned in the MySQL Manual is fairly complete.

API vs SQL, DB vs Data

I did a bunch of housekeeping in the MySQL Cluster documentation today.

Confession: I’m the bright light who came up with the term “SQL node” because I didn’t like “API node”. At the time, it seemed like a good idea, but as time has gone on, I’ve come to see the error of my ways. However, lots of people now use the term, so I guess it’s not a good idea to change it out from under them. So here’s what I’ve decided:

API node - Any application that accesses Cluster data. Basically this means any NDB API application.

SQL node - A subspecies of API node that provides an SQL interface to a Cluster. Basically, this means a MySQL Server that’s part of a Cluster. (mysqld itself isn’t an NDB API application, but the bits that let it talk to a Cluster use the NDB API.)

Also, ndbd processes were in the distant past referred referred to as “database nodes” or even “DB nodes”. Nobody at work liked these very much (AFAIK), as we were afraid that newcomers to MySQL and Cluster would find them confusing. I wanted to call them “storage nodes” while others preferred “data nodes”.

This was an argument that I lost - after I’d started using “storage nodes” in the Manual. Ooops.

So I’ve changed “storage nodes” to “data nodes” throughout the Cluster documentation. Since some people picked up on my term before it got axed, I’ve left a note in there explaining that it’s a deprecated term. For the record, however, the official term is now “data nodes”, okay? Okay.

There are also a few places in the software where “DB node” and “storage node” still appear, such as in the output of SHOW in the Cluster management client and some NDB-specific MySQL system variables. But these vestiges of Old NDB-lish should be Going Away soon, probably in 5.0.25 and 5.1.12, and maybe in the next 4.1 release as well.

Where Can I Run MySQL Cluster?

The answer to the question posed in the title used to be, “Linux, Solaris, and Mac OS X - anywhere else, and you’re on your own, mate. And forget about running it on Windows.”

The answer is now more like, “If it’s one of the Unices, chances are that we support running Cluster on it. Windows still need not apply.”

In fact, it might be easier now just to list the platforms we definitely don’t support for using Cluster, which as far as I know are these:

  • Minix
  • Plan 9
  • BeOS
  • Windows

(To see what’s officially supported by MySQL for Cluster - and to what extent - check out this page that’s maintained by our illustrious Support Department: Supported Platforms for MySQL Cluster.)

However, if you can get a MySQL client running on one of these, then it can talk to a MySQL Server that’s running as an SQL node in a Cluster. For example, I can access one of my Linux machines from this one using the mysql client or from PHP running on this machine, as I did the other day, like so:

< ?php
  //  This is *not* especially good PHP code, it's just a quick &
  //  dirty test, and not intended for production, right?
 
  $db1 = new mysqli('gigan', 'pizza', 'anchovies', 'ctest1');
  $db2 = new mysqli('mothra', 'spagbol', 'tomatoes', 'ctest1');
 
  $q = "CREATE TABLE fish (
           id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
           name VARCHAR(20)
           ) ENGINE=NDBCLUSTER";
 
  if($db1->query($q) === TRUE)
  {
    echo "<p>Cluster table created on Gigan, displaying on Mothra:</p>n";
 
    $q = "SHOW CREATE TABLE fish";
 
    if($res = $db2->query($q))
    {
      $row = $res->fetch_array();
 
      echo '<p>' . nl2br($row[1]) . "</p>n";
 
      $q = "INSERT INTO fish
                VALUES
                ('', 'trout'), ('', 'guppy'), ('', 'bass')";
      if($db1->query($q) === TRUE)
      {
        echo "<p>Data inserted into table on Gigan.</p>n";
 
        $q = "SELECT * FROM fish ORDER BY id";
 
        if($res = $db2->query($q))
        {
          echo "<p>Retrieving data from Mothra:</p>n<ul>n";
 
          while($row = $res->fetch_object())
          {
            echo "<li>Id: $row->id; Name: $row->name</li>n";
          }
 
          echo "</ul>n<p>Run completed.</p>";
 
          $db1->close();
          $db2->close();
        }
      }
    }
  }
?>

 

My ambition now is to be the first kid on my block to run his blog on a MySQL Cluster.

But I’ve got to do something about performance first - when two of your four data nodes are running on 433 MHz CPUs, it’s nothing to write home about.

In any case, you can run MySQL Cluster on lots of platforms now, and it is possible to run a client app on Windows that accesses a MySQL Cluster running on one of those.

MySQL 5.0.45-communityPHP 5.2.3