~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/rabbitmq/docs/index.rst

  • Committer: Daniel Nichter
  • Date: 2011-08-13 20:41:38 UTC
  • mto: This revision was merged to the branch mainline in revision 2413.
  • Revision ID: daniel@percona.com-20110813204138-stxa89ca1t7cg1uy
Skeleton documentation for all plugins, more complete docu for first half of plugins.
Clean up plugin.ini titles and descriptions.
Reformat and reorganize root index.
Change Administrative to Administration and remove empty files (logging, etc.)
Add, fix, and tag documentation for functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
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.
5
5
 
6
 
Getting started
7
 
-----------------------
8
 
First install a recent version of RabbitMQ, then install librabbitmq, this is the c library for talking to the RabbitMQ server:
9
 
 
10
 
.. code-block:: bash
11
 
 
12
 
         $ hg clone http://hg.rabbitmq.com/rabbitmq-codegen/
13
 
         $ hg clone http://hg.rabbitmq.com/rabbitmq-c/
14
 
         $ cd rabbitmq-c
15
 
         $ autoreconf -f -i
16
 
         $ ./configure
17
 
         $ make
18
 
         $ make install
19
 
 
20
 
Now you probably need to rebuild drizzle (the rabbitmq plugin is not built if librabbitmq is not installed), see :ref:`dependencies`.
21
 
 
22
 
To start drizzled you need to add the replication plugins, start drizzled7 something like this (you probably want to add datadir etc as well, but these are the minimum):
23
 
 
24
 
.. code-block:: bash
25
 
 
26
 
         $ sbin/drizzled7 --plugin-add rabbitmq,default-replicator --rabbitmq.use-replicator default
 
6
Loading
 
7
-------
 
8
 
 
9
To load this plugin, start :program:`drizzled` with::
 
10
 
 
11
   --plugin-add=rabbitmq
 
12
 
 
13
Loading the plugin may not enable or configure it.  See the plugin's
 
14
:ref:`rabbitmq_configuration` and :ref:`rabbitmq_variables`.
 
15
 
 
16
.. seealso:: :doc:`/options` for more information about adding and removing plugins.
 
17
 
 
18
.. _rabbitmq_configuration:
 
19
 
 
20
Configuration
 
21
-------------
 
22
 
 
23
These command line options configure the plugin when :program:`drizzled`
 
24
is started.  See :doc:`/configuration` for more information about specifying
 
25
command line options.
 
26
 
 
27
.. program:: drizzled
 
28
 
 
29
.. option:: --rabbitmq.exchange ARG
 
30
 
 
31
   :Default: ReplicationExchange
 
32
   :Variable: :ref:`rabbitmq_exchange <rabbitmq_exchange>`
 
33
 
 
34
   Name of RabbitMQ exchange to publish to
 
35
 
 
36
.. option:: --rabbitmq.host ARG
 
37
 
 
38
   :Default: localhost
 
39
   :Variable: :ref:`rabbitmq_host <rabbitmq_host>`
 
40
 
 
41
   Host name to connect to
 
42
 
 
43
.. option:: --rabbitmq.password ARG
 
44
 
 
45
   :Default: guest
 
46
   :Variable: :ref:`rabbitmq_password <rabbitmq_password>`
 
47
 
 
48
   RabbitMQ password
 
49
 
 
50
.. option:: --rabbitmq.port ARG
 
51
 
 
52
   :Default: 5672
 
53
   :Variable: :ref:`rabbitmq_port <rabbitmq_port>`
 
54
 
 
55
   Port to connect to
 
56
 
 
57
.. option:: --rabbitmq.routingkey ARG
 
58
 
 
59
   :Default: ReplicationRoutingKey
 
60
   :Variable: :ref:`rabbitmq_routingkey <rabbitmq_routingkey>`
 
61
 
 
62
   Name of RabbitMQ routing key to use
 
63
 
 
64
.. option:: --rabbitmq.use-replicator ARG
 
65
 
 
66
   :Default: default_replicator
 
67
   :Variable:
 
68
 
 
69
   Name of the replicator plugin to use (default='default_replicator')
 
70
 
 
71
.. option:: --rabbitmq.username ARG
 
72
 
 
73
   :Default: guest
 
74
   :Variable: :ref:`rabbitmq_username <rabbitmq_username>`
 
75
 
 
76
   RabbitMQ username
 
