1
0
Эх сурвалжийг харах

Rearrange InfluxDB docs so upgrade info is immediately visible.

Dan Moran 4 жил өмнө
parent
commit
701d20bbfb
1 өөрчлөгдсөн 146 нэмэгдсэн , 146 устгасан
  1. 146 146
      influxdb/content.md

+ 146 - 146
influxdb/content.md

@@ -10,7 +10,138 @@ InfluxDB is a time series database built from the ground up to handle high write
 
 The `latest` tag for this image now points to the latest released implementation of InfluxDB 2.x. If you are using the `latest` tag and would like to stay on the InfluxDB 1.x line, please update your environment to reference the `1.8` tag.
 
-## Upgrading from quay.io-hosted InfluxDB 2.x image
+## Using this Image - InfluxDB 2.x
+
+### Upgrading from InfluxDB 1.x
+
+InfluxDB 2.x provides a 1.x-compatible API, but expects a different storage layout on disk. To bridge this mismatch, the InfluxDB image contains extra functionality to migrate 1.x data and config into 2.x layouts automatically before booting the `influxd` server.
+
+The automated upgrade process also bootstraps an initial admin user, organization, and bucket in the system, so it uses the same set of environment variables as the automated setup process described above:
+
+-	`DOCKER_INFLUXDB_INIT_USERNAME`: The username to set for the system's initial super-user (**Required**).
+-	`DOCKER_INFLUXDB_INIT_PASSWORD`: The password to set for the system's inital super-user (**Required**).
+-	`DOCKER_INFLUXDB_INIT_ORG`: The name to set for the system's initial organization (**Required**).
+-	`DOCKER_INFLUXDB_INIT_BUCKET`: The name to set for the system's initial bucket (**Required**).
+-	`DOCKER_INFLUXDB_INIT_RETENTION`: The duration the system's initial bucket should retain data. If not set, the initial bucket will retain data forever.
+-	`DOCKER_INFLUXDB_INIT_ADMIN_TOKEN`: The authentication token to associate with the system's initial super-user. If not set, a token will be auto-generated by the system.
+
+It also requires extra volumes to be mounted into the 2.x container:
+
+-	Data from the 1.x instance
+-	Custom config from the 1.x instance (if any)
+
+The upgrade process searches for mounted 1.x data / config in this priority order:
+
+1.	A config file referred to by the `DOCKER_INFLUXDB_INIT_UPGRADE_V1_CONFIG` environment variable
+2.	A data directory referred to by the `DOCKER_INFLUXDB_INIT_UPGRADE_V1_DIR` environment variable
+3.	A config file mounted at `/etc/influxdb/influxdb.conf`
+4.	A data directory mounted at `/var/lib/influxdb`
+
+Finally, the `DOCKER_INFLUXDB_INIT_MODE` environment variable must be set to `upgrade`.
+
+Automated upgrade will generate both data and config files, by default under `/var/lib/influxdb2` and `/etc/influxdb2`. It's recommended to mount volumes at both paths to avoid losing data.
+
+**NOTE:** Automated upgrade will not run if an existing boltdb file is found at the configured path. This behavior allows for the InfluxDB container to reboot post-upgrade without overwriting migrated data.
+
+Find more about the InfluxDB upgrade process [here](https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/). See below for examples of common upgrade scenarios.
+
+#### Upgrade Example - Minimal
+
+Assume you've been running a minimal InfluxDB 1.x deployment:
+
+```console
+$ docker run -p 8086:8086 \
+      -v influxdb:/var/lib/influxdb \
+      %%IMAGE%%:1.8
+```
+
+To upgrade this deployment to InfluxDB 2.x, stop the running InfluxDB 1.x container, then run:
+
+```console
+$ docker run -p 8086:8086 \
+      -v influxdb:/var/lib/influxdb \
+      -v influxdb2:/var/lib/influxdb2 \
+      -e DOCKER_INFLUXDB_INIT_MODE=upgrade \
+      -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
+      -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
+      -e DOCKER_INFLUXDB_INIT_ORG=my-org \
+      -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
+      %%IMAGE%%:2.0
+```
+
+#### Upgrade Example - Custom InfluxDB 1.x Config
+
+Assume you've been running an InfluxDB 1.x deployment with customized config:
+
+```console
+$ docker run -p 8086:8086 \
+      -v influxdb:/var/lib/influxdb \
+      -v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
+      %%IMAGE%%:1.8
+```
+
+To upgrade this deployment to InfluxDB 2.x, stop the running container, then run:
+
+```console
+$ docker run -p 8086:8086 \
+      -v influxdb:/var/lib/influxdb \
+      -v influxdb2:/var/lib/influxdb2 \
+      -v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
+      -e DOCKER_INFLUXDB_INIT_MODE=upgrade \
+      -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
+      -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
+      -e DOCKER_INFLUXDB_INIT_ORG=my-org \
+      -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
+      %%IMAGE%%:2.0
+```
+
+#### Upgrade Example - Custom Paths
+
+Assume you've been running an InfluxDB 1.x deployment with data and config mounted at custom paths:
+
+```console
+$ docker run -p 8086:8086 \
+      -v influxdb:/root/influxdb/data \
+      -v $PWD/influxdb.conf:/root/influxdb/influxdb.conf:ro \
+      %%IMAGE%%:1.8 -config /root/influxdb/influxdb.conf
+```
+
+To upgrade this deployment to InfluxDB 2.x, first decide if you'd like to keep using custom paths, or use the InfluxDB 2.x defaults. If you decide to use the defaults, you'd stop the running InfluxDB 1.x container, then run:
+
+```console
+$ docker run -p 8086:8086 \
+      -v influxdb:/root/influxdb/data \
+      -v influxdb2:/var/lib/influxdb2 \
+      -v $PWD/influxdb.conf:/root/influxdb/influxdb.conf:ro \
+      -e DOCKER_INFLUXDB_INIT_MODE=upgrade \
+      -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
+      -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
+      -e DOCKER_INFLUXDB_INIT_ORG=my-org \
+      -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
+      -e DOCKER_INFLUXDB_INIT_UPGRADE_V1_CONFIG=/root/influxdb/influxdb.conf \
+      %%IMAGE%%:2.0
+```
+
+To retain your custom paths, you'd run:
+
+```console
+$ docker run -p 8086:8086 \
+      -v influxdb:/root/influxdb/data \
+      -v influxdb2:/root/influxdb2/data \
+      -v $PWD/influxdb.conf:/root/influxdb/influxdb.conf:ro \
+      -e DOCKER_INFLUXDB_INIT_MODE=upgrade \
+      -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
+      -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
+      -e DOCKER_INFLUXDB_INIT_ORG=my-org \
+      -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
+      -e DOCKER_INFLUXDB_INIT_UPGRADE_V1_CONFIG=/root/influxdb/influxdb.conf \
+      -e DOCKER_INFLUXDB_CONFIG_PATH=/root/influxdb2/config.toml \
+      -e DOCKER_INFLUXDB_BOLT_PATH=/root/influxdb2/influxdb.bolt \
+      -e DOCKER_INFLUXDB_ENGINE_PATH=/root/influxdb2/engine \
+      %%IMAGE%%:2.0
+```
+
+### Upgrading from quay.io-hosted InfluxDB 2.x image
 
 Early Docker builds of InfluxDB 2.x were hosted at `quay.io/influxdb/influxdb`. The builds were very bare-bones, containing the `influx` and `influxd` binaries without any default configuration or helper scripts. By default, the `influxd` process stored data under `/root/.influxdbv2`.
 
