Objections to using same grafana.db file with multiple docker containers

My goal is to have multiple Grafana instances (running in docker containers), that are using the same grafana.db file (i.e. have the same users, dashboards, ā€¦).

I did a test with 2 docker containers. For both, I mounted the same volume to /var/lib/grafana, where the grafana.db file is located.

So far it seems like it is working fine. When doing a change in one instance, it shows up in the other as well. However, I want to avoid running into trouble at a later stage. So my question is:

Is there any reason one should not use the same grafana.db file with multiple Grafana instances in different docker containers at the same time?

Check this out

https://www.sqlite.org/useovernet.html

I personally would have an issue with such an approach.

1 Like

Thank you for your response @yosiasz .

Since Iā€™m not an expert in this field, may I ask for clarification what this means for my setup in particular. I understand that:

  • This setup could slow down the Grafana instances.
  • It is possible that there is data lost, for example in case one dashboard is edited from two different Grafana instances.
  • The database could be corrupted, i.e. nothing works anymore? (Need to replace file with a backup file?)

Do I understand that correctly?

Would writing from only one Grafana instance and simply reading from all the others make a difference?

Thanks a lot in advance!

1 Like

Yep that is what sqlite docu says. So if they dont rexommend it, I would stay away from it.

Sqlite, also as the name implies, is not designed for multi server use. For that I wpuld rexommend as Sqllite docu itself rexommends to use a real database such as mysql postgres etc

The best if you move grafana db from sqlite3 to postgres or mysql. I think it will solve the case.

1 Like