Automatically upgrade from InfluxDB 1.x to 2.1
This page documents an earlier version of InfluxDB. InfluxDB v2.7 is the latest stable version. View this page in the v2.7 documentation.
Use the influxd upgrade
command to upgrade InfluxDB 1.x to InfluxDB 2.3. The upgrade
command provides an in-place upgrade from InfluxDB 1.x to InfluxDB 2.3.
Specifically, the upgrade process does the following:
- Reads the existing InfluxDB 1.x configuration file and generates an equivalent InfluxDB 2.3 configuration file at
~/.influxdbv2/config.toml
or at a custom path specified with the--v2-config-path
flag. - Upgrades metadata and storage engine paths to
~/.influxdbv2/meta
and~/.influxdbv2/engine
, respectively (unless otherwise specified). - Writes existing data and write ahead log (WAL) files into InfluxDB 2.3 buckets.
- Creates database and retention policy (DBRP) mappings required to query data with InfluxQL.
- Reads existing metadata and migrates non-admin users, passwords, and permissions into a 1.x authorization–compatible store within
~/influxdbv2/influxdb.bolt
.
When starting InfluxDB 2.3 after running influxdb upgrade
, InfluxDB must build a new time series index (TSI). Depending on the volume of data present, this may take some time.
Important considerations before you begin
Before upgrading to InfluxDB 2.3, consider the following guidelines. Some or all might apply to your specific installation and use case. The sections below contain our recommendations for addressing possible gaps in the upgrade process. Consider whether you need to address any of the following before upgrading.
- Available operating system, container, and platform support
- Continuous queries
- Supported protocols
- Kapacitor
- User migration
- Dashboards
- Other data
- Secure by default
- inmem indexing option
Available operating system, container, and platform support
InfluxDB 2.3 is currently available for macOS, Linux, and Windows.
InfluxDB 2.3 requires 64-bit operating systems.
Continuous queries
Continuous queries are replaced by tasks in InfluxDB 2.3. By default, influxd upgrade
writes all continuous queries to ~/continuous_queries.txt
. To convert continuous queries to InfluxDB tasks, see Migrate continuous queries to tasks.
Supported protocols
InfluxDB 2.3 doesn’t directly support the alternate write protocols supported in InfluxDB 1.x (CollectD, Graphite, OpenTSDB, Prometheus, UDP). Use Telegraf to translate these protocols to line protocol.
Kapacitor
You can continue to use Kapacitor with InfluxDB OSS 2.3 under the following scenarios:
- Kapacitor Batch-style TICKscripts work with the 1.x read compatible API. Existing Kapacitor user credentials should continue to work using the 1.x compatibility API.
- InfluxDB 2.3 has no subscriptions API and does not support Kapacitor stream tasks. To continue using stream tasks, write data directly to both InfluxDB and Kapacitor. Use Telegraf and its InfluxDB output plugin to write to Kapacitor and the InfluxDB v2 output plugin to write to InfluxDB v2.
Example Telegraf configuration
# Write to Kapacitor
[[outputs.influxdb]]
urls = ["http://localhost:9092"]
database = "example-db"
retention_policy = "example-rp"
# Write to InfluxDB 2.3
[[outputs.influxdb]]
urls = ["http://localhost:8086"]
database = "example-db"
retention_policy = "example-rp"
username = "v1-auth-username"
password = "v1-auth-password"
User migration
influxd upgrade
migrates existing 1.x users and their permissions except the following users:
- 1.x admin users
- 1.x non-admin users that have not been granted any privileges
Review 1.x user privileges
To review 1.x users with admin privileges, run the following against your InfluxDB 1.x instance:
SHOW USERS
Users with admin
set to true
will not be migrated.
To review the specific privileges granted to each 1.x user, run the following for each user in your InfluxDB 1.x instance:
SHOW GRANTS FOR "<username>"
If no grants appear, the user will not be migrated.
If using an admin user for visualization or Chronograf administrative functions, create a new read-only user before upgrading:
Create a read-only 1.x user
> CREATE USER <username> WITH PASSWORD '<password>'
> GRANT READ ON <database> TO "<username>"
InfluxDB 2.3 only grants admin privileges to the primary user set up during the InfluxDB 2.3 upgrade. This provides you with the opportunity to reassess who to grant admin permissions when setting up InfluxDB 2.3.
Dashboards
You can continue to use your existing dashboards and visualization tools with InfluxDB 2.3 via the 1.x read compatibility API. The upgrade process creates DBRP mappings to ensure existing users can execute InfluxQL queries with the appropriate permissions.
However, if your dashboard tool is configured using a user with admin permissions, you will need to create a new read-only user with the appropriate database permissions before upgrading. This new username and password combination should be used within the data source configurations to continue to provide read-only access to the underlying data.
Ensure your dashboards are all functioning before upgrading.
Other data
The 1.x _internal
database is not migrated with the influxd upgrade
command. To collect, store, and monitor similar internal InfluxDB metrics, create an InfluxDB 2.3 scraper to scrape data from the /metrics
endpoint and store them in a bucket.
Secure by default
InfluxDB 2.3 requires authentication and does not support the InfluxDB 1.x auth-enabled = false
configuration option.
Before upgrading to 2.3, enable authentication in your InfluxDB 1.x instance and test your credentials to ensure your applications, agents, and visualization tools can connect to InfluxDB.
If you upgrade with auth-enabled = false
, the upgrade may appear complete, but client requests to InfluxDB 2.3 may be silently ignored (you won’t see a notification the request was denied).
In-memory indexing option
InfluxDB 2.3 doesn’t support in-memory (inmem) indexing. The following InfluxDB 1.x configuration options associated with inmem
indexing are ignored in the upgrade process:
max-series-per-database
max-values-per-tag
Interactive shell
The InfluxDB 2.x influx
CLI does not include an interactive shell for executing InfluxQL queries or Flux queries. For information about executing InfluxQL queries, see Query data with InfluxQL. To build an interactive shell to execute Flux queries, compile and build a command line Flux REPL from source.
Perform the upgrade
If you’ve considered the guidance above and are ready to proceed, follow these steps to upgrade your InfluxDB 1.x to InfluxDB 2.3.
Download InfluxDB OSS 2.3. Unpackage the InfluxDB binaries and place them in your
$PATH
.Stop your running InfluxDB 1.x instance. Make a backup copy of all 1.x data before upgrading:
cp -R .influxdb/ .influxdb_bak/
Use
influxd version
to ensure you are running InfluxDB 2.3 from the command line. Theinfluxd upgrade
command is only available in InfluxDB 2.3.If your 1.x configuration file is at the default location, run:
influxd upgrade
Upgrade
.deb
packagesWhen installed from a
.deb
package, InfluxDB 1.x and 2.x run under theinfluxdb
user. If you’ve installed both versions from.deb
packages, run the upgrade command as theinfluxdb
user:sudo -u influxdb influxd upgrade
If your 1.x configuration file is not at the default location, run:
influxd upgrade --config-file <path to v1 config file>
To store the upgraded 2.3 configuration file in a custom location, include the
--v2-config-path
flag:influxd upgrade --v2-config-path <destination path for v2 config file>
Follow the prompts to set up a new InfluxDB 2.3 instance.
Welcome to InfluxDB 2.3 upgrade!
Please type your primary username: <your-username>
Please type your password:
Please type your password again:
Please type your primary organization name: <your-org>
Please type your primary bucket name: <your-bucket>
Please type your retention period in hours.
Or press ENTER for infinite:
You have entered:
Username: <your-username>
Organization: <your-org>
Bucket: <your-bucket>
Retention Period: infinite
Confirm? (y/n): y
The output of the upgrade prints to standard output. It is also saved (for troubleshooting and debugging) in the current directory to a file called upgrade.log
located in the home directory of the user running influxdb upgrade
.
Post-upgrade
Verify 1.x users were migrated to 2.3
To verify 1.x users were successfully migrated to 2.3, run influx v1 auth list.
Add authorizations for external clients
If your InfluxDB 1.x instance did not have authentication enabled and the influx v1 auth list
doesn’t return any users, external clients connected to your 1.x instance will not be able to access InfluxDB 2.3, which requires authentication.
For these external clients to work with InfluxDB 2.3:
- Manually create a 1.x-compatible authorization.
- Update the client configuration to use the username and password associated with your 1.x-compatible authorization.
Related
- influxd upgrade
- Manually upgrade from InfluxDB 1.x to 2.3
- Upgrade from InfluxDB 1.x to 2.3 with Docker