使用代理群集(注意隊列同步時候的 用戶名和密碼要一致 )
Message Queue Enterprise Edition 支持使用代理群集。代理群集是一組協同工作為客戶端提供消息傳送服務的代理。通過使用群集,消息服務器可以將客戶端連接分布在多個代理上,從而根據消息流量相應地調整自己的操作。有關群集及其工作原理的概述,請 參見 Message Queue 技術概述。
可通過為群集中的每個成員代理指定群集配置屬性來定義群集。可以為群集中的每個代理單獨設置這些屬性,但是,通常較為方便的一種做法是將這些屬性收集到所有代理均引用的一個中心群集配置文件中。這樣可防止設置出現不一致的情況,并確保群集中的 所有代理都共享相同、一致的配置信息。
詳細介紹了群集配置屬性。其中包括以下內容:
imq.cluster.brokerlist 給出了屬于群集的所有代理的主機名和端口號。
imq.cluster.masterbroker 指定跟蹤狀態變化的主代理(如果有)。
imq.cluster.url 指定群集配置文件(如果有)的位置。
imq.cluster.hostname 給出 cluster 連接服務(用于群集中代理之間的內部通信)的主機名或 IP 地址。如果有多個主機可用,該設置會很有用:例如,如果一臺計算機中安裝了多個網絡接口卡。
imq.cluster.port 給出 cluster 連接服務的端口號。
imq.cluster.transport 指定 cluster 連接服務所使用的傳輸協議,如 tcp 或 ssl。
可以為每個代理單獨設置 hostname 和 port 屬性,但群集中所有代理的 brokerlist、masterbroker、url 和 transport 值必須相同。
以下部分介紹了如何設置代理的群集配置屬性??梢詫θ杭械拿總€代理單獨進行設置,也可以使用群集配置文件來集中進行設置。
分別為各個代理設置群集屬性
可以在代理的實例配置文件(或在啟動代理時的命令行)中設置代理的群集配置屬性。例如,要創建由 host1 端口 9876 上的代理、host2 端口 5000 上的代理以及 ctrlhost 默認端口 (7676) 上的代理組成的群集,應在這三個代理的實例配置文件中包含以下 屬性:
imq.cluster.brokerlist=host1:9876,host2:5000,ctrlhost
請注意,如果采用此方法,則當群集配置需要更改時,您必須更新群集中每個代理的實例配置文件。
使用群集配置文件
為保持一致性和易維護性,建議將所有共享群集配置屬性收集到一個群集配置文件中,而不是分別為每個代理設置這些屬性。采用此方法時,每個代理的實例配置文件必須將 imq.cluster.url 屬性設置為指向該群集配置文件的位置:例如,
imq.cluster.url=file:/home/cluster.properties
然后群集配置文件定義群集中所有代理的共享配置屬性,例如要連接的代理的列表 (imq.cluster.brokerlist)、用于 cluster 連接服務的傳輸協議 (imq.cluster.transport) 以及(可選)主代理的地址 (imq.cluster.masterbroker)。下面的代碼定義了與前面 的示例相同的群集,其中在 ctrlhost 上運行的代理充當主代理:
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
冰是沒有未來的,因為它的永恒 閱讀(547)
評論(0) 編輯 收藏 所屬分類:
openMQ (imq)