@@ -18,7 +149,7 @@ Starting with `v2.0.4`, we've restored our DockerHub build. This build defaults
 
 To avoid this problem when migrating from `quay.io/influxdb/influxdb` to `influxdb:2.0`, you can use one of the following approaches.
 
-### Change volume mount point
+#### Change volume mount point
 
 If you don't mind using the new default path, you can switch the mount-point for the volume containing your data:
 
@@ -31,10 +162,10 @@ $ docker run -p 8086:8086 \
 # To this:
 docker run -p 8086:8086 \
       -v $PWD:/var/lib/influxdb2 \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
-### Override default configs
+#### Override default configs
 
 If you'd rather keep your data files in the home directory, you can override the container's default config:
 
@@ -49,13 +180,11 @@ docker run -p 8086:8086 \
       -e INFLUXD_BOLT_PATH=/root/.influxdbv2/influxd.bolt \
       -e INFLUXD_ENGINE_PATH=/root/.influxdbv2/engine \
       -v $PWD:/root/.influxdbv2 \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
 See the section about configuration below for more ways to override the data paths.
 
-## Using this Image - InfluxDB 2.x
-
 ### Running the container
 
 The InfluxDB image exposes a shared volume under `/var/lib/influxdb2`. You can mount a host directory to that point to access persisted container data. A typical invocation of the container might be:
