fix: LInks and headings. Replace `latest` with `v2`. Specify OSS v2 in headings. Closes fix(api-refs): specify v2 in InfluxDB OSS headings #5866, Closes Flux docs: replace `/influxdb/latest` with `/influxdb/v2` #5864. Linting cleanup, removing terminal prompt from examples
parent
4887aa5b66
commit
4403dd9a18
|
@ -66,7 +66,7 @@ The tests defined in `compose.yaml` use the dependencies and execution
|
|||
environment from this image.
|
||||
|
||||
```bash
|
||||
docker build -t influxdata:docs-pytest -f Dockerfile.pytest .
|
||||
docker build -t influxdata/docs-pytest:latest -f Dockerfile.pytest .
|
||||
```
|
||||
|
||||
### Run the documentation locally (optional)
|
||||
|
|
|
@ -32,7 +32,8 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
|||
python3-venv \
|
||||
rsync \
|
||||
telegraf \
|
||||
wget
|
||||
wget \
|
||||
yq
|
||||
|
||||
# Install InfluxDB 3 Core
|
||||
RUN curl -O https://www.influxdata.com/d/install_influxdb3.sh \
|
||||
|
|
|
@ -84,6 +84,9 @@ services:
|
|||
- type: volume
|
||||
source: test-content
|
||||
target: /app/content
|
||||
- type: bind
|
||||
source: ./test/shared/influxdb-templates
|
||||
target: /root/influxdb-templates
|
||||
working_dir: /app
|
||||
cloud-dedicated-pytest:
|
||||
container_name: cloud-dedicated-pytest
|
||||
|
|
|
@ -162,7 +162,7 @@ curl -XGET "localhost:8086/health"
|
|||
|
||||
### `/api/v2/buckets/` HTTP endpoint
|
||||
|
||||
The [/api/v2/buckets](/influxdb/latest/api/#tag/Buckets) endpoint accepts `GET`, `POST` and `DELETE` HTTP requests. Use this endpoint to [create](/influxdb/latest/api/#operation/PostBuckets), [delete](/influxdb/latest/api/#operation/DeleteBucketsID), [list](/influxdb/latest/api/#operation/GetBuckets), [update](/influxdb/latest/api/#operation/PatchBucketsID) and [retrieve](/influxdb/latest/api/#operation/GetBucketsID) buckets in your InfluxDB instance. Note that InfluxDB 2.x uses organizations and buckets instead of databases and retention policies.
|
||||
The [/api/v2/buckets](/influxdb/v2/api/#tag/Buckets) endpoint accepts `GET`, `POST` and `DELETE` HTTP requests. Use this endpoint to [create](/influxdb/v2/api/#operation/PostBuckets), [delete](/influxdb/v2/api/#operation/DeleteBucketsID), [list](/influxdb/v2/api/#operation/GetBuckets), [update](/influxdb/v2/api/#operation/PatchBucketsID) and [retrieve](/influxdb/v2/api/#operation/GetBucketsID) buckets in your InfluxDB instance. Note that InfluxDB 2.x uses organizations and buckets instead of databases and retention policies.
|
||||
|
||||
**Include the following URL parameters:**
|
||||
|
||||
|
@ -201,7 +201,7 @@ curl --request DELETE "http://localhost:8086/api/v2/buckets/test/autogen"
|
|||
|
||||
### `/api/v2/delete/` HTTP endpoint
|
||||
|
||||
The [`/api/v2/delete`](/influxdb/latest/api/#tag/Delete) endpoint accepts `POST` HTTP requests. Use this endpoint to delete points from InfluxDB, including points with specific tag values, timestamps and measurements.
|
||||
The [`/api/v2/delete`](/influxdb/v2/api/#tag/Delete) endpoint accepts `POST` HTTP requests. Use this endpoint to delete points from InfluxDB, including points with specific tag values, timestamps and measurements.
|
||||
|
||||
**Include the following URL parameters:**
|
||||
|
||||
|
@ -353,8 +353,12 @@ curl http://localhost:8086/debug/requests
|
|||
##### Track requests over a ten-second interval
|
||||
|
||||
```bash
|
||||
$ curl http://localhost:8086/debug/requests
|
||||
curl http://localhost:8086/debug/requests
|
||||
```
|
||||
|
||||
The response body contains data in JSON format:
|
||||
|
||||
```JSON
|
||||
{
|
||||
"user1:123.45.678.91": {"writes":1,"queries":0},
|
||||
}
|
||||
|
@ -365,8 +369,12 @@ The response shows that, over the past ten seconds, the `user1` user sent one re
|
|||
##### Track requests over a one-minute interval
|
||||
|
||||
```bash
|
||||
$ curl http://localhost:8086/debug/requests?seconds=60
|
||||
curl http://localhost:8086/debug/requests?seconds=60
|
||||
```
|
||||
|
||||
The response body contains data in JSON format:
|
||||
|
||||
```JSON
|
||||
{
|
||||
"user1:123.45.678.91": {"writes":3,"queries":0},
|
||||
"user1:000.0.0.0": {"writes":0,"queries":16},
|
||||
|
@ -468,8 +476,12 @@ Those `SELECT` queries require a `POST` request.
|
|||
###### Query data with a `SELECT` statement
|
||||
|
||||
```bash
|
||||
$ curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
```
|
||||
|
||||
The response body contains data in JSON format:
|
||||
|
||||
```JSON
|
||||
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:16:18Z",33.1,null,null],["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]}
|
||||
```
|
||||
|
||||
|
@ -490,8 +502,12 @@ time myfield mytag1 mytag2
|
|||
##### Query data with a `SELECT` statement and an `INTO` clause
|
||||
|
||||
```bash
|
||||
$ curl -XPOST 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * INTO "newmeas" FROM "mymeas"'
|
||||
curl -XPOST 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * INTO "newmeas" FROM "mymeas"'
|
||||
```
|
||||
|
||||
The response body contains data in JSON format:
|
||||
|
||||
```JSON
|
||||
{"results":[{"statement_id":0,"series":[{"name":"result","columns":["time","written"],"values":[["1970-01-01T00:00:00Z",2]]}]}]}
|
||||
```
|
||||
|
||||
|
@ -503,8 +519,12 @@ Note that the system uses epoch 0 (`1970-01-01T00:00:00Z`) as a [null timestamp
|
|||
##### Create a database
|
||||
|
||||
```bash
|
||||
$ curl -XPOST 'http://localhost:8086/query' --data-urlencode 'q=CREATE DATABASE "mydb"'
|
||||
curl -XPOST 'http://localhost:8086/query' --data-urlencode 'q=CREATE DATABASE "mydb"'
|
||||
```
|
||||
|
||||
The response data is similar to the following:
|
||||
|
||||
```JSON
|
||||
{"results":[{"statement_id":0}]}
|
||||
```
|
||||
|
||||
|
@ -536,7 +556,7 @@ See below for an [example](#create-a-database-using-basic-authentication) of bas
|
|||
##### Query data with a `SELECT` statement and return pretty-printed JSON
|
||||
|
||||
```bash
|
||||
$ curl -G 'http://localhost:8086/query?db=mydb&pretty=true' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
curl -G 'http://localhost:8086/query?db=mydb&pretty=true' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
|
||||
{
|
||||
"results": [
|
||||
|
@ -575,8 +595,12 @@ $ curl -G 'http://localhost:8086/query?db=mydb&pretty=true' --data-urlencode 'q=
|
|||
##### Query data with a `SELECT` statement and return second precision epoch timestamps
|
||||
|
||||
```bash
|
||||
$ curl -G 'http://localhost:8086/query?db=mydb&epoch=s' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
curl -G 'http://localhost:8086/query?db=mydb&epoch=s' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
```
|
||||
|
||||
The response body data is similar to the following:
|
||||
|
||||
```bash
|
||||
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[[1488327378,33.1,null,null],[1488327438,12.4,"12","14"]]}]}]}
|
||||
```
|
||||
|
||||
|
@ -586,7 +610,7 @@ The following example shows how to authenticate with v1.x credentials in the que
|
|||
create a database:
|
||||
|
||||
```bash
|
||||
$ curl -XPOST 'http://localhost:8086/query?u=myusername&p=mypassword' --data-urlencode 'q=CREATE DATABASE "mydb"'
|
||||
curl -XPOST 'http://localhost:8086/query?u=myusername&p=mypassword' --data-urlencode 'q=CREATE DATABASE "mydb"'
|
||||
```
|
||||
|
||||
The response body contains the following:
|
||||
|
@ -698,26 +722,37 @@ Delimit multiple placeholder key-value pairs with comma `,`.
|
|||
##### Send multiple queries
|
||||
|
||||
```bash
|
||||
$ curl -G 'http://localhost:8086/query?db=mydb&epoch=s' --data-urlencode 'q=SELECT * FROM "mymeas";SELECT mean("myfield") FROM "mymeas"'
|
||||
curl -G 'http://localhost:8086/query?db=mydb&epoch=s' --data-urlencode 'q=SELECT * FROM "mymeas";SELECT mean("myfield") FROM "mymeas"'
|
||||
```
|
||||
|
||||
The response body contains results for both queries:
|
||||
|
||||
```JSON
|
||||
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[[1488327378,33.1,null,null],[1488327438,12.4,"12","14"]]}]},{"statement_id":1,"series":[{"name":"mymeas","columns":["time","mean"],"values":[[0,22.75]]}]}]}
|
||||
```
|
||||
|
||||
The request includes two queries: `SELECT * FROM "mymeas"` and `SELECT mean("myfield") FROM "mymeas"'`.
|
||||
In the results, the system assigns a statement identifier to each query return.
|
||||
The first query's result has a `statement_id` of `0` and the second query's result has a `statement_id` of `1`.
|
||||
- The request includes two queries: `SELECT * FROM "mymeas"` and `SELECT mean("myfield") FROM "mymeas"'`.
|
||||
- In the results, InfluxDB assigns a statement identifier to each query:
|
||||
- `"statement_id": 0`: the first query
|
||||
- `"statement_id": 1`: the second query
|
||||
|
||||
##### Request query results in CSV format
|
||||
|
||||
```bash
|
||||
$ curl -H "Accept: application/csv" -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
To format results in CSV, specify `application/csv` in the HTTP `Accept` header--for example:
|
||||
|
||||
```bash
|
||||
curl -H "Accept: application/csv" -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
```
|
||||
|
||||
The response body contains data in CSV format:
|
||||
|
||||
```csv
|
||||
name,tags,time,myfield,mytag1,mytag2
|
||||
mymeas,,1488327378000000000,33.1,mytag1,mytag2
|
||||
mymeas,,1488327438000000000,12.4,12,14
|
||||
```
|
||||
|
||||
The first point has no [tag values](/enterprise_influxdb/v1/concepts/glossary/#tag-value) for the `mytag1` and `mytag2` [tag keys](/enterprise_influxdb/v1/concepts/glossary/#tag-key).
|
||||
- In the sample data, the first point doesn't contain [tag values](/enterprise_influxdb/v1/concepts/glossary/#tag-value) for the `mytag1` and `mytag2` [tag keys](/enterprise_influxdb/v1/concepts/glossary/#tag-key).
|
||||
|
||||
##### Submit queries from a file
|
||||
|
||||
|
@ -734,57 +769,77 @@ CREATE RETENTION POLICY four_weeks ON mydb DURATION 4w REPLICATION 1;
|
|||
|
||||
##### Bind a parameter in the `WHERE` clause to specific tag value
|
||||
|
||||
```bash
|
||||
$ curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "mytag1" = $tag_value' --data-urlencode 'params={"tag_value":"12"}'
|
||||
Use the `params` option to pass arguments for a parameterized query--for example:
|
||||
|
||||
```bash
|
||||
curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "mytag1" = $tag_value' --data-urlencode 'params={"tag_value":"12"}'
|
||||
```
|
||||
|
||||
The response data is similar to the following:
|
||||
|
||||
```JSON
|
||||
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]}
|
||||
```
|
||||
|
||||
The request maps `$tag_value` to `12`.
|
||||
InfluxDB stores [tag values](/enterprise_influxdb/v1/concepts/glossary/#tag-value) as strings they and must be double quoted in the request.
|
||||
- In the request, `params` maps `$tag_value` to `"12"`.
|
||||
Because InfluxDB stores [tag values](/enterprise_influxdb/v1/concepts/glossary/#tag-value) as strings, you must double-quote them in parameter values.
|
||||
- During query execution, InfluxDB substitutes the parameter values for the associated keys in the query.
|
||||
|
||||
##### Bind a parameter in the `WHERE` clause to a numerical field value
|
||||
|
||||
```bash
|
||||
$ curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "myfield" > $field_value' --data-urlencode 'params={"field_value":30}'
|
||||
curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "myfield" > $field_value' --data-urlencode 'params={"field_value":30}'
|
||||
```
|
||||
|
||||
The response data is similar to the following:
|
||||
|
||||
```JSON
|
||||
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:16:18Z",33.1,null,null]]}]}]}
|
||||
```
|
||||
|
||||
The request maps `$field_value` to `30`.
|
||||
The value `30` does not require double quotes because `myfield` stores numerical [field values](/enterprise_influxdb/v1/concepts/glossary/#field-value).
|
||||
- In the request, `params` maps `$field_value` to `30`. Because `myfield` stores numerical [field values](/enterprise_influxdb/v1/concepts/glossary/#field-value), the parameter value `30` does not require double quotes.
|
||||
- During query execution, InfluxDB substitutes the parameter values for the associated keys in the query.
|
||||
|
||||
##### Bind two parameters in the `WHERE` clause to a specific tag value and numerical field value
|
||||
|
||||
```bash
|
||||
$ curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "mytag1" = $tag_value AND "myfield" < $field_value' --data-urlencode 'params={"tag_value":"12","field_value":30}'
|
||||
curl -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas" WHERE "mytag1" = $tag_value AND "myfield" < $field_value' --data-urlencode 'params={"tag_value":"12","field_value":30}'
|
||||
```
|
||||
|
||||
The response data is similar to the following:
|
||||
|
||||
```JSON
|
||||
{"results":[{"statement_id":0,"series":[{"name":"mymeas","columns":["time","myfield","mytag1","mytag2"],"values":[["2017-03-01T00:17:18Z",12.4,"12","14"]]}]}]}
|
||||
```
|
||||
|
||||
The request maps `$tag_value` to `12` and `$field_value` to `30`.
|
||||
- In the request, `params` maps `$tag_value` to `12` and `$field_value` to `30`.
|
||||
- During query execution, InfluxDB substitutes the parameter values for the associated keys in the query.
|
||||
|
||||
#### Status codes and responses
|
||||
|
||||
The API response body contains results or error messages in JSON format.
|
||||
To pretty-print JSON for viewing, include the query string parameter `pretty=true`
|
||||
or pipe the response to a JSON-processor like [**jq**](https://stedolan.github.io/jq/).
|
||||
or pipe the response to a JSON-processor, such as [**jq**](https://stedolan.github.io/jq/).
|
||||
|
||||
##### Summary table
|
||||
|
||||
| HTTP status code | Description |
|
||||
| :--------------- | :---------- |
|
||||
| 200 OK | Success. Response body contains data in JSON format. |
|
||||
| 400 Bad Request | Unacceptable request. Can occur with a syntactically incorrect query. Response body contains an error message with additional information in JSON format. |
|
||||
| 401 Unauthorized | Unacceptable request. Can occur with invalid authentication credentials. |
|
||||
| `200 OK` | Success. Response body contains data in JSON format. |
|
||||
| `400 Bad Request` | Unacceptable request. Can occur with a syntactically incorrect query. Response body contains an error message with additional information in JSON format. |
|
||||
| `401 Unauthorized` | Unacceptable request. Can occur with invalid authentication credentials. |
|
||||
|
||||
#### Examples
|
||||
|
||||
##### A successful request that returns data
|
||||
|
||||
```bash
|
||||
$ curl -i -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
curl -i -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
```
|
||||
|
||||
The response is HTTP status `200 OK` and the body contains data in JSON format:
|
||||
|
||||
```
|
||||
HTTP/1.1 200 OK
|
||||
Connection: close
|
||||
Content-Type: application/json
|
||||
|
@ -799,8 +854,11 @@ Transfer-Encoding: chunked
|
|||
##### A query that contains an error
|
||||
|
||||
```bash
|
||||
$ curl -i -G 'http://localhost:8086/query?db=mydb1' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
curl -i -G 'http://localhost:8086/query?db=mydb1' --data-urlencode 'q=SELECT * FROM "mymeas"'
|
||||
|
||||
The response body contains details about the error:
|
||||
|
||||
```
|
||||
HTTP/1.1 200 OK
|
||||
Connection: close
|
||||
Content-Type: application/json
|
||||
|
@ -815,8 +873,13 @@ Transfer-Encoding: chunked
|
|||
##### An incorrectly formatted query
|
||||
|
||||
```bash
|
||||
$ curl -i -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT *'
|
||||
curl -i -G 'http://localhost:8086/query?db=mydb' --data-urlencode 'q=SELECT *'
|
||||
```
|
||||
|
||||
The response is HTTP status `400 Bad Request` and the body contains details
|
||||
about the error:
|
||||
|
||||
```
|
||||
HTTP/1.1 400 Bad Request
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
|
@ -830,8 +893,12 @@ Content-Length: 76
|
|||
##### A request with invalid authentication credentials
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST 'http://localhost:8086/query?u=myusername&p=notmypassword' --data-urlencode 'q=CREATE DATABASE "mydb"'
|
||||
curl -i -XPOST 'http://localhost:8086/query?u=myusername&p=notmypassword' --data-urlencode 'q=CREATE DATABASE "mydb"'
|
||||
```
|
||||
|
||||
The response is HTTP status `401 Unauthorized` and the body contains the error message.
|
||||
|
||||
```
|
||||
HTTP/1.1 401 Unauthorized
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
|
@ -878,8 +945,12 @@ in significant improvements in compression.
|
|||
##### Write a point to the database `mydb` with a timestamp in seconds
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST "http://localhost:8086/write?db=mydb&precision=s" --data-binary 'mymeas,mytag=1 myfield=90 1463683075'
|
||||
curl -i -XPOST "http://localhost:8086/write?db=mydb&precision=s" --data-binary 'mymeas,mytag=1 myfield=90 1463683075'
|
||||
```
|
||||
|
||||
A successful write returns HTTP status `204 No Content`--for example:
|
||||
|
||||
```
|
||||
HTTP/1.1 204 No Content
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
|
@ -890,13 +961,7 @@ Date: Wed, 08 Nov 2017 17:33:23 GMT
|
|||
##### Write a point to the database `mydb` and the retention policy `myrp`
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST "http://localhost:8086/write?db=mydb&rp=myrp" --data-binary 'mymeas,mytag=1 myfield=90'
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
X-Influxdb-Version: {{< latest-patch >}}
|
||||
Date: Wed, 08 Nov 2017 17:34:31 GMT
|
||||
curl -i -XPOST "http://localhost:8086/write?db=mydb&rp=myrp" --data-binary 'mymeas,mytag=1 myfield=90'
|
||||
```
|
||||
|
||||
##### Write a point to the database `mydb` using HTTP authentication
|
||||
|
@ -904,20 +969,25 @@ Date: Wed, 08 Nov 2017 17:34:31 GMT
|
|||
Valid credentials:
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST "http://localhost:8086/write?db=mydb&u=myusername&p=mypassword" --data-binary 'mymeas,mytag=1 myfield=91'
|
||||
curl -i -XPOST "http://localhost:8086/write?db=mydb&u=myusername&p=mypassword" --data-binary 'mymeas,mytag=1 myfield=91'
|
||||
```
|
||||
|
||||
A successful write returns HTTP status `204 No Content`.
|
||||
|
||||
```
|
||||
HTTP/1.1 204 No Content
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
X-Influxdb-Version: {{< latest-patch >}}
|
||||
Date: Wed, 08 Nov 2017 17:34:56 GMT
|
||||
```
|
||||
|
||||
Invalid credentials:
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST "http://localhost:8086/write?db=mydb&u=myusername&p=notmypassword" --data-binary 'mymeas,mytag=1 myfield=91'
|
||||
curl -i -XPOST "http://localhost:8086/write?db=mydb&u=myusername&p=notmypassword" --data-binary 'mymeas,mytag=1 myfield=91'
|
||||
```
|
||||
|
||||
If the username or password is incorrect, the response status is `401 Unauthorized`
|
||||
and the response body contains the error message--for example:
|
||||
|
||||
```
|
||||
HTTP/1.1 401 Unauthorized
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
|
@ -931,23 +1001,20 @@ Content-Length: 33
|
|||
|
||||
##### Write a point to the database `mydb` using basic authentication
|
||||
|
||||
Valid credentials:
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST -u myusername:mypassword "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=91'
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
X-Influxdb-Version: {{< latest-patch >}}
|
||||
Date: Wed, 08 Nov 2017 17:36:40 GMT
|
||||
curl -i -XPOST -u myusername:mypassword "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=91'
|
||||
```
|
||||
|
||||
Invalid credentials:
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST -u myusername:notmypassword "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=91'
|
||||
curl -i -XPOST -u myusername:notmypassword "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=91'
|
||||
```
|
||||
|
||||
If the username or password is incorrect, the response status is `401 Unauthorized`
|
||||
and the response body contains the error message--for example:
|
||||
|
||||
```
|
||||
HTTP/1.1 401 Unauthorized
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
|
@ -965,79 +1032,65 @@ Content-Length: 33
|
|||
--data-binary '<Data in InfluxDB line protocol format>'
|
||||
```
|
||||
|
||||
All data must be binary encoded and in the
|
||||
Data to write must be binary encoded and in the
|
||||
[InfluxDB line protocol](/enterprise_influxdb/v1/concepts/glossary/#influxdb-line-protocol) format.
|
||||
Our example shows the `--data-binary` parameter from curl, which we will use in
|
||||
all examples on this page.
|
||||
|
||||
Examples in this page use `curl` with the `--data-binary` parameter to encode
|
||||
line protocol in the request.
|
||||
Using any encoding method other than `--data-binary` will likely lead to issues;
|
||||
`-d`, `--data-urlencode`, and `--data-ascii` may strip out newlines or
|
||||
introduce new, unintended formatting.
|
||||
introduce unintended formatting.
|
||||
|
||||
Options:
|
||||
|
||||
* Write several points to the database with one request by separating each point
|
||||
- Write several points to the database with one request by separating each point
|
||||
by a new line.
|
||||
* Write points from a file with the `@` flag.
|
||||
The file should contain a batch of points in the InfluxDB line protocol format.
|
||||
- Write points from a file with the `@` flag.
|
||||
The file should contain a batch of points in line protocol format.
|
||||
Individual points must be on their own line and separated by newline characters
|
||||
(`\n`).
|
||||
Files containing carriage returns will cause parser errors.
|
||||
Files containing carriage returns cause parser errors.
|
||||
|
||||
We recommend writing points in batches of 5,000 to 10,000 points.
|
||||
Smaller batches, and more HTTP requests, will result in sub-optimal performance.
|
||||
> [!Important]
|
||||
> #### Batch writes for optimal performance
|
||||
> Write points in batches of 5,000 to 10,000 points.
|
||||
> Smaller batches, and more HTTP requests, will result in sub-optimal performance.
|
||||
|
||||
#### Examples
|
||||
|
||||
##### Write a point to the database `mydb` with a nanosecond timestamp
|
||||
##### Write a point with a nanosecond timestamp to the `mydb` database
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=90 1463683075000000000'
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
X-Influxdb-Version: {{< latest-patch >}}
|
||||
Date: Wed, 08 Nov 2017 18:02:57 GMT
|
||||
curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=90 1463683075000000000'
|
||||
```
|
||||
|
||||
##### Write a point to the database `mydb` with the local server's nanosecond timestamp
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=90'
|
||||
If successful, the response status is HTTP `204 No Content`.
|
||||
|
||||
```
|
||||
HTTP/1.1 204 No Content
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
X-Influxdb-Version: {{< latest-patch >}}
|
||||
Date: Wed, 08 Nov 2017 18:03:44 GMT
|
||||
```
|
||||
|
||||
##### Write several points to the database `mydb` by separating points with a new line
|
||||
##### Write a point with the local server's nanosecond timestamp to the `mydb` database
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=3 myfield=89 1463689152000000000
|
||||
curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=1 myfield=90'
|
||||
```
|
||||
|
||||
##### Write several points to the database by separating points with a new line
|
||||
|
||||
```bash
|
||||
curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary 'mymeas,mytag=3 myfield=89 1463689152000000000
|
||||
mymeas,mytag=2 myfield=34 1463689152000000000'
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
X-Influxdb-Version: {{< latest-patch >}}
|
||||
Date: Wed, 08 Nov 2017 18:04:02 GMT
|
||||
```
|
||||
|
||||
##### Write several points to the database `mydb` from the file `data.txt`
|
||||
|
||||
```bash
|
||||
$ curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary @data.txt
|
||||
|
||||
HTTP/1.1 204 No Content
|
||||
Content-Type: application/json
|
||||
Request-Id: [...]
|
||||
X-Influxdb-Version: {{< latest-patch >}}
|
||||
Date: Wed, 08 Nov 2017 18:08:11 GMT
|
||||
curl -i -XPOST "http://localhost:8086/write?db=mydb" --data-binary @data.txt
|
||||
```
|
||||
|
||||
A sample of the data in `data.txt`:
|
||||
`data.txt` contains the following sample data:
|
||||
|
||||
```
|
||||
mymeas,mytag1=1 value=21 1463689680000000000
|
||||
mymeas,mytag1=1 value=34 1463689690000000000
|
||||
|
@ -1132,7 +1185,7 @@ Requests to `/shard-status` return the following information in JSON format:
|
|||
- `size`: the size on disk of the shard in bytes
|
||||
- `is_hot`: whether the time range from the shard includes `now`
|
||||
{{% note %}}
|
||||
An *idle* shard is fully compacted and not receiving new (potentially historical) writes.
|
||||
An _idle_ shard is fully compacted and not receiving new (potentially historical) writes.
|
||||
A hot shard may or may not be idle.
|
||||
{{% /note %}}
|
||||
- `state`: the anti-entropy status of the shard can be one of the following:
|
||||
|
|
|
@ -4,7 +4,7 @@ description: >
|
|||
Use [`join.time()`](/flux/v0/stdlib/join/time/) to join two streams of data
|
||||
based on time values in the `_time` column.
|
||||
This type of join operation is common when joining two streams of
|
||||
[time series data](/influxdb/latest/reference/glossary/#time-series-data).
|
||||
[time series data](/influxdb/v2/reference/glossary/#time-series-data).
|
||||
menu:
|
||||
flux_v0:
|
||||
parent: Join data
|
||||
|
@ -31,7 +31,7 @@ list_code_example: |
|
|||
Use [`join.time()`](/flux/v0/stdlib/join/time/) to join two streams of data
|
||||
based on time values in the `_time` column.
|
||||
This type of join operation is common when joining two streams of
|
||||
[time series data](/influxdb/latest/reference/glossary/#time-series-data).
|
||||
[time series data](/influxdb/v2/reference/glossary/#time-series-data).
|
||||
|
||||
`join.time()` can use any of the available join methods.
|
||||
Which method you use depends on your desired behavior:
|
||||
|
|
|
@ -86,7 +86,7 @@ Durations are relative to `now()`.
|
|||
|
||||
URL of the InfluxDB instance to query.
|
||||
|
||||
See [InfluxDB OSS URLs](/influxdb/latest/reference/urls/)
|
||||
See [InfluxDB OSS URLs](/influxdb/v2/reference/urls/)
|
||||
or [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/).
|
||||
|
||||
### org
|
||||
|
@ -97,7 +97,7 @@ Organization name.
|
|||
|
||||
### token
|
||||
|
||||
InfluxDB [API token](/influxdb/latest/security/tokens/).
|
||||
InfluxDB [API token](/influxdb/v2/security/tokens/).
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ Records that evaluate to _null_ or `false` are not included in the output tables
|
|||
|
||||
URL of the InfluxDB instance to query.
|
||||
|
||||
See [InfluxDB OSS URLs](/influxdb/latest/reference/urls/)
|
||||
See [InfluxDB OSS URLs](/influxdb/v2/reference/urls/)
|
||||
or [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/).
|
||||
|
||||
### org
|
||||
|
@ -130,7 +130,7 @@ Organization name.
|
|||
|
||||
### token
|
||||
|
||||
InfluxDB [API token](/influxdb/latest/security/tokens/).
|
||||
InfluxDB [API token](/influxdb/v2/security/tokens/).
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: csv.from() function
|
||||
description: >
|
||||
`csv.from()` retrieves [annotated CSV](/influxdb/latest/reference/syntax/annotated-csv/) **from a URL**.
|
||||
`csv.from()` retrieves [annotated CSV](/influxdb/v2/reference/syntax/annotated-csv/) **from a URL**.
|
||||
menu:
|
||||
flux_v0_ref:
|
||||
name: csv.from
|
||||
|
@ -26,7 +26,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
|||
|
||||
------------------------------------------------------------------------------->
|
||||
|
||||
`csv.from()` retrieves [annotated CSV](/influxdb/latest/reference/syntax/annotated-csv/) **from a URL**.
|
||||
`csv.from()` retrieves [annotated CSV](/influxdb/v2/reference/syntax/annotated-csv/) **from a URL**.
|
||||
|
||||
{{% warn %}}
|
||||
#### Deprecated
|
||||
|
|
|
@ -63,7 +63,7 @@ Geometry Library to generate `s2_cell_id` tags.
|
|||
Specify your [S2 Cell ID level](https://s2geometry.io/resources/s2cell_statistics.html).
|
||||
|
||||
**Note:** To filter more quickly, use higher S2 Cell ID levels, but know that
|
||||
higher levels increase [series cardinality](/influxdb/latest/reference/glossary/#series-cardinality).
|
||||
higher levels increase [series cardinality](/influxdb/v2/reference/glossary/#series-cardinality).
|
||||
|
||||
Language-specific implementations of the S2 Geometry Library provide methods for
|
||||
generating S2 Cell ID tokens. For example:
|
||||
|
|
|
@ -29,7 +29,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
|
|||
|
||||
`prometheus.histogramQuantile()` calculates a quantile on a set of Prometheus histogram values.
|
||||
|
||||
This function supports [Prometheus metric parsing formats](/influxdb/latest/reference/prometheus-metrics/)
|
||||
This function supports [Prometheus metric parsing formats](/influxdb/v2/reference/prometheus-metrics/)
|
||||
used by `prometheus.scrape()`, the Telegraf `promtheus` input plugin, and
|
||||
InfluxDB scrapers available in InfluxDB OSS.
|
||||
|
||||
|
@ -53,7 +53,7 @@ Quantile to compute. Must be a float value between 0.0 and 1.0.
|
|||
|
||||
### metricVersion
|
||||
|
||||
[Prometheus metric parsing format](/influxdb/latest/reference/prometheus-metrics/)
|
||||
[Prometheus metric parsing format](/influxdb/v2/reference/prometheus-metrics/)
|
||||
used to parse queried Prometheus data.
|
||||
Available versions are `1` and `2`.
|
||||
Default is `2`.
|
||||
|
|
|
@ -86,7 +86,7 @@ _`bucket` and `bucketID` are mutually exclusive_.
|
|||
URL of the InfluxDB instance to write to.
|
||||
|
||||
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
|
||||
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/).
|
||||
or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
|
||||
`host` is required when writing to a remote InfluxDB instance.
|
||||
If specified, `token` is also required.
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ _`org` and `orgID` are mutually exclusive_.
|
|||
URL of the InfluxDB instance.
|
||||
|
||||
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
|
||||
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/).
|
||||
or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
|
||||
_`host` is required when `org` or `orgID` are specified._
|
||||
|
||||
### token
|
||||
|
|
|
@ -90,7 +90,7 @@ String-encoded organization ID.
|
|||
URL of the InfluxDB instance to query.
|
||||
|
||||
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
|
||||
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/).
|
||||
or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
|
||||
|
||||
### token
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ _`bucket` and `bucketID` are mutually exclusive_.
|
|||
URL of the InfluxDB instance to query.
|
||||
|
||||
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
|
||||
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/).
|
||||
or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
|
||||
|
||||
### org
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ _`bucket` and `bucketID` are mutually exclusive_.
|
|||
URL of the InfluxDB instance to write to.
|
||||
|
||||
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
|
||||
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/).
|
||||
or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
|
||||
`host` is required when writing to a remote InfluxDB instance.
|
||||
If specified, `token` is also required.
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ _`bucket` and `bucketID` are mutually exclusive_.
|
|||
URL of the InfluxDB instance to write to.
|
||||
|
||||
See [InfluxDB Cloud regions](/influxdb/cloud/reference/regions/)
|
||||
or [InfluxDB OSS URLs](/influxdb/latest/reference/urls/).
|
||||
or [InfluxDB OSS URLs](/influxdb/v2/reference/urls/).
|
||||
`host` is required when writing to a remote InfluxDB instance.
|
||||
If specified, `token` is also required.
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ UI and export the resources as a template.
|
|||
{{< youtube 714uHkxKM6U >}}
|
||||
|
||||
{{% note %}}
|
||||
#### InfluxDB OSS for creating templates
|
||||
#### InfluxDB OSS v2 for creating templates
|
||||
Templatable resources are scoped to a single organization, so the simplest way to create a
|
||||
template is to create a new organization, build the template within the organization,
|
||||
and then [export all resources](#export-all-resources) as a template.
|
||||
|
@ -54,15 +54,21 @@ Provide the following:
|
|||
**JSON** (`.json`) are supported.
|
||||
|
||||
###### Export all resources to a template
|
||||
```sh
|
||||
# Syntax
|
||||
influx export all -o <INFLUX_ORG> -f <FILE_PATH> -t <INFLUX_TOKEN>
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
```bash
|
||||
# Syntax
|
||||
influx export all --org <INFLUX_ORG> --file <FILE_PATH> --token <INFLUX_TOKEN>
|
||||
```
|
||||
|
||||
<!--The following fails due to an apparent missing task query in the account-->
|
||||
<!--pytest.mark.skip-->
|
||||
```bash
|
||||
# Example
|
||||
influx export all \
|
||||
-o my-org \
|
||||
-f ~/templates/awesome-template.yml \
|
||||
-t $INFLUX_TOKEN
|
||||
--org $INFLUX_ORG \
|
||||
--file /path/to/TEMPLATE_FILE.yml \
|
||||
--token $INFLUX_TOKEN
|
||||
```
|
||||
|
||||
#### Export resources filtered by labelName or resourceKind
|
||||
|
@ -81,9 +87,9 @@ and
|
|||
|
||||
```sh
|
||||
influx export all \
|
||||
-o my-org \
|
||||
-f ~/templates/awesome-template.yml \
|
||||
-t $INFLUX_TOKEN \
|
||||
--org $INFLUX_ORG \
|
||||
--file /path/to/TEMPLATE_FILE.yml \
|
||||
--token $INFLUX_TOKEN \
|
||||
--filter=resourceKind=Bucket \
|
||||
--filter=resourceKind=Dashboard \
|
||||
--filter=labelName=Example1 \
|
||||
|
@ -94,12 +100,14 @@ For information about flags, see the
|
|||
[`influx export all` documentation](/influxdb/cloud/reference/cli/influx/export/all/).
|
||||
|
||||
### Export specific resources
|
||||
|
||||
To export specific resources within an organization to a template manifest,
|
||||
use the `influx export` with resource flags for each resource to include.
|
||||
The command uses the API token to filter resources for the organization.
|
||||
|
||||
Provide the following:
|
||||
|
||||
- **Organization name** or **ID**
|
||||
- **API token** with read access to the organization
|
||||
- **API token** with read access to the organization.
|
||||
- **Destination path and filename** for the template manifest.
|
||||
The filename extension determines the template format—both **YAML** (`.yml`) and
|
||||
**JSON** (`.json`) are supported.
|
||||
|
@ -108,15 +116,20 @@ Provide the following:
|
|||
[`influx export` documentation](/influxdb/cloud/reference/cli/influx/export/).
|
||||
|
||||
###### Export specific resources to a template
|
||||
```sh
|
||||
# Syntax
|
||||
influx export all -o <INFLUX_ORG> -f <FILE_PATH> -t <INFLUX_TOKEN> [resource-flags]
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
```bash
|
||||
# Syntax
|
||||
influx export --file <FILE_PATH> --token <INFLUX_TOKEN> [resource-flags]
|
||||
```
|
||||
|
||||
<!-- Fails due to resource ID placeholders -->
|
||||
<!--pytest.mark.xfail-->
|
||||
```bash
|
||||
# Example
|
||||
influx export all \
|
||||
-o my-org \
|
||||
-f ~/templates/awesome-template.yml \
|
||||
-t $INFLUX_TOKEN \
|
||||
influx export \
|
||||
--file /path/to/TEMPLATE_FILE.yml \
|
||||
--token $INFLUX_TOKEN \
|
||||
--buckets=00x000ooo0xx0xx,o0xx0xx00x000oo \
|
||||
--dashboards=00000xX0x0X00x000 \
|
||||
--telegraf-configs=00000x0x000X0x0X0
|
||||
|
@ -125,9 +138,10 @@ influx export all \
|
|||
### Export a stack
|
||||
To export a stack and all its associated resources as a template, use the
|
||||
`influx export stack` command.
|
||||
The command uses the API token to filter resources for the organization.
|
||||
|
||||
Provide the following:
|
||||
|
||||
- **Organization name** or **ID**
|
||||
- **API token** with read access to the organization
|
||||
- **Destination path and filename** for the template manifest.
|
||||
The filename extension determines the template format—both **YAML** (`.yml`) and
|
||||
|
@ -135,19 +149,23 @@ Provide the following:
|
|||
- **Stack ID**
|
||||
|
||||
###### Export a stack as a template
|
||||
```sh
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
```bash
|
||||
# Syntax
|
||||
influx export stack \
|
||||
-o <INFLUX_ORG> \
|
||||
-t <INFLUX_TOKEN> \
|
||||
-f <FILE_PATH> \
|
||||
--token <INFLUX_TOKEN> \
|
||||
--file <FILE_PATH> \
|
||||
<STACK_ID>
|
||||
```
|
||||
|
||||
<!-- Fails due to non-existent STACK_ID -->
|
||||
<!--pytest.mark.xfail-->
|
||||
```bash
|
||||
# Example
|
||||
influx export stack \
|
||||
-o my-org \
|
||||
-t mYSuP3RS3CreTt0K3n
|
||||
-f ~/templates/awesome-template.yml \
|
||||
-t $INFLUX_TOKEN \
|
||||
-f /path/to/TEMPLATE_FILE.yml \
|
||||
05dbb791a4324000
|
||||
```
|
||||
|
||||
|
@ -206,11 +224,47 @@ when [applying the template](/influxdb/cloud/tools/influxdb-templates/use/#apply
|
|||
Users can also include the `--env-ref` flag with the appropriate key-value pair
|
||||
when installing the template.
|
||||
|
||||
<!-- //REVIEW I can't get this to work with environment reference substitution
|
||||
-- Skipping the test for now, but we should review it and fix it.
|
||||
-->
|
||||
<!--pytest.mark.skip-->
|
||||
<!--test:setup
|
||||
```sh
|
||||
# Set bucket-name-1 to "myBucket"
|
||||
jq -n '{
|
||||
apiVersion: "influxdata.com/v2alpha1",
|
||||
kind: "Bucket",
|
||||
metadata: {
|
||||
name: {
|
||||
envRef: {
|
||||
key: "bucket-name-1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}' > /path/to/TEMPLATE_FILE.json
|
||||
chmod +rx /path/to/TEMPLATE_FILE.json
|
||||
# View formatted JSON
|
||||
jq '.' /path/to/TEMPLATE_FILE.json
|
||||
```
|
||||
-->
|
||||
|
||||
For example, to set a custom bucket name when applying a template with an environment reference:
|
||||
|
||||
<!--pytest-codeblocks:cont-->
|
||||
```sh
|
||||
# The template, edited to include an environment reference:
|
||||
# apiVersion: influxdata.com/v2alpha1
|
||||
# kind: Bucket
|
||||
# metadata:
|
||||
# name:
|
||||
# envRef: bucket-name-1
|
||||
|
||||
# Apply template, set bucket-name-1 to "myBucket", and skip verification
|
||||
influx apply \
|
||||
-f /path/to/template.yml \
|
||||
--env-ref=bucket-name-1=myBucket
|
||||
--file /path/to/TEMPLATE_FILE.json \
|
||||
--env-ref bucket-name-1=myBucket \
|
||||
--force yes
|
||||
--org $INFLUX_ORG
|
||||
--token $INFLUX_TOKEN
|
||||
```
|
||||
|
||||
_If sharing your template, we recommend documenting what environment references
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
weight: 70
|
||||
parent: Concepts
|
||||
aliases:
|
||||
- /influxdb/latest/concepts/time-series-index/
|
||||
- /influxdb/v2/concepts/time-series-index/
|
||||
---
|
||||
|
||||
Find overview and background information on Time Series Index (TSI) in this topic. For detail, including how to enable and configure TSI, see [Time Series Index (TSI) details](/influxdb/v1/concepts/tsi-details/).
|
||||
|
|
|
@ -12,7 +12,7 @@ aliases:
|
|||
- /influxdb/v2/introduction/getting_started/
|
||||
- /influxdb/v2/introduction/getting_started/
|
||||
- /influxdb/v2/introduction/getting_started/
|
||||
- /influxdb/latest/introduction/getting-started/
|
||||
- /influxdb/v2/introduction/getting-started/
|
||||
|
||||
menu:
|
||||
influxdb_v1:
|
||||
|
|
|
@ -7,7 +7,7 @@ menu:
|
|||
weight: 70
|
||||
identifier: InfluxQL
|
||||
aliases:
|
||||
- /influxdb/latest/query_language/_index
|
||||
- /influxdb/v2/query_language/_index
|
||||
---
|
||||
|
||||
This section introduces InfluxQL, the InfluxDB SQL-like query language for
|
||||
|
|
|
@ -12,7 +12,7 @@ aliases:
|
|||
- /influxdb/v2/query_language/spec/
|
||||
- /influxdb/v2/query_language/spec/
|
||||
- /influxdb/v2/query_language/spec/
|
||||
- /influxdb/latest/query_language/spec/
|
||||
- /influxdb/v2/query_language/spec/
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
@ -234,12 +234,13 @@ regex_lit = "/" { unicode_char } "/" .
|
|||
`=~` matches against
|
||||
`!~` doesn't match against
|
||||
|
||||
> **Note:** InfluxQL supports using regular expressions when specifying:
|
||||
> [!Note]
|
||||
> InfluxQL supports using regular expressions when specifying:
|
||||
>
|
||||
* [field keys](/influxdb/v1/concepts/glossary/#field-key) and [tag keys](/influxdb/v1/concepts/glossary/#tag-key) in the [`SELECT` clause](/influxdb/v1/query_language/explore-data/#the-basic-select-statement)
|
||||
* [measurements](/influxdb/v1/concepts/glossary/#measurement) in the [`FROM` clause](/influxdb/v1/query_language/explore-data/#the-basic-select-statement)
|
||||
* [tag values](/influxdb/v1/concepts/glossary/#tag-value) and string [field values](/influxdb/v1/concepts/glossary/#field-value) in the [`WHERE` clause](/influxdb/v1/query_language/explore-data/#the-where-clause).
|
||||
* [tag keys](/influxdb/v1/concepts/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/v1/query_language/explore-data/#group-by-tags)
|
||||
> * [field keys](/influxdb/v1/concepts/glossary/#field-key) and [tag keys](/influxdb/v1/concepts/glossary/#tag-key) in the [`SELECT` clause](/influxdb/v1/query_language/explore-data/#the-basic-select-statement)
|
||||
> * [measurements](/influxdb/v1/concepts/glossary/#measurement) in the [`FROM` clause](/influxdb/v1/query_language/explore-data/#the-basic-select-statement)
|
||||
> * [tag values](/influxdb/v1/concepts/glossary/#tag-value) and string [field values](/influxdb/v1/concepts/glossary/#field-value) in the [`WHERE` clause](/influxdb/v1/query_language/explore-data/#the-where-clause).
|
||||
> * [tag keys](/influxdb/v1/concepts/glossary/#tag-key) in the [`GROUP BY` clause](/influxdb/v1/query_language/explore-data/#group-by-tags)
|
||||
>
|
||||
>Currently, InfluxQL does not support using regular expressions to match
|
||||
>non-string field values in the
|
||||
|
|
|
@ -20,7 +20,7 @@ including buckets, organizations, users, tasks, etc.
|
|||
{{% oss-only %}}
|
||||
|
||||
{{% note %}}
|
||||
#### InfluxDB OSS and influx CLI versions
|
||||
#### InfluxDB OSS v2 and influx CLI versions
|
||||
Beginning with **InfluxDB 2.1**, the `influx` CLI is packaged and versioned separately
|
||||
from InfluxDB.
|
||||
InfluxDB and `influx` CLI versions may differ, but compatibility is noted for each command.
|
||||
|
@ -69,6 +69,8 @@ Do one of the following:
|
|||
- [Manually download and install](#manually-download-and-install)
|
||||
|
||||
### Use Homebrew
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
```sh
|
||||
brew install influxdb-cli
|
||||
```
|
||||
|
@ -80,6 +82,7 @@ If you used Homebrew to install **InfluxDB {{< current-version >}}**, the `influ
|
|||
formula was downloaded as a dependency and should already be installed.
|
||||
If installed, `influxdb-cli` will appear in the output of the following command:
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
```sh
|
||||
brew list | grep influxdb-cli
|
||||
```
|
||||
|
@ -93,6 +96,13 @@ brew list | grep influxdb-cli
|
|||
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz" download>influx CLI v{{< latest-patch cli=true >}} (macOS)</a>
|
||||
|
||||
<!--test:previous
|
||||
```sh
|
||||
curl -s -o ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz \
|
||||
https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz
|
||||
```
|
||||
-->
|
||||
|
||||
2. **Unpackage the downloaded package.**
|
||||
|
||||
Do one of the following:
|
||||
|
@ -101,6 +111,7 @@ brew list | grep influxdb-cli
|
|||
- Run the following command in a macOS command prompt application such
|
||||
**Terminal** or **[iTerm2](https://www.iterm2.com/)**:
|
||||
|
||||
<!--pytest-codeblocks:cont-->
|
||||
```sh
|
||||
# Unpackage contents to the current working directory
|
||||
tar zxvf ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz
|
||||
|
@ -108,6 +119,7 @@ brew list | grep influxdb-cli
|
|||
|
||||
3. **(Optional) Place the binary in your `$PATH`.**
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
```sh
|
||||
# (Optional) Copy the influx binary to your $PATH
|
||||
sudo cp ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64/influx /usr/local/bin/
|
||||
|
@ -145,34 +157,40 @@ brew list | grep influxdb-cli
|
|||
|
||||
#### Download from the command line
|
||||
|
||||
```sh
|
||||
```bash
|
||||
# amd64
|
||||
wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
|
||||
|
||||
# arm
|
||||
wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz
|
||||
curl -O \
|
||||
https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
4. **Unpackage the downloaded package.**
|
||||
<!--python-codeblocks:cont-->
|
||||
```bash
|
||||
# arm
|
||||
curl -O \
|
||||
https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz \
|
||||
```
|
||||
|
||||
2. **Unpackage the downloaded package.**
|
||||
|
||||
_**Note:** The following commands are examples. Adjust the filenames, paths, and utilities if necessary._
|
||||
|
||||
```sh
|
||||
<!--python-codeblocks:cont-->
|
||||
```bash
|
||||
# amd64
|
||||
tar xvzf path/to/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
|
||||
tar xvzf influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz
|
||||
```
|
||||
|
||||
<!--python-codeblocks:cont-->
|
||||
```bash
|
||||
# arm
|
||||
tar xvzf path/to/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz
|
||||
tar xvzf influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz
|
||||
```
|
||||
|
||||
3. **(Optional) Place the unpackaged `influx` executable in your system `$PATH`.**
|
||||
|
||||
```sh
|
||||
# amd64
|
||||
sudo cp influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64/influx /usr/local/bin/
|
||||
|
||||
# arm
|
||||
sudo cp influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64/influx /usr/local/bin/
|
||||
<!--python-codeblocks:cont-->
|
||||
```bash
|
||||
sudo cp ./influx /usr/local/bin/
|
||||
```
|
||||
|
||||
If you do not move the `influx` binary into your `$PATH`, prefix the executable
|
||||
|
@ -185,7 +203,9 @@ brew list | grep influxdb-cli
|
|||
{{% tab-content %}}
|
||||
|
||||
{{% note %}}
|
||||
We recommend running `influx` CLI commands in Powershell.
|
||||
#### Use Powershell for Windows
|
||||
|
||||
Use Powershell for running `influx` CLI commands.
|
||||
Command Prompt is not fully compatible.
|
||||
{{% /note %}}
|
||||
|
||||
|
@ -229,10 +249,10 @@ Use the [`influx config create` command](/influxdb/v2/reference/cli/influx/confi
|
|||
to create an `influx` CLI config and set it as active:
|
||||
|
||||
```sh
|
||||
influx config create --config-name <config-name> \
|
||||
influx config create --config-name CONFIG_NAME \
|
||||
--host-url http://localhost:8086 \
|
||||
--org <your-org> \
|
||||
--token <your-auth-token> \
|
||||
--org ORG_NAME \
|
||||
--token API_TOKEN \
|
||||
--active
|
||||
```
|
||||
|
||||
|
@ -241,13 +261,15 @@ For more information about managing CLI configurations, see the
|
|||
|
||||
### Credential precedence
|
||||
|
||||
There are three ways to provide the necessary credentials to the `influx` CLI,
|
||||
which uses the following precedence when retrieving credentials:
|
||||
Provide credentials using any of the following supported methods.
|
||||
The `influx` CLI uses the following precedence when retrieving credentials:
|
||||
|
||||
1. Command line flags (`--host`, `--org -o`, `--token -t`)
|
||||
2. Environment variables (`INFLUX_HOST`, `INFLUX_ORG`, `INFLUX_TOKEN`)
|
||||
3. CLI configuration file
|
||||
|
||||
Command line flags override environment variables, which override configuration file values.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
|
|
|
@ -12,7 +12,7 @@ updated_in: CLI 2.5.0
|
|||
The `influx auth create` command creates an API token in InfluxDB.
|
||||
|
||||
{{% warn %}}
|
||||
**Issue resolved**: Using influx CLI 2.4 prevented you from creating an **all-access** or **operator** token using the `influx auth create` command. This issue is resolved in the influx 2.5 CLI release. Please [upgrade to the latest version](/influxdb/latest/tools/influx-cli/) of the influx cli.
|
||||
**Issue resolved**: Using influx CLI 2.4 prevented you from creating an **all-access** or **operator** token using the `influx auth create` command. This issue is resolved in the influx 2.5 CLI release. Please [upgrade to the latest version](/influxdb/v2/tools/influx-cli/) of the influx cli.
|
||||
{{% /warn %}}
|
||||
|
||||
## Usage
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: API Invokable Scripts
|
||||
description: >
|
||||
InfluxDB lets you [invoke scripts](/influxdb/cloud/api-guide/api-invokable-scripts/) using the InfluxDB APIs ([InfluxDB Cloud API](/influxdb/cloud/api/) and [InfluxDB OSS (open source) API](/influxdb/latest/api/)). Here, Jay Clifford explains how to use this feature with custom endpoints to improve the functionality, efficiency, and security of your applications.
|
||||
InfluxDB lets you [invoke scripts](/influxdb/cloud/api-guide/api-invokable-scripts/) using the InfluxDB APIs ([InfluxDB Cloud API](/influxdb/cloud/api/) and [InfluxDB OSS (open source) API](/influxdb/v2/api/)). Here, Jay Clifford explains how to use this feature with custom endpoints to improve the functionality, efficiency, and security of your applications.
|
||||
menu:
|
||||
resources:
|
||||
parent: Videos
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Intro to Client Libraries
|
||||
description: >
|
||||
[Client libraries](/influxdb/latest/api-guide/client-libraries/) are a powerful way to harness the power of InfluxDB's API using familiar programming languages. Here, Jay Clifford explains what client libraries are, how they work, and why you should use them when working with InfluxDB.
|
||||
[Client libraries](/influxdb/v2/api-guide/client-libraries/) are a powerful way to harness the power of InfluxDB's API using familiar programming languages. Here, Jay Clifford explains what client libraries are, how they work, and why you should use them when working with InfluxDB.
|
||||
menu:
|
||||
resources:
|
||||
parent: Videos
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Optimizing Flux Functions
|
||||
description: >
|
||||
Flux queries are scripts that let you work with your data in InfluxDB. Here, Scott Anderson provides some tips for [optimizing Flux queries](/influxdb/latest/query-data/optimize-queries/), so that your data and applications are more performant.
|
||||
Flux queries are scripts that let you work with your data in InfluxDB. Here, Scott Anderson provides some tips for [optimizing Flux queries](/influxdb/v2/query-data/optimize-queries/), so that your data and applications are more performant.
|
||||
menu:
|
||||
resources:
|
||||
parent: Videos
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
The InfluxDB HTTP API provides a programmatic interface for interactions with
|
||||
{{% product-name %}}, such as writing and querying data, triggering Processing
|
||||
engine plugins, and managing an InfluxDB 3 instance.
|
||||
|
||||
The InfluxDB 3 HTTP API includes endpoints for backward compatibility with
|
||||
The API includes endpoints for backward compatibility with
|
||||
InfluxDB v1 and v2 workloads, clients, and third-party tools.
|
||||
|
||||
<a class="btn" href="/influxdb3/core/api/v3/">InfluxDB 3 HTTP API for {{% product-name %}}</a>
|
||||
<a class="btn" href="/influxdb3/{{% product-key %}}/api/v3/">{{% product-name %}} HTTP API</a>
|
||||
|
|
|
@ -98,6 +98,8 @@ function substitute_placeholders {
|
|||
s|NUMBER_OF_DAYS|365|g;
|
||||
s|@path/to/line-protocol.txt|data/home-sensor-data.lp|g;
|
||||
s|/path/to/custom/assets-dir|/app/custom-assets|g;
|
||||
s|/path/to/TEMPLATE_FILE.yml|/root/influxdb-templates/TEMPLATE_FILE.yml|g;
|
||||
s|/path/to/TEMPLATE_FILE.json|/root/influxdb-templates/TEMPLATE_FILE.json|g;
|
||||
' $file
|
||||
|
||||
# v2-specific replacements.
|
||||
|
|
|
@ -51,6 +51,7 @@ setup
|
|||
|
||||
if [[ $runner == "pytest" ]]; then
|
||||
pytest \
|
||||
-ra \
|
||||
-s \
|
||||
--codeblocks \
|
||||
--suppress-no-test-exit-code \
|
||||
|
|
Loading…
Reference in New Issue