Este contenido no está disponible en el idioma seleccionado.
19.9. Cassandra Cache Store
Red Hat JBoss Data Grid allows Apache Cassandra to function as a Cache Store, leveraging their distributed database architecture to provide a virtually unlimited, horizontally scalable persistent store for cache entries.
In order to use the Cassandra Cache Store an appropriate keyspace must first be created on the Cassandra database. This may either be performed automatically or by enabling the
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
auto-create-keyspace
parameter in the cache store configuration. A sample keyspace creation is demonstrated below:
CREATE KEYSPACE IF NOT EXISTS Infinispan WITH replication = {'class':'SimpleStrategy', 'replication_factor':1}; CREATE TABLE Infinispan.InfinispanEntries (key blob PRIMARY KEY, value blob, metadata blob);
CREATE KEYSPACE IF NOT EXISTS Infinispan WITH replication = {'class':'SimpleStrategy', 'replication_factor':1};
CREATE TABLE Infinispan.InfinispanEntries (key blob PRIMARY KEY, value blob, metadata blob);
19.9.1. Enabling the Cassandra Cache Store Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
The Cassandra Cache Store is included based on the downloaded distribution. The following indicates where this is located, and steps to enable it if required:
Library Mode
- Theinfinispan-cachestore-cassandra-8.3.0.final-redhat-1-deployable.jar
is included in thejboss-datagrid-${jdg-version}-library/
directory, and may be added to any projects that are using the Cassandra Cache Store.Remote Client-Server Mode
- The Cassandra Cache Store is prepackaged in themodules/
directory of the server, and may be used by default with no additional configuration necessary.JBoss Data Grid modules for JBoss EAP
- The Cassandra Cache Store is included in the modules distributed, and may be added by using theorg.infinispan.persistence.cassandra
as the module name.
19.9.2. Cassandra Cache Store Sample XML Configuration (Remote Client-Server Mode) Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
In Remote Client-Server mode the Cassandra Cache Store is defined by using the class
org.infinispan.persistence.cassandra.CassandraStore
and defining the properties individually within the store.
The following configuration snippet provides an example on how to define a Cassandra Cache Store inside of an xml file:
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
19.9.3. Cassandra Cache Store Sample XML Configuration (Library Mode) Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
In Library Mode the Cassandra Cache Store may be configured using two different methods:
- Option 1: Using the same method discussed for Remote Client-Server Mode, found in Section 19.9.2, “Cassandra Cache Store Sample XML Configuration (Remote Client-Server Mode)”.
- Option 2: Using the
cassandra-store
schema. The following snippet shows an example configuration defining a Cassandra Cache Store:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
19.9.4. Cassandra Configuration Parameters Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
When defining a backing Cassandra instance in Library Mode one or more Expand
cassandra-server
elements may be specified in the configuration. Each of the elements has the following properties:
Parameter Name | Description | Default Value |
---|---|---|
host | The hostname or ip address of a Cassandra server. | 127.0.0.1 |
port | The port on which the server is listening. | 9042 |
The following properties may be configured on the Cassandra Cache Store:
Expand
Parameter Name | Description | Default Value |
---|---|---|
auto-create-keyspace | Determines whether the keyspace and entry table should be automatically created on startup. | true |
keyspace | Name of the keyspace to use. | Infinispan |
entry-table | Name of the table storing entries. | InfinispanEntries |
consistency-level | Consistency level to use for the queries. | LOCAL_ONE |
serial-consistency-level | Serial consistency level to use for the queries. | SERIAL |
A Expand
connection-pool
may also be defined with the following elements:
Parameter Name | Description | Default Value |
---|---|---|
pool-timeout-millis | Time that the driver blocks when no connection from hosts pool is available. After this timeout, the driver will try the next host. | 5 |
heartbeat-interval-seconds | Application-side heartbeat to avoid the connections being dropped when no activity is happening. Set to 0 to disable. | 30 |
idle-timeout-seconds | Timeout before an idle connection is removed. | 120 |