@@ -63,7 +192,7 @@ The InfluxDB image exposes a shared volume under `/var/lib/influxdb2`. You can m
 ```console
 $ docker run -p 8086:8086 \
       -v $PWD:/var/lib/influxdb2 \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
 Modify `$PWD` to the directory where you want to store data associated with the InfluxDB container.
@@ -73,7 +202,7 @@ You can also have Docker control the volume mountpoint by using a named volume.
 ```console
 $ docker run -p 8086:8086 \
       -v influxdb2:/var/lib/influxdb2 \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
 ### Exposed Ports
@@ -91,7 +220,7 @@ Find more about API Endpoints & Ports [here](https://docs.influxdata.com/influxd
 InfluxDB can be configured using a mix of a config file, environment variables, and CLI options. To mount a configuration file and use it with the server, you can use this command to generate the default configuration file:
 
 ```console
-$ docker run --rm %%IMAGE%% influxd print-config > config.yml
+$ docker run --rm %%IMAGE%%:2.0 influxd print-config > config.yml
 ```
 
 Modify the default configuration, which will now be available under `$PWD`. Then start the InfluxDB container:
@@ -99,7 +228,7 @@ Modify the default configuration, which will now be available under `$PWD`. Then
 ```console
 $ docker run -p 8086:8086 \
       -v $PWD/config.yml:/etc/influxdb2/config.yml:ro \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
 Modify `$PWD` to be the directory where you want to store the configuration file.
@@ -121,7 +250,7 @@ Finally, all config options can be passed as CLI options:
 
 ```console
 $ docker run -p 8086:8086 \
-      %%IMAGE%% --storage-wal-fsync-delay=15m
+      %%IMAGE%%:2.0 --storage-wal-fsync-delay=15m
 ```
 
 CLI options take precedence over environment variables.
@@ -142,7 +271,7 @@ It's also possible to perform manual setup from within the container using `dock
 $ docker run -d -p 8086:8086 \
       --name influxdb2 \
       -v $PWD:/var/lib/influxdb2 \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
 You can then run the `influx` client in the container:
@@ -176,7 +305,7 @@ $ docker run -d -p 8086:8086 \
       --name influxdb2 \
       -v $PWD/data:/var/lib/influxdb2 \
       -v $PWD/config:/etc/influxdb2 \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
 This will make the generated CLI configs available to the host.
@@ -205,7 +334,7 @@ $ docker run -d -p 8086:8086 \
       -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
       -e DOCKER_INFLUXDB_INIT_ORG=my-org \
       -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
 And an example using all available options is:
@@ -221,7 +350,7 @@ $ docker run -d -p 8086:8086 \
       -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
       -e DOCKER_INFLUXDB_INIT_RETENTION=1w \
       -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
 **NOTE:** Automated setup will not run if an existing boltdb file is found at the configured path. This behavior allows for the InfluxDB container to reboot post-setup without encountering "DB is already set up" errors.
@@ -235,135 +364,6 @@ Once an InfluxDB instance has completed initial setup, its APIs will unlock. See
 -	[Configuring security](https://docs.influxdata.com/influxdb/v2.0/security/)
 -	[And more!](https://docs.influxdata.com/influxdb/v2.0/)
 
-### Upgrading from InfluxDB 1.x
-
-InfluxDB 2.x provides a 1.x-compatible API, but expects a different storage layout on disk. To bridge this mismatch, the InfluxDB image contains extra functionality to migrate 1.x data and config into 2.x layouts automatically before booting the `influxd` server.
-
-The automated upgrade process also bootstraps an initial admin user, organization, and bucket in the system, so it uses the same set of environment variables as the automated setup process described above:
-
--	`DOCKER_INFLUXDB_INIT_USERNAME`: The username to set for the system's initial super-user (**Required**).
--	`DOCKER_INFLUXDB_INIT_PASSWORD`: The password to set for the system's inital super-user (**Required**).
--	`DOCKER_INFLUXDB_INIT_ORG`: The name to set for the system's initial organization (**Required**).
--	`DOCKER_INFLUXDB_INIT_BUCKET`: The name to set for the system's initial bucket (**Required**).
--	`DOCKER_INFLUXDB_INIT_RETENTION`: The duration the system's initial bucket should retain data. If not set, the initial bucket will retain data forever.
--	`DOCKER_INFLUXDB_INIT_ADMIN_TOKEN`: The authentication token to associate with the system's initial super-user. If not set, a token will be auto-generated by the system.
-
-It also requires extra volumes to be mounted into the 2.x container:
-
--	Data from the 1.x instance
--	Custom config from the 1.x instance (if any)
-
-The upgrade process searches for mounted 1.x data / config in this priority order:
-
-1.	A config file referred to by the `DOCKER_INFLUXDB_INIT_UPGRADE_V1_CONFIG` environment variable
-2.	A data directory referred to by the `DOCKER_INFLUXDB_INIT_UPGRADE_V1_DIR` environment variable
-3.	A config file mounted at `/etc/influxdb/influxdb.conf`
-4.	A data directory mounted at `/var/lib/influxdb`
-
-Finally, the `DOCKER_INFLUXDB_INIT_MODE` environment variable must be set to `upgrade`.
-
-Automated upgrade will generate both data and config files, by default under `/var/lib/influxdb2` and `/etc/influxdb2`. It's recommended to mount volumes at both paths to avoid losing data.
-
-**NOTE:** Automated upgrade will not run if an existing boltdb file is found at the configured path. This behavior allows for the InfluxDB container to reboot post-upgrade without overwriting migrated data.
-
-Find more about the InfluxDB upgrade process [here](https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/). See below for examples of common upgrade scenarios.
-
-#### Upgrade Example - Minimal
-
-Assume you've been running a minimal InfluxDB 1.x deployment:
-
-```console
-$ docker run -p 8086:8086 \
-      -v influxdb:/var/lib/influxdb \
-      %%IMAGE%%:1.8
-```
-
-To upgrade this deployment to InfluxDB 2.x, stop the running InfluxDB 1.x container, then run:
-
-```console
-$ docker run -p 8086:8086 \
-      -v influxdb:/var/lib/influxdb \
-      -v influxdb2:/var/lib/influxdb2 \
-      -e DOCKER_INFLUXDB_INIT_MODE=upgrade \
-      -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
-      -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
-      -e DOCKER_INFLUXDB_INIT_ORG=my-org \
-      -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
-      %%IMAGE%%
-```
-
-#### Upgrade Example - Custom InfluxDB 1.x Config
-
-Assume you've been running an InfluxDB 1.x deployment with customized config:
-
-```console
-$ docker run -p 8086:8086 \
-      -v influxdb:/var/lib/influxdb \
-      -v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
-      %%IMAGE%%:1.8
-```
-
-To upgrade this deployment to InfluxDB 2.x, stop the running container, then run:
-
-```console
-$ docker run -p 8086:8086 \
-      -v influxdb:/var/lib/influxdb \
-      -v influxdb2:/var/lib/influxdb2 \
-      -v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
-      -e DOCKER_INFLUXDB_INIT_MODE=upgrade \
-      -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
-      -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
-      -e DOCKER_INFLUXDB_INIT_ORG=my-org \
-      -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
-      %%IMAGE%%
-```
-
-#### Upgrade Example - Custom Paths
-
-Assume you've been running an InfluxDB 1.x deployment with data and config mounted at custom paths:
-
-```console
-$ docker run -p 8086:8086 \
-      -v influxdb:/root/influxdb/data \
-      -v $PWD/influxdb.conf:/root/influxdb/influxdb.conf:ro \
-      %%IMAGE%%:1.8 -config /root/influxdb/influxdb.conf
-```
-
-To upgrade this deployment to InfluxDB 2.x, first decide if you'd like to keep using custom paths, or use the InfluxDB 2.x defaults. If you decide to use the defaults, you'd stop the running InfluxDB 1.x container, then run:
-
-```console
-$ docker run -p 8086:8086 \
-      -v influxdb:/root/influxdb/data \
-      -v influxdb2:/var/lib/influxdb2 \
-      -v $PWD/influxdb.conf:/root/influxdb/influxdb.conf:ro \
-      -e DOCKER_INFLUXDB_INIT_MODE=upgrade \
-      -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
-      -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
-      -e DOCKER_INFLUXDB_INIT_ORG=my-org \
-      -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
-      -e DOCKER_INFLUXDB_INIT_UPGRADE_V1_CONFIG=/root/influxdb/influxdb.conf \
-      %%IMAGE%%
-```
-
-To retain your custom paths, you'd run:
-
-```console
-$ docker run -p 8086:8086 \
-      -v influxdb:/root/influxdb/data \
-      -v influxdb2:/root/influxdb2/data \
-      -v $PWD/influxdb.conf:/root/influxdb/influxdb.conf:ro \
-      -e DOCKER_INFLUXDB_INIT_MODE=upgrade \
-      -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
-      -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
-      -e DOCKER_INFLUXDB_INIT_ORG=my-org \
-      -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
-      -e DOCKER_INFLUXDB_INIT_UPGRADE_V1_CONFIG=/root/influxdb/influxdb.conf \
-      -e DOCKER_INFLUXDB_CONFIG_PATH=/root/influxdb2/config.toml \
-      -e DOCKER_INFLUXDB_BOLT_PATH=/root/influxdb2/influxdb.bolt \
-      -e DOCKER_INFLUXDB_ENGINE_PATH=/root/influxdb2/engine \
-      %%IMAGE%%
-```
-
 ### Custom Initialization Scripts
 
 The InfluxDB image supports running arbitrary initialization scripts after initial system setup, on both the `setup` and `upgrade` paths. Scripts must have extension `.sh` and be mounted inside of the `/docker-entrypoint-initdb.d` directory. When multiple scripts are present, they will be executed in lexical sort order by name.
@@ -412,7 +412,7 @@ $ docker run -p 8086:8086 \
       -e V1_RP_NAME=v1-rp \
       -e V1_AUTH_USERNAME=v1-user \
       -e V1_AUTH_PASSWORD=v1-password \
-      %%IMAGE%%
+      %%IMAGE%%:2.0
 ```
 
 **NOTE:** Custom scripts will not run if an existing boltdb file is found at the configured path (causing `setup` or `upgrade` to be skipped). This behavior allows for the InfluxDB container to reboot post-initialization without encountering errors from non-idempotent script commands.