RabbitMQ Cluster Setup

Install RabbitMQ

  1. [root@controller1 ~]# yum install erlang rabbitmq-server -y
  2. [root@controller2 ~]# yum install erlang rabbitmq-server -y
  3. [root@controller3 ~]# yum install erlang rabbitmq-server -y
  4.  
  5. [root@controller1 ~]# systemctl enable rabbitmq-server.service
  6. Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
  7. [root@controller2 ~]# systemctl enable rabbitmq-server.service
  8. Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
  9. [root@controller3 ~]# systemctl enable rabbitmq-server.service
  10. Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
  11.  
  12. [root@controller1 ~]# systemctl start rabbitmq-server.service
  13.  
  14. [root@controller1 ~]# rabbitmq-plugins enable rabbitmq_management
  15. The following plugins have been enabled:
  16.   mochiweb
  17.   webmachine
  18.   rabbitmq_web_dispatch
  19.   amqp_client
  20.   rabbitmq_management_agent
  21.   rabbitmq_management
  22.  
  23. Applying plugin configuration to rabbit@controller1... started 6 plugins.
  24. [root@controller2 ~]# rabbitmq-plugins enable rabbitmq_management
  25. The following plugins have been enabled:
  26.   mochiweb
  27.   webmachine
  28.   rabbitmq_web_dispatch
  29.   amqp_client
  30.   rabbitmq_management_agent
  31.   rabbitmq_management
  32.  
  33. Applying plugin configuration to rabbit@controller2... started 6 plugins.
  34. [root@controller3 ~]# rabbitmq-plugins enable rabbitmq_management
  35. The following plugins have been enabled:
  36.   mochiweb
  37.   webmachine
  38.   rabbitmq_web_dispatch
  39.   amqp_client
  40.   rabbitmq_management_agent
  41.   rabbitmq_management
  42.  
  43. Applying plugin configuration to rabbit@controller3... started 6 plugins.

Configure RabbitMQ for HA queues

  1. [root@controller1 ~]# scp /var/lib/rabbitmq/.erlang.cookie root@controller2:/var/lib/rabbitmq/.erlang.cookie
  2. .erlang.cookie                                                             100%   20    19.8KB/s   00:00    
  3. [root@controller1 ~]# scp /var/lib/rabbitmq/.erlang.cookie root@controller3:/var/lib/rabbitmq/.erlang.cookie
  4. .erlang.cookie                                                             100%   20    34.2KB/s   00:00

On Each Nodes

  1. # chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
  2. # chmod 400 /var/lib/rabbitmq/.erlang.cookie
  3.  
  4. # systemctl enable rabbitmq-server.service
  5. # systemctl start rabbitmq-server.service
  6.  
  7. [root@controller1 ~]# rabbitmqctl cluster_status
  8. Cluster status of node rabbit@controller1 ...
  9. [{nodes,[{disc,[rabbit@controller1]}]},
  10.  {running_nodes,[rabbit@controller1]},
  11.  {cluster_name,<<"rabbit@controller1">>},
  12.  {partitions,[]},
  13.  {alarms,[{rabbit@controller1,[]}]}]
  14. [root@controller2 ~]# rabbitmqctl cluster_status
  15. Cluster status of node rabbit@controller2 ...
  16. [{nodes,[{disc,[rabbit@controller2]}]},
  17.  {running_nodes,[rabbit@controller2]},
  18.  {cluster_name,<<"rabbit@controller2">>},
  19.  {partitions,[]},
  20.  {alarms,[{rabbit@controller2,[]}]}]
  21. [root@controller3 ~]# rabbitmqctl cluster_status
  22. Cluster status of node rabbit@controller3 ...
  23. [{nodes,[{disc,[rabbit@controller3]}]},
  24.  {running_nodes,[rabbit@controller3]},
  25.  {cluster_name,<<"rabbit@controller3">>},
  26.  {partitions,[]},
  27.  {alarms,[{rabbit@controller3,[]}]}]

