This project has retired. For details please refer to its
Attic page
Apache Gora™ - Gora Cassandra Module
Overview
This is the main documentation for the gora-cassandra module which
enables
Apache Cassandra
backend support for Gora.
gora.properties
Gora Cassandra mappings
gora.properties
Property Key
Property Value
Required
Description
gora.datastore.default=
org.apache.gora.cassandra.store.CassandraStore
Yes
Implementation of the persistent Java storage class
gora.cassandrastore.mapping.file=
/path/to/gora-cassandra-mapping.xml
No
The XML mapping file to be used. If no value is used this defaults to
gora-cassandra-mapping.xml
gora.cassandrastore.cassandraServers=
localhost
Yes
This value should specify the host for a running Cassandra server or node. In this case the server happens to be running on localhost which is the default Cassandra server configuration.
gora.cassandrastore.port=
9042
Yes
This value should specify the cql port for a running Cassandra server or node. In this case the server happens to be running on 9042 port which is the default Cassandra server configuration.
gora.cassandrastore.clusterName=
Test Cluster
No
This value should specify the cassandra cluster name for a running Cassandra server or node. In this case the server has configured to run with Cassandra cluster name as 'Test Cluster' which is the default Cassandra server configuration.
gora.cassandrastore.username=
${username}
No
The authentication details for passing a
username
to the CassandraHostConfigurator. This will be required if security is required for Cassandra reads and writes.
gora.cassandrastore.password=
${password}
No
The authentication details for passing a
password
to the CassandraHostConfigurator. This will be required if security is required for Cassandra reads and writes.
gora.cassandrastore.cassandraSerializationType=
AVRO/NATIVE
No
The serialization type for persist into the cassandra data store. default value is Native serialization type
Gora Cassandra mappings
Say we wished to map some CassandraRecord data and store it into the CassandraStore.



keyClass="org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey"
keyspace="RecordKeySpace"
table="CassandraRecord" allowFiltering="true" id="5a1c395e-b41f-11e5-9f22-ba0be0483c18">






















Here you can see that we require the definition of two child elements within the
gora-otd
mapping configuration, namely;
The
keyspace
element; where we specify:
a parameter containing the Cassandra keyspace schema name e.g.
RecordKeySpace
a parameter containing the durable write enabled property in the Cassandra keyspace e.g.
false
, More about durable write can be found
here
the child element
placementStrategy
containing the Cassandra placementStrategy details, a parameter containing the Cassandra placement strategy name, e.g.
SimpleStrategy
, gora-cassandra will use SimpleStrategy by default if no value for this attribute is specified. More about placement strategies can be found
here
a parameter containing a
replicationFactor
attribute with value integer. Again the replicationFactor value associated with the Keyspace tag
will only apply if Gora creates the Keyspace and will have no effect if this is being used against
an existing keyspace. the default value for 'replicationFactor' is '1'.
The
class
element specifying persistent fields which values should map to. This element contains;
a parameter containing the Persistent class name e.g.
org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraRecord
a parameter containing the keyClass e.g.
org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey
which specifies the keys which map to the field values,
a parameter containing the keyspace e.g.
RecordKeySpace
which matches to the above keyspace definition,
a parameter containing the table name e.g.
CassandraRecord
a parameter containing the allow filtering e.g.
true
, More about allow filtering can be found
here
a child element(s)
field
which represent fields which are to be persisted into Cassandra. These need to be configured such that they receive the following;
finally a parameter
name
e.g. (name, dateOfBirth, ssn and salary respectively) which map to Gora field name,
a parameter containing the column name e.g.
name
a parameter containing the data type of the column e.g.
text
an optional parameter
primarykey
, which indicates the primary key.
The
cassandraKey
element specifying composite key fields which is used in keyClass, This is optional, this element should be added only when composite keys are available;
a child element(s)
partitionKey
which represent cassandra partition key
a child element(s)
compositeKey
which represent cassandra composite partition key
a child element(s)
field
which represent partition key fields which are to be persisted into Cassandra. These need to be configured such that they receive the following;
a parameter
name
e.g. (name, dateOfBirth, ssn and salary respectively) which map to Gora field name,
a parameter containing the column name e.g.
name
a parameter containing the data type of the column
text
a child element(s)
clusterKey
which represent cassandra cluster key
a child element(s)
key
which represents column key fields which needs to be add clustered key.
a parameter containing the column name e.g.
name
a parameter containing the Order type of the column to be applied e.g.
desc