Configuring a "fall back" consul namer?

hey all,

Is it possible to configure two namers for the same service with one having “useHealthcheck: true” and the other as “false” (the fallback).

The problem I am trying to solve here is if there are no healthy nodes available, I want the requests to be forward to the ones in “warning” state. The service will be in a warning state when it is partially functional.

Thanks in advance.

Best Wishes,
Amit.

Yes, you can have two namers with different properties as long as you give each of them a unique prefix. You can then specify one of them as a fallback in your dtab.

1 Like

Thanks. Just to verify and for someone else looking, this is what I did:

namers:
- kind: io.l5d.consul
  host: consul.domain
  useHealthCheck: true
  prefix: /default

- kind: io.l5d.consul
  host: consul.domain
  prefix: /fallback

routers:
- protocol: thrift
  label: myservice
  thriftProtocol: binary
  thriftMethodInDst: true
  dtab: |
    /svc => /#/fallback/.local/my_service;
    /svc => /#/default/.local/my_service;
  client:
..

I have a follow up question: is it possible (doesn’t look like) to query consul for specific health status-es? Say I only want the nodes in “warning” mode and not “critical” to be part of my fallback pool. If not, would be willing to accept a PR for it?

Thanks,
Amit.

The consul namer passes the passing=true parameter to the consul health API. We’re definitely open to making this richer and more configurable where it makes sense. I recommend opening a github issue describing the details of what you’d like to implement (proposed config format, etc) and we can discuss there.

Thanks Alex. My colleague has filed an issue to discuss this further.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.