influxctl v2.8.0 (#5413)
* added influxql query support for influxctl * removed sql tag from task-based influxctl query guide * Influxctl v2.8.0 (#5418) * Release influxctl v2.8.0 * Update change logs * Apply suggestions from code review Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com> --------- Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com> * Add influxctl write timeout and new insecure TLS config (#5419) * add timeout flag to write, update config with insecure tls * fixed link * Add 'enable-system-tables' flag to `influxctl query` (#5415) * add enable system tables flag to influxctl * Apply suggestions from code review Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com> --------- Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com> * Query system tables with influxctl (#5414) * outline for querying system tables * finalized system table query examples * updated system table validity date * Apply suggestions from code review Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com> * Apply suggestions from code review --------- Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com> --------- Co-authored-by: Joshua Powers <powersj@fastmail.com> Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>pull/5420/head
parent
9ec7d65414
commit
cdc0b25ec2
|
|
@ -0,0 +1,398 @@
|
|||
---
|
||||
title: Query system data
|
||||
description: >
|
||||
Query system tables in your InfluxDB Cloud Dedicated cluster to see data related
|
||||
to queries, tables, partitions, and compaction in your cluster.
|
||||
menu:
|
||||
influxdb_cloud_dedicated:
|
||||
parent: Administer InfluxDB Cloud
|
||||
name: Query system data
|
||||
weight: 105
|
||||
---
|
||||
|
||||
{{< product-name >}} stores data related to queries, tables, partitions, and
|
||||
compaction in system tables in your cluster.
|
||||
Query data in your cluster's system tables for information about your cluster.
|
||||
|
||||
- [Query system tables](#query-system-tables)
|
||||
- [System tables](#system-tables)
|
||||
- [System query examples](#system-query-examples)
|
||||
|
||||
{{% warn %}}
|
||||
#### May impact overall cluster performance
|
||||
|
||||
Querying InfluxDB v3 system tables may impact the overall write and query
|
||||
performance of your {{< product-name omit=" Clustered" >}} cluster.
|
||||
|
||||
<!--------------- UPDATE THE DATE BELOW AS EXAMPLES ARE UPDATED --------------->
|
||||
|
||||
#### System tables are subject to change
|
||||
|
||||
System tables are not part of InfluxDB's stable API and may change with new releases.
|
||||
The provided schema information and query examples are valid as of **April 11, 2024**.
|
||||
If you detect a schema change or a non-functioning query example, please
|
||||
[submit an issue](https://github.com/influxdata/docs-v2/issues/new/choose).
|
||||
|
||||
<!--------------- UPDATE THE DATE ABOVE AS EXAMPLES ARE UPDATED --------------->
|
||||
{{% /warn %}}
|
||||
|
||||
## Query system tables
|
||||
|
||||
{{% warn %}}
|
||||
_Querying system tables [may impact overall cluster performance](#may-impact-overall-cluster-performance)._
|
||||
{{% /warn %}}
|
||||
|
||||
{{% note %}}
|
||||
Querying system tables with `influxctl` requires **`influxctl` v2.8.0 or newer**.
|
||||
{{% /note %}}
|
||||
|
||||
Use the [`influxctl query` command](/influxdb/cloud-dedicated/reference/cli/influxctl/query/)
|
||||
and SQL to query system tables. Provide the following:
|
||||
|
||||
- **Enable system tables** with the `--enable-system-tables` command flag.
|
||||
- **Database token**: A [database token](/influxdb/cloud-dedicated/admin/tokens/#database-tokens)
|
||||
with read permissions on the specified database. Uses the `token` setting from
|
||||
the [`influxctl` connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles)
|
||||
or the `--token` command flag.
|
||||
- **Database name**: The name of the database to query information about.
|
||||
Uses the `database` setting from the
|
||||
[`influxctl` connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles)
|
||||
or the `--database` command flag.
|
||||
- **SQL query**: The SQL query to execute.
|
||||
Pass the query in one of the following ways:
|
||||
|
||||
- a string on the command line
|
||||
- a path to a file that contains the query
|
||||
- a single dash (`-`) to read the query from stdin
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)|SQL_QUERY" %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--enable-system-tables \
|
||||
--database DATABASE_NAME \
|
||||
--token DATABASE_TOKEN \
|
||||
"SQL_QUERY"
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--enable-system-tables \
|
||||
--database DATABASE_NAME \
|
||||
--token DATABASE_TOKEN \
|
||||
/path/to/query.sql
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./query.sql | influxctl query \
|
||||
--enable-system-tables \
|
||||
--database DATABASE_NAME \
|
||||
--token DATABASE_TOKEN \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
Replace the following:
|
||||
|
||||
- {{% code-placeholder-key %}}`DATABASE_TOKEN`{{% /code-placeholder-key %}}:
|
||||
A database token with read access to the specified database
|
||||
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
|
||||
The name of the database to query information about.
|
||||
- {{% code-placeholder-key %}}`SQL_QUERY`{{% /code-placeholder-key %}}:
|
||||
The SQL query to execute. For examples, see [Query examples](#query-examples).
|
||||
|
||||
When prompted, enter `y` to acknowledge the potential impact querying system
|
||||
tables may have on your cluster.
|
||||
|
||||
## System tables
|
||||
|
||||
{{% warn %}}
|
||||
_System tables are [subject to change](#system-tables-are-subject-to-change)._
|
||||
{{% /warn %}}
|
||||
|
||||
- [system.queries](#systemqueries)
|
||||
- [system.tables](#systemtables)
|
||||
- [system.partitions](#systempartitions)
|
||||
- [system.compactor](#systemcompactor)
|
||||
|
||||
### system.queries
|
||||
|
||||
The `system.queries` table contains an unpersisted log of queries run against
|
||||
the current [InfluxDB Querier](/influxdb/cloud-dedicated/reference/internals/storage-engine/#querier)
|
||||
to which your query is routed.
|
||||
The query log is specific to the current Querier and is not shared across Queriers
|
||||
in your cluster.
|
||||
Logs are scoped to the specified database.
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View `system.queries` schema" %}}
|
||||
|
||||
The `system.queries` table contains the following columns:
|
||||
|
||||
- id
|
||||
- phase
|
||||
- issue_time
|
||||
- query_type
|
||||
- query_text
|
||||
- partitions
|
||||
- parquet_files
|
||||
- plan_duration
|
||||
- permit_duration
|
||||
- execute_duration
|
||||
- end2end_duration
|
||||
- compute_duration
|
||||
- max_memory
|
||||
- success
|
||||
- running
|
||||
- cancelled
|
||||
- trace_id
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
### system.tables
|
||||
|
||||
The `system.tables` table contains information about tables in the specified database.
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View `system.tables` schema" %}}
|
||||
|
||||
The `system.tables` table contains the following columns:
|
||||
|
||||
- table_name
|
||||
- partition_template
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
### system.partitions
|
||||
|
||||
The `system.partitions` table contains information about partitions associated
|
||||
with the specified database.
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View `system.partitions` schema" %}}
|
||||
|
||||
The `system.partitions` table contains the following columns:
|
||||
|
||||
- partition_id
|
||||
- table_name
|
||||
- partition_key
|
||||
- last_new_file_created_at
|
||||
- num_files
|
||||
- total_size_mb
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
### system.compactor
|
||||
|
||||
The `system.compaction` table contains information about compacted partition Parquet
|
||||
files associated with the specified database.
|
||||
|
||||
{{< expand-wrapper >}}
|
||||
{{% expand "View `system.compactor` schema" %}}
|
||||
|
||||
The `system.compactor` table contains the following columns:
|
||||
|
||||
- partition_id
|
||||
- table_name
|
||||
- partition_key
|
||||
- total_l0_files
|
||||
- total_l1_files
|
||||
- total_l2_files
|
||||
- total_l0_bytes
|
||||
- total_l1_bytes
|
||||
- total_l2_bytes
|
||||
- skipped_reason
|
||||
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
## System query examples
|
||||
|
||||
- [Query logs](#query-logs)
|
||||
- [View all stored query logs](#view-all-stored-query-logs)
|
||||
- [View query logs for queries with end-to-end durations above a threshold](#view-query-logs-for-queries-with-end-to-end-durations-above-a-threshold)
|
||||
- [Partitions](#partitions)
|
||||
- [View partition templates of all tables](#view-partition-templates-of-all-tables)
|
||||
- [View the partition template of a specific table](#view-the-partition-template-of-a-specific-table)
|
||||
- [View all partitions for a table](#view-all-partitions-for-a-table)
|
||||
- [View the number of partitions per table](#view-the-number-of-partitions-per-table)
|
||||
- [View the number of partitions for a specific table](#view-the-number-of-partitions-for-a-specific-table)
|
||||
- [Storage usage](#storage-usage)
|
||||
- [View the size of tables in megabytes](#view-the-size-of-tables-in-megabytes)
|
||||
- [View the size of a specific table in megabytes](#view-the-size-of-a-specific-table-in-megabytes)
|
||||
- [View the total size of all compacted partitions per table in bytes](#view-the-total-size-of-all-compacted-partitions-per-table-in-bytes)
|
||||
- [View the total size of all compacted partitions in bytes](#view-the-total-size-of-all-compacted-partitions-in-bytes)
|
||||
- [Compaction](#compaction)
|
||||
- [View overall compaction totals for each table](#view-overall-compaction-totals-for-each-table)
|
||||
- [View overall compaction totals for a specific table](#view-overall-compaction-totals-for-a-specific-table)
|
||||
|
||||
In the examples below, replace {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}
|
||||
with the name of the table you want to query information about.
|
||||
|
||||
---
|
||||
|
||||
{{% code-placeholders "TABLE_NAME" %}}
|
||||
|
||||
### Query logs
|
||||
|
||||
#### View all stored query logs
|
||||
|
||||
```sql
|
||||
SELECT * FROM system.queries
|
||||
```
|
||||
|
||||
#### View query logs for queries with end-to-end durations above a threshold
|
||||
|
||||
The following returns query logs for queries with an end-to-end duration greater
|
||||
than 50 milliseconds.
|
||||
|
||||
```sql
|
||||
SELECT * FROM system.queries WHERE end2end_duration::BIGINT > (50 * 1000000)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Partitions
|
||||
|
||||
#### View partition templates of all tables
|
||||
|
||||
```sql
|
||||
SELECT * FROM system.tables
|
||||
```
|
||||
|
||||
#### View the partition template of a specific table
|
||||
|
||||
```sql
|
||||
SELECT * FROM system.tables WHERE table_name = 'TABLE_NAME'
|
||||
```
|
||||
|
||||
#### View all partitions for a table
|
||||
|
||||
```sql
|
||||
SELECT * FROM system.partitions WHERE table_name = 'TABLE_NAME'
|
||||
```
|
||||
|
||||
#### View the number of partitions per table
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
table_name,
|
||||
COUNT(*) AS partition_count
|
||||
FROM
|
||||
system.partitions
|
||||
GROUP BY
|
||||
table_name
|
||||
```
|
||||
|
||||
#### View the number of partitions for a specific table
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
COUNT(*) AS partition_count
|
||||
FROM
|
||||
system.partitions
|
||||
WHERE
|
||||
table_name = 'TABLE_NAME'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Storage usage
|
||||
|
||||
#### View the size of tables in megabytes
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
table_name,
|
||||
SUM(total_size_mb) AS total_size_mb
|
||||
FROM
|
||||
system.partitions
|
||||
GROUP BY
|
||||
table_name
|
||||
```
|
||||
|
||||
#### View the size of a specific table in megabytes
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
SUM(total_size_mb) AS total_size_mb
|
||||
FROM
|
||||
system.partitions
|
||||
WHERE
|
||||
table_name = 'TABLE_NAME'
|
||||
```
|
||||
|
||||
#### View the total size of all compacted partitions per table in bytes
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
table_name,
|
||||
SUM(total_l0_bytes) + SUM(total_l1_bytes) + SUM(total_l2_bytes) AS total_bytes
|
||||
FROM
|
||||
system.compactor
|
||||
GROUP BY
|
||||
table_name
|
||||
```
|
||||
|
||||
#### View the total size of all compacted partitions in bytes
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
SUM(total_l0_bytes) + SUM(total_l1_bytes) + SUM(total_l2_bytes) AS total_bytes
|
||||
FROM
|
||||
system.compactor
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Compaction
|
||||
|
||||
#### View overall compaction totals for each table
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
table_name,
|
||||
SUM(total_l0_files) AS total_l0_files,
|
||||
SUM(total_l1_files) AS total_l1_files,
|
||||
SUM(total_l2_files) AS total_l2_files,
|
||||
SUM(total_l0_bytes) AS total_l0_bytes,
|
||||
SUM(total_l1_bytes) AS total_l1_bytes,
|
||||
SUM(total_l2_bytes) AS total_l2_bytes
|
||||
FROM
|
||||
system.compactor
|
||||
GROUP BY
|
||||
table_name
|
||||
```
|
||||
|
||||
#### View overall compaction totals for a specific table
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
SUM(total_l0_files) AS total_l0_files,
|
||||
SUM(total_l1_files) AS total_l1_files,
|
||||
SUM(total_l2_files) AS total_l2_files,
|
||||
SUM(total_l0_bytes) AS total_l0_bytes,
|
||||
SUM(total_l1_bytes) AS total_l1_bytes,
|
||||
SUM(total_l2_bytes) AS total_l2_bytes
|
||||
FROM
|
||||
system.compactor
|
||||
WHERE
|
||||
table_name = 'TABLE_NAME'
|
||||
```
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
title: Execute queries
|
||||
description: >
|
||||
Use tools and libraries to query data stored in InfluxDB Cloud Dedicated.
|
||||
weight: 201
|
||||
weight: 101
|
||||
menu:
|
||||
influxdb_cloud_dedicated:
|
||||
name: Execute queries
|
||||
|
|
|
|||
|
|
@ -9,38 +9,40 @@ menu:
|
|||
influxdb_cloud_dedicated:
|
||||
parent: Execute queries
|
||||
name: Use the influxctl CLI
|
||||
influxdb/cloud-dedicated/tags: [query, sql, influxctl, CLI]
|
||||
metadata: [SQL]
|
||||
influxdb/cloud-dedicated/tags: [query, sql, influxql, influxctl, CLI]
|
||||
related:
|
||||
- /influxdb/cloud-dedicated/reference/cli/influxctl/query/
|
||||
- /influxdb/cloud-dedicated/get-started/query/#execute-an-sql-query, Get started querying data
|
||||
- /influxdb/cloud-dedicated/reference/sql/
|
||||
- /influxdb/cloud-dedicated/reference/influxql/
|
||||
list_code_example: |
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
"q=SELECT * FROM home"
|
||||
"SELECT * FROM home"
|
||||
```
|
||||
---
|
||||
|
||||
Use the [`influxctl query` command](/influxdb/cloud-dedicated/reference/cli/influxctl/query/)
|
||||
to query data in {{< product-name >}} with SQL.
|
||||
|
||||
{{% note %}}
|
||||
The `influxctl query` command only supports SQL queries; not InfluxQL.
|
||||
{{% /note %}}
|
||||
to query data in {{< product-name >}} with SQL or InfluxQL.
|
||||
|
||||
Provide the following with your command:
|
||||
|
||||
- **Database token**: [Database token](/influxdb/cloud-dedicated/admin/tokens/#database-tokens)
|
||||
with read permissions on the queried database. Uses the `token` setting from
|
||||
the [`influxctl` connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles)
|
||||
- **Database token**: A [database token](/influxdb/cloud-dedicated/admin/tokens/#database-tokens)
|
||||
with read permissions on the queried database. By default, this uses
|
||||
the `database` setting from the [`influxctl` connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles)
|
||||
or the `--token` command flag.
|
||||
- **Database name**: Name of the database to query. Uses the `database` setting
|
||||
from the [`influxctl` connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles)
|
||||
- **Database name**: The name of the database to query. By default, this uses
|
||||
the `database` setting from the [`influxctl` connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles)
|
||||
or the `--database` command flag.
|
||||
- **SQL query**: SQL query to execute.
|
||||
- **Query language** <em class="op65">(Optional)</em>: The query language of the query.
|
||||
Use the `--language` flag to specify one of the following query languages:
|
||||
|
||||
- `sql` _(default)_
|
||||
- `influxql`
|
||||
|
||||
- **Query**: SQL or InfluxQL query to execute.
|
||||
Pass the query in one of the following ways:
|
||||
|
||||
- a string on the command line
|
||||
|
|
@ -49,6 +51,14 @@ Provide the following with your command:
|
|||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< tabs-wrapper >}}
|
||||
{{% tabs %}}
|
||||
[SQL](#)
|
||||
[InfluxQL](#)
|
||||
{{% /tabs %}}
|
||||
|
||||
{{% tab-content %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
|
|
@ -81,6 +91,48 @@ cat ./query.sql | influxctl query \
|
|||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /tab-content %}}
|
||||
|
||||
{{% tab-content %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
"SELECT * FROM home"
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
/path/to/query.influxql
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./query.influxql | influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /tab-content %}}
|
||||
{{< /tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
Replace the following:
|
||||
|
|
|
|||
|
|
@ -335,6 +335,7 @@ If stored at a non-default location, include the `--config` flag with each
|
|||
## By default, the system certificates are used. If a custom certificate
|
||||
## for connecting to InfluxDB is required, define it below.
|
||||
# [profile.tls]
|
||||
# insecure = false
|
||||
# cert = ""
|
||||
# key = ""
|
||||
# ca = ""
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
title: influxctl query
|
||||
description: >
|
||||
The `influxctl query` command queries data from InfluxDB Cloud Dedicated
|
||||
using SQL and prints results as a table or JSON.
|
||||
using SQL or InfluxQL and prints results as a table or JSON.
|
||||
menu:
|
||||
influxdb_cloud_dedicated:
|
||||
parent: influxctl
|
||||
|
|
@ -10,13 +10,14 @@ weight: 201
|
|||
metadata: [influxctl 2.4.0+]
|
||||
related:
|
||||
- /influxdb/cloud-dedicated/reference/sql/
|
||||
- /influxdb/cloud-dedicated/reference/influxql/
|
||||
- /influxdb/cloud-dedicated/query-data/
|
||||
---
|
||||
|
||||
The `influxctl query` command queries data from {{< product-name >}} using SQL
|
||||
and prints results as a table or JSON.
|
||||
or InfluxQL and prints results as a table or JSON.
|
||||
|
||||
Provide the SQL query in one of the following ways:
|
||||
Provide the query in one of the following ways:
|
||||
|
||||
- a string on the command line
|
||||
- a path to a file that contains the query
|
||||
|
|
@ -26,7 +27,6 @@ Provide the SQL query in one of the following ways:
|
|||
#### Important to note
|
||||
|
||||
- This command supports only one query per execution.
|
||||
- This command supports only SQL queries; not InfluxQL.
|
||||
- This command is not meant to be a full, feature-rich query tool.
|
||||
It's meant for debug, triage, and basic data exploration.
|
||||
{{% /note %}}
|
||||
|
|
@ -56,18 +56,20 @@ influxctl query [flags] <QUERY>
|
|||
|
||||
## Arguments
|
||||
|
||||
| Argument | Description |
|
||||
| :-------- | :---------------------------------------------------------------------------------- |
|
||||
| **QUERY** | SQL query to execute (command line string, path to file, or `-` to read from stdin) |
|
||||
| Argument | Description |
|
||||
| :-------- | :------------------------------------------------------------------------------ |
|
||||
| **QUERY** | Query to execute (command line string, path to file, or `-` to read from stdin) |
|
||||
|
||||
## Flags
|
||||
|
||||
| Flag | | Description |
|
||||
| :--- | :----------- | :----------------------------------------------------------- |
|
||||
| | `--database` | Database to query |
|
||||
| | `--format` | Output format (`table` _(default)_ or `json`) |
|
||||
| | `--token` | Database token with read permissions on the queried database |
|
||||
| `-h` | `--help` | Output command help |
|
||||
| Flag | | Description |
|
||||
| :--- | :----------------------- | :----------------------------------------------------------- |
|
||||
| | `--database` | Database to query |
|
||||
| | `--enable-system-tables` | Enable ability to query system tables |
|
||||
| | `--format` | Output format (`table` _(default)_ or `json`) |
|
||||
| | `--language` | Query language (`sql` _(default)_ or `influxql`) |
|
||||
| | `--token` | Database token with read permissions on the queried database |
|
||||
| `-h` | `--help` | Output command help |
|
||||
|
||||
{{% caption %}}
|
||||
_Also see [`influxctl` global flags](/influxdb/cloud-dedicated/reference/cli/influxctl/#global-flags)._
|
||||
|
|
@ -75,9 +77,12 @@ _Also see [`influxctl` global flags](/influxdb/cloud-dedicated/reference/cli/inf
|
|||
|
||||
## Examples
|
||||
|
||||
- [Query InfluxDB v3 with SQL](#query-influxdb-v3-with-sql)
|
||||
- [Query InfluxDB v3 with InfluxQL](#query-influxdb-v3-with-influxql)
|
||||
- [Query InfluxDB v3 and return results in table format](#query-influxdb-v3-and-return-results-in-table-format)
|
||||
- [Query InfluxDB v3 and return results in JSON format](#query-influxdb-v3-and-return-results-in-json-format)
|
||||
- [Query InfluxDB v3 using credentials from the connection profile](#query-influxdb-v3-using-credentials-from-the-connection-profile)
|
||||
- [Query data from InfluxDB v3 system tables](#query-data-from-influxdb-v3-system-tables)
|
||||
|
||||
In the examples below, replace the following:
|
||||
|
||||
|
|
@ -86,6 +91,89 @@ In the examples below, replace the following:
|
|||
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
|
||||
Name of the database to query
|
||||
|
||||
### Query InfluxDB v3 with SQL
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
"SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z'"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
/path/to/query.sql
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./query.sql | influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
### Query InfluxDB v3 with InfluxQL
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
"SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z'"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
/path/to/query.influxql
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./query.influxql | influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
### Query InfluxDB v3 and return results in table format
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
|
@ -242,6 +330,70 @@ The following example uses the `database` and `token` defined in the `default`
|
|||
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl query "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z' LIMIT 5"
|
||||
influxctl query "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z'"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
|
||||
### Query data from InfluxDB v3 system tables
|
||||
|
||||
{{% note %}}
|
||||
You must use **SQL** to query InfluxDB v3 system tables.
|
||||
{{% /note %}}
|
||||
|
||||
{{% warn %}}
|
||||
Querying system tables can impact the overall performance of your
|
||||
{{< product-name omit=" Clustered" >}} cluster. System tables are not part of
|
||||
InfluxDB's stable API and are subject to change.
|
||||
{{% /warn %}}
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--enable-system-tables \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
"SELECT * FROM system.tables"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--enable-system-tables \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
/path/to/query.sql
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./query.sql | influxctl query \
|
||||
--enable-system-tables \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
{{% expand "View command updates" %}}
|
||||
|
||||
#### v2.8.0 {date="2024-04-11"}
|
||||
|
||||
- Add InfluxQL support and introduce the `--language` flag to specify the query
|
||||
language.
|
||||
- Add `--enable-system-tables` flag to enable the ability to query InfluxDB v3
|
||||
system tables.
|
||||
|
||||
{{% /expand %}}
|
||||
|
|
|
|||
|
|
@ -219,6 +219,53 @@ cat ./metrics.lp | influxctl write \
|
|||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
### Write line protocol to InfluxDB v3 with a custom client timeout
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl write \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--timeout 20 \
|
||||
"home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000
|
||||
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
|
||||
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600
|
||||
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
|
||||
"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl write \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--timeout 20 \
|
||||
/path/to/metrics.lp
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./metrics.lp | influxctl write \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--timeout 20 \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
### Write line protocol to InfluxDB v3 using credentials from the connection profile
|
||||
|
||||
The following example uses the `database` and `token` defined in the `default`
|
||||
|
|
@ -233,3 +280,11 @@ home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600000000000
|
|||
"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
|
||||
{{% expand "View command updates" %}}
|
||||
|
||||
#### v2.8.0 {date="2024-04-11"}
|
||||
|
||||
- Add `--timeout` flag to specify a custom client timeout.
|
||||
|
||||
{{% /expand %}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: InfluxQL reference
|
||||
title: InfluxQL reference documentation
|
||||
list_title: InfluxQL
|
||||
description: InfluxQL is an SQL-like query language for interacting with data in InfluxDB.
|
||||
menu:
|
||||
|
|
|
|||
|
|
@ -11,6 +11,26 @@ menu:
|
|||
weight: 202
|
||||
---
|
||||
|
||||
## v2.8.0 {date="2024-04-11"}
|
||||
|
||||
### Features
|
||||
|
||||
- Introduce the ability to query with InfluxQL.
|
||||
- Add insecure configuration option to TLS configuration.
|
||||
- Allow users to query system tables.
|
||||
- Utilize the database proxy service.
|
||||
|
||||
### Dependency Updates
|
||||
|
||||
- Update Go to v1.22.2.
|
||||
- Update `github.com/go-git/go-git/v5` from 5.11.0 to 5.12.0.
|
||||
- Update `github.com/jedib0t/go-pretty/v6` from 6.5.6 to 6.5.8.
|
||||
- Update `golang.org/x/mod` from 0.16.0 to 0.17.0.
|
||||
- Update `golang.org/x/oauth2` from 0.18.0 to 0.19.0.
|
||||
- Update `google.golang.org/grpc` from 1.62.1 to 1.63.2.
|
||||
|
||||
---
|
||||
|
||||
## v2.7.1 {date="2024-03-27"}
|
||||
|
||||
### Bug Fixes
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: InfluxQL reference
|
||||
title: InfluxQL reference documentation
|
||||
list_title: InfluxQL
|
||||
description: InfluxQL is an SQL-like query language for interacting with data in InfluxDB.
|
||||
menu:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
title: Execute queries
|
||||
description: >
|
||||
Use tools and libraries to query data stored in an InfluxDB cluster.
|
||||
weight: 201
|
||||
weight: 101
|
||||
menu:
|
||||
influxdb_clustered:
|
||||
name: Execute queries
|
||||
|
|
|
|||
|
|
@ -8,38 +8,40 @@ menu:
|
|||
influxdb_clustered:
|
||||
parent: Execute queries
|
||||
name: Use the influxctl CLI
|
||||
influxdb/clustered/tags: [query, sql, influxctl, CLI]
|
||||
metadata: [SQL]
|
||||
influxdb/clustered/tags: [query, sql, influxql, influxctl, CLI]
|
||||
related:
|
||||
- /influxdb/clustered/reference/cli/influxctl/query/
|
||||
- /influxdb/clustered/get-started/query/#execute-an-sql-query, Get started querying data
|
||||
- /influxdb/clustered/reference/sql/
|
||||
- /influxdb/clustered/reference/influxql/
|
||||
list_code_example: |
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
"q=SELECT * FROM home"
|
||||
"SELECT * FROM home"
|
||||
```
|
||||
---
|
||||
|
||||
Use the [`influxctl query` command](/influxdb/clustered/reference/cli/influxctl/query/)
|
||||
to query data in {{< product-name >}} with SQL.
|
||||
|
||||
{{% note %}}
|
||||
The `influxctl query` command only supports SQL queries; not InfluxQL.
|
||||
{{% /note %}}
|
||||
to query data in {{< product-name >}} with SQL or InfluxQL.
|
||||
|
||||
Provide the following with your command:
|
||||
|
||||
- **Database token**: a [database token](/influxdb/clustered/admin/tokens/#database-tokens)
|
||||
with read permissions on the specified database. Uses the `token` setting from
|
||||
the [`influxctl` connection profile](/influxdb/clustered/reference/cli/influxctl/#configure-connection-profiles)
|
||||
- **Database token**: A [database token](/influxdb/clustered/admin/tokens/#database-tokens)
|
||||
with read permissions on the queried database. By default, this uses
|
||||
the `database` setting from the [`influxctl` connection profile](/influxdb/clustered/reference/cli/influxctl/#configure-connection-profiles)
|
||||
or the `--token` command flag.
|
||||
- **Database name**: Name of the database to query. Uses the `database` setting
|
||||
from the [`influxctl` connection profile](/influxdb/clustered/reference/cli/influxctl/#configure-connection-profiles)
|
||||
- **Database name**: The name of the database to query. By default, this uses
|
||||
the `database` setting from the [`influxctl` connection profile](/influxdb/clustered/reference/cli/influxctl/#configure-connection-profiles)
|
||||
or the `--database` command flag.
|
||||
- **SQL query**: SQL query to execute.
|
||||
- **Query language** <em class="op65">(Optional)</em>: The query language of the query.
|
||||
Use the `--language` flag to specify one of the following query languages:
|
||||
|
||||
- `sql` _(default)_
|
||||
- `influxql`
|
||||
|
||||
- **Query**: SQL or InfluxQL query to execute.
|
||||
Pass the query in one of the following ways:
|
||||
|
||||
- a string on the command line
|
||||
|
|
@ -48,6 +50,14 @@ Provide the following with your command:
|
|||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< tabs-wrapper >}}
|
||||
{{% tabs %}}
|
||||
[SQL](#)
|
||||
[InfluxQL](#)
|
||||
{{% /tabs %}}
|
||||
|
||||
{{% tab-content %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
|
|
@ -80,6 +90,48 @@ cat ./query.sql | influxctl query \
|
|||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /tab-content %}}
|
||||
|
||||
{{% tab-content %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
"SELECT * FROM home"
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
/path/to/query.influxql
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./query.influxql | influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /tab-content %}}
|
||||
{{< /tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
Replace the following:
|
||||
|
|
@ -169,4 +221,3 @@ influxctl query \
|
|||
{{% /influxdb/custom-timestamps %}}
|
||||
{{% /expand %}}
|
||||
{{< /expand-wrapper >}}
|
||||
|
||||
|
|
|
|||
|
|
@ -336,6 +336,7 @@ If stored at a non-default location, include the `--config` flag with each
|
|||
## By default, the system certificates are used. If a custom certificate
|
||||
## for connecting to InfluxDB is required, define it below.
|
||||
# [profile.tls]
|
||||
# insecure = false
|
||||
# cert = ""
|
||||
# key = ""
|
||||
# ca = ""
|
||||
|
|
|
|||
|
|
@ -14,19 +14,18 @@ related:
|
|||
---
|
||||
|
||||
The `influxctl query` command queries data from {{< product-name >}} using SQL
|
||||
and prints results as a table or JSON.
|
||||
or InfluxQL and prints results as a table or JSON.
|
||||
|
||||
Provide the SQL query in one of the following ways:
|
||||
Provide the query in one of the following ways:
|
||||
|
||||
- a string on the command line
|
||||
- a path to a file that contains the query
|
||||
- a single dash (`-`) to read the query from stdin
|
||||
- as a single dash (`-`) to read the query from stdin
|
||||
|
||||
{{% note %}}
|
||||
#### Important to note
|
||||
|
||||
- This command supports only one query per execution.
|
||||
- This command supports only SQL queries; not InfluxQL.
|
||||
- This command is not meant to be a full, feature-rich query tool.
|
||||
It's meant for debug, triage, and basic data exploration.
|
||||
{{% /note %}}
|
||||
|
|
@ -34,9 +33,9 @@ Provide the SQL query in one of the following ways:
|
|||
### InfluxDB connection configuration
|
||||
|
||||
Your {{< product-name omit=" Clustered" >}} cluster host and port are
|
||||
configured in your in your `influxctl`
|
||||
configured in your `influxctl`
|
||||
[connection profile](/influxdb/clustered/reference/cli/influxctl/#configure-connection-profiles).
|
||||
Default is TLS and port 443.
|
||||
Default uses TLS and port 443.
|
||||
You can set a default database and token to use for the `query` and `write`
|
||||
commands in your connection profile or pass them with the
|
||||
command using the `--database` and `--token` flags.
|
||||
|
|
@ -56,18 +55,20 @@ influxctl query [flags] <QUERY>
|
|||
|
||||
## Arguments
|
||||
|
||||
| Argument | Description |
|
||||
| :-------- | :---------------------------------------------------------------------------------- |
|
||||
| **QUERY** | SQL query to execute (command line string, path to file, or `-` to read from stdin) |
|
||||
| Argument | Description |
|
||||
| :-------- | :------------------------------------------------------------------------------ |
|
||||
| **QUERY** | Query to execute (command line string, path to file, or `-` to read from stdin) |
|
||||
|
||||
## Flags
|
||||
|
||||
| Flag | | Description |
|
||||
| :--- | :----------- | :----------------------------------------------------------- |
|
||||
| | `--database` | Database to query |
|
||||
| | `--format` | Output format (`table` _(default)_ or `json`) |
|
||||
| | `--token` | Database token with read permissions on the queried database |
|
||||
| `-h` | `--help` | Output command help |
|
||||
| Flag | | Description |
|
||||
| :--- | :----------------------- | :----------------------------------------------------------- |
|
||||
| | `--database` | Database to query |
|
||||
| | `--enable-system-tables` | Enable ability to query system tables |
|
||||
| | `--format` | Output format (`table` _(default)_ or `json`) |
|
||||
| | `--language` | Query language (`sql` _(default)_ or `influxql`) |
|
||||
| | `--token` | Database token with read permissions on the queried database |
|
||||
| `-h` | `--help` | Output command help |
|
||||
|
||||
{{% caption %}}
|
||||
_Also see [`influxctl` global flags](/influxdb/clustered/reference/cli/influxctl/#global-flags)._
|
||||
|
|
@ -75,9 +76,12 @@ _Also see [`influxctl` global flags](/influxdb/clustered/reference/cli/influxctl
|
|||
|
||||
## Examples
|
||||
|
||||
- [Query InfluxDB v3 with SQL](#query-influxdb-v3-with-sql)
|
||||
- [Query InfluxDB v3 with InfluxQL](#query-influxdb-v3-with-influxql)
|
||||
- [Query InfluxDB v3 and return results in table format](#query-influxdb-v3-and-return-results-in-table-format)
|
||||
- [Query InfluxDB v3 and return results in JSON format](#query-influxdb-v3-and-return-results-in-json-format)
|
||||
- [Query InfluxDB v3 using credentials from the connection profile](#query-influxdb-v3-using-credentials-from-the-connection-profile)
|
||||
- [Query data from InfluxDB v3 system tables](#query-data-from-influxdb-v3-system-tables)
|
||||
|
||||
In the examples below, replace the following:
|
||||
|
||||
|
|
@ -86,6 +90,89 @@ In the examples below, replace the following:
|
|||
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
|
||||
Name of the database to query
|
||||
|
||||
### Query InfluxDB v3 with SQL
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
"SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z'"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
/path/to/query.sql
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./query.sql | influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
### Query InfluxDB v3 with InfluxQL
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
"SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z'"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
/path/to/query.influxql
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./query.influxql | influxctl query \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--language influxql \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
### Query InfluxDB v3 and return results in table format
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
|
@ -242,6 +329,70 @@ The following example uses the `database` and `token` defined in the `default`
|
|||
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl query "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z' LIMIT 5"
|
||||
influxctl query "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z'"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
|
||||
### Query data from InfluxDB v3 system tables
|
||||
|
||||
{{% note %}}
|
||||
You must use **SQL** to query InfluxDB v3 system tables.
|
||||
{{% /note %}}
|
||||
|
||||
{{% warn %}}
|
||||
Querying system tables can impact the overall performance of your
|
||||
{{< product-name omit=" Clustered" >}} cluster. System tables are not part of
|
||||
InfluxDB's stable API and are subject to change.
|
||||
{{% /warn %}}
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--enable-system-tables \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
"SELECT * FROM system.tables"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl query \
|
||||
--enable-system-tables \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
/path/to/query.sql
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./query.sql | influxctl query \
|
||||
--enable-system-tables \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
{{% expand "View command updates" %}}
|
||||
|
||||
#### v2.8.0 {date="2024-04-11"}
|
||||
|
||||
- Add InfluxQL support and introduce the `--language` flag to specify the query
|
||||
language.
|
||||
- Add `--enable-system-tables` flag to enable the ability to query InfluxDB v3
|
||||
system tables.
|
||||
|
||||
{{% /expand %}}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ influxctl write [flags] <LINE_PROTOCOL>
|
|||
| | `--batch-size` | Number of metrics to write per batch (default is `10000`) |
|
||||
| | `--database` | Database to write to |
|
||||
| | `--precision` | Precision of data timestamps (`ns` _(default)_, `us`, `ms`, or `s`) |
|
||||
| | `--timeout` | Client timeout in seconds (default is `10`) |
|
||||
| | `--token` | Database token with write permissions on the target database |
|
||||
| `-h` | `--help` | Output command help |
|
||||
|
||||
|
|
@ -72,6 +73,7 @@ _Also see [`influxctl` global flags](/influxdb/clustered/reference/cli/influxctl
|
|||
- [Write line protocol to InfluxDB v3](#write-line-protocol-to-influxdb-v3)
|
||||
- [Write line protocol to InfluxDB v3 with non-default timestamp precision](#write-line-protocol-to-influxdb-v3-with-non-default-timestamp-precision)
|
||||
- [Write line protocol to InfluxDB v3 with a custom batch size](#write-line-protocol-to-influxdb-v3-with-a-custom-batch-size)
|
||||
- [Write line protocol to InfluxDB v3 with a custom client timeout](#write-line-protocol-to-influxdb-v3-with-a-custom-client-timeout)
|
||||
- [Write line protocol to InfluxDB v3 using credentials from the connection profile](#write-line-protocol-to-influxdb-v3-using-credentials-from-the-connection-profile)
|
||||
|
||||
In the examples below, replace the following:
|
||||
|
|
@ -219,6 +221,53 @@ cat ./metrics.lp | influxctl write \
|
|||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
### Write line protocol to InfluxDB v3 with a custom client timeout
|
||||
|
||||
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[string](#)
|
||||
[file](#)
|
||||
[stdin](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
{{% influxdb/custom-timestamps %}}
|
||||
```sh
|
||||
influxctl write \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--timeout 20 \
|
||||
"home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000
|
||||
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
|
||||
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600
|
||||
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
|
||||
"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
influxctl write \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--timeout 20 \
|
||||
/path/to/metrics.lp
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
cat ./metrics.lp | influxctl write \
|
||||
--token DATABASE_TOKEN \
|
||||
--database DATABASE_NAME \
|
||||
--timeout 20 \
|
||||
-
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
{{% /code-placeholders %}}
|
||||
|
||||
### Write line protocol to InfluxDB v3 using credentials from the connection profile
|
||||
|
||||
The following example uses the `database` and `token` defined in the `default`
|
||||
|
|
@ -233,3 +282,11 @@ home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600000000000
|
|||
"
|
||||
```
|
||||
{{% /influxdb/custom-timestamps %}}
|
||||
|
||||
{{% expand "View command updates" %}}
|
||||
|
||||
#### v2.8.0 {date="2024-04-11"}
|
||||
|
||||
- Add `--timeout` flag to specify a custom client timeout.
|
||||
|
||||
{{% /expand %}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: InfluxQL reference
|
||||
title: InfluxQL reference documentation
|
||||
list_title: InfluxQL
|
||||
description: InfluxQL is an SQL-like query language for interacting with data in InfluxDB.
|
||||
menu:
|
||||
|
|
|
|||
|
|
@ -12,6 +12,33 @@ weight: 202
|
|||
canonical: /influxdb/cloud-dedicated/reference/release-notes/influxctl/
|
||||
---
|
||||
|
||||
## v2.8.0 {date="2024-04-11"}
|
||||
|
||||
`influxctl` 2.8.0 requires InfluxDB Clustered version 20240326-922145 or newer.
|
||||
A change was made to how database commands were handled internally in InfluxDB
|
||||
Clustered that required this change. If using an older version of InfluxDB
|
||||
Clustered, you will observe an unimplemented gRPC error when using functionality
|
||||
that depends on the updated command handling. If upgrading is not possible, you
|
||||
can continue to use a version prior to 2.8.0 until you are able to update.
|
||||
|
||||
### Features
|
||||
|
||||
- Introduce the ability to query with InfluxQL.
|
||||
- Add insecure configuration option to TLS configuration.
|
||||
- Allow users to query system tables.
|
||||
- Utilize the database proxy service.
|
||||
|
||||
### Dependency Updates
|
||||
|
||||
- Update Go to v1.22.2.
|
||||
- Update `github.com/go-git/go-git/v5` from 5.11.0 to 5.12.0.
|
||||
- Update `github.com/jedib0t/go-pretty/v6` from 6.5.6 to 6.5.8.
|
||||
- Update `golang.org/x/mod` from 0.16.0 to 0.17.0.
|
||||
- Update `golang.org/x/oauth2` from 0.18.0 to 0.19.0.
|
||||
- Update `google.golang.org/grpc` from 1.62.1 to 1.63.2.
|
||||
|
||||
---
|
||||
|
||||
## v2.7.1 {date="2024-03-27"}
|
||||
|
||||
### Bug Fixes
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ influxdb_cloud_dedicated:
|
|||
list_order: 3
|
||||
latest: cloud-dedicated
|
||||
link: "https://www.influxdata.com/contact-sales-form/"
|
||||
latest_cli: 2.7.1
|
||||
latest_cli: 2.8.0
|
||||
placeholder_host: cluster-id.influxdb.io
|
||||
|
||||
influxdb_clustered:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
{{ $styleParsed := .Get 0 | default "" }}
|
||||
{{ $hasStyle := gt (len $styleParsed) 0 }}
|
||||
{{ $style := .Get "style" | default $styleParsed }}
|
||||
<div class="tabs{{ if $hasStyle }}{{ $style }}{{ end }}">
|
||||
<div class="tabs{{ if $hasStyle }} {{ $style }}{{ end }}">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue