> For the complete documentation index, see [llms.txt](https://utm-1.gitbook.io/utm-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utm-1.gitbook.io/utm-docs/dokumentaciya/utm-it/resheniya/kubernetes/dlya-prorabotki/migraciya-bd-grafana-iz-sqllite-v-postgresql.md).

# Миграция БД Grafana из SQLLite в PostgreSQL

## Ссылки

Grafana, SQLite и база данных заблокированы: [opsverse.io](https://opsverse.io/2022/12/15/grafana-sqlite-and-database-is-locked/)

Миграция базы данных Grafana: от внутреннего хранилища к PostgreSQL: [habr.com](https://habr.com/ru/articles/897400/)

Миграция Grafana из SQLite в PostgreSQL: [etogeek.dev](https://etogeek.dev/posts/grafana-migration-to-postgresql/)

## Проблема

В случае если включить в файле values.yaml в приложении prometheus в Argo CD то приложение подвисает и не создается. Возникает проблема с поднянием StatefulSet с именем `prometheus-stack-grafana-0` для Grafana.

Под не запускается из-за ошибки что проблема миграции - база заблокирована.

```
Error: ✗ migration failed (id = create migration_log table): database is locked
```

Вот тут если указать `enabled: true`

```
  persistence:      #!!!TEST Этого раздела не было
    enabled: false
    type: sts
    storageClassName: smb-csi-utm-server4
    accessModes:
      - ReadWriteOnce
    size: 5Gi
    finalizers:
      - kubernetes.io/pvc-protection
```

Если указать enabled: false, то создается не StatefulSet, а Deployment и там проблемы нет.\
Но данные в Grafana после перезапуска Deployment не сохраняются!

Добавленные папки, дашборды и прочее - теряются!

{% hint style="info" %}
Необходимо рассмотреть вопрос миграции БД Grafana из SQLLite в PostgreSQL
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://utm-1.gitbook.io/utm-docs/dokumentaciya/utm-it/resheniya/kubernetes/dlya-prorabotki/migraciya-bd-grafana-iz-sqllite-v-postgresql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
