diff --git a/docs/MigratePrometheusDocker.md b/docs/MigratePrometheusDocker.md index 04ee31b73..da804b139 100644 --- a/docs/MigratePrometheusDocker.md +++ b/docs/MigratePrometheusDocker.md @@ -65,7 +65,8 @@ docker volume create --name harvest_prometheus_data ## Copy the historical Prometheus data We will copy the historical Prometheus data from the old volume to the new one by -mounting both volumes and copying data between them. +mounting both volumes and copying data between them. **NOTE**: Prometheus only supports copying a single volume. It will +not work if you attempt to copy multiple volumes into the same destination volume. ```bash # replace `HISTORICAL_VOLUME` with the name of the Prometheus volume that contains you historical data found in step 2. diff --git a/docs/install/containers.md b/docs/install/containers.md index 8ae5fd1b1..e20e05501 100644 --- a/docs/install/containers.md +++ b/docs/install/containers.md @@ -140,8 +140,8 @@ docker-compose -f prom-stack.yml -f harvest-compose.yml down > Note: If you want to keep your historical Prometheus data, and you set up your Docker Compose workflow before > Harvest `22.11`, please read how -> to [migrate your Prometheus volume](https://github.com/NetApp/harvest/blob/main/docs/MigratePrometheusDocker.md) before -> continuing with the upgrade steps below. +> to [migrate your Prometheus volume](https://github.com/NetApp/harvest/blob/main/docs/MigratePrometheusDocker.md) +> before continuing with the upgrade steps below. To upgrade Harvest: @@ -149,11 +149,12 @@ To upgrade Harvest: This is needed since the new version may contain new templates, dashboards, or other files not included in the Docker image. -2. Check the release notes to see if there are new features or fixes in the `harvest docker generate` command you want - to take advantage of. - If so, regenerate your Docker compose file(s). +2. Copy your existing `harvest.yml` into the new Harvest directory created in step #1. -3. Pull new images and restart your containers like so: +3. Regenerate your `harvest-compose.yml` file by + running `bin/harvest generate docker full --port --output harvest-compose.yml` + +4. Pull new images and restart your containers like so: ``` docker pull cr.netapp.io/harvest # or if using Docker Hub: docker pull rahulguptajss/harvest diff --git a/pkg/docs/MigratePrometheusDocker.md b/pkg/docs/MigratePrometheusDocker.md deleted file mode 100644 index 04ee31b73..000000000 --- a/pkg/docs/MigratePrometheusDocker.md +++ /dev/null @@ -1,96 +0,0 @@ -# Migrate Prometheus Docker Volume - -If you want to keep your historical Prometheus data, and you generated your `harvest-compose.yml` file via `bin/harvest generate` before Harvest `22.11`, please follow the steps below to migrate your historical Prometheus data. - -This is not required if you generated your `harvest-compose.yml` file via `bin/harvest generate` at Harvest release `22.11` or after. - -Outline of steps: -1. [Stop Prometheus container so data acquiesces](#stop-prometheus-container) -2. [Find historical Prometheus volume and create new Prometheus data volume](#find-the-name-of-the-prometheus-volume-that-has-the-historical-data) -3. [Create a new Prometheus volume that Harvest 22.11 and after will use](#create-new-prometheus-volume) -4. [Copy the historical Prometheus data from the old volume to the new one](#copy-the-historical-prometheus-data) -5. [Optionally remove the historical Prometheus volume](#optionally-remove-historical-prometheus-data) - -## Stop Prometheus container - -It's safe to run the `stop` and `rm` commands below regardless if Prometheus is running or not since removing the container does not touch the historical data stored in the volume. - -Stop all containers named Prometheus and remove them. - -```bash -docker stop (docker ps -fname=prometheus -q) && docker rm (docker ps -a -fname=prometheus -q) -``` - -Docker may complain if the container is not running, like so. You can ignore this. - -
- Ignorable output when container is not running (click me) - -```bash -"docker stop" requires at least 1 argument. -See 'docker stop --help'. - -Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...] - -Stop one or more running containers -``` - -
- - -## Find the name of the Prometheus volume that has the historical data - -```bash -docker volume ls -f name=prometheus -q -``` - -Output should look like this: -```bash -harvest-22080-1_linux_amd64_prometheus_data # historical Prometheus data here -harvest_prometheus_data # it is fine if this line is missing -``` - -We want to copy the historical data from `harvest-22080-1_linux_amd64_prometheus_data` to `harvest_prometheus_data` - -> If `harvest_prometheus_data` already exists, you need to decide if you want to move that volume's data to a different volume or remove it. If you want to remove the volume, run `docker volume rm harvest_prometheus_data`. If you want to move the data, adjust the command below to first copy `harvest_prometheus_data` to a different volume and then remove it. - -## Create new Prometheus volume - -We're going to create a new mount named, `harvest_prometheus_data` by executing: - -```bash -docker volume create --name harvest_prometheus_data -``` - -## Copy the historical Prometheus data - -We will copy the historical Prometheus data from the old volume to the new one by -mounting both volumes and copying data between them. - -```bash -# replace `HISTORICAL_VOLUME` with the name of the Prometheus volume that contains you historical data found in step 2. -docker run --rm -it -v $HISTORICAL_VOLUME:/from -v harvest_prometheus_data:/to alpine ash -c "cd /from ; cp -av . /to" -``` - -Output will look something like this: - -```bash -'./wal' -> '/to/./wal' -'./wal/00000000' -> '/to/./wal/00000000' -'./chunks_head' -> '/to/./chunks_head' -... -``` - -## Optionally remove historical Prometheus data - -Before removing the historical data, [start your compose stack](https://github.com/NetApp/harvest/tree/main/docker#start-everything) and make sure everything works. - -Once you're satisfied that you can destroy the old data, remove it like so. - -```bash -# replace `HISTORICAL_VOLUME` with the name of the Prometheus volume that contains your historical data found in step 2. -docker volume rm $HISTORICAL_VOLUME -``` - -## Reference -- [Rename Docker Volume](https://github.com/moby/moby/issues/31154#issuecomment-360531460) \ No newline at end of file