Database Reference
In-Depth Information
As explained above, a data center consists of multiple racks with each rack contain-
ing multiple nodes. A data replication strategy is vital in order to enable high availabil-
ity and node failure. Situations like
Local reads (high availability)
Fail-over (node failure)
Considering these factors, we should replicate data on multiple nodes in the same
data center but with different racks. This would avoid read/write failure (in case of net-
work connection issues, power failure, etc.) of nodes in the same rack.
Replication means keeping redundant copies of data over multiple data nodes for
high availability and consistency. With Cassandra we can configure the replication
factor and replication strategy class while creating keyspace.
While creating schema (rather than keyspace) we can configure replication as:
CREATE KEYSPACE apress WITH replication = {'class':
'SimpleStrategy', 'replication_factor' : 3};
// cql3 script
create keyspace apress with
placement_strategy='org.apache.cassandra.locator.SimpleStrategy'
and strategy_options ={replication_factor:1};
// using cassandra-cli thrift
Note Schema creation and management via CQL3 and Cassandra-cli will be dis-
cussed in Chapter 2 .
Here, SimpleStrategy is the replication strategy, where the replica-
tion_factor is 3. Using SimpleStrategy like this, each data row will be rep-
licated on 3 replica nodes synchronously or asynchronously (depending on the write
consistency level) in clockwise direction.
Different strategy class options supported by Cassandra are
SimpleStrategy
LocalStrategy
NetworkTopologyStrategy
Search WWH ::




Custom Search