gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1017645 - in /websites/staging/gora/trunk/content: ./ current/gora-cassandra.html
Date Sun, 03 Sep 2017 10:56:15 GMT
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">&para;</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">&para;</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">&lt;gora-otd&gt;</span>
-  <span class="nt">&lt;keyspace</span> <span class="na">name=</span><span
class="s">&quot;Employee&quot;</span> <span class="na">host=</span><span
class="s">&quot;localhost&quot;</span> <span class="na">placement_strategy=</span><span
class="s">&quot;org.apache.cassandra.locator.SimpleStrategy&quot;</span>
-  <span class="na">replication_factor=</span><span class="s">&quot;1&quot;</span>
<span class="na">cluster=</span><span class="s">&quot;Gora Cassandra
Test Cluster&quot;</span><span class="nt">&gt;</span>
-    <span class="nt">&lt;family</span> <span class="na">name=</span><span
class="s">&quot;p&quot;</span> <span class="na">gc_grace_seconds=</span><span
class="s">&quot;5&quot;</span><span class="nt">/&gt;</span>
-    <span class="nt">&lt;family</span> <span class="na">name=</span><span
class="s">&quot;f&quot;</span> <span class="na">gc_grace_seconds=</span><span
class="s">&quot;5&quot;</span><span class="nt">/&gt;</span>
-    <span class="nt">&lt;family</span> <span class="na">name=</span><span
class="s">&quot;sc&quot;</span> <span class="na">type=</span><span
class="s">&quot;super&quot;</span> <span class="nt">/&gt;</span>
-  <span class="nt">&lt;/keyspace&gt;</span>
-
-  <span class="nt">&lt;class</span> <span class="na">name=</span><span
class="s">&quot;org.apache.gora.examples.generated.Employee&quot;</span>
<span class="na">keyClass=</span><span class="s">&quot;java.lang.String&quot;</span>
<span class="na">keyspace=</span><span class="s">&quot;Employee&quot;</span><span
class="nt">&gt;</span>
-    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;name&quot;</span>  <span class="na">family=</span><span
class="s">&quot;p&quot;</span> <span class="na">qualifier=</span><span
class="s">&quot;info:nm&quot;</span> <span class="na">ttl=</span><span
class="s">&quot;10&quot;</span><span class="nt">/&gt;</span>
-    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;dateOfBirth&quot;</span>  <span class="na">family=</span><span
class="s">&quot;p&quot;</span> <span class="na">qualifier=</span><span
class="s">&quot;info:db&quot;</span> <span class="na">ttl=</span><span
class="s">&quot;10&quot;</span><span class="nt">/&gt;</span>
-    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;ssn&quot;</span>  <span class="na">family=</span><span
class="s">&quot;p&quot;</span> <span class="na">qualifier=</span><span
class="s">&quot;info:sn&quot;</span> <span class="na">ttl=</span><span
class="s">&quot;10&quot;</span><span class="nt">/&gt;</span>
-    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;salary&quot;</span>  <span class="na">family=</span><span
class="s">&quot;p&quot;</span> <span class="na">qualifier=</span><span
class="s">&quot;info:sl&quot;</span> <span class="na">ttl=</span><span
class="s">&quot;10&quot;</span><span class="nt">/&gt;</span>
-  <span class="nt">&lt;/class&gt;</span>
-<span class="nt">&lt;/gora-otd&gt;</span>
+<h2 id="gora-cassandra-mappings">Gora Cassandra mappings<a class="headerlink" href="#gora-cassandra-mappings"
title="Permanent link">&para;</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">&lt;keyspace</span>
<span class="na">name=</span><span class="s">&quot;RecordKeySpace&quot;</span>
<span class="na">durableWrite=</span><span class="s">&quot;false&quot;</span><span
class="nt">&gt;</span>
+    <span class="nt">&lt;placementStrategy</span> <span class="na">name=</span><span
class="s">&quot;SimpleStrategy&quot;</span> <span class="na">replication_factor=</span><span
class="s">&quot;1&quot;</span><span class="nt">/&gt;</span>
+<span class="nt">&lt;/keyspace&gt;</span>
+
+<span class="nt">&lt;class</span> <span class="na">name=</span><span
class="s">&quot;org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraRecord&quot;</span>
+       <span class="na">keyClass=</span><span class="s">&quot;org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey&quot;</span>
+       <span class="na">keyspace=</span><span class="s">&quot;RecordKeySpace&quot;</span>
+       <span class="na">table=</span><span class="s">&quot;CassandraRecord&quot;</span>
<span class="na">allowFiltering=</span><span class="s">&quot;true&quot;</span>
<span class="na">id=</span><span class="s">&quot;5a1c395e-b41f-11e5-9f22-ba0be0483c18&quot;</span><span
class="nt">&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;name&quot;</span> <span class="na">column=</span><span
class="s">&quot;name&quot;</span> <span class="na">type=</span><span
class="s">&quot;text&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;dataInt&quot;</span> <span class="na">column=</span><span
class="s">&quot;age&quot;</span> <span class="na">type=</span><span
class="s">&quot;int&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;salary&quot;</span> <span class="na">column=</span><span
class="s">&quot;salary&quot;</span> <span class="na">type=</span><span
class="s">&quot;bigint&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;dataDouble&quot;</span> <span class="na">column=</span><span
class="s">&quot;testDouble&quot;</span> <span class="na">type=</span><span
class="s">&quot;double&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;dataBytes&quot;</span> <span class="na">column=</span><span
class="s">&quot;quotes&quot;</span> <span class="na">type=</span><span
class="s">&quot;blob&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;arrayInt&quot;</span> <span class="na">column=</span><span
class="s">&quot;listInt&quot;</span> <span class="na">type=</span><span
class="s">&quot;list(int)&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;arrayString&quot;</span> <span class="na">column=</span><span
class="s">&quot;listString&quot;</span> <span class="na">type=</span><span
class="s">&quot;list(text)&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;arrayLong&quot;</span> <span class="na">column=</span><span
class="s">&quot;listLong&quot;</span> <span class="na">type=</span><span
class="s">&quot;list(bigint)&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;arrayDouble&quot;</span> <span class="na">column=</span><span
class="s">&quot;listDouble&quot;</span> <span class="na">type=</span><span
class="s">&quot;list(double)&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;mapInt&quot;</span> <span class="na">column=</span><span
class="s">&quot;mapInt&quot;</span> <span class="na">type=</span><span
class="s">&quot;map(text,int)&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;mapString&quot;</span> <span class="na">column=</span><span
class="s">&quot;mapString&quot;</span> <span class="na">type=</span><span
class="s">&quot;map(text,text)&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;mapLong&quot;</span> <span class="na">column=</span><span
class="s">&quot;mapLong&quot;</span> <span class="na">type=</span><span
class="s">&quot;map(text,bigint)&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;mapDouble&quot;</span> <span class="na">column=</span><span
class="s">&quot;mapDouble&quot;</span> <span class="na">type=</span><span
class="s">&quot;map(text,double)&quot;</span><span class="nt">/&gt;</span>
+<span class="nt">&lt;/class&gt;</span>
+
+<span class="nt">&lt;cassandraKey</span> <span class="na">name=</span><span
class="s">&quot;org.apache.gora.cassandra.example.generated.AvroSerialization.CassandraKey&quot;</span><span
class="nt">&gt;</span>
+    <span class="nt">&lt;partitionKey&gt;</span>
+        <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;url&quot;</span> <span class="na">column=</span><span
class="s">&quot;urlData&quot;</span> <span class="na">type=</span><span
class="s">&quot;text&quot;</span><span class="nt">/&gt;</span>
+        <span class="nt">&lt;field</span> <span class="na">name=</span><span
class="s">&quot;timestamp&quot;</span> <span class="na">column=</span><span
class="s">&quot;timestampData&quot;</span> <span class="na">type=</span><span
class="s">&quot;bigint&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;/partitionKey&gt;</span>
+    <span class="nt">&lt;clusterKey&gt;</span>
+        <span class="nt">&lt;key</span> <span class="na">column=</span><span
class="s">&quot;timestampData&quot;</span> <span class="na">order=</span><span
class="s">&quot;desc&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;/clusterKey&gt;</span>
+<span class="nt">&lt;/cassandraKey&gt;</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) -->
 



Mime
View raw message