This is a simple example that demonstrates putting values into a replicated region, checking the size, and retrieving the values.
This example assumes you have installed Java and Geode.
-
From the
geode-examples/replicated
directory, build the example and run unit tests$ ../gradlew build
-
Next start the locator and two servers
$ gfsh run --file=scripts/start.gfsh
-
Run the example to create entries in the region
$ ../gradlew run
-
Kill one of the servers
$ gfsh -e "connect --locator=127.0.0.1[10334]" -e "stop server --name=server1"
-
Run a gfsh query, and notice that all the entries are still available due to replication
$ gfsh -e "connect --locator=127.0.0.1[10334]" -e "query --query='select e.key from /example-region.entries e'"
-
Shut down the system:
$ gfsh run --file=scripts/stop.gfsh