Configure Distributed, Replicated, and Preloaded Regions
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 theREPLICATE
shortcut settings. To create a preloaded region, set your regiondata-policy
topreloaded
. Thiscache.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 usedistributed-ack
scope. If you need a different scope, set theregion-attributes
scope
todistributed-no-ack
orglobal
.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 Geode.
Local Destroy and Invalidate in the Replicated Region
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.