77
 
 
78
.. option:: --rabbitmq.virtualhost ARG
 
79
 
 
80
   :Default: /
 
81
   :Variable: :ref:`rabbitmq_virtualhost <rabbitmq_virtualhost>`
 
82
 
 
83
   RabbitMQ virtualhost
 
84
 
 
85
.. _rabbitmq_variables:
 
86
 
 
87
Variables
 
88
---------
 
89
 
 
90
These variables show the running configuration of the plugin.
 
91
See `variables` for more information about querying and setting variables.
 
92
 
 
93
.. _rabbitmq_exchange:
 
94
 
 
95
* ``rabbitmq_exchange``
 
96
 
 
97
   :Scope: Global
 
98
   :Dynamic: No
 
99
   :Option: :option:`--rabbitmq.exchange`
 
100
 
 
101
   Name of RabbitMQ exchange to publish to
 
102
 
 
103
.. _rabbitmq_host:
 
104
 
 
105
* ``rabbitmq_host``
 
106
 
 
107
   :Scope: Global
 
108
   :Dynamic: No
 
109
   :Option: :option:`--rabbitmq.host`
 
110
 
 
111
   Host name to connect to
 
112
 
 
113
.. _rabbitmq_password:
 
114
 
 
115
* ``rabbitmq_password``
 
116
 
 
117
   :Scope: Global
 
118
   :Dynamic: No
 
119
   :Option: :option:`--rabbitmq.password`
 
120
 
 
121
   RabbitMQ password
 
122
 
 
123
.. _rabbitmq_port:
 
124
 
 
125
* ``rabbitmq_port``
 
126
 
 
127
   :Scope: Global
 
128
   :Dynamic: No
 
129
   :Option: :option:`--rabbitmq.port`
 
130
 
 
131
   Port to connect to
 
132
 
 
133
.. _rabbitmq_routingkey:
 
134
 
 
135
* ``rabbitmq_routingkey``
 
136
 
 
137
   :Scope: Global
 
138
   :Dynamic: No
 
139
   :Option: :option:`--rabbitmq.routingkey`
 
140
 
 
141
   Name of RabbitMQ routing key to use
 
142
 
 
143
.. _rabbitmq_username:
 
144
 
 
145
* ``rabbitmq_username``
 
146
 
 
147
   :Scope: Global
 
148
   :Dynamic: No
 
149
   :Option: :option:`--rabbitmq.username`
 
150
 
 
151
   RabbitMQ username
 
152
 
 
153
.. _rabbitmq_virtualhost:
 
154
 
 
155
* ``rabbitmq_virtualhost``
 
156
 
 
157
   :Scope: Global
 
158
   :Dynamic: No
 
159
   :Option: :option:`--rabbitmq.virtualhost`
 
160
 
 
161
   RabbitMQ virtualhost
 
162
 
 
163
.. _rabbitmq_examples:
 
164
 
 
165
Examples
 
166
--------
 
167
 
 
168
First install a recent version of RabbitMQ, then install librabbitmq, the C library for talking to the RabbitMQ server:
 
169
 
 
170
.. code-block:: bash
 
171
 
 
172
   $ hg clone http://hg.rabbitmq.com/rabbitmq-codegen/
 
173
   $ hg clone http://hg.rabbitmq.com/rabbitmq-c/
 
174
   $ cd rabbitmq-c
 
175
   $ autoreconf -f -i
 
176
   $ ./configure
 
177
   $ make
 
178
   $ make install
 
179
 
 
180
Now you probably need to rebuild Drizzle since the :program:`rabbitmq` plugin is not built if librabbitmq is not installed.
 
181
 
 
182
Finally, start :program:`drizzled` like:
 
183
 
 
184
.. code-block:: bash
 
185
 
 
186
   sbin/drizzled --plugin-add rabbitmq,default-replicator \
 
187
                 --rabbitmq.use-replicator default
27
188
 
28
189
To verify that it works, you can start a generic rabbitmq listener from librabbitmq:
29
190
 
30
191
.. code-block:: bash
31
192
 
32
 
         $ ./amqp_listen localhost 5672 ReplicationExchange ReplicationRoutingKey
33
 
 
34
 
And you should see something like this when you do an INSERT/CREATE/.. (just not a select) in your newly built drizzle instance:
35
 
 
36
 
.. code-block:: bash
37
 
      
38
 
     Result 0
39
 
     Frame type 1, channel 1
