diff --git a/CHANGELOG.md b/CHANGELOG.md index 92bbd7ea02..8b9f6a13f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ * [7708](https://github.com/grafana/loki/pull/7708) **DylanGuedes**: Fix multitenant querying. +* [7784](https://github.com/grafana/loki/pull/7784) **isodude**: Fix default values of connect addresses for compactor and querier workers to work with IPv6. + ##### Changes #### Promtail diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index 1ae8acf9e3..5a9eb2bec4 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -339,6 +339,7 @@ func (t *Loki) initQuerier() (services.Service, error) { querierWorkerServiceConfig := querier.WorkerServiceConfig{ AllEnabled: t.Cfg.isModuleEnabled(All), ReadEnabled: t.Cfg.isModuleEnabled(Read), + GrpcListenAddress: t.Cfg.Server.GRPCListenAddress, GrpcListenPort: t.Cfg.Server.GRPCListenPort, QuerierMaxConcurrent: t.Cfg.Querier.MaxConcurrent, QuerierWorkerConfig: &t.Cfg.Worker, @@ -703,7 +704,11 @@ func (t *Loki) supportIndexDeleteRequest() bool { func (t *Loki) compactorAddress() (string, error) { if t.Cfg.isModuleEnabled(All) || t.Cfg.isModuleEnabled(Read) { // In single binary or read modes, this module depends on Server - return fmt.Sprintf("http://127.0.0.1:%d", t.Cfg.Server.HTTPListenPort), nil + proto := "http" + if len(t.Cfg.Server.HTTPTLSConfig.TLSCertPath) > 0 && len(t.Cfg.Server.HTTPTLSConfig.TLSKeyPath) > 0 { + proto = "https" + } + return fmt.Sprintf("%s://%s:%d", proto, t.Cfg.Server.HTTPListenAddress, t.Cfg.Server.HTTPListenPort), nil } if t.Cfg.Common.CompactorAddress == "" { diff --git a/pkg/querier/worker_service.go b/pkg/querier/worker_service.go index 406502b13d..b9d06bf835 100644 --- a/pkg/querier/worker_service.go +++ b/pkg/querier/worker_service.go @@ -23,6 +23,7 @@ import ( type WorkerServiceConfig struct { AllEnabled bool ReadEnabled bool + GrpcListenAddress string GrpcListenPort int QuerierMaxConcurrent int QuerierWorkerConfig *querier_worker.Config @@ -112,7 +113,11 @@ func InitWorkerService( // Since we must be running a querier with either a frontend and/or scheduler at this point, if no scheduler ring, frontend, or scheduler address // is configured, Loki will default to using the frontend on localhost on it's own GRPC listening port. if cfg.SchedulerRing == nil && (*cfg.QuerierWorkerConfig).FrontendAddress == "" && (*cfg.QuerierWorkerConfig).SchedulerAddress == "" { - address := fmt.Sprintf("127.0.0.1:%d", cfg.GrpcListenPort) + listenAddress := "127.0.0.1" + if cfg.GrpcListenAddress != "" { + listenAddress = cfg.GrpcListenAddress + } + address := fmt.Sprintf("%s:%d", listenAddress, cfg.GrpcListenPort) level.Warn(util_log.Logger).Log( "msg", "Worker address is empty, attempting automatic worker configuration. If queries are unresponsive consider configuring the worker explicitly.", "address", address)