JBoss Data Grid's replicated mode ensures that every entry is replicated on every node in the data grid.
This mode offers security against data loss due to node failures and excellent data availability. These benefits are at the cost of limiting the storage capacity to the amount of storage available on the node with the least memory.
Programmatic Configuration:
Use the following code snippet to programmatically configure the cache for replication mode (either synchronous or asynchronous):
private static EmbeddedCacheManager createCacheManagerProgramatically() {
return new DefaultCacheManager(
new GlobalConfigurationBuilder()
.transport().addProperty("configurationFile", "jgroups.xml")
.build(),
new ConfigurationBuilder()
.clustering().cacheMode(CacheMode.REPL_SYNC)
.build()
);
}
private static EmbeddedCacheManager createCacheManagerProgramatically() {
return new DefaultCacheManager(
new GlobalConfigurationBuilder()
.transport().addProperty("configurationFile", "jgroups.xml")
.build(),
new ConfigurationBuilder()
.clustering().cacheMode(CacheMode.REPL_SYNC)
.build()
);
}
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Declarative Configuration:
Edit the cfg.xml file to include the following XML code to declaratively configure the cache for replication mode (either synchronous or asynchronous):
We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.
Making open source more inclusive
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.
About Red Hat
We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.