From spring data geode/gemfire, can we create Regions on the cluster ? Currently it is creating local cache region but any configuration being done either in ClientCache mode or ServerCache mode, doesn't have any impact on the Cluster server.
But using gfsh commands if we create a REPLICATE Region then the connectivity works fine. Is that the only way to create a REPLICATE region in Gemfire/Geode cluster ?
Next, there are many documentation which refers to Region with GLOBAL scope but again in gfsh there is no way to create a Region with Scope GLOBAL, nor I could locate any configuration via Spring data geode.
Do we have any additional information on this ?
Regards, Malaya
Searched the Geode/Gemfire documentation regarding any commannds but couldn't find any.
Tried to adapt the spring data geode/gemfire but even there also there is no option of GLOBAL region creation.
Spring Data for Apache Geode (SDG) does support pushing configuration metadata for Apache Geode Regions (and other Apache Geode objects, e.g. Indexes) to the cluster of servers using the SDG Cluster Configuration Push feature. However, this feature currently only pushes the Region "name" and
DataPolicytype (Javadoc) to the servers from the client.Additionally, "Cluster Configuration Push" only applies when your Spring [Boot] Data application is an Apache Geode
ClientCache. If the application is a peerCache, then this feature does not apply.AFAIR,
Scope.GLOBALRegions only applies toREPLICATERegions, first of all. That is, you cannot create a "GLOBAL"PARTITIONRegion. See Apache Geode docs for further details onScopealong with other Region distribution configuration attributes.Assuming your Spring [Boot] Data for Apache Geode application were a peer
Cacheinstance, then you can configure yourREPLICATERegions with a "GLOBAL"Scopeas follows:However, keep in mind this peer
Cache, Spring-configured server application is NOT going to push the configuration to other servers in the cluster.If you are using SDG Annotation-based configuration to (dynamically & conveniently) create Regions in your Spring peer
Cacheapplication, for example: using either@EnableEntityDefinedRegionsor perhaps@EnableCachingDefinedRegions, then you will need to additionally rely on 1 or moreRegionConfigurerbean definitions (see docs) to customize the configuration of individual Regions as the Annotation-based support does not enable fine-grained Region configuration customization of this nature (e.g.ScopeonREPLICATERegions).This might look something like the following.
Given a persistent entity:
Then:
Technically, you could also annotate your persistent entity classes (e.g.
Customer) with 1 of the Region type-specific mapping annotations (Javadoc), rather than simply the generic@Regionmapping annotation, as well, such as with@ReplicateRegion. This allows you to do things like:Still, I generally prefer users to simply use the generic
@Regionmapping annotation, and again, if they need to do low-level configuration of Regions (like setting "Scope" on aREPLICATERegion) then simply use Java-based configuration as the opening example demonstrated.Still, keep in mind, none of this is shared across the other servers inside the same cluster. Spring peer
Cacheapplications do NOT push configuration metadata to other servers at all, and never will. This is sort of the point of using Apache Geode's Cluster Configuration Service anyhow.Upon reviewing this and this (not that
Scopeis something you can "alter" on a Region after the fact anyway), you are CORRECT, when using Gfsh, you cannot create aGLOBALScopedREPLICATERegion in the cluster, :(In general, keep in mind that anything that is possible to do with Apache Geode's API, you can definitely do with Spring (Boot/Data) for Apache Geode and then some.
This is due in large part because SDG was built on Apache Geode's API and not some tool, like Gfsh.