{"id":1146,"date":"2009-11-10T00:02:45","date_gmt":"2009-11-09T23:02:45","guid":{"rendered":"http:\/\/www.devco.net\/?p=1146"},"modified":"2010-08-17T12:31:42","modified_gmt":"2010-08-17T11:31:42","slug":"activemq_clustering","status":"publish","type":"post","link":"https:\/\/www.devco.net\/archives\/2009\/11\/10\/activemq_clustering.php","title":{"rendered":"ActiveMQ Clustering"},"content":{"rendered":"

As part of deploying MCollective<\/a> + ActiveMQ<\/a> instead of my old Spread based system I need to figure out a multi location setup, the documentation says I’d possible so I thought I better get down and figure it out.<\/p>\n

In my case I will have per-country ActiveMQ’s, I’ve had the same with Spread in the past and it’s proven reliable enough for my needs, each ActiveMQ will carry 30 or so nodes.<\/p>\n

\"ActiveMQ

ActiveMQ Cluster<\/p><\/div>\n

The above image shows a possible setup, you can go much more complex, you can do typical hub-and-spoke setups, a fully meshed setup or maybe have a local one in your NOC etc, ActiveMQ is clever enough not to create message loops or storms if you create loops so you can build lots of resilient routes. <\/p>\n

ActiveMQ calls this a Network of Brokers and the minimal docs can be found here<\/a>. They also have docs on using SSL<\/a> for connections, you can encrypt the inter DC traffic using that.<\/p>\n

I’ll show sample config below of the one ActiveMQ node, the other would be identical except for the IP of it’s partner.\u00a0 The sample uses authentication between links as I think you really should be using auth everywhere.<\/p>\n

<\/p>\n

\r\n   \r\n\r\n      \r\n         \r\n         \r\n      <\/transportConnectors>\r\n<\/pre>\n

<\/code><\/p>\n

These are basically your listeners, we want to accept Stomp and OpenWire connections.<\/p>\n

Now comes the connection to the other ActiveMQ server:<\/p>\n

<\/p>\n

\r\n\r\n   \r\n<\/networkConnectors>\r\n<\/pre>\n

<\/code><\/p>\n

This sets up a connection to the remote server at 192.168.1.10<\/em> using username amq<\/em> and password Afuphohxoh<\/em>. You can also designate failover and backup links, see the docs for samples<\/a>. If you’re building lots of servers talking to each other you should give every link on every server a unique name. Here I called it amq1_amq2<\/em> for comms from a server called amq1<\/em> to amq2<\/em>, this is a simple naming scheme that ensures things are unique.<\/p>\n

Next up comes the Authentication and Authorization bits, this sets up the amq<\/em> user and an mcollective<\/em> user that can use the topic \/topic\/mcollective.*<\/em>. More about ActiveMQ’s security model can be found here<\/a>.<\/p>\n

<\/p>\n

\r\n    \r\n      \r\n        \r\n          \r\n          \r\n        <\/users>\r\n      <\/simpleAuthenticationPlugin>\r\n      \r\n        \r\n          \r\n            \r\n              \" write=\"admins\" read=\"admins\" admin=\"admins\" \/>\r\n              \" write=\"admins\" read=\"admins\" admin=\"admins\" \/>\r\n              \" write=\"mcollectiveusers\" read=\"mcollectiveusers\" admin=\"mcollectiveusers\" \/>\r\n              \" read=\"everyone,all\" write=\"everyone,all\" admin=\"everyone,all\"\/>\r\n            <\/authorizationEntries>\r\n          <\/authorizationMap>\r\n        <\/map>\r\n      <\/authorizationPlugin>\r\n    <\/plugins>\r\n  <\/broker>\r\n<\/pre>\n

<\/code><\/p>\n

If you setup the other node with a setup connecting back to this one you will have bi-directional messages working correctly.<\/p>\n

You can now connect your MCollective clients to either one of the servers and everything will work as if you had only one server. ActiveMQ servers will attempt reconnects regularly if the connection breaks. <\/p>\n

As part of deploying MCollective + ActiveMQ instead of my old Spread based system I need to figure out a multi location setup, the documentation says I’d possible so I thought I better get down and figure it out. In my case I will have per-country ActiveMQ’s, I’ve had the same with Spread in the […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","footnotes":""},"categories":[7],"tags":[81,78],"_links":{"self":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/1146"}],"collection":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/comments?post=1146"}],"version-history":[{"count":15,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/1146\/revisions"}],"predecessor-version":[{"id":1721,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/1146\/revisions\/1721"}],"wp:attachment":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/media?parent=1146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/categories?post=1146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/tags?post=1146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}

You can also test using my generic stomp client that I posted in the past<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"