Message Queue Enterprise Edition 支持使用代理群集。代理群集是一組協(xié)同工作為客戶端提供消息傳送服務(wù)的代理。通過(guò)使用群集,消息服務(wù)器可以將客戶端連接分布在多個(gè)代理上,從而根據(jù)消息流量相應(yīng)地調(diào)整自己的操作。有關(guān)群集及其工作原理的概述,請(qǐng) 參見(jiàn) Message Queue 技術(shù)概述。
可通過(guò)為群集中的每個(gè)成員代理指定群集配置屬性來(lái)定義群集。可以為群集中的每個(gè)代理單獨(dú)設(shè)置這些屬性,但是,通常較為方便的一種做法是將這些屬性收集到所有代理均引用的一個(gè)中心群集配置文件中。這樣可防止設(shè)置出現(xiàn)不一致的情況,并確保群集中的 所有代理都共享相同、一致的配置信息。
詳細(xì)介紹了群集配置屬性。其中包括以下內(nèi)容:
imq.cluster.brokerlist 給出了屬于群集的所有代理的主機(jī)名和端口號(hào)。
imq.cluster.masterbroker 指定跟蹤狀態(tài)變化的主代理(如果有)。
imq.cluster.url 指定群集配置文件(如果有)的位置。
imq.cluster.hostname 給出 cluster 連接服務(wù)(用于群集中代理之間的內(nèi)部通信)的主機(jī)名或 IP 地址。如果有多個(gè)主機(jī)可用,該設(shè)置會(huì)很有用:例如,如果一臺(tái)計(jì)算機(jī)中安裝了多個(gè)網(wǎng)絡(luò)接口卡。
imq.cluster.port 給出 cluster 連接服務(wù)的端口號(hào)。
imq.cluster.transport 指定 cluster 連接服務(wù)所使用的傳輸協(xié)議,如 tcp 或 ssl。
可以為每個(gè)代理單獨(dú)設(shè)置 hostname 和 port 屬性,但群集中所有代理的 brokerlist、masterbroker、url 和 transport 值必須相同。
以下部分介紹了如何設(shè)置代理的群集配置屬性。可以對(duì)群集中的每個(gè)代理單獨(dú)進(jìn)行設(shè)置,也可以使用群集配置文件來(lái)集中進(jìn)行設(shè)置。
分別為各個(gè)代理設(shè)置群集屬性
可以在代理的實(shí)例配置文件(或在啟動(dòng)代理時(shí)的命令行)中設(shè)置代理的群集配置屬性。例如,要?jiǎng)?chuàng)建由 host1 端口 9876 上的代理、host2 端口 5000 上的代理以及 ctrlhost 默認(rèn)端口 (7676) 上的代理組成的群集,應(yīng)在這三個(gè)代理的實(shí)例配置文件中包含以下 屬性:
imq.cluster.brokerlist=host1:9876,host2:5000,ctrlhost
請(qǐng)注意,如果采用此方法,則當(dāng)群集配置需要更改時(shí),您必須更新群集中每個(gè)代理的實(shí)例配置文件。
使用群集配置文件
為保持一致性和易維護(hù)性,建議將所有共享群集配置屬性收集到一個(gè)群集配置文件中,而不是分別為每個(gè)代理設(shè)置這些屬性。采用此方法時(shí),每個(gè)代理的實(shí)例配置文件必須將 imq.cluster.url 屬性設(shè)置為指向該群集配置文件的位置:例如,
imq.cluster.url=file:/home/cluster.properties
然后群集配置文件定義群集中所有代理的共享配置屬性,例如要連接的代理的列表 (imq.cluster.brokerlist)、用于 cluster 連接服務(wù)的傳輸協(xié)議 (imq.cluster.transport) 以及(可選)主代理的地址 (imq.cluster.masterbroker)。下面的代碼定義了與前面 的示例相同的群集,其中在 ctrlhost 上運(yùn)行的代理充當(dāng)主代理:
imq.cluster.brokerlist=host1:9876,host2:5000,ctrlhost
imq.cluster.masterbroker=ctrlhost
一 . Adding Brokers to a Conventional Cluster
1. To Add a New Broker to a Conventional Cluster Using a Cluster Configuration File
1).Add the new broker to the imq.cluster.brokerlist property in the cluster configuration file.
2).Issue the following command to any broker in the cluster: imqcmd reload cls
3).(Optional) Set the value of the imq.cluster.url property in the new broker’s instance configuration file (config.properties) to point to the cluster configuration file.
4).Start the new broker.
注意 :If you did not perform step 3, use the -D option on the imqbrokerd command line to set the value of imq.cluster.url to the location of the cluster configuration file.
2. To Add a New Broker to a Conventional Cluster Using a Cluster Configuration File
1).(Optional) Set the values of the following properties in the new broker’s instance configuration file (config.properties) :
imq.cluster.brokerlist
imq.cluster.masterbroker (if necessary)
imq.cluster.transport (if you are using a secure cluster connection service)
2).Modify the imq.cluster.brokerlist property of other brokers in the cluster to include the new broker.
This step is not strictly necessary to add a broker to a functioning cluster. However, should any broker need to be restarted, its imq.cluster.brokerlist value must include all other brokers in the cluster, including the newly added broker.
3).Start the new broker.
If you did not perform step 1, use the -D option on the imqbrokerd command line to set the property values listed there.
posted on 2009-12-22 09:32 冰是沒(méi)有未來(lái)的,因?yàn)樗挠篮?/a> 閱讀(556) 評(píng)論(0) 編輯 收藏 所屬分類: openMQ (imq)