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