diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c013e882f..985642224 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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) diff --git a/Dockerfile.pytest b/Dockerfile.pytest index 8f52c893b..c624960f3 100644 --- a/Dockerfile.pytest +++ b/Dockerfile.pytest @@ -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 \ diff --git a/compose.yaml b/compose.yaml index 20ebf61d8..1b51376e5 100644 --- a/compose.yaml +++ b/compose.yaml @@ -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 diff --git a/content/enterprise_influxdb/v1/tools/api.md b/content/enterprise_influxdb/v1/tools/api.md index ce9e4d312..35bfa24b0 100644 --- a/content/enterprise_influxdb/v1/tools/api.md +++ b/content/enterprise_influxdb/v1/tools/api.md @@ -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 '' ``` -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: diff --git a/content/flux/v0/join-data/time.md b/content/flux/v0/join-data/time.md index c087f61fe..42f57d631 100644 --- a/content/flux/v0/join-data/time.md +++ b/content/flux/v0/join-data/time.md @@ -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: diff --git a/content/flux/v0/stdlib/contrib/jsternberg/influxdb/from.md b/content/flux/v0/stdlib/contrib/jsternberg/influxdb/from.md index a1b8c1d5a..ba6548e98 100644 --- a/content/flux/v0/stdlib/contrib/jsternberg/influxdb/from.md +++ b/content/flux/v0/stdlib/contrib/jsternberg/influxdb/from.md @@ -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/). diff --git a/content/flux/v0/stdlib/contrib/jsternberg/influxdb/select.md b/content/flux/v0/stdlib/contrib/jsternberg/influxdb/select.md index a90e72cd5..047386468 100644 --- a/content/flux/v0/stdlib/contrib/jsternberg/influxdb/select.md +++ b/content/flux/v0/stdlib/contrib/jsternberg/influxdb/select.md @@ -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/). diff --git a/content/flux/v0/stdlib/experimental/csv/from.md b/content/flux/v0/stdlib/experimental/csv/from.md index e2cf0fbf5..bbeb5cbbe 100644 --- a/content/flux/v0/stdlib/experimental/csv/from.md +++ b/content/flux/v0/stdlib/experimental/csv/from.md @@ -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 diff --git a/content/flux/v0/stdlib/experimental/geo/_index.md b/content/flux/v0/stdlib/experimental/geo/_index.md index a6b711f53..525ebf52f 100644 --- a/content/flux/v0/stdlib/experimental/geo/_index.md +++ b/content/flux/v0/stdlib/experimental/geo/_index.md @@ -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: diff --git a/content/flux/v0/stdlib/experimental/prometheus/histogramquantile.md b/content/flux/v0/stdlib/experimental/prometheus/histogramquantile.md index 794264e72..b6cc057d4 100644 --- a/content/flux/v0/stdlib/experimental/prometheus/histogramquantile.md +++ b/content/flux/v0/stdlib/experimental/prometheus/histogramquantile.md @@ -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`. diff --git a/content/flux/v0/stdlib/experimental/to.md b/content/flux/v0/stdlib/experimental/to.md index 581383e1c..9359198fe 100644 --- a/content/flux/v0/stdlib/experimental/to.md +++ b/content/flux/v0/stdlib/experimental/to.md @@ -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. diff --git a/content/flux/v0/stdlib/influxdata/influxdb/buckets.md b/content/flux/v0/stdlib/influxdata/influxdb/buckets.md index d5219c184..437f3a9c2 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/buckets.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/buckets.md @@ -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 diff --git a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md index c6c845c08..525a58f3d 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md @@ -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 diff --git a/content/flux/v0/stdlib/influxdata/influxdb/from.md b/content/flux/v0/stdlib/influxdata/influxdb/from.md index 03660cdf4..1cbddba2d 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/from.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/from.md @@ -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 diff --git a/content/flux/v0/stdlib/influxdata/influxdb/to.md b/content/flux/v0/stdlib/influxdata/influxdb/to.md index 5dc4eda58..e18526e88 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/to.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/to.md @@ -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. diff --git a/content/flux/v0/stdlib/influxdata/influxdb/wideto.md b/content/flux/v0/stdlib/influxdata/influxdb/wideto.md index f32dbc6bb..006bdb8de 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/wideto.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/wideto.md @@ -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. diff --git a/content/influxdb/cloud/tools/influxdb-templates/create.md b/content/influxdb/cloud/tools/influxdb-templates/create.md index 91760fe36..16c5f1cc1 100644 --- a/content/influxdb/cloud/tools/influxdb-templates/create.md +++ b/content/influxdb/cloud/tools/influxdb-templates/create.md @@ -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 -f -t + +```bash +# Syntax +influx export all --org --file --token +``` + + + +```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 -f -t [resource-flags] + +```bash +# Syntax +influx export --file --token [resource-flags] +``` + + + +```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 + + +```bash # Syntax influx export stack \ - -o \ - -t \ - -f \ + --token \ + --file \ +``` + + +```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. + + + + +For example, to set a custom bucket name when applying a template with an environment reference: + + +```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 diff --git a/content/influxdb/v1/concepts/time-series-index.md b/content/influxdb/v1/concepts/time-series-index.md index af421a777..b64a354f5 100644 --- a/content/influxdb/v1/concepts/time-series-index.md +++ b/content/influxdb/v1/concepts/time-series-index.md @@ -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/). diff --git a/content/influxdb/v1/introduction/get-started.md b/content/influxdb/v1/introduction/get-started.md index 8ce8e8763..db6afef24 100644 --- a/content/influxdb/v1/introduction/get-started.md +++ b/content/influxdb/v1/introduction/get-started.md @@ -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: diff --git a/content/influxdb/v1/query_language/_index.md b/content/influxdb/v1/query_language/_index.md index 199b1e05a..cf978e58f 100644 --- a/content/influxdb/v1/query_language/_index.md +++ b/content/influxdb/v1/query_language/_index.md @@ -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 diff --git a/content/influxdb/v1/query_language/spec.md b/content/influxdb/v1/query_language/spec.md index 3ffab21ed..f8563c516 100644 --- a/content/influxdb/v1/query_language/spec.md +++ b/content/influxdb/v1/query_language/spec.md @@ -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 diff --git a/content/influxdb/v2/reference/cli/influx/_index.md b/content/influxdb/v2/reference/cli/influx/_index.md index 0c0e557be..b59dd9f3a 100644 --- a/content/influxdb/v2/reference/cli/influx/_index.md +++ b/content/influxdb/v2/reference/cli/influx/_index.md @@ -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 + + ```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: + ```sh brew list | grep influxdb-cli ``` @@ -91,40 +94,49 @@ brew list | grep influxdb-cli 1. **Download the `influx` CLI package.** - influx CLI v{{< latest-patch cli=true >}} (macOS) + influx CLI v{{< latest-patch cli=true >}} (macOS) + + 2. **Unpackage the downloaded package.** - Do one of the following: + Do one of the following: - - Double-click the downloaded package file in **Finder**. - - Run the following command in a macOS command prompt application such - **Terminal** or **[iTerm2](https://www.iterm2.com/)**: - - ```sh - # Unpackage contents to the current working directory - tar zxvf ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz - ``` + - Double-click the downloaded package file in **Finder**. + - Run the following command in a macOS command prompt application such + **Terminal** or **[iTerm2](https://www.iterm2.com/)**: + + + ```sh + # Unpackage contents to the current working directory + tar zxvf ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64.tar.gz + ``` 3. **(Optional) Place the binary in your `$PATH`.** - ```sh - # (Optional) Copy the influx binary to your $PATH - sudo cp ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64/influx /usr/local/bin/ - ``` + + ```sh + # (Optional) Copy the influx binary to your $PATH + sudo cp ~/Downloads/influxdb2-client-{{< latest-patch cli=true >}}-darwin-amd64/influx /usr/local/bin/ + ``` - If you do not move the `influx` binary into your `$PATH`, prefix the executable - `./` to run it in place. + If you do not move the `influx` binary into your `$PATH`, prefix the executable + `./` to run it in place. 4. **(macOS Catalina and newer) Authorize the `influx` binary.** - macOS requires downloaded binaries to be signed by registered Apple developers. - When you first attempt to run `influx`, macOS will prevent it from running. - To authorize the `influx` binary: + macOS requires downloaded binaries to be signed by registered Apple developers. + When you first attempt to run `influx`, macOS will prevent it from running. + To authorize the `influx` binary: - 1. Attempt to run an `influx` command. - 2. Open **System Preferences** and click **Security & Privacy**. - 3. Under the **General** tab, there is a message about `influx` being blocked. + 1. Attempt to run an `influx` command. + 2. Open **System Preferences** and click **Security & Privacy**. + 3. Under the **General** tab, there is a message about `influx` being blocked. Click **Open Anyway**. {{% /tab-content %}} @@ -135,48 +147,54 @@ brew list | grep influxdb-cli 1. **Download the influx CLI package.** - Download the `influx` CLI package [from your browser](#download-from-your-browser) - or [from the command line](#download-from-the-command-line). + Download the `influx` CLI package [from your browser](#download-from-your-browser) + or [from the command line](#download-from-the-command-line). - #### Download from your browser + #### Download from your browser - influx CLI v{{< latest-patch cli=true >}} (amd64) - influx CLI v{{< latest-patch cli=true >}} (arm) + influx CLI v{{< latest-patch cli=true >}} (amd64) + influx CLI v{{< latest-patch cli=true >}} (arm) - #### Download from the command line + #### Download from the command line - ```sh - # amd64 - wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz + ```bash + # amd64 + curl -O \ + 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 - ``` + + ```bash + # arm + curl -O \ + https://dl.influxdata.com/influxdb/releases/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz \ + ``` -4. **Unpackage the downloaded package.** +2. **Unpackage the downloaded package.** - _**Note:** The following commands are examples. Adjust the filenames, paths, and utilities if necessary._ + _**Note:** The following commands are examples. Adjust the filenames, paths, and utilities if necessary._ - ```sh - # amd64 - tar xvzf path/to/influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz + + ```bash + # amd64 + tar xvzf influxdb2-client-{{< latest-patch cli=true >}}-linux-amd64.tar.gz + ``` - # arm - tar xvzf path/to/influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64.tar.gz - ``` + + ```bash + # arm + 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/ + + ```bash + sudo cp ./influx /usr/local/bin/ + ``` - # arm - sudo cp influxdb2-client-{{< latest-patch cli=true >}}-linux-arm64/influx /usr/local/bin/ - ``` - - If you do not move the `influx` binary into your `$PATH`, prefix the executable - `./` to run it in place. + If you do not move the `influx` binary into your `$PATH`, prefix the executable + `./` to run it in place. {{% /tab-content %}} @@ -185,34 +203,36 @@ 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 %}} 1. **Download the `influx` CLI package.** - influx CLI v{{< latest-patch cli=true >}} (Windows) + influx CLI v{{< latest-patch cli=true >}} (Windows) 2. **Expand the downloaded archive.** - Expand the downloaded archive into `C:\Program Files\InfluxData\` and rename it if desired. + Expand the downloaded archive into `C:\Program Files\InfluxData\` and rename it if desired. - ```powershell - > Expand-Archive .\influxdb2-client-{{< latest-patch cli=true >}}-windows-amd64.zip -DestinationPath 'C:\Program Files\InfluxData\' - > mv 'C:\Program Files\InfluxData\influxdb2-client-{{< latest-patch cli=true >}}-windows-amd64' 'C:\Program Files\InfluxData\influx' - ``` + ```powershell + > Expand-Archive .\influxdb2-client-{{< latest-patch cli=true >}}-windows-amd64.zip -DestinationPath 'C:\Program Files\InfluxData\' + > mv 'C:\Program Files\InfluxData\influxdb2-client-{{< latest-patch cli=true >}}-windows-amd64' 'C:\Program Files\InfluxData\influx' + ``` 3. **Grant network access to the `influx` CLI.** - When using the `influx` CLI for the first time, **Windows Defender** displays - the following message: + When using the `influx` CLI for the first time, **Windows Defender** displays + the following message: - > Windows Defender Firewall has blocked some features of this app. + > Windows Defender Firewall has blocked some features of this app. - To grant the `influx` CLI the required access, do the following: + To grant the `influx` CLI the required access, do the following: - 1. Select **Private networks, such as my home or work network**. - 2. Click **Allow access**. + 1. Select **Private networks, such as my home or work network**. + 2. Click **Allow access**. {{% /tab-content %}} @@ -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 \ +influx config create --config-name CONFIG_NAME \ --host-url http://localhost:8086 \ - --org \ - --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 ``` diff --git a/content/influxdb/v2/reference/cli/influx/auth/create.md b/content/influxdb/v2/reference/cli/influx/auth/create.md index 065a65455..28411f63d 100644 --- a/content/influxdb/v2/reference/cli/influx/auth/create.md +++ b/content/influxdb/v2/reference/cli/influx/auth/create.md @@ -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 diff --git a/content/resources/videos/API-Invokable-Scripts.md b/content/resources/videos/API-Invokable-Scripts.md index 48840fe05..6b3afe5dd 100644 --- a/content/resources/videos/API-Invokable-Scripts.md +++ b/content/resources/videos/API-Invokable-Scripts.md @@ -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 diff --git a/content/resources/videos/Intro-to-Client-Libraries.md b/content/resources/videos/Intro-to-Client-Libraries.md index 9d8c75d26..1182f5b82 100644 --- a/content/resources/videos/Intro-to-Client-Libraries.md +++ b/content/resources/videos/Intro-to-Client-Libraries.md @@ -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 diff --git a/content/resources/videos/Optimizing-Flux-Functions.md b/content/resources/videos/Optimizing-Flux-Functions.md index 2a8359d2d..aafe218fe 100644 --- a/content/resources/videos/Optimizing-Flux-Functions.md +++ b/content/resources/videos/Optimizing-Flux-Functions.md @@ -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 diff --git a/content/shared/influxdb3-api-reference/_index.md b/content/shared/influxdb3-api-reference/_index.md index eca583050..89495f21e 100644 --- a/content/shared/influxdb3-api-reference/_index.md +++ b/content/shared/influxdb3-api-reference/_index.md @@ -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. -InfluxDB 3 HTTP API for {{% product-name %}} +{{% product-name %}} HTTP API diff --git a/test/scripts/prepare-content.sh b/test/scripts/prepare-content.sh index ae2ead0d8..d58eecc70 100644 --- a/test/scripts/prepare-content.sh +++ b/test/scripts/prepare-content.sh @@ -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. diff --git a/test/scripts/run-tests.sh b/test/scripts/run-tests.sh index 7f0588f98..92cef6f49 100644 --- a/test/scripts/run-tests.sh +++ b/test/scripts/run-tests.sh @@ -51,6 +51,7 @@ setup if [[ $runner == "pytest" ]]; then pytest \ + -ra \ -s \ --codeblocks \ --suppress-no-test-exit-code \