You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ali Akhtar <al...@gmail.com> on 2016/10/10 19:32:50 UTC

Where to change the datacenter name?

Where can I change the default name 'datacenter1'? I've looked through the
configuration files in /etc/cassandra , and can't find where this value is
being defined.

Re: Where to change the datacenter name?

Posted by Ben Dalling <b....@locp.co.uk>.
Hi,

It depends on which snitch you are using, but the DC name is
in cassandra-rackdc.properties for the GossipingPropertyFileSnitch.

Best wishes,

Ben

On 10 October 2016 at 20:54, Adam Hutson <ad...@datascale.io> wrote:

> There is a cluster name in the cassandra.yaml for naming the cluster, aka
> data center. Then you assign keyspaces to the data center within the CREATE
> KEYSPACE stmt with NetworkTopology.
>
> On Monday, October 10, 2016, Ali Akhtar <al...@gmail.com> wrote:
>
>> Where can I change the default name 'datacenter1'? I've looked through
>> the configuration files in /etc/cassandra , and can't find where this value
>> is being defined.
>>
>
>
> --
>
> Adam Hutson
> Data Architect | DataScale
> +1 (417) 224-5212
> adam@datascale.io
>

Re: Where to change the datacenter name?

Posted by Surbhi Gupta <su...@gmail.com>.
Data center name is there in two file , if you are using gossip as
GossipingPropertyFileSnitch
in Cassandra.yaml then data center name is in  cassandra-rackdc.properties

If you are using
PropertyFileSnitch  in Cassandra.yaml then file name where data center name
is Cassandra-topology.properties file
On Monday, October 10, 2016, Ali Akhtar <al...@gmail.com> wrote:

> So I see this:
>
> cluster_name: 'Test Cluster'
>
> But when I grep -i or ctrl + f for 'datacenter1` in cassandra.yaml, I
> don't see that anywhere except in a comment.
>
>
> Yet when I do nodetool status, I see: datacenter1
>
> And unless I define my replication as: '{'class':
> 'NetworkTopologyStrategy', 'datacenter1' : 3}' when creating my keyspace,
> my inserts / selects don't work because it says 0 replicas available (i.e
> if i use anything other than 'datacenter1' in the above stmt)
>
> I don't see 'datacenter1' in rackdc.properties. So my question is, which
> file contains 'datacenter1'?
>
> On Tue, Oct 11, 2016 at 12:54 AM, Adam Hutson <adam@datascale.io
> <javascript:_e(%7B%7D,'cvml','adam@datascale.io');>> wrote:
>
>> There is a cluster name in the cassandra.yaml for naming the cluster, aka
>> data center. Then you assign keyspaces to the data center within the CREATE
>> KEYSPACE stmt with NetworkTopology.
>>
>>
>> On Monday, October 10, 2016, Ali Akhtar <ali.rac200@gmail.com
>> <javascript:_e(%7B%7D,'cvml','ali.rac200@gmail.com');>> wrote:
>>
>>> Where can I change the default name 'datacenter1'? I've looked through
>>> the configuration files in /etc/cassandra , and can't find where this value
>>> is being defined.
>>>
>>
>>
>> --
>>
>> Adam Hutson
>> Data Architect | DataScale
>> +1 (417) 224-5212
>> adam@datascale.io <javascript:_e(%7B%7D,'cvml','adam@datascale.io');>
>>
>
>

Re: Where to change the datacenter name?

Posted by Vladimir Yudovin <vl...@winguzone.com>.
Hello,

&gt;on my local machine, Cassandra is annoyingly insisting on 'datacenter1'.

I don't believe Cassandra does it on its own )))



What is parameter endpoint_snitch in cassandra.yaml file? As it was mentioned, different snitches use different configuration files and you can set the same data center name in both your testing and production environments.



&gt;I would be careful changing datacenter name, particularly in production...it may result in stale data depending on token values 

Actually tokens shouldn't change if number of nodes remains the same.

You can change DC name on all nodes (-Dcassandra.ignore_dc=true must be set on first run) and run nodetool repair/cleanup on each node to ensure data consistency.





&gt;And unless I define my replication as: '{'class': 'NetworkTopologyStrategy', 'datacenter1' : 3}' when creating my keyspace, my inserts / selects don't work because it says 0 replicas available

Probably you can also use SimpleStrategy (depending on system configuration and needs)





Best regards, Vladimir Yudovin, 

Winguzone - Hosted Cloud Cassandra on Azure and SoftLayer.
Launch your cluster in minutes.