40
 
     Method AMQP_BASIC_DELIVER_METHOD
41
 
     Delivery 1, exchange ReplicationExchange routingkey ReplicationRoutingKey
42
 
 
43
 
     00000000: 0A 17 08 01 10 87 36 18 : F0 FA D9 99 FA F1 A7 02  ......6.........
44
 
     00000010: 20 99 81 DA 99 FA F1 A7 : 02 12 40 08 01 10 F2 FA   .........@.....
45
 
     00000020: D9 99 FA F1 A7 02 18 FC : FA D9 99 FA F1 A7 02 2A  ...............*
46
 
     00000030: 17 0A 06 0A 01 62 12 01 : 61 12 06 08 04 12 02 69  .....b..a......i
47
 
     00000040: 64 12 05 08 01 12 01 74 : 32 11 08 01 10 01 1A 0B  d......t2.......
48
 
     00000050: 0A 01 32 0A 02 61 61 10 : 00 10 00 20 01 28 01     ..2..aa.... .(.
49
 
     0000005F:
50
 
 
51
 
It is possible to configure what `exchange <http://www.rabbitmq.com/faq.html#managing-concepts-exchanges>`_ and various other settings, these are the available config parameters:
52
 
 
53
 
.. code-block:: bash
54
 
 
55
 
   --rabbitmq.host arg (=localhost)                    Host name to connect to
56
 
   --rabbitmq.port arg (=5672)                         Port to connect to
57
 
   --rabbitmq.virtualhost arg (=/)                     RabbitMQ virtualhost
58
 
   --rabbitmq.username arg (=guest)                    RabbitMQ username
59
 
   --rabbitmq.password arg (=guest)                    RabbitMQ password
60
 
   --rabbitmq.use-replicator arg (=default_replicator) Name of the replicator 
61
 
   --rabbitmq.exchange arg (=ReplicationExchange)      Name of RabbitMQ exchange
62
 
   --rabbitmq.routingkey arg (=ReplicationRoutingKey)  Name of RabbitMQ routing 
63
 
   
64
 
 
65
 
Implementation details
66
 
-----------------------
67
 
 
68
 
* If the rabbitmq server is not available when starting drizzled, drizzled will not start
69
 
* 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
 
193
   $ amqp_listen localhost 5672 ReplicationExchange ReplicationRoutingKey
 
194
 
 
195
And you should see something like this when you do an INSERT/CREATE/.. (just not a select) in your newly built Drizzle instance::
 
196
 
 
197
   Result 0
 
198
   Frame type 1, channel 1
 
199
   Method AMQP_BASIC_DELIVER_METHOD
 
200
   Delivery 1, exchange ReplicationExchange routingkey ReplicationRoutingKey
 
201
 
 
202
   00000000: 0A 17 08 01 10 87 36 18 : F0 FA D9 99 FA F1 A7 02  ......6.........
 
203
   00000010: 20 99 81 DA 99 FA F1 A7 : 02 12 40 08 01 10 F2 FA   .........@.....
 
204
   00000020: D9 99 FA F1 A7 02 18 FC : FA D9 99 FA F1 A7 02 2A  ...............*
 
205
   00000030: 17 0A 06 0A 01 62 12 01 : 61 12 06 08 04 12 02 69  .....b..a......i
 
206
   00000040: 64 12 05 08 01 12 01 74 : 32 11 08 01 10 01 1A 0B  d......t2.......
 
207
   00000050: 0A 01 32 0A 02 61 61 10 : 00 10 00 20 01 28 01     ..2..aa.... .(.
 
208
   0000005F:
 
209
 
 
210
Implementation Details
 
211
----------------------
 
212
 
 
213
* :program:`drizzled` will not sart if the rabbitmq server is not available.
 
214
* 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.
 
215
 
 
216
.. _rabbitmq_authors:
 
217
 
 
218
Authors
 
219
-------
 
220
 
 
221
Marcus Eriksson
 
222
 
 
223
.. _rabbitmq_version:
 
224
 
 
225
Version
 
226
-------
 
227
 
 
228
This documentation applies to **rabbitmq 0.1**.
 
229
 
 
230
To see which version of the plugin a Drizzle server is running, execute:
 
231
 
 
232
.. code-block:: mysql
 
233
 
 
234
   SELECT MODULE_VERSION FROM DATA_DICTIONARY.MODULES WHERE MODULE_NAME='rabbitmq'
70
235