On Other Nodes

  1. [root@controller2 ~]# rabbitmqctl stop_app
  2. Stopping node rabbit@controller2 ...
  3. [root@controller3 ~]# rabbitmqctl stop_app
  4. Stopping node rabbit@controller3 ...
  5.  
  6. [root@controller2 ~]# rabbitmqctl join_cluster --ram rabbit@controller1
  7. Clustering node rabbit@controller2 with rabbit@controller1 ...
  8. [root@controller3 ~]# rabbitmqctl join_cluster --ram rabbit@controller1
  9. Clustering node rabbit@controller3 with rabbit@controller1 ...
  10.  
  11. [root@controller2 ~]# rabbitmqctl start_app
  12. Starting node rabbit@controller2 ...
  13. [root@controller3 ~]# rabbitmqctl start_app
  14. Starting node rabbit@controller3 ...

Set the HA-Mode Policy

  1. [root@controller1 ~]# rabbitmqctl cluster_status
  2. Cluster status of node rabbit@controller1 ...
  3. [{nodes,[{disc,[rabbit@controller1]},
  4.          {ram,[rabbit@controller3,rabbit@controller2]}]},
  5.  {running_nodes,[rabbit@controller3,rabbit@controller2,rabbit@controller1]},
  6.  {cluster_name,<<"rabbit@controller1">>},
  7.  {partitions,[]},
  8.  {alarms,[{rabbit@controller3,[]},
  9.           {rabbit@controller2,[]},
  10.           {rabbit@controller1,[]}]}]
  11. [root@controller2 ~]# rabbitmqctl cluster_status
  12. Cluster status of node rabbit@controller2 ...
  13. [{nodes,[{disc,[rabbit@controller1]},
  14.          {ram,[rabbit@controller3,rabbit@controller2]}]},
  15.  {running_nodes,[rabbit@controller3,rabbit@controller1,rabbit@controller2]},
  16.  {cluster_name,<<"rabbit@controller1">>},
  17.  {partitions,[]},
  18.  {alarms,[{rabbit@controller3,[]},
  19.           {rabbit@controller1,[]},
  20.           {rabbit@controller2,[]}]}]
  21. [root@controller3 ~]# rabbitmqctl set_policy ha-all '^(?!amq\.).*' '{"ha-mode": "all"}'
  22. Setting policy "ha-all" for pattern "^(?!amq\\.).*" to "{\"ha-mode\": \"all\"}" with priority "0" ...
  23. [root@controller3 ~]# 
  24. [root@controller3 ~]# 
  25. [root@controller3 ~]# rabbitmqctl cluster_status
  26. Cluster status of node rabbit@controller3 ...
  27. [{nodes,[{disc,[rabbit@controller1]},
  28.          {ram,[rabbit@controller3,rabbit@controller2]}]},
  29.  {running_nodes,[rabbit@controller2,rabbit@controller1,rabbit@controller3]},
  30.  {cluster_name,<<"rabbit@controller1">>},
  31.  {partitions,[]},
  32.  {alarms,[{rabbit@controller2,[]},
  33.           {rabbit@controller1,[]},
  34.           {rabbit@controller3,[]}]}]
  35.  
  36. [root@controller1 ~]# rabbitmqctl set_policy ha-all '^(?!amq\.).*' '{"ha-mode": "all"}'
  37. Setting policy "ha-all" for pattern "^(?!amq\\.).*" to "{\"ha-mode\": \"all\"}" with priority "0" ...
  38. [root@controller2 ~]# rabbitmqctl set_policy ha-all '^(?!amq\.).*' '{"ha-mode": "all"}'
  39. Setting policy "ha-all" for pattern "^(?!amq\\.).*" to "{\"ha-mode\": \"all\"}" with priority "0" ...
  40. [root@controller3 ~]# rabbitmqctl set_policy ha-all '^(?!amq\.).*' '{"ha-mode": "all"}'
  41. Setting policy "ha-all" for pattern "^(?!amq\\.).*" to "{\"ha-mode\": \"all\"}" with priority "0" ...

Now, Take the Browser

http://192.168.220.21:15672

username/password :

guest/guest

Configure OpenStack services to use RabbitMQ HA queues

  1. transport_url = rabbit://RABBIT_USER:RABBIT_PASS@rabbit1:5672,
  2. RABBIT_USER:RABBIT_PASS@rabbit2:5672,RABBIT_USER:RABBIT_PASS@rabbit3:5672
  3. rabbit_retry_interval=1
  4. rabbit_retry_backoff=2
  5. rabbit_max_retries=0
  6. rabbit_durable_queues=true
  7. rabbit_ha_queues=true

