不为有趣之事,何遣有涯之生
不失其所者久,死而不亡者寿

AMQ简明教程(12) AMQ集群

AMQ集群

Queue consumer clusters

ActiveMQ支持Consumer对消息高可靠性的负载平衡消费,如果一个Consumer死掉,该消息会转发到其它的Consumer消费的Queue上。
如果一个Consumer获得消息比其它Consumer快,那么他将获得更多的消息。
因此推荐ActiveMQ的Broker和Client使用failover://transport的方式来配置链接

Broker clusters

大部情况下是使用一系列的Broker和Client链接到一起。如果一个Broker死掉了,Client可以自动链接到其它Broker上。实现以上行为需要用failover协议作为Client。

如果启动了多个Broker,Client可以使用static discover或者 Dynamic discovery容易的从一个broker到另一个broker直接链接。

这样当一个broker上没有Consumer的话,那么它的消息不会被消费的,然而该broker会通过存储和转发的策略来把该消息发到其它broker上。

特别注意:ActiveMQ默认的两个broker,static链接后是单方向的,broker-A可以访问消费broker-B的消息,如果要支持双向通信,需要在netWorkConnector配置的时候,设置duplex=true 就可以了。

消息会较为平均的分配给2个集群,而不是每个消费者。即使某个消费者集群的消费者比其他集群中多,它获得的消息总数仍然差不多。不适合机器性能不均等的架构。

原因:networkConnector配置的可用属性conduitSubscriptions :默认true,标示是否把同一个broker的多个consumer当做一个来处理

负载均衡的时候一般设置为false, 设置为false后,会按照消费者个数来分配。

Master Slave

在5.9的版本里面,废除了Pure Master Slave的方式,目前支持:

1:Shared File System Master Slave:基于共享储存的Master-Slave:多个broker实例使用一个存储文件,谁拿到文件锁就是master,其他处于待启动状态,如果master挂掉了,某个抢到文件锁的slave变成master

2:JDBC Master Slave:基于JDBC的Master-Slave:使用同一个数据库,拿到LOCK表的写锁的broker成为master

3:Replicated LevelDB Store:基于ZooKeeper复制LevelDB存储的Master-Slave机制,这个是5.9新加的
具体的可以到官方察看: http://activemq.apache.org/masterslave.html

JDBC Master Slave的方式

利用数据库作为数据源,采用Master/Slave模式,其中在启动的时候Master首先获
得独有锁,其它Slaves Broker则等待获取独有锁。
推荐客户端使用Failover来链接Brokers。
具体如下图所示:

Master失败
如果Master失败,则它释放独有锁,其他Slaver则获取独有锁,其它Slaver立即获得独有锁后此时它将变成Master,并且启动所有的传输链接。同时,Client将停止链接之
前的Master和将会轮询链接到其他可以利用的Broker即新Master。如上中图所示

Master重启
任何时候去启动新的Broker,即作为新的Slave来加入集群,如上右图所示

JDBC Master Slave的配置

使用来配置消息的持久化,自动就会使用JDBC MasterSlave的方式。

未经允许不得转载:菡萏如佳人 » AMQ简明教程(12)
分享到: 更多 (0)

