Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1 | ========================= |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 2 | Usage |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 3 | ========================= |
| 4 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 5 | RabbitMQ is a complete and highly reliable enterprise messaging |
| 6 | system based on the emerging AMQP standard. |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 7 | |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 8 | Sample pillars |
| 9 | ============== |
| 10 | |
| 11 | Standalone Broker |
| 12 | ----------------- |
| 13 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 14 | RabbitMQ as AMQP broker with admin user and vhosts: |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 15 | |
| 16 | .. code-block:: yaml |
| 17 | |
| 18 | rabbitmq: |
| 19 | server: |
| 20 | enabled: true |
| 21 | bind: |
| 22 | address: 0.0.0.0 |
| 23 | port: 5672 |
| 24 | secret_key: rabbit_master_cookie |
| 25 | admin: |
| 26 | name: adminuser |
| 27 | password: pwd |
| 28 | plugins: |
| 29 | - amqp_client |
| 30 | - rabbitmq_management |
Nick Metz | 208245c | 2017-12-03 16:18:33 +0100 | [diff] [blame] | 31 | host: |
| 32 | '/monitor': |
| 33 | enabled: true |
| 34 | user: 'monitor' |
| 35 | password: 'password' |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 36 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 37 | RabbitMQ as a Stomp broker: |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 38 | |
| 39 | .. code-block:: yaml |
| 40 | |
| 41 | rabbitmq: |
| 42 | server: |
| 43 | enabled: true |
| 44 | secret_key: rabbit_master_cookie |
| 45 | bind: |
| 46 | address: 0.0.0.0 |
| 47 | port: 5672 |
Nick Metz | 208245c | 2017-12-03 16:18:33 +0100 | [diff] [blame] | 48 | host: |
| 49 | '/monitor': |
| 50 | enabled: true |
| 51 | user: 'monitor' |
| 52 | password: 'password' |
Michael Polenchuk | 8115f0f | 2018-05-30 21:27:45 +0400 | [diff] [blame] | 53 | plugins_runas_user: rabbitmq |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 54 | plugins: |
| 55 | - rabbitmq_stomp |
| 56 | |
| 57 | RabbitMQ cluster |
| 58 | ---------------- |
| 59 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 60 | RabbitMQ as base cluster node: |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 61 | |
| 62 | .. code-block:: yaml |
| 63 | |
| 64 | rabbitmq: |
| 65 | server: |
| 66 | enabled: true |
| 67 | bind: |
| 68 | address: 0.0.0.0 |
| 69 | port: 5672 |
| 70 | secret_key: rabbit_master_cookie |
| 71 | admin: |
| 72 | name: adminuser |
| 73 | password: pwd |
| 74 | cluster: |
| 75 | enabled: true |
| 76 | role: master |
| 77 | mode: disc |
| 78 | members: |
| 79 | - name: openstack1 |
| 80 | host: 10.10.10.212 |
| 81 | - name: openstack2 |
| 82 | host: 10.10.10.213 |
| 83 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 84 | HA Queues definition: |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 85 | |
| 86 | .. code-block:: yaml |
| 87 | |
| 88 | rabbitmq: |
| 89 | server: |
| 90 | enabled: true |
| 91 | ... |
Nick Metz | 208245c | 2017-12-03 16:18:33 +0100 | [diff] [blame] | 92 | host: |
| 93 | '/monitor': |
| 94 | enabled: true |
| 95 | user: 'monitor' |
| 96 | password: 'password' |
| 97 | policies: |
| 98 | - name: HA |
| 99 | pattern: '^(?!amq\.).*' |
| 100 | definition: '{"ha-mode": "all"}' |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 101 | |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 102 | Enable TLS support |
| 103 | ------------------ |
| 104 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 105 | To enable support of TLS for rabbitmq-server you need to provide |
| 106 | a path to cacert, server cert and private key: |
Kirill Bespalov | b0cd0ae | 2017-05-30 17:45:13 +0300 | [diff] [blame] | 107 | |
| 108 | .. code-block:: yaml |
| 109 | |
| 110 | rabbitmq: |
| 111 | server: |
| 112 | enabled: true |
| 113 | ... |
| 114 | ssl: |
| 115 | enabled: True |
| 116 | key_file: /etc/rabbitmq/ssl/key.pem |
| 117 | cert_file: /etc/rabbitmq/ssl/cert.pem |
| 118 | ca_file: /etc/rabbitmq/ssl/ca.pem |
| 119 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 120 | To manage content of these files you can either use the following |
| 121 | options: |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 122 | |
| 123 | .. code-block:: yaml |
| 124 | |
| 125 | rabbitmq: |
| 126 | server: |
| 127 | enabled: true |
| 128 | ... |
| 129 | ssl: |
| 130 | enabled: True |
| 131 | |
Kirill Bespalov | b0cd0ae | 2017-05-30 17:45:13 +0300 | [diff] [blame] | 132 | key_file: /etc/rabbitmq/ssl/key.pem |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 133 | key: | |
| 134 | -----BEGIN RSA PRIVATE KEY----- |
| 135 | ... |
| 136 | -----END RSA PRIVATE KEY------- |
| 137 | |
Kirill Bespalov | b0cd0ae | 2017-05-30 17:45:13 +0300 | [diff] [blame] | 138 | ca_file: /etc/rabbitmq/ssl/ca.pem |
| 139 | cacert_chain: | |
| 140 | -----BEGIN CERTIFICATE----- |
| 141 | ... |
| 142 | -----END CERTIFICATE------- |
| 143 | |
| 144 | cert_file: /etc/rabbitmq/ssl/cert.pem |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 145 | cert: | |
| 146 | -----BEGIN CERTIFICATE----- |
| 147 | ... |
| 148 | -----END CERTIFICATE------- |
| 149 | |
| 150 | |
Kirill Bespalov | b0cd0ae | 2017-05-30 17:45:13 +0300 | [diff] [blame] | 151 | Or you can use the `salt.minion.cert` salt state which |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 152 | creates all required files according to defined reclass model. |
| 153 | See |
| 154 | https://github.com/Mirantis/reclass-system-salt-model/tree/master/salt/minion/cert/rabbitmq |
| 155 | for details. In this case you need just to enable ssl and nothing more: |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 156 | |
| 157 | .. code-block:: yaml |
| 158 | |
| 159 | rabbitmq: |
| 160 | server: |
| 161 | enabled: true |
| 162 | ... |
| 163 | ssl: |
| 164 | enabled: True |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 165 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 166 | Defaut port for TLS is ``5671``: |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 167 | |
| 168 | .. code-block:: yaml |
| 169 | |
| 170 | rabbitmq: |
| 171 | server: |
| 172 | bind: |
| 173 | ssl: |
| 174 | port: 5671 |
| 175 | |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 176 | Usage |
| 177 | ===== |
| 178 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 179 | Check cluster status, example shows running cluster with 3 nodes: |
| 180 | ctl-1, ctl-2, ctl-3 |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 181 | |
| 182 | .. code-block:: yaml |
| 183 | |
| 184 | > rabbitmqctl cluster_status |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 185 | |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 186 | Cluster status of node 'rabbit@ctl-1' ... |
Kirill Bespalov | 09e5218 | 2017-05-10 14:20:30 +0300 | [diff] [blame] | 187 | [{nodes,[{disc,['rabbit@ctl-1','rabbit@ctl-2','rabbit@ctl-3']}]}, |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 188 | {running_nodes,['rabbit@ctl-3','rabbit@ctl-2','rabbit@ctl-1']}, |
| 189 | {partitions,[]}] |
| 190 | ...done. |
| 191 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 192 | Setup management user: |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 193 | |
| 194 | .. code-block:: yaml |
| 195 | |
| 196 | > rabbitmqctl add_vhost vhost |
| 197 | > rabbitmqctl add_user user alive |
| 198 | > rabbitmqctl set_permissions -p vhost user ".*" ".*" ".*" |
| 199 | > rabbitmqctl set_user_tags user management |
| 200 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 201 | EPD process is Erlang Port Mapper Daemon. It's a feature of the |
| 202 | Erlang runtime that helps Erlang nodes to find each other. It's a |
| 203 | pretty tiny thing and doesn't contain much state (other than "what |
| 204 | Erlang nodes are running on this system?") so it's not a huge deal for |
| 205 | it to still be running. |
| 206 | |
| 207 | Although it's running as user rabbitmq, it was started automatically |
| 208 | by the Erlang VM when we started. We've considered adding "epmd -kill" |
| 209 | to our shutdown script - but that would break any other Erlang apps |
| 210 | running on the system; it's more "global" than RabbitMQ. |
Filip Pytloun | ef5b0af | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 211 | |
| 212 | Read more |
| 213 | ========= |
| 214 | |
| 215 | * http://www.rabbitmq.com/admin-guide.html |
| 216 | * https://github.com/saltstack/salt-contrib/blob/master/states/rabbitmq_plugins.py |
| 217 | * http://docs.saltstack.com/ref/states/all/salt.states.rabbitmq_user.html |
| 218 | * http://stackoverflow.com/questions/14699873/how-to-reset-user-for-rabbitmq-management |
| 219 | * http://www.rabbitmq.com/memory.html |
| 220 | |
| 221 | Clustering |
| 222 | ========== |
| 223 | |
| 224 | * http://www.rabbitmq.com/clustering.html#auto-config |
| 225 | * https://github.com/jesusaurus/hpcs-salt-state/tree/master/rabbitmq |
| 226 | * http://gigisayfan.blogspot.cz/2012/06/rabbit-mq-clustering-python-fabric.html |
| 227 | * http://docwiki.cisco.com/wiki/OpenStack_Havana_Release:_High-Availability_Manual_Deployment_Guide#RabbitMQ_Installation |
Filip Pytloun | 55a7ef0 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 228 | |
| 229 | Documentation and Bugs |
| 230 | ====================== |
| 231 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 232 | * http://salt-formulas.readthedocs.io/ |
| 233 | Learn how to install and update salt-formulas |
Filip Pytloun | 55a7ef0 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 234 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 235 | * https://github.com/salt-formulas/salt-formula-rabbitmq/issues |
| 236 | In the unfortunate event that bugs are discovered, report the issue to the |
| 237 | appropriate issue tracker. Use the Github issue tracker for a specific salt |
| 238 | formula |
Filip Pytloun | 55a7ef0 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 239 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 240 | * https://launchpad.net/salt-formulas |
| 241 | For feature requests, bug reports, or blueprints affecting the entire |
| 242 | ecosystem, use the Launchpad salt-formulas project |
Filip Pytloun | 55a7ef0 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 243 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 244 | * https://launchpad.net/~salt-formulas-users |
| 245 | Join the salt-formulas-users team and subscribe to mailing list if required |
Filip Pytloun | 55a7ef0 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 246 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 247 | * https://github.com/salt-formulas/salt-formula-rabbitmq |
| 248 | Develop the salt-formulas projects in the master branch and then submit pull |
| 249 | requests against a specific formula |
Filip Pytloun | 55a7ef0 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 250 | |
OlgaGusarenko | e27a2ea | 2018-07-31 00:59:36 +0300 | [diff] [blame^] | 251 | * #salt-formulas @ irc.freenode.net |
| 252 | Use this IRC channel in case of any questions or feedback which is always |
| 253 | welcome |