LATEST VERSION: 8.2.5 - CHANGELOG
Pivotal GemFire® v8.2

Fixed Partitioning

Fixed Partitioning

You can set up partitioned regions for specific data that must reside on specific physical computers, or when your data must be close to certain hardware components.

You implement fixed partitioning by configuring standard partitioning and then specifying the exact member where each data entry resides. You assign the data entry to a bucket and partition, and name specific members as primary and secondary hosts of each partition.

This configuration gives you complete control over the locations of your primary and any secondary buckets for the region.

Running the Example

This example shows basic region operations on a fixed-partitioned region, which has data partitions configured on two JVMs, Peer1 and Peer2. The partitions are configured as follows:

Peer1 (defined by FixedPartitionPeer1.xml) configures partition Q1 as the primary and partition Q2 as the secondary.

Peer2 (defined by FixedPartitionPeer2.xml) configures partition Q2 as the primary and partition Q1 as the secondary.

The region is configured to create one extra copy of each data entry. The copies are placed on different JVMs. When one JVM shuts down, no data is lost and operations can proceed normally on the other JVM.

Fixed partition "Q1" is associated with data of following months: Jan, Feb, Mar, Apr, May, Jun.

Fixed partition "Q2" is associated with data of following months: Jul, Aug, Sep, Oct, Nov, Dec .

Note: To run this example, you must have terminal sessions configured for the QuickStart examples, as described in Setting Up Your Environment for Running the Examples.
  1. Change to the <Install_Directory>/SampleCode/quickstart directory.
  2. In a terminal session, start Peer1:
    $ java -cp "$GEMFIRE/SampleCode/quickstart/classes:$GEMFIRE/lib/server-dependencies.jar" quickstart.FixedPartitionPeer1
  3. In a second terminal session, start Peer2:
    $ java -cp "$GEMFIRE/SampleCode/quickstart/classes:$GEMFIRE/lib/server-dependencies.jar" quickstart.FixedPartitionPeer2

Example Source Files

Table 1. Cache configuration files, located in SampleCode/quickstart/xml

FixedPartitionPeer1.xml

Configures fixed partitioning attributes for a partitioned region on Peer1.

FixedPartitionPeer2.xml

Configures fixed partitioning attributes for a partitioned region on Peer2.

Table 2. Java program files, located in SampleCode/quickstart/quickstart

FixedPartitionPeer1.java

Defines a partitioned region that has a primary partition named "Q1" with 6 buckets.

FixedPartitionPeer2.java

Defines a partitioned region that has a primary partition named "Q2" with 6 buckets.

QuarterPartitionResolver.java

This custom resolver maps a user-defined partition to a data-member node.

Related Topics
Partitioned Regions

Related Javadocs

  • com.gemstone.gemfire.cache.FixedPartitionResolver

  • com.gemstone.gemfire.cache.FixedPartitionAttributes