Deprecation

This document is DEPRECATED.

Please consider any information here as out of date. DO NOT use this document.

Instead, refer to http://infinispan.org/documentation.

Please update your bookmarks accordingly.

Skip to end of metadata
Go to start of metadata

Infinispan's CassandraCacheStore leverages Apache Cassandra's distributed database architecture to provide a virtually unlimited, horizontally scalable persistent store for Infinispan's caches.

Version

The Cassandra CacheStore was added in Infinspan 4.2.0 "Ursus". You'll need this release or later in order to use it.

Configuration

In order to use this CacheStore you need to create an appropriate  keyspace on your Cassandra database. The following storage-conf.xml  excerpt shows the declaration of the keyspace:

The important bits are the CompareWith, ColumnType and CompareSubColumnsWith declarations. Everything else can be changed at will. You can also have more than one Keyspace to accomodate for multiple caches. Also bear in mind that the current version of the CassandraCacheStore only supports the OrderPreservingPartitioner.
You then need to add an appropriate cache declaration to your infinispan.xml (or whichever file you use to configure Infinispan):

It is important the the shared property on the loader element is set to true because all the Infinispan nodes will share the same Cassandra cluster.
Since the Cassandra client library doesn't provide connection pooling, a separate project has been created at http://github.com/tristantarrant/cassandra-connection-pool.
Configuration of the connection pool can be done by creating an appropriate properties file and specifying its name in the configuration (configurationPropertiesFile).
The following is an example file:

Here is a description of the various properties which can be configured:

host a hostname (or a comma-separated list of hostnames)
port the thrift port (usually 9160)
keySpace the keyspace to use (defaults to Infinispan)
entryColumnFamily the column family where entry values will be stored. Make sure you configure your keyspace accordingly (defaults to InfinispanEntries)
expirationColumnFamily the column family where element expiration information is stored. Make sure your  (defaults to InfinispanExpiration)
sharedKeyspace whether multiple caches are to be stored in a single keyspace. In this case the cache name is prefixed to the key entries (defaults to false).
readConsistencyLevel The consistency level to use when reading from Cassandra. Possible values are ONE, QUORUM, DCQUORUM, ALL. For an explanation of these refer to the Cassandra API documentation. (defaults to ONE)
writeConsistencyLevel The consistency level to use when writing to Cassandra. Possible values are ZERO, ANY, ONE, QUORUM, DCQUORUM, ALL. For an explanation of these refer to the Cassandra API documentation. (defaults to ONE)
keyMapper A class which implements Infinispan's TwoWayKey2StringMapper interface for mapping cache keys to Cassandra row keys (defaults to org.infinispan.loaders.keymappers.DefaultTwoWayKey2StringMapper)
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.