Author: buildbot
Date: Sun Sep 3 10:56:15 2017
New Revision: 1017645
Log:
Staging update by buildbot for gora
Modified:
websites/staging/gora/trunk/content/ (props changed)
websites/staging/gora/trunk/content/current/gora-cassandra.html
Propchange: websites/staging/gora/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Sep 3 10:56:15 2017
@@ -1 +1 @@
-1805054
+1807139
Modified: websites/staging/gora/trunk/content/current/gora-cassandra.html
==============================================================================
--- websites/staging/gora/trunk/content/current/gora-cassandra.html (original)
+++ websites/staging/gora/trunk/content/current/gora-cassandra.html Sun Sep 3
10:56:15 2017
@@ -157,7 +157,18 @@ under the License.
<div class="container" id="Gora_Gora Cassandra Module">
-<h2 id="overview">Overview</h2>
+<style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h2 id="overview">Overview<a class="headerlink" href="#overview"
title="Permanent link">¶</a></h2>
<p>This is the main documentation for the gora-cassandra module which
enables <a href="http://cassandra.apache.org">Apache Cassandra</a> backend
support for Gora. </p>
<div class="toc">
@@ -167,7 +178,7 @@ enables <a href="http://cassandra.apache
<li><a href="#gora-cassandra-mappings">Gora Cassandra mappings</a></li>
</ul>
</div>
-<h2 id="goraproperties">gora.properties</h2>
+<h2 id="goraproperties">gora.properties<a class="headerlink"
href="#goraproperties" title="Permanent link">¶</a></h2>
<p><table class="table">
<thead>
<tr>
@@ -185,16 +196,28 @@ enables <a href="http://cassandra.apache
<td>Implementation of the persistent Java storage class</td>
</tr>
<tr>
- <td>gora.cassandra.mapping.file=</td>
+ <td>gora.cassandrastore.mapping.file=</td>
<td>/path/to/gora-cassandra-mapping.xml</td>
<td>No</td>
<td>The XML mapping file to be used. If no value is used this defaults to
<code>gora-cassandra-mapping.xml</code></td>
</tr>
<tr>
- <td>gora.cassandra.servers=</td>
- <td>localhost:9160</td>
+ <td>gora.cassandrastore.cassandraServers=</td>
+ <td>localhost</td>
<td>Yes</td>
- <td>This value should specify the host:port for a running Cassandra server
or node. In this case the server happens to be running on localhost at port
9160 which is the default Cassandra server configuration. It is important that
the <b>host</b> matches that specified in
<code>gora-cassandra-mapping.xml</code></td>
+ <td>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.</td>
+ </tr>
+ <tr>
+ <td>gora.cassandrastore.port=</td>
+ <td>9042</td>
+ <td>Yes</td>
+ <td>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.</td>
+ </tr>
+ <tr>
+ <td>gora.cassandrastore.clusterName=</td>
+ <td>Test Cluster</td>
+ <td>No</td>
+ <td>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.</td>
</tr>
<tr>
<td>gora.cassandrastore.username=</td>
@@ -208,91 +231,112 @@ enables <a href="http://cassandra.apache
<td>No</td>
<td>The authentication details for passing a <b>password</b> to the
CassandraHostConfigurator. This will be required if security is required for
Cassandra reads and writes.</td>
</tr>
- </tboday>
+ <tr>
+ <td>gora.cassandrastore.cassandraSerializationType=</td>
+ <td>AVRO/NATIVE</td>
+ <td>No</td>
+ <td>The serialization type for persist into the cassandra data store.
default value is Native serialization type</td>
+ </tr>
+ </tbody>
</table></p>
-<h2 id="gora-cassandra-mappings">Gora Cassandra mappings</h2>
-<p>Say we wished to map some Employee data and store it into the
CassandraStore.</p>
-<div class="codehilite"><pre><span class="nt"><gora-otd></span>
- <span class="nt"><keyspace</span> <span class="na">name=</span><span
class="s">"Employee"</span> <span class="na">host=</span><span
class="s">"localhost"</span> <span
class="na">placement_strategy=</span><span
class="s">"org.apache.cassandra.locator.SimpleStrategy"</span>
- <span class="na">replication_factor=</span><span
class="s">"1"</span> <span class="na">cluster=</span><span
class="s">"Gora Cassandra Test Cluster"</span><span
class="nt">></span>
- <span class="nt"><family</span> <span class="na">name=</span><span
class="s">"p"</span> <span class="na">gc_grace_seconds=</span><span
class="s">"5"</span><span class="nt">/></span>
- <span class="nt"><family</span> <span class="na">name=</span><span
class="s">"f"</span> <span class="na">gc_grace_seconds=</span><span
class="s">"5"</span><span class="nt">/></span>
- <span class="nt"><family</span> <span class="na">name=</span><span
class="s">"sc"</span> <span class="na">type=</span><span
class="s">"super"</span> <span class="nt">/></span>
- <span class="nt"></keyspace></span>
-
- <span class="nt"><class</span> <span class="na">name=</span><span
class="s">"org.apache.gora.examples.generated.Employee"</span> <span
class="na">keyClass=</span><span class="s">"java.lang.String"</span>
<span class="na">keyspace=</span><span
class="s">"Employee"</span><span class="nt">></span>
- <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"name"</span> <span class="na">family=</span><span
class="s">"p"</span> <span class="na">qualifier=</span><span
class="s">"info:nm"</span> <span class="na">ttl=</span><span
class="s">"10"</span><span class="nt">/></span>
- <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"dateOfBirth"</span> <span class="na">family=</span><span
class="s">"p"</span> <span class="na">qualifier=</span><span
class="s">"info:db"</span> <span class="na">ttl=</span><span
class="s">"10"</span><span class="nt">/></span>
- <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"ssn"</span> <span class="na">family=</span><span
class="s">"p"</span> <span class="na">qualifier=</span><span
class="s">"info:sn"</span> <span class="na">ttl=</span><span
class="s">"10"</span><span class="nt">/></span>
- <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"salary"</span> <span class="na">family=</span><span
class="s">"p"</span> <span class="na">qualifier=</span><span
class="s">"info:sl"</span> <span class="na">ttl=</span><span
class="s">"10"</span><span class="nt">/></span>
- <span class="nt"></class></span>
-<span class="nt"></gora-otd></span>
+<h2 id="gora-cassandra-mappings">Gora Cassandra mappings<a class="headerlink"
href="#gora-cassandra-mappings" title="Permanent link">¶</a></h2>
+<p>Say we wished to map some CassandraRecord data and store it into the
CassandraStore.</p>
+<p><gora-otd></p>
+<div class="codehilite"><pre><span class="nt"><keyspace</span> <span
class="na">name=</span><span class="s">"RecordKeySpace"</span> <span
class="na">durableWrite=</span><span class="s">"false"</span><span
class="nt">></span>
+ <span class="nt"><placementStrategy</span> <span
class="na">name=</span><span class="s">"SimpleStrategy"</span> <span
class="na">replication_factor=</span><span class="s">"1"</span><span
class="nt">/></span>
+<span class="nt"></keyspace></span>
+
+<span class="nt"><class</span> <span class="na">name=</span><span
class="s">"org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraRecord"</span>
+ <span class="na">keyClass=</span><span
class="s">"org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey"</span>
+ <span class="na">keyspace=</span><span
class="s">"RecordKeySpace"</span>
+ <span class="na">table=</span><span
class="s">"CassandraRecord"</span> <span
class="na">allowFiltering=</span><span class="s">"true"</span> <span
class="na">id=</span><span
class="s">"5a1c395e-b41f-11e5-9f22-ba0be0483c18"</span><span
class="nt">></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"name"</span> <span class="na">column=</span><span
class="s">"name"</span> <span class="na">type=</span><span
class="s">"text"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"dataInt"</span> <span class="na">column=</span><span
class="s">"age"</span> <span class="na">type=</span><span
class="s">"int"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"salary"</span> <span class="na">column=</span><span
class="s">"salary"</span> <span class="na">type=</span><span
class="s">"bigint"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"dataDouble"</span> <span class="na">column=</span><span
class="s">"testDouble"</span> <span class="na">type=</span><span
class="s">"double"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"dataBytes"</span> <span class="na">column=</span><span
class="s">"quotes"</span> <span class="na">type=</span><span
class="s">"blob"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"arrayInt"</span> <span class="na">column=</span><span
class="s">"listInt"</span> <span class="na">type=</span><span
class="s">"list(int)"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"arrayString"</span> <span class="na">column=</span><span
class="s">"listString"</span> <span class="na">type=</span><span
class="s">"list(text)"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"arrayLong"</span> <span class="na">column=</span><span
class="s">"listLong"</span> <span class="na">type=</span><span
class="s">"list(bigint)"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"arrayDouble"</span> <span class="na">column=</span><span
class="s">"listDouble"</span> <span class="na">type=</span><span
class="s">"list(double)"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"mapInt"</span> <span class="na">column=</span><span
class="s">"mapInt"</span> <span class="na">type=</span><span
class="s">"map(text,int)"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"mapString"</span> <span class="na">column=</span><span
class="s">"mapString"</span> <span class="na">type=</span><span
class="s">"map(text,text)"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"mapLong"</span> <span class="na">column=</span><span
class="s">"mapLong"</span> <span class="na">type=</span><span
class="s">"map(text,bigint)"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"mapDouble"</span> <span class="na">column=</span><span
class="s">"mapDouble"</span> <span class="na">type=</span><span
class="s">"map(text,double)"</span><span class="nt">/></span>
+<span class="nt"></class></span>
+
+<span class="nt"><cassandraKey</span> <span class="na">name=</span><span
class="s">"org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey"</span><span
class="nt">></span>
+ <span class="nt"><partitionKey></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"url"</span> <span class="na">column=</span><span
class="s">"urlData"</span> <span class="na">type=</span><span
class="s">"text"</span><span class="nt">/></span>
+ <span class="nt"><field</span> <span class="na">name=</span><span
class="s">"timestamp"</span> <span class="na">column=</span><span
class="s">"timestampData"</span> <span class="na">type=</span><span
class="s">"bigint"</span><span class="nt">/></span>
+ <span class="nt"></partitionKey></span>
+ <span class="nt"><clusterKey></span>
+ <span class="nt"><key</span> <span class="na">column=</span><span
class="s">"timestampData"</span> <span class="na">order=</span><span
class="s">"desc"</span><span class="nt">/></span>
+ <span class="nt"></clusterKey></span>
+<span class="nt"></cassandraKey></span>
</pre></div>
+<p></gora-otd></p>
<p>Here you can see that we require the definition of two child elements
within the
<code>gora-otd</code> mapping configuration, namely;</p>
<p>The <b>keyspace</b> element; where we specify: </p>
<ol>
<li>
-<p>a parameter containing the Cassandra keyspace schema name e.g.
<b>Employee</b>, </p>
-</li>
-<li>
-<p>a parameter containing the host e.g. <b>localhost</b>. The value of the
host attribute of keyspace tag should match exactly what is in
- gora.properties file. Essentially this means that if you are using port
number, you should
- use it everywhere regardless of whether it is the default port or not.
- At runtime Gora will otherwise try to connect to localhost. For more
information please see <a
href="https://issues.apache.org/jira/browse/GORA-269">here</a></p>
+<p>a parameter containing the Cassandra keyspace schema name e.g.
<b>RecordKeySpace</b>, </p>
</li>
<li>
-<p>a parameter containing the Cassandra cluster name e.g. <b>Gora Cassandra
Test Cluster</b>,</p>
+<p>a parameter containing the durable write enabled property in the Cassandra
keyspace e.g. <b>false</b>, More about durable write can be found <a
href="http://docs.datastax.com/en/cassandra/2.1/cassandra/dml/dml_durability_c.html">here</a>.</p>
</li>
<li>
-<p>a parameter containing a <b>placement_strategy</b>: The value of
'placement_strategy' should be a fully qualifed class name that is known to
- the cassansra cluster, not the application or Gora. As of this writing, the
classes that ship
- with cassandra are:
- <code>org.apache.cassandra.locator.SimpleStrategy</code> and
- <code>org.apache.cassandra.locator.NetworkTopologyStrategy</code>.
- gora-cassandra will use SimpleStrategy by default if no value for this
attribute is specified. Finally
- it should be noted that the placement_strategy attribute of the keyspace tag
- will only apply if Gora creates the Cassandra Keyspace. More about
placement strategies can be found
- <a
href="http://www.datastax.com/documentation/cassandra/1.2/cassandra/architecture/architectureDataDistributeReplication_c.html">here</a>.</p>
+<p>the child element <b>placementStrategy</b> containing the Cassandra
placementStrategy details, a parameter containing the Cassandra placement
strategy name, e.g. <b>SimpleStrategy</b>, gora-cassandra will use
SimpleStrategy by default if no value for this attribute is specified. More
about placement strategies can be found <a
href="http://docs.datastax.com/en/archived/cassandra/2.0/cassandra/architecture/architectureDataDistributeReplication_c.html">here</a>.</p>
</li>
<li>
-<p>a parameter containing a <b>replication_factor</b> attribute with value
integer. Again the replacation_factor value associated with the Keyspace tag
+<p>a parameter containing a <b>replicationFactor</b> 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 'replication_factor' is '1'.
<b>N.B.</b>In Cassandra this property is required if the placement_strategy
- class is SimpleStrategy; otherwise, not used. This value essentially
relates to the number of replicas of data you want to reside on multiple
nodes.</p>
-</li>
-<li>
-<p>A child element <b>family</b> containing the <b>name</b>, <b>type</b> and
<b>gc_grace_seconds</b> parameters for column families we wish to create within
Cassandra. In this case we create three columns; <b>p</b>, <b>f</b> and
<b>sc</b> the last of which contains an optional <b>type</b> attribute which
further defines this as a super column.
- Additonally, column families <b>p</b> and <b>f</b> assign a value of 5 to
<b>gc_grace_seconds</b>. In Gora we define the default value of
'gc_grace_seconds' as '0' which is ONLY VIABLE FOR A SINGLE NODE
- CLUSTER. You should update this value according to your <a
href="https://wiki.apache.org/cassandra/StorageConfiguration">cluster
configuration</a>.
- Columns marked with a gc_grace_seconds exist for a configured time period.
More information can be found <a
href="http://www.datastax.com/documentation/cassandra/2.0/cassandra/dml/dml_about_deletes_c.html">here</a></p>
+ an existing keyspace. the default value for 'replicationFactor' is '1'. </p>
</li>
</ol>
<p>The <b>class</b> element specifying persistent fields which values should
map to. This element contains; </p>
<ol>
<li>
-<p>a parameter containing the Persistent class name e.g.
<b>org.apache.gora.examples.generated.Employee</b>, </p>
+<p>a parameter containing the Persistent class name e.g.
<b>org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraRecord</b>,
</p>
+</li>
+<li>
+<p>a parameter containing the keyClass e.g.
<b>org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey</b>
which specifies the keys which map to the field values, </p>
+</li>
+<li>
+<p>a parameter containing the keyspace e.g. <b>RecordKeySpace</b> which
matches to the above keyspace definition,</p>
</li>
<li>
-<p>a parameter containing the keyClass e.g. <b>java.lang.String</b> which
specifies the keys which map to the field values, </p>
+<p>a parameter containing the table name e.g. <b>CassandraRecord</b>,</p>
</li>
<li>
-<p>a parameter containing the keyspace e.g. <b>Employee</b> which matches to
the above keyspace definition,</p>
+<p>a parameter containing the allow filtering e.g. <b>true</b>, More about
allow filtering can be found <a
href="https://www.datastax.com/dev/blog/allow-filtering-explained-2">here</a>.</p>
</li>
<li>
-<p>finally a child element(s) <b>field</b> which represent fields which are to
be persisted into Cassandra. These need to be configured such that they receive
the following;</p>
-<p>a parameter <b>name</b> e.g. (name, dateOfBirth, ssn and salary
respectively), </p>
-<p>a parameter containing the column <b>family</b> to which the field belongs
e.g. (all p in this case), </p>
-<p>an optional parameter <b>qualifier</b>, which enables more granular control
over the data to be persisted into Cassandra.</p>
-<p>an optional patameter <b>ttl</b> (time to live): the value of the 'ttl'
attribute should most likely always
- be zero unless you want Cassandra to create Tombstones and delete portions
of your
- data once this period expires. Any positive value is read and bound to the
number
- of seconds after which the value for that field will disappear. The default
value of ttl
- is '0'.</p>
+<p>a child element(s) <b>field</b> which represent fields which are to be
persisted into Cassandra. These need to be configured such that they receive
the following;</p>
+<p>finally a parameter <b>name</b> e.g. (name, dateOfBirth, ssn and salary
respectively) which map to Gora field name, </p>
+<p>a parameter containing the column name e.g. <b>name</b>, </p>
+<p>a parameter containing the data type of the column e.g. <b>text</b>,</p>
+<p>an optional parameter <b>primarykey</b>, which indicates the primary
key.</p>
</li>
</ol>
+<p>The <b>cassandraKey</b> element specifying composite key fields which is
used in keyClass, This is optional, this element should be added only when
composite keys are available; </p>
+<ol>
+<li>a child element(s) <b>partitionKey</b> which represent cassandra partition
key</li>
+</ol>
+<p>a child element(s) <b>compositeKey</b> which represent cassandra composite
partition key</p>
+<p>a child element(s) <b>field</b> which represent partition key fields which
are to be persisted into Cassandra. These need to be configured such that they
receive the following;</p>
+<p>a parameter <b>name</b> e.g. (name, dateOfBirth, ssn and salary
respectively) which map to Gora field name, </p>
+<p>a parameter containing the column name e.g. <b>name</b>, </p>
+<p>a parameter containing the data type of the column <b>text</b>,</p>
+<ol>
+<li>a child element(s) <b>clusterKey</b> which represent cassandra cluster
key</li>
+</ol>
+<p>a child element(s) <b>key</b> which represents column key fields which
needs to be add clustered key. </p>
+<p>a parameter containing the column name e.g. <b>name</b>, </p>
+<p>a parameter containing the Order type of the column to be applied e.g.
<b>desc</b>,</p>
</div> <!-- /container (main block) -->