|
|
|
|
@ -4,50 +4,47 @@ weight: 1000 |
|
|
|
|
--- |
|
|
|
|
# Loki's Architecture |
|
|
|
|
|
|
|
|
|
This document will expand on the information detailed in the [Loki |
|
|
|
|
Overview](../overview/). |
|
|
|
|
## Multi-tenancy |
|
|
|
|
|
|
|
|
|
## Multi Tenancy |
|
|
|
|
|
|
|
|
|
All data - both in memory and in long-term storage - is partitioned by a |
|
|
|
|
All data, both in memory and in long-term storage, may be partitioned by a |
|
|
|
|
tenant ID, pulled from the `X-Scope-OrgID` HTTP header in the request when Loki |
|
|
|
|
is running in multi-tenant mode. When Loki is **not** in multi-tenant mode, the |
|
|
|
|
header is ignored and the tenant ID is set to "fake", which will appear in the |
|
|
|
|
index and in stored chunks. |
|
|
|
|
|
|
|
|
|
## Modes of Operation |
|
|
|
|
## Modes of operation |
|
|
|
|
|
|
|
|
|
 |
|
|
|
|
|
|
|
|
|
Loki has a set of components (defined below in [Components](#components)) which |
|
|
|
|
Loki has a set of [components](#components), which |
|
|
|
|
are internally referred to as modules. Each component spawns a gRPC server for |
|
|
|
|
internal traffic and an HTTP/1 server for external API requests. All components |
|
|
|
|
come with an HTTP/1 server, but most only expose readiness, health, and metrics |
|
|
|
|
endpoints. |
|
|
|
|
|
|
|
|
|
Which component Loki runs is determined by either the `-target` flag at the |
|
|
|
|
command line or the `target: <string>` section in Loki's config file. When the |
|
|
|
|
value of `target` is `all`, Loki will run all of its components in a single |
|
|
|
|
process. This is referred to as "single process", "single binary", or monolithic |
|
|
|
|
mode. Monolithic mode is the default deployment of Loki when Loki is installed |
|
|
|
|
using Helm. |
|
|
|
|
Loki can run as a single binary; all components are part of the same process. |
|
|
|
|
Or, Loki can run components as microservices. |
|
|
|
|
As microservices, the cluster is horizontally scalable. |
|
|
|
|
|
|
|
|
|
When `target` is _not_ set to `all` (i.e., it is set to `querier`, `ingester`, |
|
|
|
|
`query-frontend`, or `distributor`), then Loki is said to be running in "horizontally scalable", |
|
|
|
|
or microservices, mode. |
|
|
|
|
When invoked, the `-target` flag on the |
|
|
|
|
command line or the `target: <string>` configuration determines |
|
|
|
|
the components' mode: single binary or microservices. |
|
|
|
|
A `target` value of `all` runs Loki in single binary mode. |
|
|
|
|
A `target` value of one of the components invokes that component |
|
|
|
|
as its own microservice. |
|
|
|
|
|
|
|
|
|
Each component of Loki, such as the ingesters and distributors, communicate with |
|
|
|
|
one another over gRPC using the gRPC listen port defined in the Loki config. |
|
|
|
|
When running components in monolithic mode, this is still true: each component, |
|
|
|
|
one another over gRPC using the gRPC listen port defined in the Loki configuration. |
|
|
|
|
When running components as a single binary, this is still true: each component, |
|
|
|
|
although running in the same process, will connect to each other over the local |
|
|
|
|
network for inter-component communication. |
|
|
|
|
|
|
|
|
|
Single process mode is ideally suited for local development, small workloads, |
|
|
|
|
and for evaluation purposes. Monolithic mode can be scaled with multiple |
|
|
|
|
The single process mode is ideally suited for local development, small workloads, |
|
|
|
|
and for evaluation purposes. The single binary mode can be scaled to multiple |
|
|
|
|
processes with the following limitations: |
|
|
|
|
|
|
|
|
|
1. Local index and local storage cannot currently be used when running |
|
|
|
|
monolithic mode with more than one replica, as each replica must be able to |
|
|
|
|
1. Local index and local storage cannot currently be used |
|
|
|
|
with more than one replica, as each replica must be able to |
|
|
|
|
access the same storage backend, and local storage is not safe for concurrent |
|
|
|
|
access. |
|
|
|
|
1. Individual components cannot be scaled independently, so it is not possible |
|
|
|
|
|