If you're planning to have another DC, then it's better to start to use NetworkTopologyStrategy from beginning - just specify the one DC, and when you get another, it will be simply to expand to it (see documentation: https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/operations/opsAddDCToCluster.html). When adding new DC, for system keyspaces you can use following script to perform adjustments: https://github.com/DataStax-Toolkit/cassandra-dse-helper-scripts/tree/master/adjust-keyspaces (it could be used for non-system keyspaces as well)
On Sat, Dec 19, 2020 at 10:21 AM Manu Chadha <manu.cha...@hotmail.com> wrote: > Is it possible to use NetworkTopologyStrategy when creating a keyspace and > add data centers later? > > I am just starting with an MVP application and I don't expect much > traffic or data. Thus I have created only one data center. However, I'll > like to add more data centers later if needed > > I notice that the replication factor for each data center needs to be > specified at the time of keyspace creation > > CREATE KEYSPACE "Excalibur" > > WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'dc1' : 3, 'dc2' : > 2}; > > As I only have dc1 at the moment, could I just do > > CREATE KEYSPACE "Excalibur" > > WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'dc1' : 3}; > > and when I have another datacenter say dc2, could I edit the Excalibur > keyspace? > > ALTER KEYSPACE "Excalibur" > > WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'dc2' : 2}; > > > > or can I start with SimpleStrategy now and change to > NetworkTopologyStrategy later? I suspect this might not work as I think > this needs changing snitch etc. > > > > > > Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for > Windows 10 > > > -- With best wishes, Alex Ott http://alexott.net/ Twitter: alexott_en (English), alexott (Russian)