Skip to content

Commit

Permalink
ingester/shutdown -> ingester/flush_shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-d committed Jan 8, 2021
1 parent b72198c commit 97debb7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions docs/sources/api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The HTTP API includes the following endpoints:
- [Examples](#examples-8)
- [`GET /ready`](#get-ready)
- [`POST /flush`](#post-flush)
- [`POST /ingester/shutdown`](#post-shutdown)
- [`POST /ingester/flush_shutdown`](#post-ingesterflush_shutdown)
- [`GET /metrics`](#get-metrics)
- [Series](#series)
- [Examples](#examples-9)
Expand Down Expand Up @@ -108,7 +108,7 @@ While these endpoints are exposed by just the distributor:
And these endpoints are exposed by just the ingester:

- [`POST /flush`](#post-flush)
- [`POST /ingester/shutdown`](#post-ingestershutdown)
- [`POST /ingester/flush_shutdown`](#post-ingesterflush_shutdown)

The API endpoints starting with `/loki/` are [Prometheus API-compatible](https://prometheus.io/docs/prometheus/latest/querying/api/) and the result formats can be used interchangeably.

Expand Down Expand Up @@ -846,13 +846,13 @@ backing store. Mainly used for local testing.

In microservices mode, the `/flush` endpoint is exposed by the ingester.

## `POST /ingester/shutdown`
## `POST /ingester/flush_shutdown`

`/ingester/shutdown` triggers a shutdown of the ingester and notably will _always_ flush any in memory chunks it holds.
`/ingester/flush_shutdown` triggers a shutdown of the ingester and notably will _always_ flush any in memory chunks it holds.
This is helpful for scaling down WAL-enabled ingesters where we want to ensure old WAL directories are not orphaned,
but instead flushed to our chunk backend.

In microservices mode, the `/ingester/shutdown` endpoint is exposed by the ingester.
In microservices mode, the `/ingester/flush_shutdown` endpoint is exposed by the ingester.

## `GET /metrics`

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/operations/storage/wal.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ When scaling down, we must ensure existing data on the leaving ingesters are flu

Consider you have 4 ingesters `ingester-0 ingester-1 ingester-2 ingester-3` and you want to scale down to 2 ingesters, the ingesters which will be shutdown according to statefulset rules are `ingester-3` and then `ingester-2`.

Hence before actually scaling down in Kubernetes, port forward those ingesters and hit the [`/ingester/shutdown`](../../api#post-ingestershutdown) endpoint. This will flush the chunks and shut down the ingesters (while also removing itself from the ring).
Hence before actually scaling down in Kubernetes, port forward those ingesters and hit the [`/ingester/flush_shutdown`](../../api#post-ingesterflush_shutdown) endpoint. This will flush the chunks and shut down the ingesters (while also removing itself from the ring).

After hitting the endpoint for `ingester-2 ingester-3`, scale down the ingesters to 2.

Expand Down
3 changes: 1 addition & 2 deletions pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ func (t *Loki) initIngester() (_ services.Service, err error) {
logproto.RegisterIngesterServer(t.Server.GRPC, t.ingester)
grpc_health_v1.RegisterHealthServer(t.Server.GRPC, t.ingester)
t.Server.HTTP.Path("/flush").Handler(http.HandlerFunc(t.ingester.FlushHandler))
// TODO(owen-d): should this use cortex style path (/ingester/shutdown), legacy style (/shutdown), or apir prefixed (/loki/api/v1/ingester/shutdown)?
t.Server.HTTP.Methods("POST").Path("/ingester/shutdown").Handler(http.HandlerFunc(t.ingester.ShutdownHandler))
t.Server.HTTP.Methods("POST").Path("/ingester/flush_shutdown").Handler(http.HandlerFunc(t.ingester.ShutdownHandler))
return t.ingester, nil
}

Expand Down

0 comments on commit 97debb7

Please sign in to comment.