cassandrareplicationtopologygossip

Cassandra - Setup replication on 2 physcial machines


I want to setup Replication on two systems. So, need suggestions for the same . I have following doubts :-

1) Is it possible to setup replication on two physical machines ?
2) If Yes, What should be the keyspace Schema ?
3) CREATE KEYSPACE ums_db WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '3', 'DC2': '3'} ;

What does above schema means that I need to have 6 physical machines or just 2 physical machines where 3 nodes are logically created to store copies of data on each physical datacenter ?

4) What is the best schema for creating replication with 2 physical machines and what all files need to be changed and how ?

Thanks,


Solution

  • Is it possible to setup replication on two physical machines ?
    

    Yes, it is possible. If you are just doing it for evaluation purpose, do it using CCM tool. CCM tool creates a local cluster for specified number of nodes. Read about CCM tool here - Link (I never tried creating clusters on two different machines, but it shoud work.)

    If you want to use two physical machines, create clusters with three nodes on each machine. CCM tool copies cassandra configuration of each node in seperate directory. For example on machine 1 /root/cassandra/node1 /root/cassandra/node2 /root/cassandra/node3. Each node has separate ip, like 192.172.10.1,192.172.10.2, 192.172.10.3, and separate configuration directory. Change the cassandra-topology.properties file on each node (each config directory). Use This as example. This will create a cluster of 6 nodes on two different machines.

    What should be the keyspace Schema ?
    

    You did it correctly, this is how schema definition should be -

    CREATE KEYSPACE ums_db WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '3', 'DC2': '3'} ;
    

    This says, copy a row on three nodes in data centre DC1 and three nodes on data centre DC2.

    What is the best schema for creating replication with 2 physical machines and what all files need to be changed and how ?
    

    If you are doing it just for POC and evaluation purpose, just change above create keyspace statement to -

    CREATE KEYSPACE ums_db WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '2', 'DC2': '2'} ;