|Managing Pivotal GemFire / Cache and Region Snapshots|
To import a GemFire cache or region data snapshot that you previously exported into another distributed system or region, use the cache.getSnapshotService.load API, region.getSnapshotService.load API, or the gfsh command-line interface (import data).
During an import, the CacheWriter and CacheListener callbacks are not invoked. In addition, the imported data is not distributed to clients or to gateway senders for WAN distribution.
If an error occurs during import, the import is halted and the region will contain some but not all snapshot data.
The state of a cache client is indeterminate after an import. It is likely that the data in the client's cache is inconsistent with the imported data. Take the client offline during the import and restart it after the import completes.
When you import a cache snapshot, the snapshot file is imported into the same region (match determined by name) that was used during snapshot export. When you import a cache, you import all snapshot files located within a directory into the cache. The API attempts to load all files in the specified directory.
File mySnapshotDir = ... Cache cache = ... cache.getSnapshotService().load(mySnapshotDir, SnapshotFormat.GEMFIRE);
File mySnapshot = ... Region<String, MyObject> region = ... region.getSnapshotService().load(mySnapshot, SnapshotFormat.GEMFIRE);
gfsh>import data --region=Region --file=filename.gfd --member=membernamewhere Region corresponds to the name of the region that you want to import data into; filename (must end in .gfd) corresponds to the name of the file to be imported; and membername corresponds to the member where the region to be imported is hosted. For example:
gfsh>import data --region=region1 --file=region1_2012_10_10.gfd --member=server2The snapshot file must already reside on the specified member at the location specified in the --file argument before import.
For more information on this command, see import data.