Merge branch 'master' into influxdb-1.12.0

pull/5992/head^2
Scott Anderson 2025-04-16 15:11:02 -06:00 committed by GitHub
commit fd5c0f1933
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 114 additions and 34 deletions

View File

@ -335,19 +335,67 @@ cpu,host=Alpha,region=us-west,application=webserver val=6i,usage_percent=25.3,st
### Write data using the CLI
To quickly get started writing data, you can use the `influxdb3` CLI.
For batching and higher-volume write workloads, we recommend using the [HTTP API](#write-data-using-the-http-api).
> [!Note]
> For batching and higher-volume write workloads, we recommend using the [HTTP API](#write-data-using-the-http-api).
>
> #### Write data using InfluxDB API client libraries
>
> InfluxDB provides supported client libraries that integrate with your code
> to construct data as time series points and write the data as line protocol to your {{% product-name %}} database.
> For more information, see how to [use InfluxDB client libraries to write data](/influxdb3/version/write-data/api-client-libraries/).
##### Example: write data using the influxdb3 CLI
If you save the preceding line protocol to a file (for example, `server_data`), then you can use the `influxdb3` CLI to write the data--for example:
Use the `influxdb3 write` command to write data to a database.
In the code samples, replace the following placeholders with your values:
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: The name of the [database](/influxdb3/version/admin/databases/) to write to.
{{% show-in "core" %}}
- {{% code-placeholder-key %}}`TOKEN`{{% /code-placeholder-key %}}: A [token](/influxdb3/version/admin/tokens/) for your {{% product-name %}} server.
{{% /show-in %}}
{{% show-in "enterprise" %}}
- {{% code-placeholder-key %}}`TOKEN`{{% /code-placeholder-key %}}: A [token](/influxdb3/version/admin/tokens/)
with permission to write to the specified database.
{{% /show-in %}}
##### Write data via stdin
Pass data as quoted line protocol via standard input (stdin)--for example:
{{% code-placeholders "DATABASE_NAME|TOKEN" %}}
```bash
influxdb3 write \
--database mydb \
--file server_data \
--precision ns
--database DATABASE_NAME \
--token TOKEN \
--precision ns \
--accept-partial \
'cpu,host=Alpha,region=us-west,application=webserver val=1i,usage_percent=20.5,status="OK"
cpu,host=Bravo,region=us-east,application=database val=2i,usage_percent=55.2,status="OK"
cpu,host=Charlie,region=us-west,application=cache val=3i,usage_percent=65.4,status="OK"
cpu,host=Bravo,region=us-east,application=database val=4i,usage_percent=70.1,status="Warn"
cpu,host=Bravo,region=us-central,application=database val=5i,usage_percent=80.5,status="OK"
cpu,host=Alpha,region=us-west,application=webserver val=6i,usage_percent=25.3,status="Warn"'
```
{{% /code-placeholders %}}
##### Write data from a file
Pass the `--file` option to write line protocol you have saved to a file--for example, save the
[sample line protocol](#write-data-in-line-protocol-syntax) to a file named `server_data`
and then enter the following command:
{{% code-placeholders "DATABASE_NAME|TOKEN" %}}
```bash
influxdb3 write \
--database DATABASE_NAME \
--token TOKEN \
--precision ns \
--accept-partial \
--file server_data
```
{{% /code-placeholders %}}
### Write data using the HTTP API
@ -356,6 +404,7 @@ The `/api/v3/write_lp` endpoint is the recommended endpoint for writing data and
provides additional options for controlling write behavior.
If you need to write data using InfluxDB v1.x or v2.x tools, use the compatibility API endpoints.
Compatibility APIs work with [Telegraf](/telegraf/v1/), InfluxDB v2.x and v1.x [API client libraries](/influxdb3/version/reference/client-libraries), and other tools that support the v1.x or v2.x APIs.
{{% tabs-wrapper %}}
{{% tabs %}}
@ -374,13 +423,13 @@ and supports the following parameters:
- `?accept_partial=<BOOLEAN>`: Accept or reject partial writes (default is `true`).
- `?no_sync=<BOOLEAN>`: Control when writes are acknowledged:
- `no_sync=true`: Acknowledge writes before WAL persistence completes.
- `no_sync=true`: Acknowledges writes before WAL persistence completes.
- `no_sync=false`: Acknowledges writes after WAL persistence completes (default).
- `?precision=<PRECISION>`: Specify the precision of the timestamp. The default is nanosecond precision.
- request body: The line protocol data to write.
For more information about the parameters, see [Write data](/influxdb3/core/write-data/).
##### Example: write data using the /api/v3 HTTP API
The following examples show how to write data using `curl` and the `/api/3/write_lp` HTTP endpoint.
@ -449,7 +498,7 @@ For more information about the ingest path and data flow, see [Data durability](
{{% /tab-content %}}
{{% tab-content %}}
<!------------ BEGIN /api/v2/write -------------->
The `/api/v2/write` InfluxDB v2 compatibility endpoint provides backwards compatibility with clients that can write data to InfluxDB OSS v2.x and Cloud 2 (TSM).
The `/api/v2/write` InfluxDB v2 compatibility endpoint provides backwards compatibility with clients (such as [Telegraf's InfluxDB v2 output plugin](/telegraf/v1/plugins/#output-influxdb_v2) and [InfluxDB v2 API client libraries](/influxdb3/version/reference/client-libraries/v2/)) that can write data to InfluxDB OSS v2.x and Cloud 2 (TSM).
{{<api-endpoint endpoint="/api/v2/write?bucket=mydb&precision=ns" method="post" >}}
<!------------ END /api/v2/write -------------->
@ -465,15 +514,6 @@ The `/write` InfluxDB v1 compatibility endpoint provides backwards compatibility
{{% /tab-content %}}
{{% /tabs-wrapper %}}
#### Write data using InfluxDB client libraries
InfluxData provides supported InfluxDB 3 client libraries that you can integrate with your code
to construct data as time series points, and then write them as line protocol to an {{% product-name %}} database.
For more information, see how to [use InfluxDB client libraries to write data](/influxdb3/version/write-data/api-client-libraries/).
{{% product-name %}} supports the InfluxDB v2.x and v1.x compatibility APIs for
writing data with tools such as InfluxDB v2 and v1 client libraries and Telegraf.
> [!Note]
> #### Compatibility APIs differ from native APIs
>

View File

@ -439,19 +439,67 @@ cpu,host=Alpha,region=us-west,application=webserver val=6i,usage_percent=25.3,st
### Write data using the CLI
To quickly get started writing data, you can use the `influxdb3` CLI.
For batching and higher-volume write workloads, we recommend using the [HTTP API](#write-data-using-the-http-api).
> [!Note]
> For batching and higher-volume write workloads, we recommend using the [HTTP API](#write-data-using-the-http-api).
>
> #### Write data using InfluxDB API client libraries
>
> InfluxDB provides supported client libraries that integrate with your code
> to construct data as time series points and write the data as line protocol to your {{% product-name %}} database.
> For more information, see how to [use InfluxDB client libraries to write data](/influxdb3/version/write-data/api-client-libraries/).
##### Example: write data using the influxdb3 CLI
If you save the preceding line protocol to a file (for example, `server_data`), then you can use the `influxdb3` CLI to write the data--for example:
Use the `influxdb3 write` command to write data to a database.
In the code samples, replace the following placeholders with your values:
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: The name of the [database](/influxdb3/version/admin/databases/) to write to.
{{% show-in "core" %}}
- {{% code-placeholder-key %}}`TOKEN`{{% /code-placeholder-key %}}: A [token](/influxdb3/version/admin/tokens/) for your {{% product-name %}} server.
{{% /show-in %}}
{{% show-in "enterprise" %}}
- {{% code-placeholder-key %}}`TOKEN`{{% /code-placeholder-key %}}: A [token](/influxdb3/version/admin/tokens/)
with permission to write to the specified database.
{{% /show-in %}}
##### Write data via stdin
Pass data as quoted line protocol via standard input (stdin)--for example:
{{% code-placeholders "DATABASE_NAME|TOKEN" %}}
```bash
influxdb3 write \
--database mydb \
--file server_data \
--precision ns
--database DATABASE_NAME \
--token TOKEN \
--precision ns \
--accept-partial \
'cpu,host=Alpha,region=us-west,application=webserver val=1i,usage_percent=20.5,status="OK"
cpu,host=Bravo,region=us-east,application=database val=2i,usage_percent=55.2,status="OK"
cpu,host=Charlie,region=us-west,application=cache val=3i,usage_percent=65.4,status="OK"
cpu,host=Bravo,region=us-east,application=database val=4i,usage_percent=70.1,status="Warn"
cpu,host=Bravo,region=us-central,application=database val=5i,usage_percent=80.5,status="OK"
cpu,host=Alpha,region=us-west,application=webserver val=6i,usage_percent=25.3,status="Warn"'
```
{{% /code-placeholders %}}
##### Write data from a file
Pass the `--file` option to write line protocol you have saved to a file--for example, save the
[sample line protocol](#write-data-in-line-protocol-syntax) to a file named `server_data`
and then enter the following command:
{{% code-placeholders "DATABASE_NAME|TOKEN" %}}
```bash
influxdb3 write \
--database DATABASE_NAME \
--token TOKEN \
--precision ns \
--accept-partial \
--file server_data
```
{{% /code-placeholders %}}
### Write data using the HTTP API
@ -460,6 +508,7 @@ The `/api/v3/write_lp` endpoint is the recommended endpoint for writing data and
provides additional options for controlling write behavior.
If you need to write data using InfluxDB v1.x or v2.x tools, use the compatibility API endpoints.
Compatibility APIs work with [Telegraf](/telegraf/v1/), InfluxDB v2.x and v1.x [API client libraries](/influxdb3/version/reference/client-libraries), and other tools that support the v1.x or v2.x APIs.
{{% tabs-wrapper %}}
{{% tabs %}}
@ -478,13 +527,13 @@ and supports the following parameters:
- `?accept_partial=<BOOLEAN>`: Accept or reject partial writes (default is `true`).
- `?no_sync=<BOOLEAN>`: Control when writes are acknowledged:
- `no_sync=true`: Acknowledge writes before WAL persistence completes.
- `no_sync=true`: Acknowledges writes before WAL persistence completes.
- `no_sync=false`: Acknowledges writes after WAL persistence completes (default).
- `?precision=<PRECISION>`: Specify the precision of the timestamp. The default is nanosecond precision.
- request body: The line protocol data to write.
For more information about the parameters, see [Write data](/influxdb3/core/write-data/).
##### Example: write data using the /api/v3 HTTP API
The following examples show how to write data using `curl` and the `/api/3/write_lp` HTTP endpoint.
@ -553,7 +602,7 @@ For more information about the ingest path and data flow, see [Data durability](
{{% /tab-content %}}
{{% tab-content %}}
<!------------ BEGIN /api/v2/write -------------->
The `/api/v2/write` InfluxDB v2 compatibility endpoint provides backwards compatibility with clients that can write data to InfluxDB OSS v2.x and Cloud 2 (TSM).
The `/api/v2/write` InfluxDB v2 compatibility endpoint provides backwards compatibility with clients (such as [Telegraf's InfluxDB v2 output plugin](/telegraf/v1/plugins/#output-influxdb_v2) and [InfluxDB v2 API client libraries](/influxdb3/version/reference/client-libraries/v2/)) that can write data to InfluxDB OSS v2.x and Cloud 2 (TSM).
{{<api-endpoint endpoint="/api/v2/write?bucket=mydb&precision=ns" method="post" >}}
<!------------ END /api/v2/write -------------->
@ -569,15 +618,6 @@ The `/write` InfluxDB v1 compatibility endpoint provides backwards compatibility
{{% /tab-content %}}
{{% /tabs-wrapper %}}
#### Write data using InfluxDB client libraries
InfluxData provides supported InfluxDB 3 client libraries that you can integrate with your code
to construct data as time series points, and then write them as line protocol to an {{% product-name %}} database.
For more information, see how to [use InfluxDB client libraries to write data](/influxdb3/version/write-data/api-client-libraries/).
{{% product-name %}} supports the InfluxDB v2.x and v1.x compatibility APIs for
writing data with tools such as InfluxDB v2 and v1 client libraries and Telegraf.
> [!Note]
> #### Compatibility APIs differ from native APIs
>