You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by Apache Wiki <wi...@apache.org> on 2011/06/28 15:03:33 UTC

[Cassandra Wiki] Update of "Counters" by SylvainLebresne

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for change notification.

The "Counters" page has been changed by SylvainLebresne:
http://wiki.apache.org/cassandra/Counters?action=diff&rev1=13&rev2=14

  
  == Getting started ==
  
- In order to use counters in Cassandra you need to first set up a cluster, see the [[http://wiki.apache.org/cassandra/GettingStarted|Getting started]] guide for more information. Currently the counters code is slated for a release in Cassandra 0.8.0.
+ In order to use counters in Cassandra you need to first set up a cluster, see the [[http://wiki.apache.org/cassandra/GettingStarted|Getting started]] guide for more information. Also note that counters are available starting with Cassandra 0.8.0.
  
  ==== Configuration ====
  
+ To use counters, you have to define a column family (or super column family) whose columns will act as counters. To create such a column family `counterCF` using the CLI, you will have to do:
- When first setting up the cluster you can specify a column or super column that will act as counters.
- For example using the cassandra.yaml configuration file:
- 
  {{{
+ [default@test] create column family counterCF with default_validation_class=CounterColumnType and replicate_on_write=true;
- - name: Counter1
-   default_validation_class: CounterColumnType
- 
- - name: SuperCounter1
-   column_type: Super
-   default_validation_class: CounterColumnType
  }}}
+ Setting the `default_validation_class` to `CounterColumnType` indicates that the column will be counters. Setting `replicate_on_write=true` will be optional starting in 0.8.2, but a bug made it default to false in 0.8.0 and 0.8.1, which is unsafe.
  
  ==== Incrementing and accessing counters ====