0

Hi I'm new to Cassandra. I have a 2 node Cassandra cluster. For reasons imposed by the front end I need...

  1. Total replication of all data on each of the two nodes.
  2. Eventual consistent writes. So the node being written to will respond with an acknowledge to the front end straight away. Not synchronized on the replication

Can anyone tell me is this possible? Is it done in the YAML file? I know there is properties there for consistency but I don't see that any of the Partitioners suit my needs. Where can I set the replication factor?

Thanks

Rob McFeely
  • 2,823
  • 8
  • 33
  • 50

1 Answers1

2

You set the replication factor during creation of the keyspace. So if you use (and plan for the future on using) a single data center set-up, you create the keyspace using cqlsh like so

CREATE KEYSPACE "Excalibur"
WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 3};

Check out the documentation regarding the create keyspace. How this is handled internally is related to the snitch definition of the cluster and a strategy option defined per keyspace. In the case of the SimpleStrategy above, this simply assumes a ring topology of your cluster and places the data clockwise in that ring (see this).

Regarding consistency, you can very different levels of consistency for write and read operations in your client/driver during each operation:

Cassandra extends the concept of eventual consistency by offering tunable consistency―for any given read or write operation, the client application decides how consistent the requested data should be.

Read the doc

If you use Java in your clients, and the DatatStax Java driver, you can set the consistency level using

QueryOptions.setConsistencyLevel(ConsistencyLevel consistencyLevel) 

"One" is the default setting.

Hope that helps

John
  • 1,462
  • 10
  • 17
  • 1
    Network topology strategy is not a good example for this case, though :-) I think `SimpleStrategy` is enough. He should also read [this](http://www.datastax.com/documentation/cassandra/2.0/cassandra/architecture/architectureDataDistributeReplication_c.html) – Jacek L. Apr 04 '14 at 06:37
  • Thanks for the answer its very clear. Ill try this out. – Rob McFeely Apr 04 '14 at 10:55