1+++
2title = "Upgrade Grafana"
3description = "Guide for upgrading Grafana"
4keywords = ["grafana", "configuration", "documentation", "upgrade"]
5weight = 700
6+++
7
8# Upgrade Grafana
9
10We recommend that you upgrade Grafana often to stay up to date with the latest fixes and enhancements.
11In order to make this a reality, Grafana upgrades are backward compatible and the upgrade process is simple and quick.
12
13Upgrading is generally safe (between many minor and one major version) and dashboards and graphs will look the same. There may be minor breaking changes in some edge cases, which are outlined in the [Release Notes](https://community.grafana.com/c/releases) and [Changelog](https://github.com/grafana/grafana/blob/main/CHANGELOG.md)
14
15## Backup
16
17We recommend that you backup a few things in case you have to rollback the upgrade.
18
19- Installed plugins - Back them up before you upgrade them in case you want to rollback the Grafana version and want to get the exact same versions you were running before the upgrade.
20- Configuration files do not need to be backed up. However, you might want to in case you add new configuration options after upgrade and then rollback.
21
22### Database backup
23
24Before upgrading it can be a good idea to backup your Grafana database. This will ensure that you can always rollback to your previous version. During startup, Grafana will automatically migrate the database schema (if there are changes or new tables). Sometimes this can cause issues if you later want to downgrade.
25
26#### sqlite
27
28If you use sqlite you only need to make a backup of your `grafana.db` file. This is usually located at `/var/lib/grafana/grafana.db` on Unix systems.
29If you are unsure what database you use and where it is stored check you grafana configuration file. If you
30installed grafana to custom location using a binary tar/zip it is usually in `<grafana_install_dir>/data`.
31
32#### mysql
33
34```bash
35backup:
36> mysqldump -u root -p[root_password] [grafana] > grafana_backup.sql
37
38restore:
39> mysql -u root -p grafana < grafana_backup.sql
40```
41
42#### postgres
43
44```bash
45backup:
46> pg_dump grafana > grafana_backup
47
48restore:
49> psql grafana < grafana_backup
50```
51
52### Ubuntu or Debian
53
54You can upgrade Grafana by following the same procedure as when you installed it.
55
56#### Upgrade Debian package
57
58If you installed Grafana by downloading a Debian package (`.deb`), then you can execute the same `dpkg -i` command but with the new package. It will upgrade your Grafana installation.
59
60Go to the [download page](https://grafana.com/grafana/download?platform=linux) for the latest download
61links.
62
63```bash
64wget <debian package url>
65sudo apt-get install -y adduser libfontconfig1
66sudo dpkg -i grafana_<version>_amd64.deb
67```
68
69#### Upgrade from APT repository
70
71If you installed Grafana from our APT repository, then Grafana will automatically update when you run apt-get upgrade to upgrade all system packages.
72
73```bash
74sudo apt-get update
75sudo apt-get upgrade
76```
77
78#### Upgrade from binary .tar file
79
80If you downloaded the binary `.tar.gz` package, then you can just download and extract the new package and overwrite all your existing files. However, this might overwrite your config changes.
81
82We recommend that you save your custom configuration changes in a file named `<grafana_install_dir>/conf/custom.ini`.
83This allows you to upgrade Grafana without risking losing your configuration changes.
84
85### Centos / RHEL
86
87If you installed Grafana by downloading an RPM package you can just follow the same installation guide and execute the same `yum install` or `rpm -i` command but with the new package. It will upgrade your Grafana installation.
88
89If you used our YUM repository:
90
91```bash
92sudo yum update grafana
93```
94
95### Docker
96
97This just an example, details depend on how you configured your grafana container.
98
99```bash
100docker pull grafana/grafana
101docker stop my-grafana-container
102docker rm my-grafana-container
103docker run -d --name=my-grafana-container --restart=always -v /var/lib/grafana:/var/lib/grafana grafana/grafana
104```
105
106### Windows
107
108If you downloaded the Windows binary package you can just download a newer package and extract to the same location (and overwrite the existing files). This might overwrite your configuration changes. We recommend that you save your configuration changes in a file named `<grafana_install_dir>/conf/custom.ini` as this will make upgrades easier without risking losing your configuration changes.
109
110## Update plugins
111
112After you have upgraded, we strongly recommend that you update all your plugins as a new version of Grafana
113can make older plugins stop working properly.
114
115You can update all plugins using
116
117```bash
118grafana-cli plugins update-all
119```
120
121## Upgrading to v5.0
122
123The dashboard grid layout engine has changed. All dashboards will be automatically upgraded to new positioning system when you load them in v5. Dashboards saved in v5 will not work in older versions of Grafana. Some external panel plugins might need to be updated to work properly.
124
125For more details on the new panel positioning system, refer to [panel size position]({{< relref "../dashboards/json-model.md#panel-size-position" >}})
126
127## Upgrading to v5.2
128
129One of the database migrations included in this release will update all annotation timestamps from second to millisecond precision. If you have a large amount of annotations the database migration may take a long time to complete which may cause problems if you use systemd to run Grafana.
130
131We've got one report where using systemd, PostgreSQL and a large amount of annotations (table size 1645mb) took 8-20 minutes for the database migration to complete. However, the grafana-server process was killed after 90 seconds by systemd. Any database migration queries in progress when systemd kills the grafana-server process continues to execute in database until finished.
132
133If you're using systemd and have a large amount of annotations consider temporary adjusting the systemd `TimeoutStartSec` setting to something high like `30m` before upgrading.
134
135## Upgrading to v6.0
136
137If you have text panels with script tags they will no longer work due to a new setting that per default disallow unsanitized HTML.
138For more information about the new setting, refer to [disable sanitize html]({{< relref "../administration/configuration/#disable-sanitize-html" >}}).
139
140### Authentication and security
141
142If you are using Grafana's builtin, LDAP (without Auth Proxy) or OAuth authentication all users will be required to login upon the next visit after the upgrade.
143
144If you have `cookie_secure` set to `true` in the `session` section you probably want to change the `cookie_secure` to `true` in the `security` section as well. Ending up with a configuration like this:
145
146```ini
147[session]
148cookie_secure = true
149
150[security]
151cookie_secure = true
152```
153
154The `login_remember_days`, `cookie_username` and `cookie_remember_name` settings in the `security` section are no longer being used so they're safe to remove.
155
156If you have `login_remember_days` configured to 0 (zero) you should change your configuration to this to accomplish similar behavior, i.e. a logged in user will maximum be logged in for 1 day until being forced to login again:
157
158```ini
159[auth]
160login_maximum_inactive_lifetime_days = 1
161login_maximum_lifetime_days = 1
162```
163
164The default cookie name for storing the auth token is `grafana_session`. you can configure this with `login_cookie_name` in `[auth]` settings.
165
166## Upgrading to v6.2
167
168### Ensure encryption of data source secrets
169
170Data sources store passwords and basic auth passwords in secureJsonData encrypted (AES-256 in CFB mode) by default. Existing data source
171will keep working with unencrypted passwords. If you want to migrate to encrypted storage for your existing data sources
172you can do that by:
173
174- For data sources created through UI, you need to go to data source config, re-enter the password or basic auth
175  password and save the data source.
176- For data sources created by provisioning, you need to update your config file and use secureJsonData.password or
177  secureJsonData.basicAuthPassword field. See [provisioning docs]({{< relref "../administration/provisioning" >}}) for example of current
178  configuration.
179
180### Embedding Grafana
181
182If you're embedding Grafana in a `<frame>`, `<iframe>`, `<embed>` or `<object>` on a different website it will no longer work due to a new setting
183that per default instructs the browser to not allow Grafana to be embedded. For more information about embedding Grafana, refer to [configuration embedding]({{< relref "../administration/configuration/#allow-embedding" >}}) about
184this new setting.
185
186### Session storage is no longer used
187
188In 6.2 we completely removed the backend session storage since we replaced the previous login session implementation with an auth token.
189If you are using Auth proxy with LDAP, a shared cached is used in Grafana, so you might want to configure [remote_cache] instead. If not,
190Grafana will fall back to using the database as a shared cache.
191
192### Upgrading Elasticsearch to v7.0+
193
194The semantics of `max concurrent shard requests` changed in Elasticsearch v7.0, see [release notes](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/breaking-changes-7.0.html#semantics-changed-max-concurrent-shared-requests) for reference.
195
196If you upgrade Elasticsearch to v7.0+ you should make sure to update the data source configuration in Grafana so that version
197is `7.0+` and `max concurrent shard requests` properly configured. 256 was the default in pre v7.0 versions. In v7.0 and above 5 is the default.
198
199## Upgrading to v6.4
200
201### Annotations database migration
202
203One of the database migrations included in this release will merge multiple rows used to represent an annotation range into a single row. If you have a large number of region annotations the database migration may take a long time to complete. See [Upgrading to v5.2](#upgrading-to-v5-2) for tips on how to manage this process.
204
205### Docker
206
207Grafana’s docker image is now based on [Alpine](http://alpinelinux.org) instead of [Ubuntu](https://ubuntu.com/).
208
209### Plugins that need updating
210
211- [Splunk](https://grafana.com/grafana/plugins/grafana-splunk-datasource)
212
213## Upgrading to v6.5
214
215Pre Grafana 6.5.0, the CloudWatch datasource used the GetMetricStatistics API for all queries that did not have an ´id´ and did not have an ´expression´ defined in the query editor. The GetMetricStatistics API has a limit of 400 transactions per second (TPS). In this release, all queries use the GetMetricData API which has a limit of 50 TPS and 100 metrics per transaction. We expect this transition to be smooth for most of our users, but in case you do face throttling issues we suggest you increase the TPS quota. To do that, please visit the [AWS Service Quotas console](https://console.aws.amazon.com/servicequotas/home?r#!/services/monitoring/quotas/L-5E141212). For more details around CloudWatch API limits, [see CloudWatch docs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_limits.html).
216
217Each request to the GetMetricData API can include 100 queries. This means that each panel in Grafana will only issue one GetMetricData request, regardless of the number of query rows that are present in the panel. Consequently as it is no longer possible to set `HighRes` on a per query level anymore, this switch is now removed from the query editor. High resolution can still be achieved by choosing a smaller minimum period in the query editor.
218
219The handling of multi-valued template variables in dimension values has been changed in Grafana 6.5. When a multi template variable is being used, Grafana will generate a search expression. In the GetMetricData API, expressions are limited to 1024 characters, so it might be the case that this limit is reached when a multi-valued template variable that has a lot of values is being used. If this is the case, we suggest you start using `*` wildcard as dimension value instead of a multi-valued template variable.
220
221## Upgrading to v6.6
222
223The Generic OAuth setting `send_client_credentials_via_post`, used for supporting non-compliant providers, has been removed. From now on, Grafana will automatically detect if credentials should be sent as part of the URL or request body for a specific provider. The result will be remembered and used for additional OAuth requests for that provider.
224
225### Important changes regarding SameSite cookie attribute
226
227Chrome 80 treats cookies as `SameSite=Lax` by default if no `SameSite` attribute is specified, see https://www.chromestatus.com/feature/5088147346030592.
228
229Due to this change in Chrome, the `[security]` setting `cookie_samesite` configured to `none` now renders cookies with `SameSite=None` attribute compared to before where no `SameSite` attribute was added to cookies. To get the old behavior, use value `disabled` instead of `none`, see [cookie_samesite in Configuration]({{< relref "../administration/configuration/#cookie-samesite" >}}) for more information.
230
231> **Note:** There is currently a bug affecting Mac OSX and iOS that causes `SameSite=None` cookies to be treated as `SameSite=Strict` and therefore not sent with cross-site requests, see https://bugs.webkit.org/show_bug.cgi?id=198181 for details. Until this is fixed, `SameSite=None` might not work properly on Safari.
232
233This version of Chrome also rejects insecure `SameSite=None` cookies. See https://www.chromestatus.com/feature/5633521622188032 for more information. Make sure that you
234change the `[security]` setting `cookie_secure` to `true` and use HTTPS when `cookie_samesite` is configured to `none`, otherwise authentication in Grafana won't work properly.
235
236## Upgrading to v7.0
237
238### PhantomJS removed
239
240PhantomJS was deprecated in [Grafana v6.4]({{< relref "../whatsnew/whats-new-in-v6-4.md#phantomjs-deprecation" >}}) and starting from Grafana v7.0.0, all PhantomJS support has been removed. This means that Grafana no longer ships with a built-in image renderer, and we advise you to install the [Grafana Image Renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer).
241
242### Dashboard minimum refresh interval enforced
243
244A global minimum dashboard refresh interval is now enforced and defaults to 5 seconds. For more information about this setting, refer to [minimum refresh interval]({{< relref "../administration/configuration/#min-refresh-interval" >}}).
245
246### Backend plugins
247
248Grafana now requires backend plugins to be signed. If a backend plugin is not signed Grafana will not load/start it. This is an additional security measure to make sure backend plugin binaries and files haven't been tampered with. All Grafana Labs authored backend plugins, including Enterprise plugins, are now signed. It's possible to allow unsigned plugins using a configuration setting, but is something we strongly advise against doing. For more information about this setting, refer to [allow loading unsigned plugins]({{< relref "../administration/#allow_loading_unsigned_plugins" >}}).
249
250### Cookie path
251
252Starting from Grafana v7.0.0, the cookie path does not include the trailing slash if Grafana is served from a subpath in order to align with [RFC 6265](https://tools.ietf.org/html/rfc6265#section-5.1.4). However, stale session cookies (set before the upgrade) can result in unsuccessful logins because they can not be deleted during the standard login phase due to the changed cookie path. Therefore users experiencing login problems are advised to manually delete old session cookies, or administrators can fix this for all users by changing the [`login_cookie_name`]({{< relref "../administration/#login-cookie-name" >}}), so the old cookie would get ignored.
253
254## Upgrading to v7.2
255
256### Ensure encryption of existing alert notification channel secrets
257
258Before Grafana v7.2 alert notification channels did not store sensitive settings/secrets such as API tokens and password encrypted in the database. In Grafana v7.2, creating a new alert notification channel will store sensitive settings encrypted in the database.
259
260The following alert notifiers have been updated to support storing their sensitive settings encrypted:
261
262- Slack (URL and Token)
263- Pagerduty (Integration Key)
264- Webhook (Password)
265- Prometheus Alertmanager (Basic Auth Password)
266- Opsgenie (API Key)
267- Sensu (Password)
268- Telegram (BOT API Token)
269- LINE (token)
270- Pushover (API Token, User key)
271- Threema Gateway (API Secret)
272
273For existing alert notification channels, there is no automatic migration of storing sensitive settings encrypted, and they will continue to work as before. Migration must be done manually. Opening a configured alert notification channel in the UI and saving it will store sensitive settings encrypted and at the same time reset the historic unencrypted setting of that alert notification channel in the database.
274
275> Please note that when migrating a notification channel and later downgrading Grafana to an earlier version, the notification channel will not be able to read stored sensitive settings and, as a result, not function as expected.
276
277For provisioning of alert notification channels, refer to [Alert notification channels]({{< relref "../administration/provisioning.md#alert-notification-channels" >}}).
278
279## Upgrading to v7.3
280
281### AWS CloudWatch data source
282
283The AWS CloudWatch data source's authentication scheme has changed in Grafana 7.3. Most importantly the authentication method _ARN_ has been removed, and a new one has been added: _AWS SDK Default_. Existing data source configurations using the former will fallback to the latter. Assuming an IAM role will still work though, and the old _ARN_ method would use the default AWS SDK authentication method under the hood anyway.
284
285Since _ARN_ has been removed as an authentication method, we have instead made it into an option for providing the ARN of an IAM role to assume. This works independently of the authentication method you choose.
286
287The new authentication method, _AWS SDK Default_, uses the default AWS Go SDK credential chain, which at the time of writing looks for credentials in the following order:
288
2891. Environment variables.
2901. Shared credentials file.
2911. If your application uses an ECS task definition or RunTask API operation, IAM role for tasks.
2921. If your application is running on an Amazon EC2 instance, IAM role for Amazon EC2.
293
294The other authentication methods, _Access and secret key_ and _Credentials file_, have changed in regards to fallbacks. If these methods fail, they no longer fallback to other methods. e.g. environment variables. If you want fallbacks, you should use _AWS SDK Default_ instead.
295
296For more information and details, please refer to [Using AWS CloudWatch in Grafana]({{< relref "../datasources/aws-cloudwatch/aws-authentication.md" >}}).
297
298### User invites database migration
299
300The database table _temp_user_, that tracks user invites, is subject to a database migration that changes the data type of the _created_ and _updated_ columns:
301
302| Database | Old data type | New data type |
303| -------- | ------------- | ------------- |
304| Sqlite   | DATETIME      | INTEGER       |
305| MySQL    | DATETIME      | INT           |
306| Postgres | TIMESTAMP     | INTEGER       |
307
308> Please note that if downgrading Grafana to an earlier version, you have to manually change the data type of the _created_ and _updated_ columns back to _old data type_ , otherwise the user invite feature doesn't function as expected.
309
310### Snapshots database migration
311
312The database table _dashboard_snapshot_, that stores dashboard snapshots, adds a new column _dashboard_encrypted_ for storing an encrypted snapshot.
313NOTE: Only snapshots created on Grafana 7.3 or later will use this column to store snapshot data as encrypted. Snapshots created before this version will be unaffected and remain unencrypted.
314
315### Use of the root group in the Docker images
316
317The Grafana Docker images use the `root` group instead of the `grafana` group. This change can cause builds to break for users who extend the Grafana Docker image. Learn more about this change in the [Docker migration instructions]({{< relref "docker/#migrate-to-v73-or-later">}})
318
319## Upgrading to v7.5
320
321### VictorOps Alert Notifier
322
323The VictorOps alert notifier now accepts a `severity` tag, in a similar vein to the PagerDuty alert notifier. The possible values are outlined in the [VictorOps docs](https://help.victorops.com/knowledge-base/incident-fields-glossary/).
324
325For example, if you want an alert to be `INFO`-level in VictorOps, create a tag `severity=info` (case-insensitive) in your alert.
326
327## Upgrading to v8.0
328
329### Plugins
330
331Grafana now requires all plugins to be signed. If a plugin is not signed Grafana will not load/start it. This is an additional security measure to make sure plugin files and binaries haven't been tampered with. All Grafana Labs authored plugins, including Enterprise plugins, are now signed. It's possible to allow unsigned plugins using a configuration setting, but is something we strongly advise against doing. For more information about this setting, refer to [allow loading unsigned plugins]({{< relref "../administration/#allow_loading_unsigned_plugins" >}}).
332
333### Grafana Live
334
335Grafana now maintains persistent WebSocket connections for real-time messaging needs.
336
337When WebSocket connection is established, Grafana checks the request Origin header due to security reasons (for example, to prevent hijacking of WebSocket connection). If you have a properly defined public URL (`root_url` server option) then the origin check should successfully pass for WebSocket requests originating from public URL pages. In case of an unsuccessful origin check, Grafana returns a 403 error. It's also possible to add a list of additional origin patterns for the origin check.
338
339To handle many concurrent WebSocket connections you may need to tune your OS settings or infrastructure. Grafana Live is enabled by default and supports 100 concurrent WebSocket connections max to avoid possible problems with the file descriptor OS limit. As soon as your setup meets the requirements to scale the number of persistent connections this limit can be increased. You also have an option to disable Grafana Live.
340
341Refer to [Grafana Live configuration]({{< relref "../live/configure-grafana-live.md" >}}) documentation for more information.
342
343### Postgres, MySQL, Microsoft SQL Server data sources
344
345Grafana v8.0 changes the underlying data structure to [data frames]({{< relref "../developers/plugins/data-frames.md" >}}) for the Postgres, MySQL, Microsoft SQL Server data sources. As a result, a _Time series_ query result gets returned in a [wide format]({{< relref "../developers/plugins/data-frames.md#wide-format" >}}). To make the visualizations work as they did before, you might have to do some manual migrations.
346
347For any existing panels/visualizations using a _Time series_ query, where the time column is only needed for filtering the time range, for example, using the bar gauge or pie chart panel, we recommend that you use a _Table query_ instead and exclude the time column as a field in the response.
348Refer to this [issue comment](https://github.com/grafana/grafana/issues/35534#issuecomment-861519658) for detailed instructions and workarounds.
349
350#### Prefix added to series names
351
352When you have a query where there's a time value and a numeric value selected together with a string value that's not named _metric_, the graph panel renders series names as `value <hostname>` rather than just `<hostname>` which was the case before Grafana 8.
353
354```sql
355SELECT
356  $__timeGroup("createdAt",'10m'),
357  avg(value) as "value",
358  hostname
359FROM grafana_metric
360WHERE $__timeFilter("createdAt")
361GROUP BY time, hostname
362ORDER BY time
363```
364
365There are two possible workarounds to resolve this problem:
366
3671. In Grafana v8.0.3, use an alias of the string column selected as `metric`. for example, `hostname as metric`.
3682. Use the [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}) to format the alias. For the preceding example query, you would use `${__field.labels.hostname}` option.
369
370For more information, refer to the our relational databases documentation of [Postgres]({{< relref "../datasources/postgres.md#time-series-queries" >}}), [MySQL]({{< relref "../datasources/mysql.md#time-series-queries" >}}), [Microsoft SQL Server]({{< relref "../datasources/mssql.md#time-series-queries" >}}).
371
372## Upgrading to v8.1
373
374### Use of unencrypted passwords for data sources no longer supported
375
376As of Grafana v8.1, we no longer support unencrypted storage of passwords and basic auth passwords.
377
378> **Note:** Since Grafana v6.2, new or updated data sources store passwords and basic auth passwords encrypted. See [upgrade note]({{< relref "#ensure-encryption-of-data-source-secrets" >}}) for more information. However, unencrypted passwords and basic auth passwords were also allowed.
379
380To migrate to encrypted storage, follow the instructions from the [v6.2 upgrade notes]({{< relref "#ensure-encryption-of-data-source-secrets" >}}). You can also use a `grafana-cli` command to migrate all of your data sources to use encrypted storage of secrets. See [migrate data and encrypt passwords]({{< relref "../administration/cli.md#migrate-data-and-encrypt-passwords" >}}) for further instructions.
381