a4f200325f22621f2f0dd634af6bc8201b823a80
[packages/precise/mcollective.git] / website / reference / integration / activemq_clusters.md
1 ---
2 layout: default
3 title: ActiveMQ Clustering
4 toc: false
5 ---
6 [MessageFlow]: /mcollective/reference/basic/messageflow.html
7 [NetworksOfBrokers]: http://activemq.apache.org/networks-of-brokers.html
8 [SampleConfig]: http://github.com/puppetlabs/marionette-collective/tree/master/ext/activemq/
9 [fuse_cluster]: http://fusesource.com/docs/broker/5.5/clustering/index.html
10 [activemq_network]: /mcollective/deploy/middleware/activemq.html#settings-for-networks-of-brokers
11
12 Relying on existing middleware tools and not re-inventing the transport wheel ourselves means we can take advantage of a lot of the built in features they provide.  One such feature is clustering in ActiveMQ that allows for highly scalable and flexible network layouts.
13
14 We'll cover here how to build a multi data center network of ActiveMQ servers with a NOC, the NOC computers would not need to send any packets direct to the nodes they manage and thanks to our meta data based approach to addressing machines they do not even need to know IPs or hostnames.
15
16 There is an example of a 3 node cluster in the [ext/activemq directory of the MCollective source][SampleConfig].
17
18 ## Network Design
19
20 ### Network Layout
21
22 ![ActiveMQ Cluster](/mcollective/images/activemq-multi-locations.png)
23
24 The diagram above shows our sample network, I am using the same techniques to put an ActiveMQ in each of 4 countries and then having local nodes communicate to in-country ActiveMQ nodes.
25
26 * These are the terminals of your NOC staff, they run the client code, these could also be isolated web servers for running admin tools etc.
27 * Each location has its own instance of ActiveMQ and nodes would only need to communicate to their local ActiveMQ.  This greatly enhances security in a setup like this.
28 * The ActiveMQ instances speak to each other using a protocol called OpenWire, you can run this over IPSec or you could use the native support for SSL.
29 * These are the servers being managed, they run the server code.  No direct communications needs to be in place between NOC and managed servers.
30
31 Refer to the [MessageFlow][] document to see how messages would traverse the middleware in a setup like this.
32
33 ### General Observations
34 The main design goal here is to promote network isolation, the staff in your NOC are often high churn people, you'll get replacement staff relatively often and it's a struggle to secure what information they carry and how and when you can trust them.
35
36 Our model of using middleware and off-loading authentication and authorization onto the middleware layer means you only need to give NOC people appropriate access to the middleware and not to each individual machine.
37
38 Our usage of meta data to address machines rather than hostnames or ip address means you do not need to divulge this information to NOC staff, from their point of view they access machines like this:
39
40 * All machines in _datacenter=a_
41 * AND all machines with puppet class _/webserver/_
42 * AND all machines with Facter fact _customer=acmeinc_
43
44 In the end they can target the machines they need to target for maintenance commands as above without the need for any info about hostnames, ips, or even what/where data center A is.
45
46 This model works particularly well in a Cloud environment where hostnames are dynamic and not under your control, in a cloud like Amazon S3 machines are better identified by what AMI they have booted and in what availability zones they are rather than what their hostnames are.
47
48 ## ActiveMQ Configuration
49
50 ActiveMQ supports many types of cluster; we think their Network of Brokers model works best for MCollective.
51
52 You will need to configure your ActiveMQ servers with everything from the ["Settings for Networks of Brokers" section of the ActiveMQ config reference][activemq_network]. Note the comments about the bi-directional connections: In the example network described above, you could either configure a pair of connectors on each datacenter broker to connect them to the NOC, or configure several pairs of connectors on the NOC broker to connect it to every datacenter. Do whichever makes sense for your own convenience and security needs.
53
54 There is also a set of example config files in the [ext/activemq directory of the MCollective source][SampleConfig]; refer to these while reading the config reference. 
55
56 See [the ActiveMQ docs][NetworksOfBrokers] or [the Fuse docs][fuse_cluster] for more detailed info about networks of brokers.
57