For the Old Set-Up

  1. # rabbitmqctl stop_app
  2. # rabbitmqctl reset
  3. # rabbitmqctl start_app

Create RabbitMQ Admin

  1. [root@controller1 ~]# rabbitmqctl  add_user admin admin
  2. Creating user "admin" ...
  3. [root@controller1 ~]# rabbitmqctl  set_user_tags admin administrator
  4. Setting tags for user "admin" to [administrator] ...
  5. [root@controller1 ~]# rabbitmqctl add_user openstack openstack
  6. Creating user "openstack" ...
  7. [root@controller1 ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*" 
  8. Setting permissions for user "openstack" in vhost "/" ...
  9. [root@controller1 ~]# rabbitmqctl  set_user_tags openstack administrator
  10. Setting tags for user "openstack" to [administrator] ...
  11. [root@controller1 ~]# systemctl restart rabbitmq-server.service

69 thoughts on “RabbitMQ Cluster Setup

  1. takarat.com says:

    Thank you for every other fantastic article.
    Where else may anyone get that kind of info in such a perfect
    method of writing? I have a presentation next week, and I’m on the
    look for such info.

  2. Frank says:

    I could not refrain from commenting. Exceptionally well written!
    I am sure this paragraph has touched all the internet users, its
    really really nice piece of writing on building up new web site.
    Hi, I do believe this is an excellent blog. I stumbledupon it 😉 I will revisit once again since
    i have book marked it. Money and freedom is the greatest way to change, may you
    be rich and continue to help others. http://foxnews.org

  3. http://bong889.com says:

    The process begins from the uncomplicated activity of the account option.
    Cherry blossom tattoos represent various things in numerous cultures.

    Now you’ve taken that all-important first step and they are
    looking over this report about flash games and social
    network, you might be within the unique and privideged position to be
    amongst a small grouping of pioneering entreprenuers who may have learned about it and therefore are taking affirmative action.

  4. Aracelis says:

    Terrific work! Thaat is the type oof info that are meant to be shared across the web.

    Disgrace on Google for not positioning this publish higher!
    Come on over and talk over with my web site . Thanks
    =)

    • admin says:

      I think everyone in the world has their own characteristics, so be yourself as you like.
      SEO is a commercial activity that I don’t think it’s a good way to get your own blog to rank.

  5. Standard Oyster Company says:

    I do believe all of the ideas you have presented in your post.
    They are really convincing and will definitely work.
    Nonetheless, the posts are too brief for newbies.

    May you please prolong them a little from subsequent time?
    Thank you for the post.

  6. https://edumesa.vn/hoc-hat-karaoke-tai-ha-noi/ says:

    Great ? I should definitely pronounce, impressed with your site.
    I had no trouble navigating through all the tabs as well as related information ended up being truly easy to do
    to access. I recently found what I hoped for before you know
    it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or something, web site theme .
    a tones way for your client to communicate.
    Nice task.

  7. marketstrom.gr says:

    I’m not sure where you are getting your info, but great topic.
    I needs to spend some time learning much more or understanding more.
    Thanks for excellent info I was looking for this information for
    my mission.

  8. BocaHickory.Com says:

    Greetings, I do believe your web site might be having browser compatibility problems.
    When I look at your blog in Safari, it looks
    fine however, when opening in I.E., it’s got some overlapping issues.
    I merely wanted to provide you with a quick heads up! Apart from that,
    fantastic site!

    • admin says:

      Thanks for your reminder, but I hava no time to solve this compatibility problems.
      Luckily, Microsoft recommends that everyone use chrome, so it’s not a big problem now, right?

  9. https://edumesa.vn/hoc-hat-karaoke-tai-ha-noi/ says:

    I as well as my friends happened to be going through the great tactics found on your site and so all of a sudden got a terrible feeling I had not expressed respect
    to the site owner for those tips. The young boys are already certainly excited to learn all
    of them and already have pretty much been having fun with them.
    Appreciate your turning out to be simply considerate and then for making a decision on varieties of impressive information most people are really desirous to
    be informed on. My sincere apologies for not saying thanks to earlier.

  10. music webstore says:

    Hey just wanted to give you a brief heads up and let you know a few of the
    images aren’t loading properly. I’m not sure
    why but I think its a linking issue. I’ve tried it in two different internet browsers and both
    show the same outcome.

    • admin says:

      Use google’s chrome and have a try.
      If the issue is still exist,
      the problem is network speed which maybe yours or my server(China).

  11. ironthundersaloon.Com says:

    Woah! I’m really enjoying the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s tough to get
    that “perfect balance” between superb usability and visual appeal.
    I must say you’ve done a amazing job with this.

    Also, the blog loads extremely fast for me on Chrome.
    Superb Blog!

  12. BestVernon says:

    I see you don’t monetize your site, don’t waste your traffic, you can earn additional bucks every month.
    If you want to read about this method, simply search in gooogle:
    dracko’s tricks

  13. buy dvd says:

    It’s a pity you don’t have a donate button! I’d most certainly donate to this excellent
    blog! I guess for now i’ll settle for bookmarking and adding your RSS feed to my Google account.
    I look forward to fresh updates and will talk about this site with my Facebook group.

    Talk soon!

  14. music says:

    Hello! Someone in my Facebook group shared this site with
    us so I came to give it a look. I’m definitely enjoying the information. I’m book-marking
    and will be tweeting this to my followers! Superb blog and excellent design.

  15. Commercial Lighting says:

    Hi there! This is kind of off topic but I need sme
    advice frokm aan established blog. Is it very hard to set up your own blog?
    I’m not very techincal but I can figure things out prretty fast.
    I’m thinkinhg about making my own but I’m not sure where to begin. Do
    you have any tips or suggestions? Thanks

    • admin says:

      Maybe you can search keyword ‘vps’ and ‘how to create a blog’ with google which is a better way to look for some advice!
      However, you can contace me if you can not established blog yet.

  16. dress shirts jermyn says:

    Greetings from Idaho! I’m bored to death at work so I decided to browse your blog on my iphone during lunch break.
    I love the information you present here and can’t wait to take a look when I get
    home. I’m surprised at how quick your blog loaded on my mobile ..

    I’m not even using WIFI, just 3G .. Anyhow, great site!

  17. oldehickorytaproom.Com says:

    Thanks for ones marvelous posting! I actually enjoyed reading
    it, you can be a great author.I will be sure to bookmark
    your blog and definitely will come back someday.
    I want to encourage you continue your great job, have a nice holiday weekend!

  18. dropYourTable says:

    Hi water, I like your article, he gave me a lot of technical guidance. I hope you can continue to write, and I will continue to pay attention to your articles. Come on

  19. تسديد قروض says:

    Greetings! This is my first visit to your blog! We are a collection of volunteers and
    starting a new initiative in a community in the same niche.
    Your blog provided us valuable information to work on. You have done a marvellous job!

  20. https://www.cheats-network.com says:

    Does your blog have a contact page? I’m having problems
    locating it but, I’d like to shoot you an email.

    I’ve got some creative ideas for your blog you might be interested in hearing.

    Either way, great site and I look forward to seeing it improve over time.

  21. cameraipgiasi.com says:

    Hi, I think your website might be having browser compatibility issues.
    When I look at your blog site in Chrome, it looks fine but when opening in Internet
    Explorer, it has some overlapping. I just wanted to give you a quick heads up!
    Other then that, fantastic blog!

  22. buy viagra sildenafil online says:

    I’m really impressed with your writing skills and also with
    the layout on your weblog. Is this a paid theme or did you modify it yourself?

    Anyway keep up the nice quality writing, it’s rare to see a great blog
    like this one nowadays.

  23. used nikon film cameras says:

    With havin so much content and articles do you ever run into any problems of plagorism or copyright violation? My website has a
    lot of exclusive content I’ve either created myself or outsourced
    but it looks like a lot of it is popping it up all over the web without my permission. Do you
    know any solutions to help stop content from being stolen?
    I’d really appreciate it.

  24. Jim says:

    It is appropriate time to make some plans for the future and it’s time to
    be happy. I’ve read this post and if I could I wish to
    suggest you few interesting things or advice.
    Maybe you can write next articles referring
    to this article. I want to read more things about it!
    Hi there! This post couldn’t be written much better!
    Going through this post reminds me of my previous roommate!
    He continually kept talking about this. I
    will send this information to him. Pretty sure he’s
    going to have a good read. Thank you for sharing! It is appropriate time to make
    some plans for the future and it is time to be happy.
    I have read this post and if I could I wish to suggest you few interesting things or
    advice. Perhaps you can write next articles referring to
    this article. I wish to read even more things about it! http://starbucks.com

  25. Marjorie says:

    I have been absent for a while, but now I remember why I used to love this website.
    Thanks, I will try and check back more frequently.
    How frequently you update your website?

  26. camera ip không dây says:

    Simply desire to say your article is as surprising.
    The clearness in your post is just great and i could assume you’re an expert
    on this subject. Fine with your permission let me to grab your
    RSS feed to keep updated with forthcoming post.
    Thanks a million and please continue the gratifying work.

  27. minecraft says:

    I was very happy to find this page. I wanted to thank you for your time for this fantastic read!!
    I definitely appreciated every bit of it and I have
    you saved to fav to check out new stuff in your web site.

  28. impot Direct says:

    Simply want to say your article is as astounding.
    The clearness in your post is just excellent and i can assume you are an expert on this subject.
    Fine with your permission let me to grab your RSS feed to keep updated with forthcoming post.
    Thanks a million and please carry on the enjoyable work.

  29. minecraft says:

    The other day, while I was at work, my sister stole my
    iphone and tested to see if it can survive a
    30 foot drop, just so she can be a youtube sensation. My iPad
    is now broken and she has 83 views. I know this is completely off topic but I had to share it with someone!

  30. multi unit Houses for Sale columbia sc says:

    I have been surfing online more than three hours nowadays,
    yet I never found any interesting article like yours.
    It is lovely price enough for me. In my view, if all webmasters
    and bloggers made excellent content material
    as you did, the net will be much more helpful than ever before.

  31. camera wifi giá rẻ says:

    I’m really enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it
    much more enjoyable for me to come here and visit
    more often. Did you hire out a developer to create your theme?

    Excellent work!

  32. 사설토토 says:

    I like what you guys are usually up too. This kind of clever work
    and reporting! Keep up the superb works guys
    I’ve incorporated you guys to my personal blogroll.

  33. stripping says:

    I am not sure where you’re getting your info, but good topic.
    I needs to spend some time learning much more or understanding more.
    Thanks for great information I was looking for this info for my mission.

  34. uniforms suplier in Uae says:

    Hi, i read your blog from time to time and i own a similar
    one and i was just curious if you get a lot of spam comments?
    If so how do you reduce it, any plugin or anything you can advise?
    I get so much lately it’s driving me insane so any support
    is very much appreciated.

  35. emailmarketingblog42.blog.fc2.com says:

    Have you ever considered publishing an e-book or guest authoring on other sites?
    I have a blog centered on the same subjects you discuss and
    would really like to have you share some stories/information.
    I know my audience would appreciate your work.
    If you are even remotely interested, feel free to send me an e mail.

  36. online poker says:

    Hi! I know this is kinda off topic however , I’d
    figured I’d ask. Would you be interested in exchanging links or maybe guest authoring a blog article or vice-versa?
    My website discusses a lot of the same subjects as yours and I feel we could greatly benefit from each other.
    If you are interested feel free to send me an e-mail.

    I look forward to hearing from you! Excellent blog by the way!

  37. elitek.nl says:

    I’d like to thank you for the efforts you’ve put in penning this website.
    I really hope to view the same high-grade content from
    you later on as well. In fact, your creative writing abilities has motivated me to get my own site now 😉

  38. aroma diffuser user manual says:

    Thanks for the marvelous posting! I serioysly enjoyed reading it, you happen to be a great author.

    I will remember to bookmark your blog and will come
    back very soon.I want to encourage yourself to continue
    your great work, have a nice morning!

Leave a Reply

Your email address will not be published. Required fields are marked *