# Newbie question: automatically forward query to all datacenters?

**URL:** <https://discuss.hashicorp.com/t/newbie-question-automatically-forward-query-to-all-datacenters/9116>\
**Category:** Consul\
**Created:** [May 22, 2020, 5:40pm UTC](https://discuss.hashicorp.com/t/newbie-question-automatically-forward-query-to-all-datacenters/9116 "2020-05-22T17:40:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gopakumarce](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/gopakumarce/32/7208_2.png) [@gopakumarce](https://discuss.hashicorp.com/u/gopakumarce)\
**Post date:** [May 22, 2020, 5:40pm UTC](https://discuss.hashicorp.com/t/newbie-question-automatically-forward-query-to-all-datacenters/9116/1 "2020-05-22T17:40:58Z")

</div>

I am like three days old/new to consul. Say I have two data centers separated across WAN - sjc and nyc. And I want to be able to do a dns SRV query in sjc for a service thats registered in nyc. But i dont know exactly that the service is in nyc, so I dont want myself to to do a query to each data center one by one - can consul do a local dc lookup and if that fails just query all other DCs ?

As a “hack” I tried configuring both the sites as a single DC and configured wan join on the servers, it joined all fine, and I expected that within a data center all the servers will sync the services even if its over wan gossip, but that doesnt seem to happen.

Rgds,  
Gopa.

---

<div class="post-metadata">

**Author:** ![Wolfsrudel](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/wolfsrudel/32/28465_2.png) [@Wolfsrudel](https://discuss.hashicorp.com/u/Wolfsrudel)\
**Post date:** [May 22, 2020, 6:42pm UTC](https://discuss.hashicorp.com/t/newbie-question-automatically-forward-query-to-all-datacenters/9116/2 "2020-05-22T18:42:02Z")

</div>

Sounds like a Jobs for failover with prepared queries:

> **[Geo Failover with Prepared Queries | Consul - HashiCorp Learn](https://learn.hashicorp.com/consul/developer-discovery/geo-failover)**
>
> This guide describes how to use Consul's prepared query capability, which automates geo failover policies for services in the case that one of multiple connected datacenters is unavailable.

---

<div class="post-metadata">

**Author:** ![gopakumarce](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/gopakumarce/32/7208_2.png) [@gopakumarce](https://discuss.hashicorp.com/u/gopakumarce)\
**Post date:** [May 22, 2020, 6:51pm UTC](https://discuss.hashicorp.com/t/newbie-question-automatically-forward-query-to-all-datacenters/9116/3 "2020-05-22T18:51:39Z")

</div>

Thanks. Yes I saw the prepared query section where I can specify an order of DCs to forward the query to. So we cant achieve the same with the standard DNS / SRV lookup ?

Rgds,  
Gopa.

---

<div class="post-metadata">

**Author:** ![blake](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/blake/32/27620_2.png) [@blake](https://discuss.hashicorp.com/u/blake)\
**Post date:** [May 22, 2020, 9:31pm UTC](https://discuss.hashicorp.com/t/newbie-question-automatically-forward-query-to-all-datacenters/9116/4 "2020-05-22T21:31:07Z")

</div>

Hi @gopakumarce ,

Prepared Queries support both A and SRV record DNS lookups. See [https://www.consul.io/docs/agent/dns#prepared-query-lookups](https://www.consul.io/docs/agent/dns#prepared-query-lookups) for more info.

---

<div class="post-metadata">

**Author:** ![ks5564](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/ks5564/32/7621_2.png) [@ks5564](https://discuss.hashicorp.com/u/ks5564)\
**Post date:** [June 4, 2020, 8:25pm UTC](https://discuss.hashicorp.com/t/newbie-question-automatically-forward-query-to-all-datacenters/9116/5 "2020-06-04T20:25:28Z")

</div>

Hi All,

This is a newbie question sorry for that.

I have a two different understanding of consul

1. Is consul a network tool
2. used as a persistent storage for Vault HA support.

Can someone please point me with a doc that has deep explaining or help me understand it.

---

<div class="post-metadata">

**Author:** ![blake](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/blake/32/27620_2.png) [@blake](https://discuss.hashicorp.com/u/blake)\
**Post date:** [June 4, 2020, 9:32pm UTC](https://discuss.hashicorp.com/t/newbie-question-automatically-forward-query-to-all-datacenters/9116/6 "2020-06-04T21:32:20Z")

</div>

Hi @ks5564,

This video should be helpful in understanding Consul as a service networking platform.

[![](https://global.discourse-cdn.com/hashicorp/original/2X/d/da511e4804c05d2a43133d8bcf6073ceab8ad9d0.jpeg "Introduction to HashiCorp Consul with Armon Dadgar") ](https://www.youtube.com/watch?v=mxeMdl0KvBI)

Consul can be used as a data store for Vault, but that barely scratches the surface of the functionality Consul offers.
