Monday, March 28, 2011

Publish transactions to RabbitMQ in drizzled7

Since Drizzle went GA a couple of weeks ago, i figured i should update rabbitreplication to support it, quite a few changes have been done to the structure of the protobuf messages etc. First hurdle was to get drizzle to actually publish messages to rabbitmq, so here is a step-by-step tutorial to get started with that.

  1. Install a recent version of rabbitmq
  2. Get the latest version of librabbitmq:
    $ hg clone http://hg.rabbitmq.com/rabbitmq-codegen/
    $ hg clone http://hg.rabbitmq.com/rabbitmq-c/
    
  3. Build it (in the rabbitmq-c directory):
    $ autoreconf -f -i
    $ ./configure
    $ make
    $ make install
    
  4. Install Drizzle, follow these instructions:
    http://docs.drizzle.org/#compiling-and-installing. (During ./configure you should see that librabbitmq is found and that the plugin is getting built)
  5. Start Drizzle like this:
    $ sbin/drizzled7 --plugin-add rabbitmq,default-replicator --rabbitmq.use-replicator default
    
  6. To verify that it works, you can run a rabbitmq consumer from rabbitmq-c/examples, like this:
    ./amqp_listen localhost 5672 ReplicationExchange ReplicationRoutingKey
    Then execute an insert (or something, just not a select :) ) on your drizzle server, and you should see something like this in your console:
    Result 0
    Frame type 1, channel 1
    Method AMQP_BASIC_DELIVER_METHOD
    Delivery 1, exchange ReplicationExchange routingkey ReplicationRoutingKey
    ----
    00000000: 0A 17 08 01 10 87 36 18 : F0 FA D9 99 FA F1 A7 02  ......6.........
    00000010: 20 99 81 DA 99 FA F1 A7 : 02 12 40 08 01 10 F2 FA   .........@.....
    00000020: D9 99 FA F1 A7 02 18 FC : FA D9 99 FA F1 A7 02 2A  ...............*
    00000030: 17 0A 06 0A 01 62 12 01 : 61 12 06 08 04 12 02 69  .....b..a......i
    00000040: 64 12 05 08 01 12 01 74 : 32 11 08 01 10 01 1A 0B  d......t2.......
    00000050: 0A 01 32 0A 02 61 61 10 : 00 10 00 20 01 28 01     ..2..aa.... .(.
    0000005F:
    
In a couple of days I'll make a new release of rabbitreplication that supports the latest version of drizzle, stay tuned for that! I'll also update the drizzle rabbitmq plugin so that it is actually usable (support reconnect etc)

1 comment:

saimi prince said...

Very good blog you have here but I was curious about if
you knew of any message boards that cover the same topics talked
about in this article my name is hashmi