Today marks the first release of Drizzle Tools for MySQL
servers. Drizzle Tools aims to be a collection of useful
utilities to use with MySQL servers based around the work on the
Libdrizzle Redux project.
In this first version there is one utility in the tree called
'drizzle-binlogs'. If you've seen me talk about this tool
before it is because it used to be included in the Libdrizzle 5.1
source but has now been moved here to be developed
independently. For those who haven't 'drizzle-binlogs' is a
tool which connects to a MySQL server as a slave, retrieves the
binary log files and stores them locally. This could be
used as part of a backup solution or a rapid way to help create a
new MySQL master server.
Due to the API changes before the Libdrizzle API became stable
Drizzle Tools requires a minimum of Libdrizzle 5.1.3 to be …
Now that we have frozen the 5.1 API of Libdrizzle I can blog
about how to use parts of the API.
In this blog post I will cover connecting to a MySQL server and
retrieving the binary logs.
First of all we need to connect to the MySQL server
#include <libdrizzle-5.1/libdrizzle.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <inttypes.h>
int main(void)
{
drizzle_st *con;
drizzle_binlog_st *binlog;
drizzle_return_t ret;
con= drizzle_create("localhost", 3306, "user", "pass", "",
NULL);
ret= drizzle_connect(con);
if (ret != DRIZZLE_RETURN_OK)
{
printf("Could not connect to server: %s\n",
drizzle_error(con));
return EXIT_FAILURE;
} …
A couple of days ago we released Libdrizzle 5.1.3. With
this release of the C connector for MySQL servers we are freezing
the 5.1 API and declaring it stable. This is also one of
our biggest releases after incorporating code from a Seattle
developer day. The diff since 5.1.2 is over 6000 lines long
and around 180KBytes, incorporating many bug fixes and
improvements.
The most notable changes in this release are:
- the drizzle_binlogs tool has been removed, it is now in the Drizzle Tools tree which will have its first release soon.
- the connection API has been refactored, options processing has been re-written and the connection API has been simplified in general
- drizzle_escape_string has been made safer
- drizzle_hex_string and drizzle_mysql_password_hash has been removed
- internal …
This weekend I am supposed to be giving a talk at FOSDEM on
Libdrizzle. Unfortunately my kids and I all
fell ill on Thursday (my wife appears to be immune) so I had to
cancel my plans (infecting 5000 people didn't seem wise :)
Instead I am writing this blog post about Libdrizzle and my part
in it which covers some of what I was going to talk about.
History of LibdrizzleLibdrizzle started out as a from-scratch C
connector for Drizzle and MySQL originally created by Eric
Day. It was designed to be high performance and use common
standards to make it easy to work on. In the summer of 2010
it was merged into the main Drizzle tree where development has
been focused. There were several attempts to split it out
again but until now none were truly successful.
For a few years Brian …
As part of the Libdrizzle Redux project I created an example tool
which was bundled with it which will connect to a MySQL server as
a slave and download the binary logs to local files. This
was developed as a quick example of what can be done with the new
binlog API.
Two things quickly became apparent:
- We shouldn't really be distributing applications in a library
- I am going to be developing more useful tools around libdrizzle and they certainly shouldn't be in the same package
- BSD is a fantastic license for a library, but I personally prefer GPLv2 for applications
With this in mind I have pulled the drizzle_binlogs utility from
Libdrizzle trunk (and therefore won't be in the 5.1.3 release)
and put it in its own repository. It has been licensed
appropriately (GPLv2) and I am already beginning to develop more
tools to go with it.
The are no source …