2017-08-22 41 views
0

我有一個基於hazelcast的應用程序,它將一組特定的ips和端口傳遞給hazelcast。如果羣集名稱不匹配,如何讓hazelcast失敗?

如果其中一個套接字屬於具有不同名稱的羣集,我該如何使hazelcast失敗?


作爲例子,我希望這些設置快速失敗:

node1 has ip1, is configured to form a cluster called "hello" with ip2 
node2 has ip2, is configured to form a cluster called "world" with ip1 

目前只產生一個日誌消息:

WARN: Node could not join cluster at node: [ip1]:9003 Cause: the target cluster has a different group-name 

但我想hazelcast在這種情況下失敗。

回答

0

兩個節點應該建立獨立的羣集,因爲名稱不匹配。這實際上是有意設計的,因爲您可能想要在同一個多播區域中啓動多個羣集。如果他們加入這將是一個錯誤。

我想你正在尋找的是第二個節點,如果它無法加入現有的集羣,它會快速失敗。如果羣集名稱(組名)相同但密碼不匹配,則是這種情況。現在第二個節點將無法加入並停止操作。

+0

它不起作用。使用錯誤的憑證進行連接只會導致另一條日誌消息:與主體ClientPrincipal相關的來自Connection的身份驗證[id = 41,/192.168.33.11:9003->/192.168.33.12:37078,endpoint = null,alive = true,type = NONE] {uuid ='8cf96bb9-a3e7-4488-9547-e14d2a475557',ownerUuid ='73884d75-b751-43a0-b752-e0bc3bb17d44'},認證失敗(在所有成員的日誌中) – slartidan

+0

正如前面提到的組密碼使其失敗。我猜它在放棄之前會重試3次。 – noctarius

+0

從版本3.8.2開始不再是這種情況。請參閱http://docs.hazelcast.org/docs/3.8.6/manual/html-single/index.html#creating-cluster-groups –