Setup Grafana for High Availability in 5 min with docker-compose.

Lehlogonolo Masubelele
2 min readMar 26, 2021

Pre-requisites:

Breakdown:

  • The Nginx Alpine image will serve as our Load Balancer.
  • PostgreSQL 12 will store our data.

Quick Setup:

docker-compose up -d

Check container status:

docker-compose ps

If status is not Up for all containers run docker-compose up -d and docker-compose ps until you see something like this:

Go to localhost:8080 on you browser.

Initial sign in details:

password=admin username=admin123

Test

Open Grafana in multiple browsers and check the logs:

docker-compose logs -f grafana1 grafana2

A look at our nginx configuration file nginx.conf:

upstream grafana-HA { 
server grafana1:3000;
server grafana2:3000;
}

Conclusion

As you can see above all requests are proxied to the server group grafana-HA, and nginx applies HTTP load balancing to distribute the requests using the default method round robin.

Podman

https://github.com/codesenju/grafana_ha_podman

References:

--

--