You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Manu Chadha <ma...@hotmail.com> on 2020/12/19 09:21:20 UTC

Use NetworkTopologyStrategy for single data center and add data centers later

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


Re: Use NetworkTopologyStrategy for single data center and add data centers later

Posted by Alex Ott <al...@gmail.com>.
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 <ma...@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)

Re: Use NetworkTopologyStrategy for single data center and add data centers later

Posted by Johnny Miller <jo...@digitalis.io>.
Never, ever use SimpleStrategy in production - that's my golden rule. It's
extremely limiting if you do and a pain to change your mind later.

On Thu, 28 Jan 2021 at 02:00, Carl Mueller
<ca...@smartthings.com.invalid> wrote:

> Yes, perform that as soon as possible.
>
> When you add a new datacenter, keyspaces that are SimpleStrategy (don't
> forget about system_traces and system_distributed) won't work.
>
> On Sat, Dec 19, 2020 at 12:38 PM Aaron Ploetz <aa...@gmail.com>
> wrote:
>
>> Yes, you absolutely can (and should) use NetworkTopologyStrategy with a
>> single data center.  In fact, I would argue that SimpleStrategy should
>> almost never be used.  But that's just me.
>>
>> Thanks,
>>
>> Aaron
>>
>>
>> On Sat, Dec 19, 2020 at 3:21 AM Manu Chadha <ma...@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
>>>
>>>
>>>
>>

-- 



--

The information contained in this electronic message and any 
attachments to this message are intended for the exclusive use of the 
addressee(s) and may contain proprietary, confidential or privileged 
information. If you are not the intended recipient, you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately and destroy all copies of this message and any attachments. 
WARNING: Computer viruses can be transmitted via email. The recipient 
should check this email and any attachments for the presence of viruses. 
The company accepts no liability for any damage caused by any virus 
transmitted by this email. www.digitalis.io <http://www.digitalis.io>

Re: Use NetworkTopologyStrategy for single data center and add data centers later

Posted by Carl Mueller <ca...@smartthings.com.INVALID>.
Yes, perform that as soon as possible.

When you add a new datacenter, keyspaces that are SimpleStrategy (don't
forget about system_traces and system_distributed) won't work.

On Sat, Dec 19, 2020 at 12:38 PM Aaron Ploetz <aa...@gmail.com> wrote:

> Yes, you absolutely can (and should) use NetworkTopologyStrategy with a
> single data center.  In fact, I would argue that SimpleStrategy should
> almost never be used.  But that's just me.
>
> Thanks,
>
> Aaron
>
>
> On Sat, Dec 19, 2020 at 3:21 AM Manu Chadha <ma...@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
>>
>>
>>
>

Re: Use NetworkTopologyStrategy for single data center and add data centers later

Posted by Aaron Ploetz <aa...@gmail.com>.
Yes, you absolutely can (and should) use NetworkTopologyStrategy with a
single data center.  In fact, I would argue that SimpleStrategy should
almost never be used.  But that's just me.

Thanks,

Aaron


On Sat, Dec 19, 2020 at 3:21 AM Manu Chadha <ma...@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
>
>
>