6
It is possible to replicate transactions directly to a `RabbitMQ <http://www.rabbitmq.org>`_ server from drizzle, this could be used to create advanced replication solutions, to visualize data, or to build triggers. For example, `RabbitReplication <http://www.rabbitreplication.org>`_ has been built to consume the messages from rabbitmq, transform them, and persist the data in drizzle, mysql, many nosql stores and even replicating directly to websockets for data visualization.
11
To load this plugin, start :program:`drizzled` with::
15
Loading the plugin may not enable or configure it. See the plugin's
16
:ref:`rabbitmq_configuration` and :ref:`rabbitmq_variables`.
18
.. seealso:: :ref:`drizzled_plugin_options` for more information about adding and removing plugins.
20
.. _rabbitmq_configuration:
25
These command line options configure the plugin when :program:`drizzled`
26
is started. See :ref:`command_line_options` for more information about specifying
31
.. option:: --rabbitmq.exchange ARG
33
:Default: ReplicationExchange
34
:Variable: :ref:`rabbitmq_exchange <rabbitmq_exchange>`
36
Name of RabbitMQ exchange to publish to
38
.. option:: --rabbitmq.host ARG
41
:Variable: :ref:`rabbitmq_host <rabbitmq_host>`
43
Host name to connect to
45
.. option:: --rabbitmq.password ARG
48
:Variable: :ref:`rabbitmq_password <rabbitmq_password>`
52
.. option:: --rabbitmq.port ARG
55
:Variable: :ref:`rabbitmq_port <rabbitmq_port>`
59
.. option:: --rabbitmq.routingkey ARG
61
:Default: ReplicationRoutingKey
62
:Variable: :ref:`rabbitmq_routingkey <rabbitmq_routingkey>`
64
Name of RabbitMQ routing key to use
66
.. option:: --rabbitmq.use-replicator ARG
68
:Default: default_replicator
71
Name of the replicator plugin to use (default='default_replicator')
73
.. option:: --rabbitmq.username ARG
76
:Variable: :ref:`rabbitmq_username <rabbitmq_username>`
80
.. option:: --rabbitmq.virtualhost ARG
83
:Variable: :ref:`rabbitmq_virtualhost <rabbitmq_virtualhost>`
87
.. _rabbitmq_variables:
92
These variables show the running configuration of the plugin.
93
See `variables` for more information about querying and setting variables.
95
.. _rabbitmq_exchange:
97
* ``rabbitmq_exchange``
101
:Option: :option:`--rabbitmq.exchange`
103
Name of RabbitMQ exchange to publish to
111
:Option: :option:`--rabbitmq.host`
113
Host name to connect to
115
.. _rabbitmq_password:
117
* ``rabbitmq_password``
121
:Option: :option:`--rabbitmq.password`
131
:Option: :option:`--rabbitmq.port`
135
.. _rabbitmq_routingkey:
137
* ``rabbitmq_routingkey``
141
:Option: :option:`--rabbitmq.routingkey`
143
Name of RabbitMQ routing key to use
145
.. _rabbitmq_username:
147
* ``rabbitmq_username``
151
:Option: :option:`--rabbitmq.username`
155
.. _rabbitmq_virtualhost:
157
* ``rabbitmq_virtualhost``
161
:Option: :option:`--rabbitmq.virtualhost`
165
.. _rabbitmq_examples:
170
First install a recent version of RabbitMQ, then install librabbitmq, the C library for talking to the RabbitMQ server:
174
$ hg clone http://hg.rabbitmq.com/rabbitmq-codegen/
175
$ hg clone http://hg.rabbitmq.com/rabbitmq-c/
182
Now you probably need to rebuild Drizzle since the :program:`rabbitmq` plugin is not built if librabbitmq is not installed.
184
Finally, start :program:`drizzled` like:
188
sbin/drizzled --plugin-add rabbitmq,default-replicator \
189
--rabbitmq.use-replicator default
191
To verify that it works, you can start a generic rabbitmq listener from librabbitmq:
195
$ amqp_listen localhost 5672 ReplicationExchange ReplicationRoutingKey
197
And you should see something like this when you do an INSERT/CREATE/.. (just not a select) in your newly built Drizzle instance::
200
Frame type 1, channel 1
201
Method AMQP_BASIC_DELIVER_METHOD
202
Delivery 1, exchange ReplicationExchange routingkey ReplicationRoutingKey
204
00000000: 0A 17 08 01 10 87 36 18 : F0 FA D9 99 FA F1 A7 02 ......6.........
205
00000010: 20 99 81 DA 99 FA F1 A7 : 02 12 40 08 01 10 F2 FA .........@.....
206
00000020: D9 99 FA F1 A7 02 18 FC : FA D9 99 FA F1 A7 02 2A ...............*
207
00000030: 17 0A 06 0A 01 62 12 01 : 61 12 06 08 04 12 02 69 .....b..a......i
208
00000040: 64 12 05 08 01 12 01 74 : 32 11 08 01 10 01 1A 0B d......t2.......
209
00000050: 0A 01 32 0A 02 61 61 10 : 00 10 00 20 01 28 01 ..2..aa.... .(.
212
Implementation Details
213
----------------------
215
* :program:`drizzled` will not sart if the rabbitmq server is not available.
216
* If the rabbitmq server goes away, the plugin will try to reconnect and resend the message 3 times, after that, the transaction is rolled back.
218
.. _rabbitmq_authors:
225
.. _rabbitmq_version:
230
This documentation applies to **rabbitmq 0.1**.
232
To see which version of the plugin a Drizzle server is running, execute:
234
.. code-block:: mysql
236
SELECT MODULE_VERSION FROM DATA_DICTIONARY.MODULES WHERE MODULE_NAME='rabbitmq'