blob: 973164f65865b1adcf2f6acc9751f2208da275e4 [file] [log] [blame]
Pavel Cizinskyccaeb942018-12-12 12:03:06 +01001=====
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +03002Usage
Pavel Cizinskyccaeb942018-12-12 12:03:06 +01003=====
Filip Pytlounef5b0af2015-10-06 16:28:32 +02004
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +03005RabbitMQ is a complete and highly reliable enterprise messaging
6system based on the emerging AMQP standard.
Filip Pytlounef5b0af2015-10-06 16:28:32 +02007
Filip Pytlounef5b0af2015-10-06 16:28:32 +02008Sample pillars
9==============
10
11Standalone Broker
12-----------------
13
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +030014RabbitMQ as AMQP broker with admin user and vhosts:
Filip Pytlounef5b0af2015-10-06 16:28:32 +020015
16.. code-block:: yaml
17
18 rabbitmq:
19 server:
20 enabled: true
Buddy Lindsey, Jrf0d58ae2018-07-16 16:36:55 -050021 memory:
22 vm_high_watermark: 0.4
Filip Pytlounef5b0af2015-10-06 16:28:32 +020023 bind:
24 address: 0.0.0.0
25 port: 5672
26 secret_key: rabbit_master_cookie
27 admin:
28 name: adminuser
29 password: pwd
30 plugins:
31 - amqp_client
32 - rabbitmq_management
Nick Metz208245c2017-12-03 16:18:33 +010033 host:
34 '/monitor':
35 enabled: true
36 user: 'monitor'
37 password: 'password'
Filip Pytlounef5b0af2015-10-06 16:28:32 +020038
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +030039RabbitMQ as a Stomp broker:
Filip Pytlounef5b0af2015-10-06 16:28:32 +020040
41.. code-block:: yaml
42
43 rabbitmq:
44 server:
45 enabled: true
46 secret_key: rabbit_master_cookie
47 bind:
48 address: 0.0.0.0
49 port: 5672
Nick Metz208245c2017-12-03 16:18:33 +010050 host:
51 '/monitor':
52 enabled: true
53 user: 'monitor'
54 password: 'password'
Michael Polenchuk8115f0f2018-05-30 21:27:45 +040055 plugins_runas_user: rabbitmq
Filip Pytlounef5b0af2015-10-06 16:28:32 +020056 plugins:
57 - rabbitmq_stomp
58
59RabbitMQ cluster
60----------------
61
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +030062RabbitMQ as base cluster node:
Filip Pytlounef5b0af2015-10-06 16:28:32 +020063
64.. code-block:: yaml
65
66 rabbitmq:
67 server:
68 enabled: true
69 bind:
70 address: 0.0.0.0
71 port: 5672
72 secret_key: rabbit_master_cookie
73 admin:
74 name: adminuser
75 password: pwd
76 cluster:
77 enabled: true
78 role: master
79 mode: disc
80 members:
81 - name: openstack1
82 host: 10.10.10.212
83 - name: openstack2
84 host: 10.10.10.213
85
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +030086HA Queues definition:
Filip Pytlounef5b0af2015-10-06 16:28:32 +020087
88.. code-block:: yaml
89
90 rabbitmq:
91 server:
92 enabled: true
93 ...
Nick Metz208245c2017-12-03 16:18:33 +010094 host:
95 '/monitor':
96 enabled: true
97 user: 'monitor'
98 password: 'password'
99 policies:
100 - name: HA
101 pattern: '^(?!amq\.).*'
102 definition: '{"ha-mode": "all"}'
Kirill Bespalov09e52182017-05-10 14:20:30 +0300103
Kirill Bespalov09e52182017-05-10 14:20:30 +0300104Enable TLS support
105------------------
106
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +0300107To enable support of TLS for rabbitmq-server you need to provide
108a path to cacert, server cert and private key:
Kirill Bespalovb0cd0ae2017-05-30 17:45:13 +0300109
110.. code-block:: yaml
111
112 rabbitmq:
113 server:
114 enabled: true
115 ...
116 ssl:
117 enabled: True
118 key_file: /etc/rabbitmq/ssl/key.pem
119 cert_file: /etc/rabbitmq/ssl/cert.pem
120 ca_file: /etc/rabbitmq/ssl/ca.pem
121
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +0300122To manage content of these files you can either use the following
123options:
Kirill Bespalov09e52182017-05-10 14:20:30 +0300124
125.. code-block:: yaml
126
127 rabbitmq:
128 server:
129 enabled: true
130 ...
131 ssl:
132 enabled: True
133
Kirill Bespalovb0cd0ae2017-05-30 17:45:13 +0300134 key_file: /etc/rabbitmq/ssl/key.pem
Kirill Bespalov09e52182017-05-10 14:20:30 +0300135 key: |
136 -----BEGIN RSA PRIVATE KEY-----
137 ...
138 -----END RSA PRIVATE KEY-------
139
Kirill Bespalovb0cd0ae2017-05-30 17:45:13 +0300140 ca_file: /etc/rabbitmq/ssl/ca.pem
141 cacert_chain: |
142 -----BEGIN CERTIFICATE-----
143 ...
144 -----END CERTIFICATE-------
145
146 cert_file: /etc/rabbitmq/ssl/cert.pem
Kirill Bespalov09e52182017-05-10 14:20:30 +0300147 cert: |
148 -----BEGIN CERTIFICATE-----
149 ...
150 -----END CERTIFICATE-------
151
152
Kirill Bespalovb0cd0ae2017-05-30 17:45:13 +0300153Or you can use the `salt.minion.cert` salt state which
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +0300154creates all required files according to defined reclass model.
155See
156https://github.com/Mirantis/reclass-system-salt-model/tree/master/salt/minion/cert/rabbitmq
157for details. In this case you need just to enable ssl and nothing more:
Kirill Bespalov09e52182017-05-10 14:20:30 +0300158
159.. code-block:: yaml
160
161 rabbitmq:
162 server:
163 enabled: true
164 ...
165 ssl:
166 enabled: True
Kirill Bespalov09e52182017-05-10 14:20:30 +0300167
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +0300168Defaut port for TLS is ``5671``:
Kirill Bespalov09e52182017-05-10 14:20:30 +0300169
170.. code-block:: yaml
171
172 rabbitmq:
173 server:
174 bind:
175 ssl:
176 port: 5671
177
Michael Polenchuk161ebd12018-12-24 17:00:30 +0400178Manage environment variables
179----------------------------
180
181Create a config file with variable settings that override the defaults
182built in to the RabbitMQ startup scripts:
183
184.. code-block:: yaml
185
186 rabbitmq:
187 server:
188 enabled: true
189 ...
190 env_variables:
191 hostname: localhost
192 node_port: 5671
193 export:
194 home: /var/lib/rabbitmq
195 erl_inetrc: /etc/rabbitmq/inetrc
196
197
Filip Pytlounef5b0af2015-10-06 16:28:32 +0200198Usage
199=====
200
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +0300201Check cluster status, example shows running cluster with 3 nodes:
202ctl-1, ctl-2, ctl-3
Filip Pytlounef5b0af2015-10-06 16:28:32 +0200203
204.. code-block:: yaml
205
206 > rabbitmqctl cluster_status
Kirill Bespalov09e52182017-05-10 14:20:30 +0300207
Filip Pytlounef5b0af2015-10-06 16:28:32 +0200208 Cluster status of node 'rabbit@ctl-1' ...
Kirill Bespalov09e52182017-05-10 14:20:30 +0300209 [{nodes,[{disc,['rabbit@ctl-1','rabbit@ctl-2','rabbit@ctl-3']}]},
Filip Pytlounef5b0af2015-10-06 16:28:32 +0200210 {running_nodes,['rabbit@ctl-3','rabbit@ctl-2','rabbit@ctl-1']},
211 {partitions,[]}]
212 ...done.
213
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +0300214Setup management user:
Filip Pytlounef5b0af2015-10-06 16:28:32 +0200215
216.. code-block:: yaml
217
218 > rabbitmqctl add_vhost vhost
219 > rabbitmqctl add_user user alive
220 > rabbitmqctl set_permissions -p vhost user ".*" ".*" ".*"
221 > rabbitmqctl set_user_tags user management
222
OlgaGusarenkoe27a2ea2018-07-31 00:59:36 +0300223EPD process is Erlang Port Mapper Daemon. It's a feature of the
224Erlang runtime that helps Erlang nodes to find each other. It's a
225pretty tiny thing and doesn't contain much state (other than "what
226Erlang nodes are running on this system?") so it's not a huge deal for
227it to still be running.
228
229Although it's running as user rabbitmq, it was started automatically
230by the Erlang VM when we started. We've considered adding "epmd -kill"
231to our shutdown script - but that would break any other Erlang apps
232running on the system; it's more "global" than RabbitMQ.
Filip Pytlounef5b0af2015-10-06 16:28:32 +0200233
Vasyl Saienko14fd5a92019-04-14 19:15:52 +0000234Upgrades
235========
236
237The rabbitmq formula provide set of phases (logical bloks) that will help to
238build flexible upgrade orchestration logic for particular components. The list
239of phases might and theirs descriptions are listed in table below:
240
241+-------------------------------+------------------------------------------------------+
242| State | Description |
243+===============================+======================================================+
244| <app>.upgrade.service_running | Ensure that all services for particular application |
245| | are enabled for autostart and running |
246+-------------------------------+------------------------------------------------------+
247| <app>.upgrade.service_stopped | Ensure that all services for particular application |
248| | disabled for autostart and dead |
249+-------------------------------+------------------------------------------------------+
250| <app>.upgrade.pkgs_latest | Ensure that packages used by particular application |
251| | are installed to latest available version. |
252+-------------------------------+------------------------------------------------------+
253| <app>.upgrade.render_config | Ensure configuration is rendered actual version. +
254+-------------------------------+------------------------------------------------------+
255| <app>.upgrade.pre | We assume this state is applied on all nodes in the |
256| | cloud before running upgrade. |
257| | Only non destructive actions will be applied during |
258| | this phase. Perform service built in service check |
259| | like (rabbitmqctl cluster_status) |
260+-------------------------------+------------------------------------------------------+
261| <app>.upgrade.upgrade.pre | Do nothing for now |
262+-------------------------------+------------------------------------------------------+
263| <app>.upgrade.upgrade | This state will basically upgrade application on |
264| | particular target. Stop services, render |
265| | configuration, install new packages, start services |
266+-------------------------------+------------------------------------------------------+
267| <app>.upgrade.upgrade.post | Do nothing for now |
268+-------------------------------+------------------------------------------------------+
269| <app>.upgrade.post | This phase should be launched only when upgrade of |
270| | the cloud is completed. Cleanup temporary files, |
271| | perform other post upgrade tasks. |
272+-------------------------------+------------------------------------------------------+
273| <app>.upgrade.verify | Verify current node is present in running_nodes on |
274| | the cluster. |
275+-------------------------------+------------------------------------------------------+
276
277
Filip Pytlounef5b0af2015-10-06 16:28:32 +0200278Read more
279=========
280
281* http://www.rabbitmq.com/admin-guide.html
282* https://github.com/saltstack/salt-contrib/blob/master/states/rabbitmq_plugins.py
283* http://docs.saltstack.com/ref/states/all/salt.states.rabbitmq_user.html
284* http://stackoverflow.com/questions/14699873/how-to-reset-user-for-rabbitmq-management
285* http://www.rabbitmq.com/memory.html
286
287Clustering
288==========
289
290* http://www.rabbitmq.com/clustering.html#auto-config
291* https://github.com/jesusaurus/hpcs-salt-state/tree/master/rabbitmq
292* http://gigisayfan.blogspot.cz/2012/06/rabbit-mq-clustering-python-fabric.html
293* http://docwiki.cisco.com/wiki/OpenStack_Havana_Release:_High-Availability_Manual_Deployment_Guide#RabbitMQ_Installation