Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: default ring listen address to 127.0.0.1 when no default network interface is found #4483

Closed
trevorwhitney opened this issue Oct 15, 2021 · 3 comments · Fixed by #4570
Assignees
Labels

Comments

@trevorwhitney
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Since the change in default limits to use the global strategy for distributor limits, we now require the distributor ring to be active. As a result, the code to find the listen address via the default set of interfaces is going to run. When this code fails to find an interface because different OSes have different names for the default interfaces, it causes loki to fail to boot.

Describe the solution you'd like
In this case, where none of the default interfaces are found, we should default the listen_address to 127.0.0.1. This problem only came up for the distributor ring, but I think this is reasonable to do for all the rings. It's probably worth a discussion with the cortex team to see if this change is reasonable to upstream, or at least upstream for the ruler ring?

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Error encountered when default interface is not found:

ts=2021-10-15T07:09:34.268243247Z caller=log.go:168 level=info msg="Starting Loki" version="(version=, branch=, revision=)"
ts=2021-10-15T07:09:34.268514046Z caller=gokit.go:47 level=info http=[::]:3100 grpc=[::]:9095 msg="server listening on addresses"
level=warn ts=2021-10-15T07:09:34.271030144Z caller=worker_service.go:88 msg="Worker address is empty, attempting automatic worker configuration.  If queries are unresponsive consider configuring the worker explicitly." address=127.0.0.1:9095
level=warn ts=2021-10-15T07:09:34.271640859Z caller=net.go:19 msg="error getting interface" inf=eth0 err="route ip+net: no such network interface"
level=warn ts=2021-10-15T07:09:34.271843265Z caller=net.go:19 msg="error getting interface" inf=en0 err="route ip+net: no such network interface"
level=error ts=2021-10-15T07:09:34.271892519Z caller=log.go:106 msg="error running loki" err="No address found for [eth0 en0]\nerror initialising module: distributor\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/home/danny/Code/open-source/loki/vendor/github.com/grafana/dskit/modules/modules.go:108\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/home/danny/Code/open-source/loki/vendor/github.com/grafana/dskit/modules/modules.go:78\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/home/danny/Code/open-source/loki/pkg/loki/loki.go:277\nmain.main\n\t/home/danny/Code/open-source/loki/cmd/loki/main.go:101\nruntime.main\n\t/home/danny/go/go1.16.5/src/runtime/proc.go:225\nruntime.goexit\n\t/home/danny/go/go1.16.5/src/runtime/asm_amd64.s:1371"

setting needed for resolution:

distributor:
  ring:
    instance_addr: 127.0.0.1
@dannykopping
Copy link
Contributor

Please also do the same for the ingester 🙏

@DylanGuedes DylanGuedes self-assigned this Oct 25, 2021
@slim-bean
Copy link
Collaborator

This is largely solved by #4546 in that PR applies whatever is defined to the ingester to all the other rings which would address the issue as defined.

A further discussion about how to better handle the large number of operating systems which don't have either eth0 or en0 could still be discussed here though I think

@DylanGuedes
Copy link
Contributor

I'm going for the following route:

  • If the ingester interface names aren't different from the default names, try to add a loopback interface to it (such as lo)
  • If the ingester interface names are set different by the user, doesn't append the loopback interface
    Since right now the ingester ring default configs are replicated to other rings, applying this behavior to only the ingester has the good side-effect of having loopback when appropriate for all rings at the same time.

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants