Mimir on AWS ECS Fargate. #3807
Replies: 11 comments 14 replies
-
👋 Hi and welcome to Mimir!
They're not mandatory. We actually recommend to run Mimir mainly with the default configuration except for the object storage and configuring memberlist to let Mimir replicas to communicate eachother and share the ring (which is the data structure Mimir uses extensively for sharding and replication).
We don't have a document or template for Fargate or Docker swarm, but there's a simple example setup here: |
Beta Was this translation helpful? Give feedback.
-
I'm not familiar with ECS Fargate so I'm not sure what services discovery is in this context. Keep in mind that Mimir needs to build a cluster too. If you use memberlist (recommended), then you need some "seed nodes" configured as follows:
Basically, a seed node is a Mimir replica (one of your 3 replicas) with a well know address. If address is dynamic, you can configure your infrastructure to have 1 DNS record which replies with the addresses of (some of) your Mimir replicas. Mimir will periodically resolve such DNS record and contact the new addresses when discovered through it.
You need persistence at two levels:
|
Beta Was this translation helpful? Give feedback.
-
Thanks @pracucci for the swift response. I got my doubts cleared for now. Happy Christmas 🎄 and New Year ✨️ Regarding the WAL which persists data to Disk storage. Correct me if I'm wrong. |
Beta Was this translation helpful? Give feedback.
-
@inugravi I'm finding myself in the same situation with fargate and mimir.yml with the monolithic mode. Would you mind posting what you came up with? Hoping it would save me a couple of wheels, especially if you made any tweaks for ECS/Fargate! |
Beta Was this translation helpful? Give feedback.
-
Hi @KaladinAlThor , Apologies for the late response, I'm on vacation and will be back tomorrow. So, once I get something will definitely help you out with everything. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Definitely @pracucci |
Beta Was this translation helpful? Give feedback.
-
Starting Mimir on ECS is not the rocket science. You just need to use the service discovery. Some copy paste from my terraform (cdktf typescript) config: readonly portHTTP = 8080
readonly portGRPC = 9095
readonly portMemberlist = 7946
const ecsDiscovery = new ServiceDiscoveryPrivateDnsNamespace(this, "private_dns_service_discrovery", <ServiceDiscoveryPrivateDnsNamespaceConfig>{
provider: providers.awsPrimary,
name: "ecs.local",
vpc: network.vpcModule.vpcIdOutput
})
this.discoveryService = new ServiceDiscoveryService(this, "discovery_service", <ServiceDiscoveryServiceConfig>{
provider: config.provider,
name: "grafana-mimir",
dnsConfig: <ServiceDiscoveryServiceDnsConfig>{
namespaceId: ecsDiscovery.id,
dnsRecords: [
<ServiceDiscoveryServiceDnsConfigDnsRecords>{
ttl: 10,
type: "A"
}
],
routingPolicy: "MULTIVALUE"
},
healthCheckCustomConfig: <ServiceDiscoveryServiceHealthCheckCustomConfig>{
failureThreshold: 1
}
})
const task = new EcsTaskDefinition(this, "task", <EcsTaskDefinitionConfig>{
provider: config.provider,
lifecycle: <TerraformResourceLifecycle>{
createBeforeDestroy: true
},
executionRoleArn: taskExecutionRole.arn,
taskRoleArn: taskRole.arn,
family: "grafana-mimir",
networkMode: "awsvpc",
requiresCompatibilities: ["FARGATE"],
cpu: "512",
memory: "1024",
runtimePlatform: <EcsTaskDefinitionRuntimePlatform>{
operatingSystemFamily: "LINUX",
cpuArchitecture: this.cpuArchitecture
},
volume: [],
containerDefinitions: Fn.jsonencode([
{
cpu: 0,
name: "main",
image: "grafana/mimir:2.5.0",
command: [
"-server.http-listen-port", `${this.portHTTP}`,
"-server.grpc-listen-port", `${this.portGRPC}`,
// !!!!! THE MOST IMPORTAND PART - dns+ resolving !!!!!!!
"-memberlist.join", `dns+${this.discoveryService.name}.${ecsDiscovery.name}:${this.portMemberlist}`,
"-common.storage.backend", "s3",
"-common.storage.s3.endpoint", `s3.${config.provider.region}.amazonaws.com`,
"-common.storage.s3.region", config.provider.region,
"-blocks-storage.s3.bucket-name", blocksStorage.bucket,
"-alertmanager-storage.s3.bucket-name", alertmanagerStorage.bucket,
"-ruler-storage.s3.bucket-name", rulerStorage.bucket,
"-auth.multitenancy-enabled", `${config.multitenancyEnabled}`,
"-distributor.ingestion-rate-limit", "1000000",
"-distributor.ingestion-burst-size", "10000000"
],
healthCheck: {
command: ["CMD", "/bin/true"],
interval: 10,
retries: 1,
timeout: 5
},
portMappings: [
{
containerPort: this.portHTTP,
hostPort: this.portHTTP,
protocol: "tcp"
},
{
containerPort: this.portGRPC,
hostPort: this.portGRPC,
protocol: "tcp"
},
],
essential: true,
environment: [],
mountPoints: [],
volumesFrom: [],
startTimeout: 15,
logConfiguration: {
logDriver: "awslogs",
options: {
"awslogs-group": logGroup.name,
"awslogs-region": config.provider.region,
"awslogs-stream-prefix": "ecs",
"awslogs-datetime-format": "%Y-%m-%d %H:%M:%S,%f"
}
}
}])
})
new EcsService(this, "service", <EcsServiceConfig>{
provider: config.provider,
name: "grafana-mimir",
cluster: cluster.name,
deploymentController: <EcsServiceDeploymentController>{
type: "ECS"
},
deploymentMinimumHealthyPercent: 50,
deploymentMaximumPercent: 100,
desiredCount: config.instanceCount || 1,
enableEcsManagedTags: true,
healthCheckGracePeriodSeconds: 0,
networkConfiguration: <EcsServiceNetworkConfiguration>{
assignPublicIp: false,
subnets: config.subnetIds,
securityGroups: [this.securityGroup.id]
},
capacityProviderStrategy: [
<EcsServiceCapacityProviderStrategy>{
capacityProvider: this.capacityProvider,
weight: 100
}
],
platformVersion: "LATEST",
schedulingStrategy: "REPLICA",
taskDefinition: `${task.family}:${task.revision}`,
serviceRegistries: <EcsServiceServiceRegistries>{ // <= DONT FORGET THIS TOO
registryArn: this.discoveryService.arn
}
}) |
Beta Was this translation helpful? Give feedback.
-
@inugravi managing config files (like mimir.yml) with terraform on ECS is a real asspain. Thats why i am using command cli parameters. |
Beta Was this translation helpful? Give feedback.
-
@KaladinAlThor @a0s @mirnujAtom Hi Guys, I am also facing issues making Loki Simple scalable work on ECS fargate which follows similar architecture and memberlist. |
Beta Was this translation helpful? Give feedback.
-
@radevkal We threw out Mimir, now we use JuiceFS to store Prometheus metrics. We are going to try OpenObserve as a remote-write storage for Prometheus, because we already use O2 for traces and logs. |
Beta Was this translation helpful? Give feedback.
-
@inugravi I want to configure machines in AWS ECS forgate, but I can't quite figure out if I can use one EFS storage that will be mounted to all instances? Or maybe I should use a separate EFS for each instance? If it is a separate EFS, can I be sure that if the instances are terminated correctly during scaling, all the data from the EFS will go to s3? |
Beta Was this translation helpful? Give feedback.
-
Grafana Mimir on AWS ECS Fargate.
Hello Team,
Since we are thinking to leverage Grafana Mimir to our PROD infrastructure, We chose Monolith deployment with 3 mimir fargate containers as below. (We are still not into Kubernetes, as of today for Microservice type deployment)
Thanks to the documentation which has everything, but we are a bit confused while authoring the mimir.yml .
We are not sure about the mandatory/non-mandatory sections of the config file.
As we know common block for AWS s3 storage in mimir.yml for monolith deployment is mandatory, but sections like compactor, distributor, ingester etc, are they mandatory to declare in mimir.yml ?
So, my final question can be put it the below way.
Is there any document/template of mimir.yml available? (specifically, to host it in ECS FARGATE or docker swarm)
Describe the solution that you’d like or the expected outcome
The expected implementation is that.
Here our only requirement is that we just need the precise mimir.yml (or at least it's structure) to get it embedded within all the 3 mimir ecs fargate containers.
Sorry if it is too long but here is our requirement. Please help.
#GrafanaMimir_HelpingHands
Beta Was this translation helpful? Give feedback.
All reactions