Skip to content

Commit 6b82aa2

Browse files
authored
Merge pull request #5898 from influxdata/jts/update-examples-and-pe-cache
Jts/update examples and pe cache
2 parents c15ff4e + 3bf5f48 commit 6b82aa2

File tree

7 files changed

+265
-170
lines changed

7 files changed

+265
-170
lines changed

api-docs/influxdb3/core/v3/ref.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ tags:
6767
6868
- HTTP [`/api/v3/query_sql` endpoint](#operation/GetExecuteQuerySQL) for new query workloads using SQL.
6969
- HTTP [`/api/v3/query_influxql` endpoint](#operation/GetExecuteInfluxQLQuery) for new query workloads using InfluxQL.
70-
- Flight SQL and InfluxDB 3 _Flight+gRPC_ APIs for querying with SQL or InfluxQL. For more information about using Flight APIs, see [InfluxDB 3 client libraries](https://github.com/InfluxCommunity).
70+
- Flight SQL and InfluxDB 3 _Flight+gRPC_ APIs for querying with SQL or InfluxQL. For more information about using Flight APIs, see [InfluxDB 3 client libraries](https://github.com/InfluxCommunity?q=influxdb3&type=public&language=&sort=).
7171
7272
### Server information
7373
@@ -118,7 +118,7 @@ tags:
118118
InfluxDB 3 Core provides the InfluxDB 3 Processing engine, an embedded Python VM that can dynamically load and trigger Python plugins in response to events in your database.
119119
Use Processing engine plugins and triggers to run code and perform tasks for different database events.
120120
121-
To get started with the Processing Engine, see the [Processing Engine and Python plugins](/influxdb3/core/processing-engine/) guide.
121+
To get started with the Processing engine, see the [Processing engine and Python plugins](/influxdb3/core/processing-engine/) guide.
122122
- name: Quick start
123123
description: |
124124
1. [Check the status](#section/Server-information) of the InfluxDB server.

api-docs/influxdb3/enterprise/v3/ref.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ tags:
6767
6868
- HTTP [`/api/v3/query_sql` endpoint](#operation/GetExecuteQuerySQL) for new query workloads using SQL.
6969
- HTTP [`/api/v3/query_influxql` endpoint](#operation/GetExecuteInfluxQLQuery) for new query workloads using InfluxQL.
70-
- Flight SQL and InfluxDB 3 _Flight+gRPC_ APIs for querying with SQL or InfluxQL. For more information about using Flight APIs, see [InfluxDB 3 client libraries](https://github.com/InfluxCommunity).
70+
- Flight SQL and InfluxDB 3 _Flight+gRPC_ APIs for querying with SQL or InfluxQL. For more information about using Flight APIs, see [InfluxDB 3 client libraries](https://github.com/InfluxCommunity?q=influxdb3&type=public&language=&sort=).
7171
7272
### Server information
7373
@@ -118,7 +118,7 @@ tags:
118118
InfluxDB 3 Enterprise provides the InfluxDB 3 Processing engine, an embedded Python VM that can dynamically load and trigger Python plugins in response to events in your database.
119119
Use Processing engine plugins and triggers to run code and perform tasks for different database events.
120120
121-
To get started with the Processing Engine, see the [Processing Engine and Python plugins](/influxdb3/enterprise/processing-engine/) guide.
121+
To get started with the Processing engine, see the [Processing engine and Python plugins](/influxdb3/enterprise/processing-engine/) guide.
122122
- name: Quick start
123123
description: |
124124
1. [Check the status](#section/Server-information) of the InfluxDB server.

content/influxdb3/core/plugins.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
2-
title: Processing Engine and Python plugins
3-
description: Use the Python processing engine to trigger and execute custom code on different events in an {{< product-name >}} instance.
2+
title: Processing engine and Python plugins
3+
description: |
4+
Use the InfluxDB 3 Processing engine with Python to trigger and execute custom
5+
code on different events in an {{< product-name >}} instance.
46
menu:
57
influxdb3_core:
6-
name: Processing Engine and Python plugins
8+
name: Processing engine and Python plugins
79
weight: 4
810
influxdb3/core/tags: []
911
related:

content/influxdb3/enterprise/plugins.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
2-
title: Processing Engine and Python plugins
3-
description: Use the Python processing engine to trigger and execute custom code on different events in an {{< product-name >}} instance.
2+
title: Processing engine and Python plugins
3+
description: |
4+
Use the InfluxDB 3 Processing engine with Python to trigger and execute custom
5+
code on different events in an {{< product-name >}} instance.
46
menu:
57
influxdb3_enterprise:
68
name: Processing Engine and Python plugins

content/shared/v3-core-get-started/_index.md

Lines changed: 48 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ docker run -it \
195195
```bash
196196
# S3 object store (default is the us-east-1 region)
197197
# Specify the Object store type and associated options
198-
199-
```bash
200198
influxdb3 serve \
201199
--node-id=host01 \
202200
--object-store=s3 \
@@ -209,16 +207,21 @@ influxdb3 serve \
209207
# Minio or other open source object store
210208
# (using the AWS S3 API with additional parameters)
211209
# Specify the object store type and associated options
212-
213-
```bash
214-
influxdb3 serve --node-id=host01 --object-store=s3 --bucket=BUCKET \
210+
influxdb3 serve \
211+
--node-id=host01 \
212+
--object-store=s3 \
213+
--bucket=BUCKET \
215214
--aws-access-key=AWS_ACCESS_KEY \
216215
--aws-secret-access-key=AWS_SECRET_ACCESS_KEY \
217216
--aws-endpoint=ENDPOINT \
218217
--aws-allow-http
219218
```
220219

221-
_For more information about server options, run `influxdb3 serve --help`._
220+
For more information about server options, use the CLI help:
221+
222+
```bash
223+
influxdb3 serve --help
224+
```
222225

223226
> [!Important]
224227
> #### Stopping the Docker container
@@ -407,7 +410,7 @@ Using `no_sync=true` is best when prioritizing high-throughput writes over absol
407410
408411
The `no_sync` parameter controls when writes are acknowledged--for example:
409412
410-
```sh
413+
```bash
411414
curl "http://localhost:8181/api/v3/write_lp?db=sensors&precision=auto&no_sync=true" \
412415
--data-raw "home,room=Sunroom temp=96"
413416
```
@@ -416,7 +419,7 @@ curl "http://localhost:8181/api/v3/write_lp?db=sensors&precision=auto&no_sync=tr
416419
417420
The `no_sync` CLI option controls when writes are acknowledged--for example:
418421
419-
```sh
422+
```bash
420423
influxdb3 write --bucket=mydb --org=my_org --token=my-token --no-sync
421424
```
422425
@@ -430,7 +433,7 @@ influxdb3 create database mydb
430433
431434
To learn more about a subcommand, use the `-h, --help` flag:
432435
433-
```
436+
```bash
434437
influxdb3 create -h
435438
```
436439
@@ -462,7 +465,7 @@ The `query` subcommand includes options to help ensure that the right database i
462465
463466
#### Example: query `“SHOW TABLES”` on the `servers` database:
464467
465-
```
468+
```console
466469
$ influxdb3 query --database=servers "SHOW TABLES"
467470
+---------------+--------------------+--------------+------------+
468471
| table_catalog | table_schema | table_name | table_type |
@@ -478,7 +481,7 @@ $ influxdb3 query --database=servers "SHOW TABLES"
478481
479482
#### Example: query the `cpu` table, limiting to 10 rows:
480483
481-
```
484+
```console
482485
$ influxdb3 query --database=servers "SELECT DISTINCT usage_percent, time FROM cpu LIMIT 10"
483486
+---------------+---------------------+
484487
| usage_percent | time |
@@ -496,7 +499,7 @@ $ influxdb3 query --database=servers "SELECT DISTINCT usage_percent, time FROM c
496499
+---------------+---------------------+
497500
```
498501
499-
### Querying using the CLI for InfluxQL
502+
### Query using the CLI for InfluxQL
500503
501504
[InfluxQL](/influxdb3/version/reference/influxql/) is an SQL-like language developed by InfluxData with specific features tailored for leveraging and working with InfluxDB. It’s compatible with all versions of InfluxDB, making it a good choice for interoperability across different InfluxDB installations.
502505
@@ -540,13 +543,13 @@ We recommend installing the required packages in a Python virtual environment fo
540543
541544
To get started, install the `influxdb3-python` package.
542545
543-
```
546+
```bash
544547
pip install influxdb3-python
545548
```
546549
547550
From here, you can connect to your database with the client library using just the **host** and **database name:
548551
549-
```py
552+
```python
550553
from influxdb_client_3 import InfluxDBClient3
551554
552555
client = InfluxDBClient3(
@@ -558,7 +561,7 @@ client = InfluxDBClient3(
558561
The following example shows how to query using SQL, and then
559562
use PyArrow to explore the schema and process results:
560563
561-
```py
564+
```python
562565
from influxdb_client_3 import InfluxDBClient3
563566
564567
client = InfluxDBClient3(
@@ -591,27 +594,16 @@ For more information about the Python client library, see the [`influxdb3-python
591594
### Last values cache
592595
593596
{{% product-name %}} supports a **last-n values cache** which stores the last N values in a series or column hierarchy in memory. This gives the database the ability to answer these kinds of queries in under 10 milliseconds.
594-
You can use the `influxdb3` CLI to create a last value cache.
595-
596-
```
597-
Usage: $ influxdb3 create last_cache [OPTIONS] -d <DATABASE_NAME> -t <TABLE> [CACHE_NAME]
598-
599-
Options:
600-
-h, --host <HOST_URL> URL of the running {{% product-name %}} server [env: INFLUXDB3_HOST_URL=]
601-
-d, --database <DATABASE_NAME> The database to run the query against [env: INFLUXDB3_DATABASE_NAME=]
602-
--token <AUTH_TOKEN> The token for authentication [env: INFLUXDB3_AUTH_TOKEN=]
603-
-t, --table <TABLE> The table for which the cache is created
604-
--key-columns <KEY_COLUMNS> Columns used as keys in the cache
605-
--value-columns <VALUE_COLUMNS> Columns to store as values in the cache
606-
--count <COUNT> Number of entries per unique key:column
607-
--ttl <TTL> The time-to-live for entries (seconds)
608-
--help Print help information
597+
You can use the `influxdb3` CLI to [create a last value cache](/influxdb3/version/reference/cli/influxdb3/create/last_cache/).
609598
599+
```bash
600+
influxdb3 create last_cache \
601+
-d <DATABASE_NAME> \
602+
-t <TABLE> \
603+
[CACHE_NAME]
610604
```
611605
612-
You can create a last values cache per time series, but be mindful of high cardinality tables that could take excessive memory.
613-
614-
An example of creating this cache in use:
606+
Consider the following `cpu` sample table:
615607
616608
| host | application | time | usage\_percent | status |
617609
| ----- | ----- | ----- | ----- | ----- |
@@ -621,42 +613,48 @@ An example of creating this cache in use:
621613
| Bravo | database | 2024-12-11T10:01:00 | 80.5 | OK |
622614
| Alpha | webserver | 2024-12-11T10:02:00 | 25.3 | Warn |
623615
616+
The following command creates a last value cache named `cpuCache`:
617+
624618
```bash
625-
influxdb3 create last_cache --database=servers --table=cpu --key-columns=host,application --value-columns=usage_percent,status --count=5 cpuCache
619+
influxdb3 create last_cache \
620+
--database=servers \
621+
--table=cpu \
622+
--key-columns=host,application \
623+
--value-columns=usage_percent,status \
624+
--count=5 cpuCache
626625
```
627626
628-
#### Query a Last values cache
627+
_You can create a last values cache per time series, but be mindful of high cardinality tables that could take excessive memory._
628+
629+
#### Query a last values cache
629630
630-
To leverage the LVC, call it using the `last_cache()` function in your query--for example:
631+
To use the LVC, call it using the `last_cache()` function in your query--for example:
631632
632633
```bash
633-
influxdb3 query --database=servers "SELECT * FROM last_cache('cpu', 'cpuCache') WHERE host = 'Bravo;"
634+
influxdb3 query \
635+
--database=servers \
636+
"SELECT * FROM last_cache('cpu', 'cpuCache') WHERE host = 'Bravo';"
634637
```
635638
636639
> [!Note]
637640
> #### Only works with SQL
638641
>
639642
> The Last values cache only works with SQL, not InfluxQL; SQL is the default language.
640643
641-
#### Deleting a Last values cache
644+
#### Delete a Last values cache
642645
643-
To remove a Last values cache, use the following command:
646+
Use the `influxdb3` CLI to [delete a last values cache](/influxdb3/version/reference/cli/influxdb3/delete/last_cache/)
644647
645648
```bash
646-
influxdb3 delete last_cache [OPTIONS] -d <DATABASE_NAME> -t <TABLE> --cache-name <CACHE_NAME>
647-
648-
Options:
649-
-h, --host <HOST_URL> Host URL of the running InfluxDB 3 server
650-
-d, --database <DATABASE_NAME> The database to run the query against
651-
--token <AUTH_TOKEN> The token for authentication
652-
-t, --table <TABLE> The table for which the cache is being deleted
653-
-n, --cache-name <CACHE_NAME> The name of the cache being deleted
654-
--help Print help information
649+
influxdb3 delete last_cache \
650+
-d <DATABASE_NAME> \
651+
-t <TABLE> \
652+
--cache-name <CACHE_NAME>
655653
```
656654
657655
### Distinct values cache
658656
659-
Similar to the Last values cache, the database can cache in RAM the distinct values for a single column in a table or a heirarchy of columns. This is useful for fast metadata lookups, which can return in under 30 milliseconds. Many of the options are similar to the last value cache. See the CLI output for more information:
657+
Similar to the Last values cache, the database can cache in RAM the distinct values for a single column in a table or a hierarchy of columns. This is useful for fast metadata lookups, which can return in under 30 milliseconds. Many of the options are similar to the last value cache. See the CLI output for more information:
660658
661659
```bash
662660
influxdb3 create distinct_cache -h
@@ -784,7 +782,7 @@ To test a plugin, do the following:
784782
```bash
785783
influxdb3 test wal_plugin \
786784
--lp <INPUT_LINE_PROTOCOL> \
787-
--input-arguments "arg1=foo,arg2=bar"
785+
--input-arguments "arg1=foo,arg2=bar" \
788786
--database <DATABASE_NAME> \
789787
<PLUGIN_FILENAME>
790788
```
@@ -833,7 +831,3 @@ enable the trigger and have it run the plugin as you write data:
833831
```bash
834832
influxdb3 enable trigger --database mydb trigger1
835833
```
836-
837-
For more information, see [Python plugins and the Processing engine](/influxdb3/version/plugins/).
838-
839-

0 commit comments

Comments
 (0)