Skip to content

Latest commit

 

History

History
61 lines (38 loc) · 2.08 KB

README.md

File metadata and controls

61 lines (38 loc) · 2.08 KB

Geode Persistence Example

This is a simple example that demonstrates persistent regions.

The data for a region resides in memory in the JVM for the server. When a region is persistent, the data for that region is also preserved in a disk store. The disk store uses a directory in a file system to save the operations on regions. Unlike non-persistent regions, the data for a persistent region is available even after a period where no servers for that region are running.

This example assumes you have installed Java and Geode.

Steps

  1. From the geode-examples/persistence directory, build the example, and run unit tests.

     $ ../gradlew build
    
  2. Next start a locator, start a server, create a disk store, and create a persistent region.

     $ gfsh run --file=scripts/start.gfsh
    
  3. Run the example to increment an entry the region.

     $ ../gradlew run
    
  4. Observe that the first time an initial value is used.

     Initialized counter to 0
     Incremented counter to 1
    
  5. Restart down the server.

     $ gfsh run --file=scripts/restart.gfsh
    
  6. Run the example to increment an entry the region.

     $ ../gradlew run
    
  7. Observe that the second time the previous value is used.

     Retrieved counter of 1
     Incremented counter to 2
    
  8. Shut down the system.

     $ gfsh run --file=scripts/stop.gfsh