评论 62

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    Marvelous, what a blog it is! This website provides valuable facts to us,
    keep it up.

    Сialis2年前 (2018-11-08)回复
  2. #2

    Please stop by the sites we follow, including this a single, because it represents our picks in the web.

    Google1年前 (2019-03-01)回复
  3. #3

    I know this web site gives quality depending content and other stuff, is there any other site which
    provides these information in quality?

    minecraft1年前 (2019-03-23)回复
  4. #4

    Everything is very open with a really clear
    explanation of the issues. It was truly informative.

    Your site is extremely helpful. Many thanks for sharing!

    minecraft1年前 (2019-03-28)回复
    • I'm glad it helped

      hzqiuxm1年前 (2019-03-29)回复
  5. #5

    If some one needs expert view about blogging and site-building after that i propose him/her to pay a quick visit
    this webpage, Keep up the nice job.

    tinyurl.com1年前 (2019-04-15)回复
  6. #6

    I have fun with, cause I discovered exactly
    what I used to be looking for. You have ended my 4
    day lengthy hunt! God Bless you man. Have a nice day. Bye

    minecraft1年前 (2019-04-15)回复
  7. #7

    Sweet blog! I found it while searching on Yahoo News. Do you have any tips on how to get
    listed in Yahoo News? I've been trying for a while but I never seem
    to get there! Many thanks

    minecraft1年前 (2019-04-18)回复
  8. #8

    What's up to every body, it's my first go to see of
    this website; this website contains amazing and really excellent information designed for visitors.

    minecraft1年前 (2019-04-19)回复
  9. #9

    I all the time emailed this web site post page to all my friends, for the reason that if like to read it next my links
    will too.

    http://tinyurl.com1年前 (2019-04-20)回复
    • thanks!

      hzqiuxm1年前 (2019-04-26)回复
  10. #10

    We are a group of volunteers and starting a new scheme in our community.
    Your site offered us with valuable info to work on. You have performed a formidable activity and our entire group shall
    be thankful to you.

    minecraft1年前 (2019-04-21)回复
    • Thank you, and congratulations!

      hzqiuxm1年前 (2019-04-26)回复
  11. #11

    I do not even know how I ended up here, but I thought this post was great.
    I don't know who you are but certainly you are going to
    a famous blogger if you are not already 😉 Cheers!

    minecraft1年前 (2019-04-23)回复
    • thanks!

      hzqiuxm1年前 (2019-04-26)回复
  12. #12

    Hi, after reading this awesome post i am also glad to
    share my familiarity here with friends.

    minecraft1年前 (2019-04-24)回复
  13. #13

    For hottest news you have to visit world wide web and on web I found this web page as
    a best website for most up-to-date updates.

    minecraft1年前 (2019-04-25)回复
  14. #14

    Awesome! Its actually remarkable piece of writing,
    I have got much clear idea concerning from this paragraph.

    gamefly free trial1年前 (2019-05-01)回复
  15. #15

    Wow, fantastic weblog structure! How lengthy have
    you been running a blog for? you made running a
    blog look easy. The entire look of your web site is wonderful, as neatly as the content material!

    gamefly free trial1年前 (2019-05-01)回复
  16. #16

    I needed to thank you for this great read!! I definitely enjoyed every little bit
    of it. I've got you book marked to look at new things you post…

    gamefly free trial1年前 (2019-05-02)回复
  17. #17

    Do you mind if I quote a couple of your articles
    as long as I provide credit and sources back to your site?
    My blog site is in the very same area of interest as
    yours and my users would definitely benefit from some of the information you provide
    here. Please let me know if this ok with you.
    Thanks!

    minecraft download free1年前 (2019-05-09)回复
    • ok

      hzqiuxm1年前 (2019-05-21)回复
  18. #18

    Great article! This is the kind of info that should be shared around the net.
    Shame on Google for now not positioning this submit upper!
    Come on over and talk over with my website . Thank you =)

    g1年前 (2019-05-12)回复
  19. #19

    I read this piece of writing fully about the comparison of hottest
    and preceding technologies, it's amazing article.

    download minecraft pc1年前 (2019-05-16)回复
  20. #20

    Your way of describing everything in this piece
    of writing is genuinely fastidious, every one be capable of simply
    be aware of it, Thanks a lot.

    download minecraft pc1年前 (2019-05-16)回复
  21. #21

    It's going to be finish of mine day, but before finish I am reading this great paragraph to improve my knowledge.

    minecraft download pc1年前 (2019-05-17)回复
  22. #22

    Stunning quest there. What occurred after?
    Take care!

  23. #23

    Incredible points. Solid arguments. Keep
    up the great effort.

    free minecraft download1年前 (2019-05-18)回复
  24. #24

    Hey there! Someone in my Myspace group shared this site with
    us so I came to give it a look. I'm definitely enjoying the information.
    I'm bookmarking and will be tweeting this to my followers!
    Exceptional blog and superb style and design.

    nagels breda1年前 (2019-05-21)回复
  25. #25

    Ahaa, its fastidious discussion on the topic of this piece of writing here at this webpage, I have read all
    that, so now me also commenting here.

    Fuck Girls Online1年前 (2019-05-21)回复
  26. #26

    Good day! Would you mind if I share your blog with my facebook group?
    There's a lot of people that I think would really enjoy your content.
    Please let me know. Many thanks

    salarisadministratie1年前 (2019-05-25)回复
    • of course!

      hzqiuxm1年前 (2019-05-26)回复
  27. #27

    I love what you guys are up too. This type
    of clever work and reporting! Keep up the amazing works guys I've added
    you guys to my personal blogroll.

    Sexy Ass Cams1年前 (2019-05-26)回复
  28. #28

    I just want to say I am very new to blogs and truly savored you’re web site. More than likely I’m likely to bookmark your website . You amazingly come with superb articles and reviews. Regards for sharing your webpage.

    fordkey1年前 (2019-06-10)回复
  29. #29

    thank you web site admin

    gums1年前 (2019-06-25)回复
  30. #30

    thank you web site admin

    dorem1年前 (2019-06-25)回复
  31. #31

    I just want to mention I’m all new to blogs and certainly savored you’re web site. More than likely I’m want to bookmark your site . You surely have good writings. Appreciate it for sharing your web page.

    kor childs1年前 (2019-07-07)回复
  32. #32

    Thanks-a-mundo for the blog.Really looking forward to read more. Awesome.

    hulk childs1年前 (2019-07-07)回复
  33. #33

    Your positions continually have got a lot of really up to date info. Where do you come up with this? Just saying you are very resourceful. Thanks again

    hulk childs1年前 (2019-07-07)回复
  34. #34

    thank you web site admin

    korn childs1年前 (2019-07-07)回复
  35. #35

    Amazing blog layout here. Was it hard creating a nice looking website like this?

    childs prns1年前 (2019-07-16)回复
  36. #36

    Only wanna tell that this is extremely helpful, Thanks for taking your time to write this.

    sik road1年前 (2019-07-20)回复
  37. #37

    Thanks-a-mundo for the blog.Really looking forward to read more. Awesome.

    sik road1年前 (2019-07-20)回复
  38. #38

    I just want to say I am very new to blogs and truly savored you’re web site. More than likely I’m likely to bookmark your website . You amazingly come with superb articles and reviews. Regards for sharing your webpage.

    viagra online1年前 (2019-07-20)回复
  39. #39

    Amazing blog layout here. Was it hard creating a nice looking website like this?

    viagra online1年前 (2019-07-21)回复
  40. #40

    thank you web site admin

    viagra hole sales1年前 (2019-07-22)回复
  41. #41

    How long does a copyright last on newspaper articles?. . If a service copies newspapers articles and then posts it in a database on the Internet, is there also a copyright on the Internet content?.

    anne childs1年前 (2019-07-22)回复
  42. #42

    How long does a copyright last on newspaper articles?. . If a service copies newspapers articles and then posts it in a database on the Internet, is there also a copyright on the Internet content?.

    anne childs1年前 (2019-07-22)回复
  43. #43

    I just want to say I am very new to blogs and truly savored you’re web site. More than likely I’m likely to bookmark your website . You amazingly come with superb articles and reviews. Regards for sharing your webpage.

    animal google porno11个月前 (09-12)回复
  44. #44

    thank you admin .

    pipiii10个月前 (10-15)回复
  45. #45

    thank you web site admin

    dddddd8个月前 (12-09)回复
  46. #46

    thank you web site admin

    aaaaaa8个月前 (12-09)回复
  47. #47

    thank you web site admin

    dddddd8个月前 (12-09)回复
  48. #48

    thank you web site admin

    club brutige8个月前 (12-12)回复
  49. #49

    You made some respectable points there. I seemed on the web for the issue and found most people will go together with along with your website.

    x esfordsler8个月前 (12-13)回复
  50. #50

    Thank you very much for the content. I wish you continued success.

    agri-partner8个月前 (12-15)回复
  51. #51

    thank you web site admin

    pezevenk enis8个月前 (12-15)回复
  52. #52

    thank you web site admin

    karsiyaka escort7个月前 (01-04)回复
  53. #53

    thank you web site admin

    karsiyaka escort7个月前 (01-05)回复
  54. #54

    Thanks for finally writing about >AMQ简明教程(12) AMQ集群-菡萏如佳人 <Liked it!

    Ulysses7个月前 (01-05)回复
  55. #55

    thank you web site admin

    karsiyaka escort7个月前 (01-05)回复
  56. #56

    Amazing blog layout here. Was it hard creating a nice looking website like this?

    evli pornolar6个月前 (02-03)回复

欢迎加入紫牛小筑

进入小筑关于作者