---- On Mon, 10 Oct 2016 16:30:49 -0400Ali Akhtar &lt;ali.rac200@gmail.com&gt; wrote ----




Yeah, so what's happening is, I'm running Cassandra thru a docker image in production, and so over there, it is using the datacenter name that I specified thru an env variable.



But on my local machine, Cassandra is annoyingly insisting on 'datacenter1'.



So in order to maintain the same .cql scripts for setting up the db, I either need to change the dc name locally or in production.



I guess it looks like I should leave it 'datacenter1' in production.




On Tue, Oct 11, 2016 at 1:19 AM, Amit Trivedi &lt;triamit@gmail.com&gt; wrote:






I believe it is coming from system.local. You can verify by executing


select data_center from system.local;

I would be careful changing datacenter name, particularly in production.  This is essentially because if change of datacenter requires snitch configuration change, it may result in stale data depending on token values and snitch settings and there is a risk of node reporting invalid/ missing data to client.






On Mon, Oct 10, 2016 at 4:08 PM, Ali Akhtar &lt;ali.rac200@gmail.com&gt; wrote:

So I see this:



cluster_name: 'Test Cluster'



But when I grep -i or ctrl + f for 'datacenter1` in cassandra.yaml, I don't see that anywhere except in a comment.





Yet when I do nodetool status, I see: datacenter1



And unless I define my replication as: '{'class': 'NetworkTopologyStrategy', 'datacenter1' : 3}' when creating my keyspace, my inserts / selects don't work because it says 0 replicas available (i.e if i use anything other than 'datacenter1' in the above stmt)



I don't see 'datacenter1' in rackdc.properties. So my question is, which file contains 'datacenter1'?




On Tue, Oct 11, 2016 at 12:54 AM, Adam Hutson &lt;adam@datascale.io&gt; wrote:

There is a cluster name in the cassandra.yaml for naming the cluster, aka data center. Then you assign keyspaces to the data center within the CREATE KEYSPACE stmt with NetworkTopology. 





On Monday, October 10, 2016, Ali Akhtar &lt;ali.rac200@gmail.com&gt; wrote:

Where can I change the default name 'datacenter1'? I've looked through the configuration files in /etc/cassandra , and can't find where this value is being defined.





-- 

Adam Hutson
Data Architect | DataScale
+1 (417) 224-5212
adam@datascale.io













Re: Where to change the datacenter name?

Posted by Ali Akhtar <al...@gmail.com>.
Yeah, so what's happening is, I'm running Cassandra thru a docker image in
production, and so over there, it is using the datacenter name that I
specified thru an env variable.

But on my local machine, Cassandra is annoyingly insisting on 'datacenter1'.

So in order to maintain the same .cql scripts for setting up the db, I
either need to change the dc name locally or in production.

I guess it looks like I should leave it 'datacenter1' in production.

On Tue, Oct 11, 2016 at 1:19 AM, Amit Trivedi <tr...@gmail.com> wrote:

> I believe it is coming from system.local. You can verify by executing
>
> select data_center from system.local;
>
> I would be careful changing datacenter name, particularly in production. This
> is essentially because if change of datacenter requires snitch
> configuration change, it may result in stale data depending on token values
> and snitch settings and there is a risk of node reporting invalid/ missing
> data to client.
>
>
>
> On Mon, Oct 10, 2016 at 4:08 PM, Ali Akhtar <al...@gmail.com> wrote:
>
>> So I see this:
>>
>> cluster_name: 'Test Cluster'
>>
>> But when I grep -i or ctrl + f for 'datacenter1` in cassandra.yaml, I
>> don't see that anywhere except in a comment.
>>
>>
>> Yet when I do nodetool status, I see: datacenter1
>>
>> And unless I define my replication as: '{'class':
>> 'NetworkTopologyStrategy', 'datacenter1' : 3}' when creating my keyspace,
>> my inserts / selects don't work because it says 0 replicas available (i.e
>> if i use anything other than 'datacenter1' in the above stmt)
>>
>> I don't see 'datacenter1' in rackdc.properties. So my question is, which
>> file contains 'datacenter1'?
>>
>> On Tue, Oct 11, 2016 at 12:54 AM, Adam Hutson <ad...@datascale.io> wrote:
>>
>>> There is a cluster name in the cassandra.yaml for naming the cluster,
>>> aka data center. Then you assign keyspaces to the data center within the
>>> CREATE KEYSPACE stmt with NetworkTopology.
>>>
>>>
>>> On Monday, October 10, 2016, Ali Akhtar <al...@gmail.com> wrote:
>>>
>>>> Where can I change the default name 'datacenter1'? I've looked through
>>>> the configuration files in /etc/cassandra , and can't find where this value
>>>> is being defined.
>>>>
>>>
>>>
>>> --
>>>
>>> Adam Hutson
>>> Data Architect | DataScale
>>> +1 (417) 224-5212
>>> adam@datascale.io
>>>
>>
>>
>

