summaryrefslogtreecommitdiff
path: root/docs/rabbitmq.sample.config
blob: 69fdb0a1e802950ac68dc9fbef9270faab265b48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
[
 %% ----------------------------------------------------------------------------
 %% RabbitMQ Sample Configuration File
 %% ----------------------------------------------------------------------------

 {rabbit, [%%
           %% Network Connectivity
           %%

           %% AMQP listen on ports
           {tcp_listeners, [5672, 5673]},

           %% SSL (AMQP) listen on ports
           {ssl_listeners, [5674, 5675]},

           %% SSL options
           {ssl_options, [{cacertfile,"/path/to/testca/cacert.pem"},
                          {certfile,"/path/to/server/cert.pem"},
                          {keyfile,"/path/to/server/key.pem"},
                          {verify, verify_peer},
                          {fail_if_no_peer_cert, true}]},

           %% Frame Max (in bytes)
           {frame_max, 131072},

           %% Heartbeat delay (in seconds)
           {heartbeat, 600},

           %% Socket options
           %% See  (http://www.erlang.org/doc/man/inet.html#setopts-2)
           {tcp_listen_options, [binary,
                                 {packet,        raw},
                                 {reuseaddr,     true},
                                 {backlog,       128},
                                 {nodelay,       true},
                                 {exit_on_close, false}]},

           %%
           %% Security/AAA & Default VHost/User
           %%

           %% Set available auth mechanisms
           {auth_mechanisms, ['PLAIN', 'AMQPLAIN']},

           %% To enable auth-mechanism-ssl
           %% {auth_mechanisms, ['EXTERNAL']},

           %% Available authentication databases
           {auth_backends, [rabbit_auth_backend_internal]},

           %% To enable the LDAP backend
           %% {auth_backends, [rabbit_auth_backend_ldap]},

           %% Virtual host to create on first start
           {default_vhost, <<"/">>},

           %% User name to create on first start
           {default_user, <<"guest">>},

           %% Password for default user
           {default_pass, <<"guest">>},

           %% Tags for default user
           {default_user_tags, [administrator]},

           %% Permissions for default user
           {default_permissions, [<<".*">>, <<".*">>, <<".*">>]},

           %%
           %% Resource Limits & Flow Control
           %%

           %% Memory-based Flow Control threshold
           {vm_memory_high_watermark, 0.4},

           %% Disk free limits (set in bytes)
           {disk_free_limit, 1000000000},

           %% Disk free limits (relative to total RAM)
           {disk_free_limit, {mem_relative, 1.0}},

           %% Log levels
           {log_levels, [{connection, info}]},

           %%
           %% Misc/Advanced Options:
           %%
           %% NB: Change these only if you understand what you're doing!
           %%

           %% How to respond to cluster partitions
           {cluster_partition_handling, ignore},

           %% Make clustering happen *automatically*
           {cluster_nodes, {['rabbit@my.host.com'], disc}},

           %% Set (internal) statistics granularity
           {collect_statistics, none},

           %% Statistics collection interval (in milliseconds)
           {collect_statistics_interval, 5000},

           %% Override file handle limits
           {file_handles_high_watermark, 10000000},

           %% Explicitly enable/disable hipe compilation
           {hipe_compile, true},

           %% Override the number of delegate processes in use
           {delegate_count, 16}m

           %% Implementation module for queue indexing
           {msg_store_index_module, rabbit_msg_store_ets_index},

           %% Implementation module for queue content handling
           {backing_queue_module, rabbit_variable_queue},

           %% Tunes the maximum (individual) file size limit for
           %% the broker's persistent message store. WARNING you
           %% should almost certainly not need to change this
           {msg_store_file_size_limit, 16777216},

           %% Tunes the maximum number of journal entries for
           %% the broker's persistent message store. WARNING:
           %% you should almost certainly not need to change this
           {queue_index_max_journal_entries, 65536}
          ]},

 %% ----------------------------------------------------------------------------
 %% RabbiMQ Management Plugin
 %%
 %% See http://www.rabbitmq.com/management.html for details
 %% ----------------------------------------------------------------------------

 {rabbitmq_management,
  [%% Pre-Load schema definitions from the following JSON file
   {load_definitions, "/path/to/schema.json"},

   %% Log HTTP requests to a file
   {http_log_dir, "/path/to/access.log"},

   %% Change the port on which the HTTP listener listens,
   %% specify an interface for the web server to bind to.
   %% Also set the listener to use SSL
   {listener, [{port, 12345},
               {ip, "127.0.0.1"},
               {ssl, true},
               {ssl_opts, [{cacertfile, "/path/to/cacert.pem"},
                           {certfile,   "/path/to/cert.pem"},
                           {keyfile,    "/path/to/key.pem"}]}]},

   %% Sample retention policies
   {sample_retention_policies,
    [{global,   [{60, 5}, {3600, 60}, {86400, 1200}]},
     {basic,    [{60, 5}, {3600, 60}]},
     {detailed, [{10, 5}]}]}
  ]},

 {rabbitmq_management_agent [%% Force fine-grained statistics
                             {force_fine_statistics, true}]},

 %% ----------------------------------------------------------------------------
 %% RabbiMQ Shovel Plugin
 %%
 %% See http://www.rabbitmq.com/shovel.html for details
 %% ----------------------------------------------------------------------------

 {rabbitmq_shovel,
  [{shovels, [{my_first_shovel,
               [{sources,
                 %% Setting SSL Options via the connection string
                 [{brokers, ["amqps://username:password@host:port/vhost?"
                             "cacertfile=/path/to/cacert.pem"
                             "&certfile=/path/to/certfile.pem"
                             "&keyfile=/path/to/keyfile.pem"
                             "&verify=verify_peer"
                             "&fail_if_no_peer_cert=true",

                             %% Tuning connection via the connection string
                             "amqp://john:secret@host2.domain/my_vhost"
                             "?heartbeat=5&frame_max=8192"
                            ]},
                  {declarations,
                   [ {'exchange.declare',
                      [{exchange, <<"my_fanout">>},
                       {type, <<"fanout">>}, durable]},
                     {'queue.declare',
                      [{arguments,
                        [{<<"x-message-ttl">>, long, 60000}]}]},
                     {'queue.bind',
                      [{exchange, <<"my_direct">>}, {queue,<<>>}]}
                   ]}
                 ]},
                {destinations,
                 [{broker, "amqp://"},
                  {declarations, [{'exchange.declare',
                                   [{exchange, <<"my_direct">>},
                                    {type, <<"direct">>}, durable]}]}
                 ]},
                {queue, <<>>},
                {prefetch_count, 10},
                {ack_mode, on_confirm},
                {publish_properties, [{delivery_mode, 2}]},
                {publish_fields, [{exchange, <<"my_direct">>},
                                  {routing_key, <<"from_shovel">>}]},
                {reconnect_delay, 2.5}
               ]}
             ]}]},

 %% ----------------------------------------------------------------------------
 %% RabbiMQ Stomp Adapter
 %%
 %% See http://www.rabbitmq.com/stomp.html for details
 %% ----------------------------------------------------------------------------

 {rabbitmq_stomp, [%% Listen only on localhost (ipv4 & ipv6) on port 61613
                   {tcp_listeners, [{"127.0.0.1", 61612},
                                    {"::1",       61612}]},

                   %% Listen for SSL connections on 61613
                   {ssl_listeners, [61613]},

                   %% Extract name from client's certificate when using SSL
                   {ssl_cert_login, true},

                   %% Use cn instead of dn when reading from the SSL cert
                   %%                , {ssl_cert_login_from, common_name}

                   %% Set a default user and password
                   {default_user, [{login, "guest"},
                                   {passcode, "guest"}]}
                  ]},

 %% ----------------------------------------------------------------------------
 %% RabbiMQ MQTT Adapter
 %%
 %% See http://hg.rabbitmq.com/rabbitmq-mqtt/file/stable/README.md for details
 %% ----------------------------------------------------------------------------

 {rabbitmq_mqtt, [{default_user,     <<"guest">>},
                  {default_pass,     <<"guest">>},
                  {allow_anonymous,  true},
                  {vhost,            <<"/">>},
                  {exchange,         <<"amq.topic">>},
                  {subscription_ttl, 1800000},
                  {prefetch,         10},
                  {ssl_listeners,    []},
                  {tcp_listeners,    [1883]},
                  {tcp_listen_options, [binary,
                                        {packet,    raw},
                                        {reuseaddr, true},
                                        {backlog,   128},
                                        {nodelay,   true}]}]},

 %% ----------------------------------------------------------------------------
 %% RabbiMQ AMQP 1.0 Support
 %%
 %% See http://hg.rabbitmq.com/rabbitmq-amqp1.0/file/default/README.md
 %% for details
 %% ----------------------------------------------------------------------------

 {rabbitmq_amqp1_0, [{default_user, "guest"},
                     {protocol_strict_mode, false}]},

 %% ----------------------------------------------------------------------------
 %% RabbitMQ LDAP Plugin
 %%
 %% See http://www.rabbitmq.com/ldap.html for details.
 %%
 %% ----------------------------------------------------------------------------

 {rabbitmq_auth_backend_ldap,
  [{servers,               ["my-ldap-server"]},
   {user_dn_pattern,       "cn=${username},ou=People,dc=example,dc=com"},
   {use_ssl,               false},
   {port,                  389},
   {log,                   false},
   {vhost_access_query,    {in_group
                            "ou=${vhost}-users,ou=vhosts,dc=example,dc=com"}},
   {resource_access_query,
    {for, [{permission, configure, {in_group, "cn=admin,dc=example,dc=com"}},
           {permission, write,
            {for, [{resource, queue, {in_group,
                                      "cn=admin,dc=example,dc=com"}},
                   {resource, exchange, {constant, true}}]}},
           {permission, read,
            {for, [{resource, exchange, {in_group,
                                         "cn=admin,dc=example,dc=com"}},
                   {resource, queue, {constant, true}}]}}
          ]
    }},
   {tag_queries, [{administrator, {constant, false}},
                  {management,    {constant, true}}]}
  ]
 },

 %% ----------------------------------------------------------------------------
 %% Lager Logging Support
 %%
 %% See https://github.com/basho/lager for specific configuration.
 %%
 %% ----------------------------------------------------------------------------

 {lager, [{handlers,
           [{lager_console_backend, info},
            {lager_file_backend,
             [%% Location of the error log
              {"/var/log/rabbitmq/error.log", error, 10485760, "$D0", 5},
              %% Location of the info log
              {"/var/log/rabbitmq/console.log", info, 10485760, "$D0", 5}
             ]}
           ]}
         ]}
].