replication
How to set the replication factor for a new graph.
Synopsis
system.graph('graph_name').replication("{'class' : 'NetworkTopologyStrategy', 'dc1' : 3}")
Description
Create a new graph. The graph_name specified is used to create two Cassandra keyspaces, graph_name and graph_name_system, and can only contain alphanumeric and underscore characters.
Examples
Create a new graph and set the graph_name replication configuration using
replication()
as well as the graph_name_system configuration using
systemReplication()
. Apache Cassandra settings for replication factor are used, either
SimpleStrategy
for single nodes or
NetworkTopologyStrategy
for multiple nodes or multiple datacenters.
NetworkTopologyStrategy
, whereas for a single node, the replication
strategy will default to SimpleStrategy
. The number of nodes will determine
the default replication factor:
number of nodes per datacenter | graph_name replication factor | graph_name_system replication factor |
---|---|---|
1-3 | number of nodes per datacenter | number of nodes per datacenter |
greater than 3 | 3 | 5 |
system.graph('food').
replication("{'class' : 'NetworkTopologyStrategy', 'dc1' : 3 }").
systemReplication("{'class' : 'NetworkTopologyStrategy', 'dc1' : 3 }").
ifNotExists().create()
The
resulting list:==>null
The replication settings can be verified using
the cqlsh
tool, running the CQL command DESCRIBE keyspace
food;
.In addition to setting the replication factor for the graph_name
keyspace,
the replication factor for the
graph_name_system
must also be set.