Merge branch 'master' into clustered/install-reorg
commit
3b314c7429
|
@ -457,7 +457,8 @@ For {{% product-name %}} v1 API `/query` requests, set parameters as listed in t
|
|||
|
||||
Parameter | Allowed in | Ignored | Value
|
||||
----------|------------|---------|-------------------------------------------------------------------------
|
||||
`chunked` | | Ignored | N/A _(Note that an unbounded query might return a large amount of data)_
|
||||
`chunked` | Query string | Honored | Returns points in streamed batches instead of in a single response. If set to `true`, InfluxDB chunks responses by series or by every 10,000 points, whichever occurs first.
|
||||
`chunked_size` | Query string | Honored | **Requires `chunked` to be set to `true`**. If set to a specific value, InfluxDB chunks responses by series or by this number of points.
|
||||
`db` | Query string | Honored | Database name |
|
||||
`epoch` | Query string | Honored | [Timestamp precision](#timestamp-precision) |
|
||||
`p` | Query string | Honored | Database token
|
||||
|
|
|
@ -33,11 +33,13 @@ prepend:
|
|||
3. In your terminal, create a directory for your Node.js project and change to it.
|
||||
|
||||
```sh
|
||||
mkdir influx-node-app && cd $_
|
||||
mkdir influx-node-app && cd influx-node-app
|
||||
```
|
||||
|
||||
4. Enter the following command to generate an npm package for your project.
|
||||
The `npm` package manager is included with Node.js.
|
||||
|
||||
- `npm`: the package manager included with Node.js
|
||||
- `-y`: uses defaults for the package and bypasses prompts
|
||||
|
||||
```sh
|
||||
npm init -y
|
||||
|
@ -53,15 +55,21 @@ Follow these steps to initialize the TypeScript project:
|
|||
```sh
|
||||
npm i -g typescript && npm i --save-dev @types/node
|
||||
```
|
||||
2. Create a TypeScript configuration with default values.
|
||||
|
||||
2. Enter the following command to create a TypeScript configuration
|
||||
(`tsconfig.json`) with default values:
|
||||
|
||||
```sh
|
||||
tsc --init
|
||||
```
|
||||
3. Run the TypeScript compiler. To recompile your code automatically as you make changes, pass the `watch` flag to the compiler.
|
||||
|
||||
3. Run the TypeScript compiler.
|
||||
To recompile your code automatically as you make changes, pass the `--watch, -w` flag to the compiler.
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
|
||||
```sh
|
||||
tsc -w -p
|
||||
tsc --watch
|
||||
```
|
||||
|
||||
## Install dependencies
|
||||
|
|
|
@ -62,7 +62,8 @@ For {{% product-name %}} v1 API `/query` requests, set parameters as listed in t
|
|||
|
||||
Parameter | Allowed in | Ignored | Value
|
||||
------------|--------------|---------|-------------------------------------------------------------------------
|
||||
`chunked` | | Ignored | N/A _(Note that an unbounded query might return a large amount of data)_
|
||||
`chunked` | Query string | Honored | Returns points in streamed batches instead of in a single response. If set to `true`, InfluxDB chunks responses by series or by every 10,000 points, whichever occurs first.
|
||||
`chunked_size` | Query string | Honored | **Requires `chunked` to be set to `true`**. If set to a specific value, InfluxDB chunks responses by series or by this number of points.
|
||||
`db` | Query string | Honored | Database name [mapped to a bucket](/influxdb/cloud-serverless/guides/api-compatibility/v1/#map-v1-databases-and-retention-policies-to-buckets)
|
||||
`epoch` | Query string | Honored | [Timestamp precision](#timestamp-precision)
|
||||
`pretty` | Query string | Ignored | N/A
|
||||
|
|
|
@ -35,11 +35,13 @@ Install the Node.js JavaScript client library to write data to InfluxDB {{% prod
|
|||
3. In your terminal, create a directory for your Node.js project and change to it.
|
||||
|
||||
```sh
|
||||
mkdir influx-node-app && cd $_
|
||||
mkdir influx-node-app && cd influx-node-app
|
||||
```
|
||||
|
||||
4. Enter the following command to generate an npm package for your project.
|
||||
The `npm` package manager is included with Node.js.
|
||||
|
||||
- `npm`: the package manager included with Node.js
|
||||
- `-y`: uses defaults for the package and bypasses prompts
|
||||
|
||||
```sh
|
||||
npm init -y
|
||||
|
@ -55,15 +57,21 @@ Follow these steps to initialize the TypeScript project:
|
|||
```sh
|
||||
npm i -g typescript && npm i --save-dev @types/node
|
||||
```
|
||||
2. Create a TypeScript configuration with default values.
|
||||
|
||||
2. Enter the following command to create a TypeScript configuration
|
||||
(`tsconfig.json`) with default values:
|
||||
|
||||
```sh
|
||||
tsc --init
|
||||
```
|
||||
3. Run the TypeScript compiler. To recompile your code automatically as you make changes, pass the `watch` flag to the compiler.
|
||||
|
||||
3. Run the TypeScript compiler.
|
||||
To recompile your code automatically as you make changes, pass the `--watch, -w` flag to the compiler.
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
|
||||
```sh
|
||||
tsc -w -p
|
||||
tsc --watch
|
||||
```
|
||||
|
||||
## Install dependencies
|
||||
|
@ -84,7 +92,7 @@ It only works with InfluxDB v2 management APIs.
|
|||
The client examples include an [`env`](https://github.com/influxdata/influxdb-client-js/blob/master/examples/env.js) module for accessing your InfluxDB properties from environment variables or from `env.js`.
|
||||
The examples use these properties to interact with the InfluxDB API.
|
||||
|
||||
Set environment variables or update `env.js` with your InfluxDB [bucket](/influxdb/cloud-serverless/organizations/buckets/), [organization](/influxdb/cloud-serverless/organizations/), [token](/influxdb/cloud-serverless/security/tokens/), and [url](/influxdb/cloud-serverless/reference/urls/).
|
||||
Set environment variables or update `env.js` with your InfluxDB [bucket](/influxdb/cloud-serverless/organizations/buckets/), [organization](/influxdb/cloud-serverless/organizations/), [token](/influxdb/cloud-serverless/security/tokens/), and [URL](/influxdb/cloud-serverless/reference/urls/).
|
||||
|
||||
```sh
|
||||
export INFLUX_URL=https://{{< influxdb/host >}}
|
||||
|
|
|
@ -456,7 +456,8 @@ For {{% product-name %}} v1 API `/query` requests, set parameters as listed in t
|
|||
|
||||
Parameter | Allowed in | Ignored | Value
|
||||
----------|------------|---------|-------------------------------------------------------------------------
|
||||
`chunked` | | Ignored | N/A _(Note that an unbounded query might return a large amount of data)_
|
||||
`chunked` | Query string | Honored | Returns points in streamed batches instead of in a single response. If set to `true`, InfluxDB chunks responses by series or by every 10,000 points, whichever occurs first.
|
||||
`chunked_size` | Query string | Honored | **Requires `chunked` to be set to `true`**. If set to a specific value, InfluxDB chunks responses by series or by this number of points.
|
||||
`db` | Query string | Honored | Database name |
|
||||
`epoch` | Query string | Honored | [Timestamp precision](#timestamp-precision) |
|
||||
`p` | Query string | Honored | Database token
|
||||
|
|
|
@ -33,11 +33,13 @@ prepend:
|
|||
3. In your terminal, create a directory for your Node.js project and change to it.
|
||||
|
||||
```sh
|
||||
mkdir influx-node-app && cd $_
|
||||
mkdir influx-node-app && cd influx-node-app
|
||||
```
|
||||
|
||||
4. Enter the following command to generate an npm package for your project.
|
||||
The `npm` package manager is included with Node.js.
|
||||
|
||||
- `npm`: the package manager included with Node.js
|
||||
- `-y`: uses defaults for the package and bypasses prompts
|
||||
|
||||
```sh
|
||||
npm init -y
|
||||
|
@ -53,15 +55,21 @@ Follow these steps to initialize the TypeScript project:
|
|||
```sh
|
||||
npm i -g typescript && npm i --save-dev @types/node
|
||||
```
|
||||
2. Create a TypeScript configuration with default values.
|
||||
|
||||
2. Enter the following command to create a TypeScript configuration
|
||||
(`tsconfig.json`) with default values:
|
||||
|
||||
```sh
|
||||
tsc --init
|
||||
```
|
||||
3. Run the TypeScript compiler. To recompile your code automatically as you make changes, pass the `watch` flag to the compiler.
|
||||
|
||||
3. Run the TypeScript compiler.
|
||||
To recompile your code automatically as you make changes, pass the `--watch, -w` flag to the compiler.
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
|
||||
```sh
|
||||
tsc -w -p
|
||||
tsc --watch
|
||||
```
|
||||
|
||||
## Install dependencies
|
||||
|
|
|
@ -15,15 +15,11 @@ aliases:
|
|||
Enabling TLS encrypts the communication between clients and the InfluxDB server.
|
||||
When configured with a signed certificate, TLS also allows clients to verify the authenticity of the InfluxDB server.
|
||||
|
||||
To set up TLS over HTTPS, do the following:
|
||||
Follow steps to set up TLS over HTTPS, connect to your server, and troubleshoot problems:
|
||||
|
||||
- [Obtain requirements](#obtain-requirements)
|
||||
- [Single domain certificates signed by a Certificate Authority (CA)](#single-domain-certificates-signed-by-a-certificate-authority-ca)
|
||||
- [Wildcard certificates signed by a Certificate Authority](#wildcard-certificates-signed-by-a-certificate-authority)
|
||||
- [Self-signed certificates](#self-signed-certificates)
|
||||
- [Configure InfluxDB to use TLS](#configure-influxdb-to-use-tls)
|
||||
- [Connect Telegraf to a secured InfluxDB instance](#connect-telegraf-to-a-secured-influxdb-instance)
|
||||
- [Example Telegraf configuration](#example-telegraf-configuration)
|
||||
- [Troubleshoot TLS](#troubleshoot-tls)
|
||||
|
||||
{{% warn %}}
|
||||
|
@ -59,12 +55,19 @@ You can generate a self-signed certificate on your own machine.
|
|||
|
||||
## Configure InfluxDB to use TLS
|
||||
|
||||
1. [Download or generate certificate files](#1-download-or-generate-certificate-files)
|
||||
2. [Set certificate file permissions](#2-set-certificate-file-permissions)
|
||||
3. [Run `influxd` with TLS flags](#3-run-influxd-with-tls-flags)
|
||||
4. [Verify TLS connection](#4-verify-tls-connection)
|
||||
1. [Download or generate certificate files](download-or-generate-certificate-files)
|
||||
2. [Set certificate file permissions](#set-certificate-file-permissions)
|
||||
3. [Run `influxd` with TLS flags](#run-influxd-with-tls-flags)
|
||||
4. [Verify TLS connection](#verify-tls-connection)
|
||||
|
||||
### 1. Download or generate certificate files
|
||||
### Download or generate certificate files
|
||||
|
||||
Choose one of the following:
|
||||
|
||||
- [Download and install CA certificate files](#download-and-install-ca-certificate-files)
|
||||
- [Generate self-signed certificates](#generate-and-self-signed-certificates)
|
||||
|
||||
#### Download and install CA certificate files
|
||||
|
||||
If using a [certificate signed by a CA](#single-domain-certificates-signed-by-a-certificate-authority-ca), follow their instructions to download and install the certificate files.
|
||||
Note the location where certificate files are installed, and then continue to [set certificate file permissions](#set-certificate-file-permissions).
|
||||
|
@ -78,10 +81,16 @@ For example, if [Let's Encrypt](https://letsencrypt.org/) is your CA and you use
|
|||
`/etc/letsencrypt/live/$domain`. For more information about Let's Encrypt certificate paths, see [Where are my certificates?](https://eff-certbot.readthedocs.io/en/latest/using.html#where-are-my-certificates)
|
||||
{{% /note %}}
|
||||
|
||||
#### Generate self-signed certificates
|
||||
|
||||
To generate [self-signed certificates](#self-signed-certificates), use the `openssl` command on your system.
|
||||
|
||||
The following example shows how to generate certificates located in `/etc/ssl`
|
||||
on Unix-like systems and Windows.
|
||||
The following example:
|
||||
|
||||
1. Configures [Subject Alternative Name](https://docs.openssl.org/master/man5/x509v3_config/#subject-alternative-name) (`subjectAltName`, SAN)
|
||||
for your TLS certificate.
|
||||
2. Generates certificates located in `/etc/ssl` for Unix-like and Windows systems.
|
||||
|
||||
_For example purposes only, the code creates an unencrypted private key._
|
||||
|
||||
{{% warn %}}
|
||||
|
@ -116,6 +125,7 @@ cat > san.cnf <<EOF
|
|||
[alt_names]
|
||||
DNS.1 = example.com
|
||||
DNS.2 = www.example.com
|
||||
IP.1 = 10.1.2.3
|
||||
EOF
|
||||
|
||||
# Generate a private key and certificate signing request (CSR)
|
||||
|
@ -138,11 +148,22 @@ rm san.cnf
|
|||
|
||||
Replace the following with your own values:
|
||||
|
||||
- {{% code-placeholder-key %}}`NUMBER_OF_DAYS`{{% /code-placeholder-key %}}: the number of days for files to remain valid
|
||||
- {{% code-placeholder-key %}}`/etc/ssl`{{% /code-placeholder-key %}}: the SSL configurations directory for your system
|
||||
- Configuration field values in `req_distinguished_name` and `alt_names`
|
||||
- {{% code-placeholder-key %}}`NUMBER_OF_DAYS`{{% /code-placeholder-key %}}:
|
||||
the number of days for files to remain valid
|
||||
- {{% code-placeholder-key %}}`/etc/ssl`{{% /code-placeholder-key %}}: the SSL
|
||||
configurations directory for your system
|
||||
- Configuration field values in `req_distinguished_name` and `alt_names`--for
|
||||
example, in the `[alt_names]` section, set the domain names and IP addresses
|
||||
you use to access your InfluxDB server.
|
||||
|
||||
### 2. Set certificate file permissions
|
||||
The output is a private key and a CSR that includes the
|
||||
specified domain names and IP address in the
|
||||
[Subject Alternative Name](https://docs.openssl.org/master/man5/x509v3_config/#subject-alternative-name)
|
||||
SAN extension.
|
||||
The resulting certificate is valid for `example.com`, `www.example.com`, and
|
||||
the IP address `10.1.2.3`.
|
||||
|
||||
### Set certificate file permissions
|
||||
|
||||
The user running InfluxDB must have read permissions on the TLS certificate files.
|
||||
|
||||
|
@ -150,16 +171,18 @@ The user running InfluxDB must have read permissions on the TLS certificate file
|
|||
Ultimately, make sure all users running InfluxDB have read permissions for the TLS certificate.
|
||||
{{% /note %}}
|
||||
|
||||
In your terminal, run `chmod` to set permissions on your installed certificate files--for example:
|
||||
The following example shows how to set read permissions on the self-signed
|
||||
certificate and key files generated in [the preceding step](#1-download-or-generate-certificate-files):
|
||||
In your terminal, run `chown` to set the owner and `chmod` to set permissions on your installed certificate files.
|
||||
|
||||
The following example shows how to transfer the ownership to the user and group `influxdb` and set read permissions on the self-signed
|
||||
certificate and key files generated in [the preceding step](#download-or-generate-certificate-files):
|
||||
|
||||
```bash
|
||||
sudo chown influxdb: /etc/ssl/influxdb-selfsigned.crt /etc/ssl/influxdb-selfsigned.key
|
||||
sudo chmod 644 /etc/ssl/influxdb-selfsigned.crt
|
||||
sudo chmod 600 /etc/ssl/influxdb-selfsigned.key
|
||||
```
|
||||
|
||||
### 3. Verify certificate and key files
|
||||
### Verify certificate and key files
|
||||
|
||||
To ensure that the certificate and key files are correct and match each other,
|
||||
enter the following commands in your terminal:
|
||||
|
@ -169,7 +192,7 @@ openssl x509 -noout -modulus -in /etc/ssl/influxdb-selfsigned.crt | openssl md5
|
|||
openssl rsa -noout -modulus -in /etc/ssl/influxdb-selfsigned.key | openssl md5
|
||||
```
|
||||
|
||||
### 4. Run `influxd` with TLS flags
|
||||
### Run `influxd` with TLS flags
|
||||
|
||||
To start InfluxDB with TLS command line flags, enter the following command with
|
||||
paths to your key and certificate files:
|
||||
|
@ -182,7 +205,7 @@ influxd \
|
|||
|
||||
If successful, InfluxDB runs in the background and logs to `influxdb.log`.
|
||||
|
||||
### 4. Verify TLS connection
|
||||
### Verify TLS connection
|
||||
|
||||
To test your certificates, access InfluxDB using the `https://` protocol--for example, using cURL:
|
||||
|
||||
|
@ -313,6 +336,16 @@ Ensure that the TLS configuration in InfluxDB is correct.
|
|||
Check the paths to the certificate and key files in the InfluxDB configuration
|
||||
or command line flags.
|
||||
|
||||
#### Example error: cannot validate certificate for <IP_ADDRESS>
|
||||
|
||||
```log
|
||||
Sep 25 14:00:02 host influxd-systemd-start.sh[11782]: ts=2024-09-25T12:00:02.055617Z lvl=error msg="Unable to gather" log_id=0rr6jG30000 service=scraper scraper-name="new target" error="Get \"https://10.1.2.3:8086/metrics\": tls: failed to verify certificate: x509: cannot validate certificate for 10.1.2.3 because it doesn't contain any IP SANs"
|
||||
Sep 25 14:00:02 host influxd-systemd-start.sh[11782]: ts=2024-09-25T12:00:02.055397Z lvl=info msg="http: TLS handshake error from 10.1.2.3:46380: remote error: tls: bad certificate" log_id=0rr6jG30000 service=http
|
||||
```
|
||||
|
||||
If you access your InfluxDB server via IP address, then include the address in
|
||||
your subjectAltName configuration.
|
||||
|
||||
### Update OpenSSL and InfluxDB
|
||||
|
||||
Ensure that you are using the latest versions of OpenSSL and InfluxDB, as
|
||||
|
|
|
@ -21,31 +21,47 @@ aliases:
|
|||
2. Ensure that InfluxDB is running and you can connect to it.
|
||||
For information about what URL to use to connect to InfluxDB OSS or InfluxDB Cloud, see [InfluxDB URLs](/influxdb/v2/reference/urls/).
|
||||
|
||||
3. Start a new Node.js project.
|
||||
The `npm` package manager is included with Node.js.
|
||||
3. Create a directory for your new Node.js project, and then change to the
|
||||
directory--for example, enter the following command into your terminal:
|
||||
|
||||
```sh
|
||||
npm init -y influx-node-app
|
||||
```
|
||||
```sh
|
||||
mkdir influx-node-app && cd influx-node-app
|
||||
```
|
||||
|
||||
4. Enter the following command to generate an npm package for your project.
|
||||
|
||||
- `npm`: the package manager included with Node.js
|
||||
- `-y`: uses defaults for the package and bypasses prompts
|
||||
|
||||
```sh
|
||||
npm init -y
|
||||
```
|
||||
|
||||
## Install TypeScript
|
||||
|
||||
Many of the client library examples use [TypeScript](https://www.typescriptlang.org/). Follow these steps to initialize the TypeScript project.
|
||||
Many of the client library examples use [TypeScript](https://www.typescriptlang.org/).
|
||||
Follow these steps to initialize the TypeScript project:
|
||||
|
||||
1. Install TypeScript and type definitions for Node.js.
|
||||
|
||||
```sh
|
||||
npm i -g typescript && npm i --save-dev @types/node
|
||||
```
|
||||
2. Create a TypeScript configuration with default values.
|
||||
|
||||
2. Enter the following command to create a TypeScript configuration
|
||||
(`tsconfig.json`) with default values:
|
||||
|
||||
```sh
|
||||
tsc --init
|
||||
```
|
||||
3. Run the TypeScript compiler. To recompile your code automatically as you make changes, pass the `watch` flag to the compiler.
|
||||
|
||||
3. Run the TypeScript compiler.
|
||||
To recompile your code automatically as you make changes, pass the `--watch, -w` flag to the compiler.
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
|
||||
```sh
|
||||
tsc -w -p
|
||||
tsc --watch
|
||||
```
|
||||
|
||||
## Install dependencies
|
||||
|
@ -76,7 +92,7 @@ The client examples include an [`env`](https://github.com/influxdata/influxdb-cl
|
|||
The examples use these properties to interact with the InfluxDB API.
|
||||
{{% /note %}}
|
||||
|
||||
1. Set environment variables or update `env.mjs` with your InfluxDB [bucket](/influxdb/v2/admin/buckets/), [organization](/influxdb/v2/admin/organizations/), [token](/influxdb/v2/admin/tokens/), and [url](/influxdb/v2/reference/urls/).
|
||||
1. Set environment variables or update `env.mjs` with your InfluxDB [bucket](/influxdb/v2/admin/buckets/), [organization](/influxdb/v2/admin/organizations/), [token](/influxdb/v2/admin/tokens/), and [URL](/influxdb/v2/reference/urls/).
|
||||
|
||||
```sh
|
||||
export INFLUX_URL=http://localhost:8086
|
||||
|
@ -89,7 +105,9 @@ The examples use these properties to interact with the InfluxDB API.
|
|||
- *`YOUR_ORG`*: InfluxDB organization ID
|
||||
- *`YOUR_BUCKET`*: InfluxDB bucket name
|
||||
|
||||
2. Run an example script.
|
||||
2. Run one of the [`influxdb-client-js` example scripts](https://github.com/influxdata/influxdb-client-js/tree/master/examples/).
|
||||
|
||||
<!--pytest.mark.skip-->
|
||||
|
||||
```sh
|
||||
query.ts
|
||||
|
|
|
@ -12,7 +12,7 @@ influxdb/v2/tags: [influxql, query, write]
|
|||
related:
|
||||
- /influxdb/v2/query-data/influxql
|
||||
- /influxdb/v2/install/upgrade/v1-to-v2/
|
||||
alias:
|
||||
aliases:
|
||||
- /influxdb/v2/reference/api/influxdb-1x/
|
||||
---
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@ weight: 3
|
|||
influxdb/v2/tags: [api]
|
||||
aliases:
|
||||
- /influxdb/v2/concepts/api/
|
||||
related:
|
||||
- /influxdb/v2/api-guide/api_intro/
|
||||
- /influxdb/v2/api-guide/influxdb-1x/
|
||||
---
|
||||
|
||||
The InfluxDB HTTP API provides a programmatic interface for interactions such as writing and querying data, and managing resources in {{% product-name %}}.
|
||||
|
@ -38,6 +41,6 @@ and visit the `/docs` endpoint in a browser ([localhost:8086/docs](http://localh
|
|||
|
||||
<a class="btn" href="/influxdb/v2/api/v1-compatibility/">InfluxDB v1 API for {{% product-name %}}</a>
|
||||
|
||||
The InfluxDB HTTP API includes [InfluxDB v1 compatibility endpoints](/influxdb/v2/reference/api/influxdb-1x/)
|
||||
The InfluxDB HTTP API includes InfluxDB v1 compatibility endpoints
|
||||
that work with InfluxDB 1.x client libraries and third-party integrations like
|
||||
[Grafana](https://grafana.com) and others.
|
||||
|
|
Loading…
Reference in New Issue