Merge pull request #1987 from influxdata/influxdb-2.0.3

InfluxDB 2.0.3
pull/1989/head
noramullen1 2020-12-14 18:24:10 -08:00 committed by GitHub
commit 1250e842ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 208 additions and 151 deletions

View File

@ -90,7 +90,7 @@ To use the `influx` CLI to manage and interact with your InfluxDB Cloud instance
Click the following button to download and install `influx` CLI for macOS.
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_client_2.0.2_darwin_amd64.tar.gz" download>influx CLI (macOS)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb2_client_2.0.3_darwin_amd64.tar.gz" download>influx CLI (macOS)</a>
#### Step 2: Unpackage the influx binary
@ -102,7 +102,7 @@ or run the following command in a macOS command prompt application such
```sh
# Unpackage contents to the current working directory
tar zxvf ~/Downloads/influxdb_client_2.0.2_darwin_amd64.tar.gz
tar zxvf ~/Downloads/influxdb2_client_2.0.3_darwin_amd64.tar.gz
```
#### Step 3: (Optional) Place the binary in your $PATH
@ -114,7 +114,7 @@ prefix the executable with `./` to run in place. If the binary is on your $PATH,
```sh
# Copy the influx binary to your $PATH
sudo cp influxdb_client_2.0.2_darwin_amd64/influx /usr/local/bin/
sudo cp influxdb2_client_2.0.3_darwin_amd64/influx /usr/local/bin/
```
{{% note %}}
@ -158,8 +158,8 @@ To see all available `influx` commands, type `influx -h` or check out [influx -
Click one of the following buttons to download and install the `influx` CLI appropriate for your chipset.
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_client_2.0.2_linux_amd64.tar.gz" download >influx CLI (amd64)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_client_2.0.2_linux_arm64.tar.gz" download >influx CLI (arm)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_client_2.0.3_linux_amd64.tar.gz" download >influx CLI (amd64)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_client_2.0.3_linux_arm64.tar.gz" download >influx CLI (arm)</a>
#### Step 2: Unpackage the influx binary
@ -167,7 +167,7 @@ Click one of the following buttons to download and install the `influx` CLI appr
```sh
# Unpackage contents to the current working directory
tar xvfz influxdb_client_2.0.2_linux_amd64.tar.gz
tar xvfz influxdb_client_2.0.3_linux_amd64.tar.gz
```
#### Step 3: (Optional) Place the binary in your $PATH
@ -179,7 +179,7 @@ prefix the executable with `./` to run in place. If the binary is on your $PATH,
```sh
# Copy the influx and influxd binary to your $PATH
sudo cp influxdb_client_2.0.2_linux_amd64/influx /usr/local/bin/
sudo cp influxdb_client_2.0.3_linux_amd64/influx /usr/local/bin/
```
{{% note %}}

View File

@ -7,6 +7,9 @@ menu:
parent: influx
weight: 101
influxdb/cloud/tags: [delete]
related:
- /influxdb/cloud/write-data/delete-data
- /influxdb/cloud/reference/syntax/delete-predicate
---
{{< duplicate-oss >}}

View File

@ -11,6 +11,7 @@ menu:
weight: 104
influxdb/cloud/tags: [syntax, delete]
related:
- /influxdb/cloud/write-data/delete-data/
- /influxdb/cloud/reference/cli/influx/delete/
---

View File

@ -13,82 +13,5 @@ related:
- /influxdb/v2.0/reference/syntax/delete-predicate/
- /influxdb/v2.0/reference/cli/influx/delete/
---
<!--
## Delete data in the InfluxDB UI
Delete data from buckets you've created. You cannot delete data from system buckets.
### Delete data from buckets
1. Click **Load Data** in the navigation bar.
{{< nav-icon "load data" >}}
2. Select **Buckets**.
3. Next to the bucket with data you want to delete, click **Delete Data by Filter**.
4. In the **Delete Data** window that appears:
- Select a **Target Bucket** to delete data from.
- Enter a **Time Range** to delete data from.
- Click **+ Add Filter** to filter by tag key and value pair.
- Select **I understand that this cannot be undone**.
5. Click **Confirm Delete** to delete the selected data.
### Delete data from the Data Explorer
1. Click the **Data Explorer** icon in the sidebar.
{{< nav-icon "data-explorer" >}}
2. Click **Delete Data** in the top navigation bar.
3. In the **Delete Data** window that appears:
- Select a **Target Bucket** to delete data from.
- Enter a **Time Range** to delete data from.
- Click **+ Add Filter** to filter by tag key-value pairs.
- Select **I understand that this cannot be undone**.
4. Click **Confirm Delete** to delete the selected data.
!-->
Use the `influx` CLI or the InfluxDB API [`/delete`](/influxdb/v2.0/api/#/paths/~1delete/post) endpoint to delete data.
## Delete data using the influx CLI
{{% note %}}
If you haven't already, download and set up the [`influx` CLI](/influxdb/cloud/get-started/#optional-download-install-and-use-the-influx-cli). Following these setup instructions creates a configuration profile that stores your credentials, including your organization and token.
{{% /note %}}
1. Use the [`influx delete` command](/influxdb/v2.0/reference/cli/influx/delete/) to delete points from InfluxDB.
2. If you set up a configuration profile with your organization and token, specify the bucket (`-b`) to delete from. Otherwise, specify your organization (`-o`), bucket (`-b`), and authentication token (`-t`) with write permissions.
3. Define the time range to delete data from with the `--start` and `--stop` flags.
4. (Optional) Specify which points to delete using the predicate parameter and [delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate/).
#### Example
```sh
influx delete --bucket my-bucket \
--start '1970-01-01T00:00:00.00Z' \
--stop '2020-01-01T00:00:00.00Z' \
```
## Delete data using the API
1. Use the InfluxDB API `/delete` endpoint to delete points from InfluxDB.
2. Include your organization and bucket as query parameters in the request URL.
3. Use the `Authorization` header to provide your InfluxDB authentication token with write permissions.
4. In your request payload, define the time range to delete data from with `start` and `stop`.
5. (Optional) Specify which points to delete using the `predicate` parameter and [delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate/).
#### Example
```sh
curl --request POST \
https://cloud2.influxdata.com/api/v2/delete?org=<org-name>&bucket=<bucket-name> \
--header 'Authorization: Token <INFLUXDB_AUTH_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"predicate": "_measurement=\"example-measurement\" and _field=\"example-field\"",
"start": "2020-08-16T08:00:00Z",
"stop": "2020-08-17T08:00:00Z"
}'
```
_For more information, see the [`/delete` API documentation](/influxdb/v2.0/api/#/paths/~1delete/post)._
{{< duplicate-oss >}}

View File

@ -32,7 +32,7 @@ _See [Differences between InfluxDB Cloud and InfluxDB OSS](#differences-between-
Download InfluxDB v2.0 for macOS.
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb-2.0.2_darwin_amd64.tar.gz" download>InfluxDB v2.0 (macOS)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb-2.0.3_darwin_amd64.tar.gz" download>InfluxDB v2.0 (macOS)</a>
### (Optional) Verify the authenticity of downloaded binary
@ -50,13 +50,13 @@ If `gpg` is not available, see the [GnuPG homepage](https://gnupg.org/download/)
For example:
```
wget https://dl.influxdata.com/influxdb/releases/influxdb-2.0.2_darwin_amd64.tar.gz.asc
wget https://dl.influxdata.com/influxdb/releases/influxdb-2.0.3_darwin_amd64.tar.gz.asc
```
3. Verify the signature with `gpg --verify`:
```
gpg --verify influxdb-2.0.2_darwin_amd64.tar.gz.asc influxdb-2.0.2_darwin_amd64.tar.gz
gpg --verify influxdb-2.0.3_darwin_amd64.tar.gz.asc influxdb-2.0.3_darwin_amd64.tar.gz
```
The output from this command should include the following:
@ -73,7 +73,7 @@ or run the following command in a macOS command prompt application such
```sh
# Unpackage contents to the current working directory
tar zxvf ~/Downloads/influxdb-2.0.2_darwin_amd64.tar.gz
tar zxvf ~/Downloads/influxdb-2.0.3_darwin_amd64.tar.gz
```
#### (Optional) Place the binaries in your $PATH
@ -83,7 +83,7 @@ prefix the executables with `./` to run then in place.
```sh
# (Optional) Copy the influx and influxd binary to your $PATH
sudo cp influxdb-2.0.2_darwin_amd64/{influx,influxd} /usr/local/bin/
sudo cp influxdb-2.0.3_darwin_amd64/{influx,influxd} /usr/local/bin/
```
{{% note %}}
@ -152,7 +152,8 @@ influxd --reporting-disabled
Download InfluxDB v2.0 for Linux.
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb-2.0.2_linux_amd64.tar.gz" download >InfluxDB v2.0 (amd64)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb-2.0.3_linux_amd64.tar.gz" download >InfluxDB v2.0 (amd64)</a>
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb-2.0.3_linux_arm64.tar.gz" download >InfluxDB v2.0 (arm)</a>
### (Optional) Verify the authenticity of downloaded binary
@ -170,13 +171,13 @@ If `gpg` is not available, see the [GnuPG homepage](https://gnupg.org/download/)
For example:
```
wget https://dl.influxdata.com/influxdb/releases/influxdb-2.0.2_linux_amd64.tar.gz.asc
wget https://dl.influxdata.com/influxdb/releases/influxdb-2.0.3_linux_amd64.tar.gz.asc
```
3. Verify the signature with `gpg --verify`:
```
gpg --verify influxdb-2.0.2_linux_amd64.tar.gz.asc influxdb-2.0.2_linux_amd64.tar.gz
gpg --verify influxdb-2.0.3_linux_amd64.tar.gz.asc influxdb-2.0.3_linux_amd64.tar.gz
```
The output from this command should include the following:
@ -193,10 +194,10 @@ _**Note:** The following commands are examples. Adjust the file names, paths, an
```sh
# Unpackage contents to the current working directory
tar xvzf path/to/influxdb-2.0.2_linux_amd64.tar.gz
tar xvzf path/to/influxdb-2.0.3_linux_amd64.tar.gz
# Copy the influx and influxd binary to your $PATH
sudo cp influxdb-2.0.2_linux_amd64/{influx,influxd} /usr/local/bin/
sudo cp influxdb-2.0.3_linux_amd64/{influx,influxd} /usr/local/bin/
```
{{% note %}}
@ -253,7 +254,7 @@ Expose port `8086`, which InfluxDB uses for client-server communication over
the [InfluxDB HTTP API](/influxdb/v2.0/reference/api/).
```sh
docker run --name influxdb -p 8086:8086 quay.io/influxdb/influxdb:v2.0.2
docker run --name influxdb -p 8086:8086 quay.io/influxdb/influxdb:v2.0.3
```
_To run InfluxDB in [detached mode](https://docs.docker.com/engine/reference/run/#detached-vs-foreground), include the `-d` flag in the `docker run` command._

View File

@ -7,32 +7,61 @@ menu:
parent: influx
weight: 101
influxdb/v2.0/tags: [delete]
related:
- /influxdb/v2.0/write-data/delete-data
- /influxdb/v2.0/reference/syntax/delete-predicate
---
The `influx delete` command deletes [points](/influxdb/v2.0/reference/glossary/#point)
from an InfluxDB bucket. Identify points to delete using [delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate).
{{% note %}}
In **InfluxDB OSS 2.0rc**, the `influx delete --predicate` flag has been disabled.
The `-p`, `--predicate` flag is supported in **InfluxDB Cloud** and **InfluxDB OSS 2.0 beta 16 or earlier**.
from an InfluxDB bucket in a specified time range.
Select points to delete within the specified time range using [delete predicate syntax](/influxdb/v2.0/reference/syntax/delete-predicate).
{{% warn %}}
Running `influx delete` without the `-p` or `--predicate` flag deletes all data with timestamps between the specified
`--start` and `--stop` times in the specified bucket.
{{% /note %}}
{{% /warn %}}
## Flags
| Flag | | Description | Input type | {{< cli/mapped >}} |
|:---- |:--- |:----------- |:----------:|:------------------ |
| `-c` | `--active-config` | CLI configuration to use for command | string | |
| `-b` | `--bucket` | Name of bucket to remove data from | string | `INFLUX_BUCKET_NAME` |
| | `--bucket-id` | Bucket ID | string | `INFLUX_BUCKET_ID` |
| | `--configs-path` | Path to `influx` CLI configurations (default `~/.influxdbv2/configs`) | string |`INFLUX_CONFIGS_PATH` |
| `-h` | `--help` | Help for the `delete` command | | |
| | `--host` | HTTP address of InfluxDB (default `http://localhost:8086`) | string | `INFLUX_HOST` |
| `-o` | `--org` | Organization name | string | `INFLUX_ORG` |
| | `--org-id` | Organization ID | string | `INFLUX_ORG_ID` |
| `-p` | `--predicate` | Only supported in InfluxDB Cloud and InfluxDB OSS 2.0 beta 16 or earlier InfluxQL-like predicate string (see [Delete predicate](/influxdb/v2.0/reference/syntax/delete-predicate)). | string | |
| | `--skip-verify` | Skip TLS certificate verification | | |
| | `--start` | Start time in RFC3339 format (i.e. `2009-01-02T23:00:00Z`) | string | |
| | `--stop` | Stop time in RFC3339 format (i.e. `2009-01-02T23:00:00Z`) | string | |
| `-t` | `--token` | Authentication token | string | `INFLUX_TOKEN` |
| Flag | | Description | Input type | {{< cli/mapped >}} |
|:---- |:--- |:----------- |:----------:|:------------------ |
| `-c` | `--active-config` | CLI configuration to use for command | string | |
| | `--bucket` | Name of bucket to remove data from | string | `INFLUX_BUCKET_NAME` |
| | `--bucket-id` | Bucket ID | string | `INFLUX_BUCKET_ID` |
| | `--configs-path` | Path to `influx` CLI configurations (default `~/.influxdbv2/configs`) | string |`INFLUX_CONFIGS_PATH` |
| `-h` | `--help` | Help for the `delete` command | | |
| | `--host` | HTTP address of InfluxDB (default `http://localhost:8086`) | string | `INFLUX_HOST` |
| `-o` | `--org` | Organization name | string | `INFLUX_ORG` |
| | `--org-id` | Organization ID | string | `INFLUX_ORG_ID` |
| `-p` | `--predicate` | InfluxQL-like predicate string (see [Delete predicate](/influxdb/v2.0/reference/syntax/delete-predicate)) | string | |
| | `--skip-verify` | Skip TLS certificate verification | | |
| | `--start` | ({{< req >}}) Start time in RFC3339 format (i.e. `2009-01-02T23:00:00Z`) | string | |
| | `--stop` | ({{< req >}}) Stop time in RFC3339 format (i.e. `2009-01-02T23:00:00Z`) | string | |
| `-t` | `--token` | Authentication token | string | `INFLUX_TOKEN` |
## Examples
##### Delete all points in a measurement
```sh
influx delete \
--bucket example-bucket \
--start 1970-01-01T00:00:00Z \
--stop $(date +"%Y-%m-%dT%H:%M:%SZ") \
--predicate '_measurement="example-measurement"'
```
##### Delete points in a measurement with a specific tag value
```sh
influx delete \
--bucket example-bucket \
--start 1970-01-01T00:00:00Z \
--stop $(date +"%Y-%m-%dT%H:%M:%SZ") \
--predicate '_measurement="example-measurement" AND host="old-host"'
```
##### Delete all points within a specified time frame
```sh
influx delete \
--bucket example-bucket \
--start 2020-03-01T00:00:00Z \
--stop 2020-11-14T00:00:00Z
```

View File

@ -54,4 +54,5 @@ influxd upgrade [command]
| `-t` | `--token` | Token for username. If not specified, a token is auto-generated. | string |
| `-u` | `--username` | Primary username | string |
| | `--v1-dir` | Path to source 1.x `db` directory containing `meta`, `data`, and `wal` sub-folders (default `~/.influxdb`) | string |
| | `--v2-config-path` | Destination path for upgraded 2.x configuration file (default `~/.influxdbv2/config.toml`) | string |
| `-v` | `--verbose` | Verbose output | |

View File

@ -8,6 +8,50 @@ menu:
weight: 101
---
## v2.0.3 General Availability [2020-12-14]
### Breaking Changes
#### `influxd upgrade`
Previously, `influxd upgrade` would attempt to write upgraded `config.toml` files into the same directory as the source
`influxdb.conf` file. If this failed, a warning would be logged and `config.toml` would write into the `home` directory of the user who launched the upgrade.
This release breaks this behavior in two ways:
- By default, `config.toml` writes into the same directory as the Bolt DB and engine files (`~/.influxdbv2/`)
- If writing upgraded config fails, the `upgrade` process exits with an error instead of falling back to the `HOME` directory
To override the default configuration path (`~/.influxdbv2/`), use the new `--v2-config-path` option to specify the output path to the v2 configuration file (`config.toml`). For details, see [Upgrade from InfluxDB 1.x to InfluxDB 2.0](/influxdb/v2.0/upgrade/v1-to-v2/).
#### InfluxDB v2 packaging
We've renamed the InfluxDB v2 DEB and RPM packages to clarify versions. The package name is now `influxdb2` and conflicts with any previous `influxdb` package (including initial 2.0.0, 2.0.1, and 2.0.2 packages).
This release also defines v2-specific path defaults and provides [helper scripts](https://github.com/influxdata/influxdb/blob/master/scripts/influxdb2-upgrade.sh) for `influxd upgrade` and cleanup cases.
### Features
- Allow password to be specified as a CLI option in [`influx v1 auth create`](/influxdb/cloud/reference/cli/influx/auth/create/).
- Allow password to be specified as a CLI option in [`influx v1 auth set-password`](/influxdb/cloud/reference/cli/influx/auth/).
- Implement [delete with predicate](/influxdb/v2.0/write-data/delete-data/).
- Improve ID-related error messages for `influx v1 dbrp` commands.
- Update Flux to [v0.98.0](/influxdb/v2.0/reference/release-notes/flux/#v0-98-0-2020-12-07).
- Update `flux-lsp-browser` to v0.5.25.
- Support for ARM64 preview build.
### Bug Fixes
- Don't log bodies of v1 write request bodies.
- Fix panic when writing a point with 100 or more tags.
- Fix validation of existing DB names when creating DBRP mappings.
- Enforce max value of 2147483647 on query concurrency to avoid startup panic.
- Automatically migrate existing DBRP mappings from old schema to avoid panic.
- Optimize shard lookup in groups containing only one shard.
- Always respect the `--name` option in `influx setup`.
- Allow for 0 (infinite) values for `--retention` in `influx setup`.
- Fix panic when using a `null` value as a record or array in a Flux query.
## v2.0.2 General Availability [2020-11-19]
### Breaking changes

View File

@ -2,8 +2,7 @@
title: Delete predicate syntax
list_title: Delete predicate
description: >
The InfluxDB `/delete` endpoint uses an InfluxQL-like predicate syntax to determine
what data points to delete.
InfluxDB uses an InfluxQL-like predicate syntax to determine what data points to delete.
menu:
influxdb_2_0_ref:
parent: Syntax
@ -11,17 +10,12 @@ menu:
weight: 104
influxdb/v2.0/tags: [syntax, delete]
related:
- /influxdb/v2.0/write-data/delete-data/
- /influxdb/v2.0/reference/cli/influx/delete/
---
{{% note %}}
In **InfluxDB OSS 2.0rc**, the delete with predicate API (`/api/v2/delete`) has been disabled and returns a 501 Not implemented message.
Use the InfluxDB `/delete` endpoint with **InfluxDB Cloud** and **InfluxDB OSS 2.0 beta 16 or earlier**.
{{% /note %}}
The InfluxDB `/delete` endpoint uses an InfluxQL-like predicate syntax to determine
what data [points](/influxdb/v2.0/reference/glossary/#point) to delete.
InfluxDB uses an InfluxQL-like predicate syntax to determine what data
[points](/influxdb/v2.0/reference/glossary/#point) to delete.
InfluxDB uses the delete predicate to evaluate the [series keys](/influxdb/v2.0/reference/glossary/#series-key)
of points in the time range specified in the delete request.
Points with series keys that evaluate to `true` for the given predicate are deleted.

View File

@ -23,7 +23,7 @@ If you're upgrading from InfluxDB 1.x on Docker, we recommend waiting to upgrade
Specifically, the upgrade process does the following:
1. Reads the existing InfluxDB 1.x configuration file and generates an equivalent InfluxDB 2.0 configuration file at `~/.influxdbv2/config.toml`.
1. Reads the existing InfluxDB 1.x configuration file and generates an equivalent InfluxDB 2.0 configuration file at `~/.influxdbv2/config.toml` or at a custom path specified with the `--v2-config-path` flag.
2. Upgrades metadata and storage engine paths to `~/.influxdbv2/meta` and `~/.influxdbv2/engine`, respectively (unless otherwise specified).
3. Writes existing data and write ahead log (WAL) files into InfluxDB 2.0 [buckets](/influxdb/v2.0/reference/glossary/#bucket).
4. Creates [database and retention policy (DBRP) mappings](/influxdb/v2.0/reference/api/influxdb-1x/dbrp/) required to query data with InfluxQL.
@ -55,7 +55,7 @@ InfluxDB 2.0 requires 64-bit operating systems.
{{% /warn %}}
InfluxDB 2.0 is currently available for macOS and Linux.
Docker images, ARM builds, and Windows builds are not currently available,
Docker images and Windows builds are not currently available,
but are planned for subsequent releases.
### Continuous queries
@ -138,7 +138,7 @@ and test your credentials to ensure your applications, agents, and visualization
If you upgrade with `auth-enabled = false`, the upgrade may appear complete,
but client requests to InfluxDB 2.0 may be silently ignored (you won't see a notification the request was denied).
## Perform the upgrade
If you've considered the [guidance above](#before-you-begin-important-considerations)
@ -166,6 +166,12 @@ and are ready to proceed, follow these steps to upgrade your InfluxDB 1.x to Inf
influxd upgrade --config-file <path to v1 config file>
```
To store the upgraded 2.0 configuration file in a custom location, include the `--v2-config-path` flag:
```sh
influxd upgrade --v2-config-path <destination path for v2 config file>
```
5. Follow the prompts to set up a new InfluxDB 2.0 instance.
```

View File

@ -13,6 +13,7 @@ related:
- /influxdb/v2.0/reference/syntax/delete-predicate/
- /influxdb/v2.0/reference/cli/influx/delete/
---
<!--
## Delete data in the InfluxDB UI
@ -48,42 +49,95 @@ Delete data from buckets you've created. You cannot delete data from system buck
4. Click **Confirm Delete** to delete the selected data.
!-->
Use the `influx` CLI or the InfluxDB API [`/delete`](/influxdb/v2.0/api/#/paths/~1delete/post) endpoint to delete data.
Use the [`influx` CLI](/influxdb/v2.0/reference/cli/influx/) or the InfluxDB API
[`/api/v2/delete`](/influxdb/v2.0/api/#operation/PostDelete) endpoint to delete data.
- [Delete data using the influx CLI](#delete-data-using-the-influx-cli)
- [Delete data using the API](#delete-data-using-the-api)
{{% note %}}
The `influx delete --predicate` flag is currently disabled and will be re-enabled in an upcoming release. Deleting data without a predicate deletes all data in the specified bucket with timestamps between the specified `start` and `stop` times.
{{% /note %}}
## Delete data using the influx CLI
{{% note %}}
Use [InfluxDB CLI connection configurations](/influxdb/v2.0/reference/cli/influx/config/)
to provide your **InfluxDB host, organization, and authentication token**.
{{% /note %}}
1. Use the [`influx delete` command](/influxdb/v2.0/reference/cli/influx/delete/) to delete points from InfluxDB.
2. Specify your organization, bucket, and authentication token.
3. Define the time range to delete data from with the `--start` and `--stop` flags.
2. Use the `--bucket` flag to specify which bucket to delete data from.
3. Use the `--start` and `--stop` flags to define the time range to delete data from.
Use [RFC3339 timestamps](/influxdb/v2.0/reference/glossary/#rfc3339-timestamp).
4. _(Optional)_ Use the `-p`, `--predicate` flag to include a [delete predicate](/influxdb/v2.0/reference/syntax/delete-predicate)
that identifies which points to delete.
#### Example
{{% warn %}}
Deleting data without a [delete predicate](/influxdb/v2.0/reference/syntax/delete-predicate)
deletes all data in the specified bucket with timestamps between the specified `start` and `stop` times.
{{% /warn %}}
### Examples
##### Delete points in a specific measurement with a specific tag value
```sh
influx delete -o my-org -b my-bucket -t $INFLUX_TOKEN \
 --start '1970-01-01T00:00:00.00Z' \
 --stop '2020-01-01T00:00:00.00Z' \
influx delete --bucket example-bucket \
 --start '1970-01-01T00:00:00Z' \
  --stop $(date +"%Y-%m-%dT%H:%M:%SZ") \
--predicate '_measurement="example-measurement" AND exampleTag="exampleTagValue"'
```
##### Delete all points in a specified time range
```sh
influx delete --bucket example-bucket \
--start 2020-03-01T00:00:00Z \
--stop 2020-11-14T00:00:00Z
```
## Delete data using the API
Use the InfluxDB API [`/api/v2/delete` endpoint](/influxdb/v2.0/api/#operation/PostDelete)
to delete points from InfluxDB.
Include the following:
1. Use the InfluxDB API `/delete` endpoint to delete points from InfluxDB.
2. Include your organization and bucket as query parameters in the request URL.
3. Use the `Authorization` header to provide your InfluxDB authentication token.
4. In your request payload, define the time range to delete data from with `start` and `stop`.
- **Request method:** `POST`
- **Headers:**
- **Authorization:** `Token` schema with your InfluxDB authentication token
- **Content-type:** `application/json`
- **Query parameters:**
- **org** or **orgID:** organization name or [organization ID](/influxdb/v2.0/organizations/view-orgs/#view-your-organization-id)
- **bucket** or **bucketID:** bucket name or [bucket ID](/influxdb/v2.0/organizations/buckets/view-buckets/)
- **Request body:** JSON object with the following fields:
{{< req type="key" >}}
- {{< req "\*" >}} **start:** earliest time to delete data from ([RFC3339](/influxdb/v2.0/reference/glossary/#rfc3339-timestamp))
- {{< req "\*" >}} **stop:** latest time to delete data from ([RFC3339](/influxdb/v2.0/reference/glossary/#rfc3339-timestamp))
- **predicate:** [delete predicate](/influxdb/v2.0/reference/syntax/delete-predicate) statement
#### Example
{{% warn %}}
Deleting data without a [delete predicate](/influxdb/v2.0/reference/syntax/delete-predicate)
deletes all data in the specified bucket with timestamps between the specified `start` and `stop` times.
{{% /warn %}}
#### Examples
##### Delete points in a specific measurement with a specific tag value
```sh
curl --request POST http://localhost:8086/api/v2/delete/?org=myOrg&bucket=myBucket \
curl --request POST http://localhost:8086/api/v2/delete/?org=example-org&bucket=example-bucket \
--header 'Authorization: Token <YOURAUTHTOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"start": "1970-01-01T00:00:00.00Z",
"stop": "2020-01-01T00:00:00.00Z"
"start": "2020-03-01T00:00:00Z",
"stop": "2020-11-14T00:00:00Z",
"predicate": "_measurement=\"example-measurement\" AND exampleTag=\"exampleTagValue\""
}'
```
_For more information, see the [`/delete` API documentation](/influxdb/v2.0/api/#/paths/~1delete/post)._
##### Delete all points in a specified time range
```sh
curl --request POST http://localhost:8086/api/v2/delete/?org=example-org&bucket=example-bucket \
--header 'Authorization: Token <YOURAUTHTOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"start": "2020-03-01T00:00:00Z",
"stop": "2020-11-14T00:00:00Z"
}'
```
_For more information, see the [`/api/v2/delete` endpoint documentation](/influxdb/v2.0/api/#operation/PostDelete)._

View File

@ -1,5 +1,6 @@
{{ $currentVersion := (index (findRE "[^/]+.*?" .Page.RelPermalink) 0) }}
{{ $product := (index (findRE "[^/]+.*?" .Page.RelPermalink) 0) }}
{{ $currentVersion := (index (findRE "[^/]+.*?" .Page.RelPermalink) 1) }}
{{ $cli := replaceRE "/cli/" "" (index (findRE "/cli/[a-z]*" .Page.RelPermalink) 0) }}
{{ $link := print "/" $currentVersion "/reference/cli/" $cli "/#mapped-environment-variables"}}
{{ $link := print "/" $product "/" $currentVersion "/reference/cli/" $cli "/#mapped-environment-variables"}}
Maps to <a class="q-link" href="{{ $link }}">?</a>