참조 : http://wiki.apache.org/cassandra/API
ConsistencyLevel 은 일관성을 최대한 보장하기 위한 옵션값인듯 하다
음.. 그러니까
데이터를 쓸때 n개의 DB 서버 중에
한군데만 쓰기가 완료되도 ok
두군데서만 쓰기가 완료되도 ok
세군데, n/2 + 1 ....
데이터를 불러올때 n개의 DB 서버 중에
제일빨리 응답한놈데이터를 쓸것이냐,
서버 2개에서 데이터를 읽어서 가장 최근 자료를 쓸 것이냐
서버 3개, n/2 + 1 ....
뭐 이런 규칙을 정의한듯 (영어가 짧아서...)
Write
Level | Behavior |
ANY | Ensure that the write has been written to at least 1 node, including HintedHandoff recipients. |
ONE | Ensure that the write has been written to at least 1 replica's commit log and memory table before responding to the client. |
TWO | Ensure that the write has been written to at least 2 replica's before responding to the client. |
THREE | Ensure that the write has been written to at least 3 replica's before responding to the client. |
QUORUM | Ensure that the write has been written to N / 2 + 1 replicas before responding to the client. |
LOCAL_QUORUM | Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) |
EACH_QUORUM | Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) |
ALL | Ensure that the write is written to all N replicas before responding to the client. Any unresponsive replicas will fail the operation. |
Read
Level | Behavior |
ANY | Not supported. You probably want ONE instead. |
ONE | Will return the record returned by the first replica to respond. A consistency check is always done in a background thread to fix any consistency issues when ConsistencyLevel.ONE is used. This means subsequent calls will have correct data even if the initial read gets an older value. (This is calledReadRepair) |
TWO | Will query 2 replicas and return the record with the most recent timestamp. Again, the remaining replicas will be checked in the background. |
THREE | Will query 3 replicas and return the record with the most recent timestamp. |
QUORUM | Will query all replicas and return the record with the most recent timestamp once it has at least a majority of replicas (N / 2 + 1) reported. Again, the remaining replicas will be checked in the background. |
LOCAL_QUORUM | Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied. |
EACH_QUORUM | Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied. |
ALL | Will query all replicas and return the record with the most recent timestamp once all replicas have replied. Any unresponsive replicas will fail the operation. |
'Cassandra' 카테고리의 다른 글
Cassandra - Java를 이용하여 데이터 쓰기 (super column family) (0) | 2013.04.05 |
---|---|
Cassandra - Java를 이용하여 데이터 쓰기 (column family) (0) | 2013.04.04 |
Cassandra - thrift 인터페이스 jar 만들기 (0) | 2013.03.29 |
Cassandra - thrift 인터페이스 생성 (0) | 2013.03.28 |
Cassandra - 데이터 읽기, 쓰기(cassandra-cli) (0) | 2013.03.27 |