Database Reference
In-Depth Information
cassandra> set Keyspace1.Standard2['mykey']['rf']='1'
Value inserted.
Now I shut down node 1.5 and connect to the other node, 1.7, and try to get the value I just set:
cassandra> connect 192.168.1.7/9160
Connected to: "TDG Cluster" on 192.168.1.7/9160
cassandra> get Keyspace1.Standard2['mykey']['rf']
Exception null
Because my replication factor was 1, the value was written only to the 1.5 node, so when I lost
that node, the other node in the cluster didn't have the value. No client will be able to read the
value of the rf column until 1.5 comes back online.
But let's see the effect of updating the replication factor. We change it from 1 to 2 in the 1.5 and
1.7 nodes and restart. Let's insert a new value to our rf column on node 1.7:
cassandra> connect 192.168.1.7/9160
Connected to: "TDG Cluster" on 192.168.1.7/9160
cassandra> get Keyspace1.Standard2['mykey']['rf']
Exception null
cassandra> set Keyspace1.Standard2['mykey']['rf']='2'
Value inserted.
The Exception null response in the preceding example proves that the value didn't exist on
node 1.7 beforehand. Now we shut down node 1.7 and connect to 1.5, and we see the value be-
cause it was replicated to 1.5 on our write to 1.7, due to our replication factor:
cassandra> connect 192.168.1.5/9160
Connected to: "TDG Cluster" on 192.168.1.5/9160
cassandra> get Keyspace1.Standard2['mykey']['rf']
=> (column=rf, value=2, timestamp=1279491483449000)
As a general guideline, you can anticipate that your write throughput capacity will be the number
of nodes divided by your replication factor. So in a 10-node cluster that typically does 10,000
writes per second with a replication factor of 1, if you increase the replication factor to 2, you
can expect to do around 5,000 writes per second.
Partitioners
The future is already here; it's just not evenly distributed yet.
—William Gibson
The purpose of the partitioner is to allow you to specify how row keys should be sorted, which
has a significant impact on how data will be distributed across your nodes. It also has an effect
Search WWH ::




Custom Search