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 | |
| 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 |
| 20 | bind: |
| 21 | address: 0.0.0.0 |
| 22 | port: 5672 |
| 23 | secret_key: rabbit_master_cookie |
| 24 | admin: |
| 25 | name: adminuser |
| 26 | password: pwd |
| 27 | plugins: |
| 28 | - amqp_client |
| 29 | - rabbitmq_management |
| 30 | virtual_hosts: |
| 31 | - enabled: true |
| 32 | host: '/monitor' |
| 33 | user: 'monitor' |
| 34 | password: 'password' |
| 35 | |
| 36 | RabbitMQ as a Stomp broker |
| 37 | |
| 38 | .. code-block:: yaml |
| 39 | |
| 40 | rabbitmq: |
| 41 | server: |
| 42 | enabled: true |
| 43 | secret_key: rabbit_master_cookie |
| 44 | bind: |
| 45 | address: 0.0.0.0 |
| 46 | port: 5672 |
| 47 | virtual_hosts: |
| 48 | - enabled: true |
| 49 | host: '/monitor' |
| 50 | user: 'monitor' |
| 51 | password: 'password' |
| 52 | plugins: |
| 53 | - rabbitmq_stomp |
| 54 | |
| 55 | RabbitMQ cluster |
| 56 | ---------------- |
| 57 | |
| 58 | RabbitMQ as base cluster node |
| 59 | |
| 60 | .. code-block:: yaml |
| 61 | |
| 62 | rabbitmq: |
| 63 | server: |
| 64 | enabled: true |
| 65 | bind: |
| 66 | address: 0.0.0.0 |
| 67 | port: 5672 |
| 68 | secret_key: rabbit_master_cookie |
| 69 | admin: |
| 70 | name: adminuser |
| 71 | password: pwd |
| 72 | cluster: |
| 73 | enabled: true |
| 74 | role: master |
| 75 | mode: disc |
| 76 | members: |
| 77 | - name: openstack1 |
| 78 | host: 10.10.10.212 |
| 79 | - name: openstack2 |
| 80 | host: 10.10.10.213 |
| 81 | |
| 82 | HA Queues definition |
| 83 | |
| 84 | .. code-block:: yaml |
| 85 | |
| 86 | rabbitmq: |
| 87 | server: |
| 88 | enabled: true |
| 89 | ... |
| 90 | virtual_hosts: |
| 91 | - enabled: true |
| 92 | host: '/monitor' |
| 93 | user: 'monitor' |
| 94 | password: 'password' |
| 95 | policies: |
| 96 | - name: HA |
| 97 | pattern: '^(?!amq\.).*' |
| 98 | definition: '{"ha-mode": "all"}' |
| 99 | |
| 100 | Usage |
| 101 | ===== |
| 102 | |
| 103 | Check cluster status, example shows running cluster with 3 nodes: ctl-1, ctl-2, ctl-3 |
| 104 | |
| 105 | .. code-block:: yaml |
| 106 | |
| 107 | > rabbitmqctl cluster_status |
| 108 | |
| 109 | Cluster status of node 'rabbit@ctl-1' ... |
| 110 | [{nodes,[{disc,['rabbit@ctl-1','rabbit@ctl-2','rabbit@ctl-3']}]}, |
| 111 | {running_nodes,['rabbit@ctl-3','rabbit@ctl-2','rabbit@ctl-1']}, |
| 112 | {partitions,[]}] |
| 113 | ...done. |
| 114 | |
| 115 | Setup management user. |
| 116 | |
| 117 | .. code-block:: yaml |
| 118 | |
| 119 | > rabbitmqctl add_vhost vhost |
| 120 | > rabbitmqctl add_user user alive |
| 121 | > rabbitmqctl set_permissions -p vhost user ".*" ".*" ".*" |
| 122 | > rabbitmqctl set_user_tags user management |
| 123 | |
| 124 | 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. |
| 125 | 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. |
| 126 | |
| 127 | Read more |
| 128 | ========= |
| 129 | |
| 130 | * http://www.rabbitmq.com/admin-guide.html |
| 131 | * https://github.com/saltstack/salt-contrib/blob/master/states/rabbitmq_plugins.py |
| 132 | * http://docs.saltstack.com/ref/states/all/salt.states.rabbitmq_user.html |
| 133 | * http://stackoverflow.com/questions/14699873/how-to-reset-user-for-rabbitmq-management |
| 134 | * http://www.rabbitmq.com/memory.html |
| 135 | |
| 136 | Clustering |
| 137 | ========== |
| 138 | |
| 139 | * http://www.rabbitmq.com/clustering.html#auto-config |
| 140 | * https://github.com/jesusaurus/hpcs-salt-state/tree/master/rabbitmq |
| 141 | * http://gigisayfan.blogspot.cz/2012/06/rabbit-mq-clustering-python-fabric.html |
| 142 | * http://docwiki.cisco.com/wiki/OpenStack_Havana_Release:_High-Availability_Manual_Deployment_Guide#RabbitMQ_Installation |