hashicorp / consul

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
https://www.consul.io
Other
28.25k stars 4.41k forks source link

Support DNS lookups to "meta" DCs #208

Closed armon closed 8 years ago

armon commented 10 years ago

We can support special meta-dc's that have special meanings. Examples:

progrium commented 10 years ago
wuub commented 10 years ago

@armon this is very interesting. are there any active work/design going on, or is it only an idea?

armon commented 10 years ago

@wuub No active work on this yet, but its in the design phase you could say. Definitely something I'm keen to support!

armon commented 10 years ago

@andrewwatson mentioned the possibility of named groups of data centers. e.g. "EU" -> ["UK", "GE", "FR"]

andrewwatson commented 10 years ago

In addition to establishing maps like "EU" -> ["UK", "DE"] it would be very useful to be able to specify for each dc a backup or a list of backups

I'm thinking this could be in the K/V, even.

/_meta/dc/backups => 'dc1, dc2, dc3'

That way you could change it without restarting anything.

jefferai commented 10 years ago

Yes, yes, a thousand times yes.

We want to have the ability, when desired, to have services resolve locally when possible but remotely if necessary. We don't necessarily want every query to behave this way so it'd be nice to be able to specify behavior per-query.

I'm assuming the "global" behavior mentioned in the first comment would be what I described above.

keyneston commented 9 years ago

If and when you do implement this can you make sure these meta-datacenters also work in the http api.

It would be useful in our puppet code for example to be able to say dc=global.

mfischer-zd commented 9 years ago

+1 for this request. We would like a datacenter-neutral, globally replicated K/V store, where the HTTP clients (not necessarily through their own Consul agent) preferentially look up from the local datacenter but can fall back over the WAN if necessary.

armon commented 9 years ago

@mfischer-zd As a note, this ticket will only affect DNS and not the KV store

mfischer-zd commented 9 years ago

@armon understood - this would affect how the Consul HTTP server (which would be accessible remotely) would be resolved.

andrewwatson commented 9 years ago

No, I don't think so. It would affect the answers you got back from the consul server you send DNS queries to.

On Mon, Oct 27, 2014, 1:19 PM Michael S. Fischer notifications@github.com wrote:

@armon https://github.com/armon understood - this would affect how the Consul HTTP server (which would be accessible remotely) would be resolved.

— Reply to this email directly or view it on GitHub https://github.com/hashicorp/consul/issues/208#issuecomment-60631558.

mfischer-zd commented 9 years ago

@andrewwatson in my scenario I have two separate Consul clusters, one configured in the usual way (cluster A), and another that provides a replicated K/V store (cluster B, running on a dedicated set of hosts which does not include the clients). Cluster A would be used by clients to perform DNS queries to resolve members of Cluster B.

So really we're saying the same thing.

hco commented 9 years ago

+1 For this feature! :-)

A nice to have would be to allow your own priorities for a response of the DC "any".

adrienbrault commented 9 years ago

:+1:

hopperd commented 9 years ago

+1 This functionality would be very useful, we have multiple data centers and a client might not actually know which datacenter that service resides in and thus would want to have local return if available, but then the others if not.

mfischer-zd commented 9 years ago

An easy workaround would be to use a regular DNS server to serve a CNAME record outside the .service.consul domain. For example, a query for "frobinator.service.local" against the local DNS resolver could result in a CNAME answer for "frobinator.dc1.service.consul".

What do you think of this? Doing so would keep Consul out of the complex business of managing foreign service endpoints.

jefferai commented 9 years ago

@mfischer-zd then you have to implement and configure some other piece of software to do this, when Consul already knows where things live.

DanyC97 commented 9 years ago

Has been done any progress on this ?

thanks!

StephenTallamy commented 9 years ago

Any updates on this? Is a solution likely to hit a release version soon? I have this same requirement - I want my DNS names to resolve to nodes in my local data center unless Consul detects an outage for all nodes in my local data center and then it will resolve to nodes in a remote data center. At this point I don't need rules around which data center it fails over to, although later this could be beneficial.

armon commented 9 years ago

We are getting closer, but still looking like a Consul 0.6 or 0.7 feature.

StephenTallamy commented 9 years ago

Thanks @armon - what's the release timescale on those?

armon commented 9 years ago

@StephenTallamy No hard deadlines. Consul 0.6 likely next month, and 0.7 in Q4.

hopperd commented 9 years ago

Will this functionality help with DNS forwarding? Currently it seems as though it isn't possible to use DNS forwarding with multiple data centers as you'll only get back the services from the DC that is queried. We have currently 2 data centers (these are real data centers in different parts of the country) and multiple environments in each data center (dev, qa, perf, prod, etc).

So it seems that setting up DNS forward to work in this situation is essentially not possible without this feature.

armon commented 9 years ago

@split3 Correct! You will be able to query multiple DCs at the same time.

slackpad commented 8 years ago

The "local" use case is covered here https://github.com/hashicorp/consul/issues/1229 and in its linked issues. The multi-DC aspect of this is now supported with prepared queries, released in 0.6.0:

https://www.consul.io/docs/agent/http/query.html