Files
grafana/docs/sources/shared/back-up/back-up-grafana.md
Isabel Matwawana e26cd8614d Docs: fix config file info in upgrade guide (#83273)
* Updated incorrect custom config file names and locations

* Corrected default config file name

* Updated more config file info

* Apply suggestions from code review

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>

* Reverted change

* Fixed default config file info, added second custom file option, and added note about file locations

* Added file path for second custom option

* Apply suggestion from review

Co-authored-by: Usman Ahmad <usman.ahmad@grafana.com>

* Apply suggestion from review

Co-authored-by: Usman Ahmad <usman.ahmad@grafana.com>

* Apply suggestions from review

Co-authored-by: Usman Ahmad <usman.ahmad@grafana.com>

* Apply suggestion from review

* Add version interpolation syntax

* Updated wording

* Ran prettier

---------

Co-authored-by: Pepe Cano <825430+ppcano@users.noreply.github.com>
Co-authored-by: Usman Ahmad <usman.ahmad@grafana.com>
2024-02-29 09:39:25 -05:00

2.8 KiB

headless labels title
true
products
enterprise
oss
Back up Grafana

Back up Grafana

This topic explains how to back up a local Grafana deployment, including configuration, plugin data, and the Grafana database.

Back up the Grafana configuration file

Copy Grafana configuration files that you might have modified in your Grafana deployment to a backup directory.

The Grafana configuration files are located in the following directories:

  • Default configuration: $WORKING_DIR/defaults.ini (Don't change this file)
  • Custom configuration: $WORKING_DIR/custom.ini

For more information on where to find configuration files, refer to Configuration file location.

{{% admonition type="note" %}} If you installed Grafana using the deb or rpm packages, then your configuration file is located at /etc/grafana/grafana.ini. This path is specified in the Grafana init.d script using --config file parameter. {{% /admonition %}}

Back up plugin data

Installing plugins in Grafana creates a folder for each plugin with its associated files and data. Copy all files and folders recursively from this location to your backup repository.

The Grafana plugin files are located in the following directories:

  • Default location for plugins in a binary or source installation: $WORKING_DIR/data/plugins
  • Default location for plugins in a deb or rpm package: /var/lib/grafana/plugins. This path is specified in the Grafana init.d script using --config file parameter.

Back up the Grafana database

We recommend that you back up your Grafana database so that you can roll back to a previous version, if required.

SQLite

The default Grafana database is SQLite, which stores its data in a single file on disk. To back up this file, copy it to your backup repository.

{{% admonition type="note" %}} To ensure data integrity, shut down your Grafana service before backing up the SQLite database. {{% /admonition %}}

The SQLite database file is located in one of the following directories:

  • Default location for SQLite data in a binary or source installation: $WORKING_DIR/data/grafana.db
  • Default location for SQLite data in a deb or rpm package: /var/lib/grafana/grafana.db. This path is specified in the Grafana init.d script using --config file parameter.

MySQL

To back up or restore a MySQL Grafana database, run the following commands:

backup:
> mysqldump -u root -p[root_password] [grafana] > grafana_backup.sql

restore:
> mysql -u root -p grafana < grafana_backup.sql

Postgres

To back up or restore a Postgres Grafana database, run the following commands:

backup:
> pg_dump grafana > grafana_backup

restore:
> psql grafana < grafana_backup