Controlled partitioning and MapStore

2019-08-26 09:21发布

问题:

Lets say, I have several Hazelcast members (servers) spread across world (e.g. Germany, Russia and etc).

It was required to store/split data in database by region and all data should be accessible from any server via IMap backed by MapStore.

I recently read this article which fulfills my requirement, but I am not sure about how will MapStore behave.

Crucial moment is that, if member1 (e.g. Russia) requests data from IMap with key owned by member2 (e.g. Germany), on which side MapStore.load() will be called?

回答1:

You should not split members of the same cluster across different data centers. Members of a cluster depend on a regular heartbeat message to detect the health of the cluster; wide area networks cannot reliably deliver these in a consistent fashion and you will almost certainly have network partition issues (split brain syndrome).

Each data center (Germany, Russia, etc.) should have a separate cluster with region-specific maps. These maps can then be replicated (WAN replication) to the remote data centers both for disaster recovery and to provide a geographically close server to support users in that region needing access to the other region's data.

Since the data in the database is already split by region, matching this split on the Hazelcast side means that the MapLoader will always be loading from a database in the same location.