I have a Hazelcast cluster formed of 2 full members and a Lite member, multicast enabled. I want to connect multiple Hazelcast (.NET) clients exclusively to the Hazelcast Lite member. The thing is that even if I configure the address and port of this Lite member on the client side I still see connections from the client to the other 2 Hazelcast full cluster members:
<hazelcast-client>
<network>
<cluster-members>
<address>10.28.0.106:5701</address>
</cluster-members>
</network>
...
</hazelcast-client>
Can this be done?
The idea is to have the Lite member store a large amount of mostly read-only data (near-client will be enabled on the Lite member) and will be running on the same machine as the clients so the access will be much faster than client->cluster connections.
Let's ignore the fact that this Lite member becomes a single point of failure here, the system as whole won't be impacted.
答案 0 :(得分:2)
如果在客户端将智能路由设置为false并且仅在客户端配置lite成员,则客户端将仅连接到lite成员。 见http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#setting-smart-routing
但是当该成员死亡时,客户端将连接到其他节点之一。如果您希望客户端在与lite成员断开连接时关闭,则可以在客户端使用生命周期监听器。当您看到LifecycleEvent.LifecycleState.CLIENT_DISCONNECTED事件时,调用hazelcastClient.shutdown()。
答案 1 :(得分:0)
我认为您可以将GroupConfig
用于此目的。
来自JavaDoc:
使用群组可以创建多个群集,其中每个群集都有自己的群组,并且不会干扰其他群集。
您应该为客户声明组配置(2次 - 对于Lite会员和正式会员)以及Lite&amp;相应的正式成员。
<group>
<name>liteGroup</name>
<password>pswd1</password>
<group>
<group>
<name>fullGroup</name>
<password>pswd2</password>
<group>
如果您有任何疑问,请随时与我联系。