Plan the configuration and ongoing management of your distributed, replicated, and preloaded regions, and configure the regions.
Before you begin, understand Basic Configuration and Programming.
Choose the region shortcut setting that most closely matches your region configuration. See org.apache.geode.cache.RegionShortcut
or Region Shortcuts. To create a replicated region, use one of the REPLICATE
shortcut settings. To create a preloaded region, set your region data-policy
to preloaded
. This cache.xml
declaration creates a replicated region:
<region-attributes refid="REPLICATE">
</region-attributes>
You can also use gfsh to configure a region. For example:
gfsh>create region --name=regionA --type=REPLICATE
See Region Types.
Choose the level of distribution for your region. The region shortcuts in RegionShortcut
for distributed regions use distributed-ack
scope. If you need a different scope, set the region-attributes
scope
to distributed-no-ack
or global
.
Example:
<region-attributes refid="REPLICATE" scope="distributed-no-ack">
</region-attributes>
If you are using the distributed-ack
scope, optionally enable concurrency checks for the region.
Example:
<region-attributes refid="REPLICATE" scope="distributed-ack" concurrency-checks-enabled="true">
</region-attributes>
If you are using global
scope, program any explicit locking you need in addition to the automated locking provided by Tanzu GemFire.
Of all the operations that affect the local cache only, only local region destroy is allowed in a replicated region. Other operations are not configurable or throw exceptions. For example, you cannot use local destroy as the expiration action on a replicated region. This is because local operations like entry invalidation and destruction remove data from the local cache only. A replicated region would no longer be complete if data were removed locally but left intact.