Re: Where to change the datacenter name?

Posted by Amit Trivedi <tr...@gmail.com>.
I believe it is coming from system.local. You can verify by executing

select data_center from system.local;

I would be careful changing datacenter name, particularly in production. This
is essentially because if change of datacenter requires snitch
configuration change, it may result in stale data depending on token values
and snitch settings and there is a risk of node reporting invalid/ missing
data to client.



On Mon, Oct 10, 2016 at 4:08 PM, Ali Akhtar <al...@gmail.com> wrote:

> So I see this:
>
> cluster_name: 'Test Cluster'
>
> But when I grep -i or ctrl + f for 'datacenter1` in cassandra.yaml, I
> don't see that anywhere except in a comment.
>
>
> Yet when I do nodetool status, I see: datacenter1
>
> And unless I define my replication as: '{'class':
> 'NetworkTopologyStrategy', 'datacenter1' : 3}' when creating my keyspace,
> my inserts / selects don't work because it says 0 replicas available (i.e
> if i use anything other than 'datacenter1' in the above stmt)
>
> I don't see 'datacenter1' in rackdc.properties. So my question is, which
> file contains 'datacenter1'?
>
> On Tue, Oct 11, 2016 at 12:54 AM, Adam Hutson <ad...@datascale.io> wrote:
>
>> There is a cluster name in the cassandra.yaml for naming the cluster, aka
>> data center. Then you assign keyspaces to the data center within the CREATE
>> KEYSPACE stmt with NetworkTopology.
>>
>>
>> On Monday, October 10, 2016, Ali Akhtar <al...@gmail.com> wrote:
>>
>>> Where can I change the default name 'datacenter1'? I've looked through
>>> the configuration files in /etc/cassandra , and can't find where this value
>>> is being defined.
>>>
>>
>>
>> --
>>
>> Adam Hutson
>> Data Architect | DataScale
>> +1 (417) 224-5212
>> adam@datascale.io
>>
>
>

Re: Where to change the datacenter name?

Posted by Ali Akhtar <al...@gmail.com>.
So I see this:

cluster_name: 'Test Cluster'

But when I grep -i or ctrl + f for 'datacenter1` in cassandra.yaml, I don't
see that anywhere except in a comment.


Yet when I do nodetool status, I see: datacenter1

And unless I define my replication as: '{'class':
'NetworkTopologyStrategy', 'datacenter1' : 3}' when creating my keyspace,
my inserts / selects don't work because it says 0 replicas available (i.e
if i use anything other than 'datacenter1' in the above stmt)

I don't see 'datacenter1' in rackdc.properties. So my question is, which
file contains 'datacenter1'?

On Tue, Oct 11, 2016 at 12:54 AM, Adam Hutson <ad...@datascale.io> wrote:

> There is a cluster name in the cassandra.yaml for naming the cluster, aka
> data center. Then you assign keyspaces to the data center within the CREATE
> KEYSPACE stmt with NetworkTopology.
>
>
> On Monday, October 10, 2016, Ali Akhtar <al...@gmail.com> wrote:
>
>> Where can I change the default name 'datacenter1'? I've looked through
>> the configuration files in /etc/cassandra , and can't find where this value
>> is being defined.
>>
>
>
> --
>
> Adam Hutson
> Data Architect | DataScale
> +1 (417) 224-5212
> adam@datascale.io
>

Re: Where to change the datacenter name?

Posted by Adam Hutson <ad...@datascale.io>.
There is a cluster name in the cassandra.yaml for naming the cluster, aka
data center. Then you assign keyspaces to the data center within the CREATE
KEYSPACE stmt with NetworkTopology.

On Monday, October 10, 2016, Ali Akhtar <al...@gmail.com> wrote:

> Where can I change the default name 'datacenter1'? I've looked through the
> configuration files in /etc/cassandra , and can't find where this value is
> being defined.
>


-- 

Adam Hutson
Data Architect | DataScale
+1 (417) 224-5212
adam@datascale.io