# What should be the value of data center?

**URL:** <https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424>\
**Category:** General\
**Created:** [January 24, 2022, 11:57am UTC](https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424 "2022-01-24T11:57:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sham\_yuga](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sham\_yuga](https://forum.yugabyte.com/u/sham_yuga)\
**Post date:** [January 24, 2022, 11:57am UTC](https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424/1 "2022-01-24T11:57:33Z")

</div>

From the database cluster(given below), to set the `HostSelectionPolicy`, How do I know the name of datacenter(`dc1`)? Is it the name of datacenter where application is running?

* * *

yugabyte cluster has 2 regions, 3 AZs, 6 node architecture.

4 nodes in central region,  
2 nodes in east region

```auto
Node1 (Master, TServer) US-east
Node2 (Master, TServer) US-central-1
Node3 (TServer) US-central-1
Node4 (TServer) US-east
Node5 (Master, TServer) US-central-2 (Leader)
Node6 (TServer) US-central-2

```

* * *

Application is running in central region.

Application is using YCQL driver(yugabyte gocql client) that is currently configured to send SQL queries to Node2(only). **Goal** is to enable the driver to have connections for all tablet leaders(in central region)

* * *

As mentioned [here](https://blog.yugabyte.com/yugabyte-db-architecture-diverse-workloads-with-operational-simplicity/):  
_In many cases, this forwarding will be purely local, because both CQL and Redis Cluster clients are **capable of sending requests to the right server** and avoiding an additional network hop._

For this, driver [documentation](https://pkg.go.dev/github.com/yugabyte/gocql#hdr-Data_center_awareness_and_query_routing) says to provide the list of all tablet leaders and the hostselectionpolicy(shown below):

```auto
cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3")
cluster.PoolConfig.HostSelectionPolicy = gocql.TokenAwareHostPolicy(gocql.DCAwareRoundRobinPolicy("dc1"))

```

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [January 24, 2022, 2:22pm UTC](https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424/2 "2022-01-24T14:22:54Z")

</div>

Can you paste the `--placement_cloud`, `--placement_region`, `--placement_zone` for the servers?

---

<div class="post-metadata">

**Author:** ![sham\_yuga](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sham\_yuga](https://forum.yugabyte.com/u/sham_yuga)\
**Post date:** [January 24, 2022, 5:44pm UTC](https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424/3 "2022-01-24T17:44:45Z")

</div>

@dorian_yugabyte  
How to view `--placement_cloud` , `--placement_region` , `--placement_zone` values through yugaware UI interface? Is it “cloud info” column?

 ![Screen Shot 2022-01-24 at 9.45.58 AM](https://canada1.discourse-cdn.com/flex027/uploads/yugabyte/original/1X/d218fb467bd2a47abeb30666c39082fc13b3f089.png)

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [January 25, 2022, 8:40am UTC](https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424/4 "2022-01-25T08:40:09Z")

</div>

You can look at them on `http://tserverip:9000/varz`, `http://masterip:7000/varz`, or on `http://yb-master-ip:7000/tablet-servers` on the list of yb-tablet servers.

---

<div class="post-metadata">

**Author:** ![sham\_yuga](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sham\_yuga](https://forum.yugabyte.com/u/sham_yuga)\
**Post date:** [January 26, 2022, 2:31pm UTC](https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424/5 "2022-01-26T14:31:05Z")

</div>

@dorian_yugabyte

For your question: Can you paste the `--placement_cloud` , `--placement_region` , `--placement_zone` for the servers?

Below are the values for all 6 nodes:

Node1:

```auto
--placement_cloud=onprem
--placement_region=US East 2
--placement_zone=useast2-1

```

Node2:

```auto
--placement_cloud=onprem
--placement_region=US Central
--placement_zone=uscentral-1

```

Node3:

```auto
--placement_cloud=onprem
--placement_region=US Central
--placement_zone=uscentral-1

```

Node4:

```auto
--placement_cloud=onprem
--placement_region=US East 2
--placement_zone=useast2-1

```

Node5:

```auto
--placement_cloud=onprem
--placement_region=US Central
--placement_zone=uscentral-2

```

Node6:

```auto
--placement_cloud=onprem
--placement_region=US Central
--placement_zone=uscentral-2

```

* * *

Application(using gocql driver) is in central region.

What should be the value of `dc1` in `gocql.TokenAwareHostPolicy(gocql.DCAwareRoundRobinPolicy("dc1"))`?

---

<div class="post-metadata">

**Author:** ![Alan\_Caldera](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/alan_caldera/32/91_2.png) [@Alan\_Caldera](https://forum.yugabyte.com/u/Alan_Caldera)\
**Post date:** [January 26, 2022, 3:03pm UTC](https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424/6 "2022-01-26T15:03:26Z")

</div>

@sham_yuga - The value of `gocql.TokenAwareHostPolicy(gocql.DCAwareRoundRobinPolicy())` should be “`US Central`” which corresponds to `--placement_region`. This is the value that will be in `system.local` and `system.peers` as the `datacenter`.

Hope this helps.  
Alan

---

<div class="post-metadata">

**Author:** ![sham\_yuga](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sham\_yuga](https://forum.yugabyte.com/u/sham_yuga)\
**Post date:** [January 27, 2022, 6:26pm UTC](https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424/7 "2022-01-27T18:26:08Z")

</div>

@Alan_Caldera  
If I set `gocql.TokenAwareHostPolicy(gocql.DCAwareRoundRobinPolicy("US Central"))` and let’s say, gocql driver found the tablet server(that owns the table partition) in the central region, as down… What happens next? Because the replication of this tablet is in “US East 2”. How does gocql driver know that the query has to be sent to the tablet server in east region?

---

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [January 28, 2022, 9:09am UTC](https://forum.yugabyte.com/t/what-should-be-the-value-of-data-center/1424/8 "2022-01-28T09:09:57Z")

</div>

@sham_yuga  
It knows the location of every tablet peer/leader for all tables/indexes in the whole cluster.
