文档文档

influx auth create

The influx auth create command creates an API token in InfluxDB. (influx auth create 命令在 InfluxDB 中创建一个 API 令牌。)

Issue resolved: Using influx CLI 2.4 prevented you from creating an all-access or operator token using the influx auth create command. This issue is resolved in the influx 2.5 CLI release. Please upgrade to the latest version of the influx cli. (问题已解决:使用 influx CLI 2.4 阻止您使用 influx auth create 命令创建 all-accessoperator 令牌。 此问题已在 influx 2.5 CLI 版本中得到解决。 请升级到最新版本 的 influx cli。)

Usage (用法)

influx auth create [flags]

Flags (标志)

Flag (标志)Description (描述)Input type (输入类型)Maps to ? (映射到 ?)
-c--active-config (活动配置)CLI configuration to use for command (用于命令的 CLI 配置)string (字符串)
--all-access (全部访问)Grants all permissions in a single organization (授予单个组织中的所有权限)
--configs-path (配置路径)Path to influx CLI configurations (default ~/.influxdbv2/configs) (influx CLI 配置的路径 (默认为 ~/.influxdbv2/configs))string (字符串)INFLUX_CONFIGS_PATH
-d--description (描述)API token description (API 令牌描述)string (字符串)
-h--help (帮助)Help for the create command (create 命令的帮助)
--hide-headers (隐藏标题)Hide table headers (default false) (隐藏表头 (默认为 false))INFLUX_HIDE_HEADERS
--host (主机)HTTP address of InfluxDB (default https://127.0.0.1:8086) (InfluxDB 的 HTTP 地址 (默认为 https://127.0.0.1:8086))string (字符串)INFLUX_HOST
--http-debug (HTTP 调试)Inspect communication with InfluxDB servers (检查与 InfluxDB 服务器的通信)string (字符串)
--jsonOutput data as JSON (default false) (将数据以 JSON 格式输出 (默认为 false))INFLUX_OUTPUT_JSON
--operator (操作员)(InfluxDB OSS only) Grants all permissions in all organizations ((仅限 InfluxDB OSS) 授予所有组织中的所有权限)string (字符串)
-o--org (组织)Organization name (mutually exclusive with --org-id) (组织名称 (与 --org-id 互斥))string (字符串)INFLUX_ORG
--org-id (组织 ID)Organization ID (mutually exclusive with --org) (组织 ID (与 --org 互斥))string (字符串)INFLUX_ORG_ID
--read-bucket (读取存储桶)Grant permission to read a specified bucket ID (授予读取指定存储桶 ID 的权限)stringArray (字符串数组)
--read-buckets (读取存储桶)Grant permission to read all organization buckets (授予读取所有组织存储桶的权限)
--read-checks (读取检查)Grant permission to read checks (授予读取检查的权限)
--read-dashboards (读取仪表盘)Grant permission to read dashboards (授予读取仪表盘的权限)
--read-dbrps (读取 DBRP)Grant permission to read database retention policy mappings (授予读取数据库保留策略映射的权限)
--read-notificationEndpoints (读取通知端点)Grant permission to read notificationEndpoints (授予读取通知端点的权限)
--read-notificationRules (读取通知规则)Grant permission to read notificationRules (授予读取通知规则的权限)
--read-orgs (读取组织)Grant permission to read organizations (授予读取组织的权限)
--read-remotes (读取远程)Grant permission to read remote configurations (授予读取远程配置的权限)
--read-replications (读取复制)Grant permission to read replication configurations (授予读取复制配置的权限)
--read-tasks (读取任务)Grant permission to read tasks (授予读取任务的权限)
--read-telegrafs (读取 Telegrafs)Grant permission to read Telegraf configurations (授予读取 Telegraf 配置的权限)
--read-users (读取用户)Grant permission to read organization users (授予读取组织用户的权限)
--skip-verify (跳过验证)Skip TLS certificate verification (跳过 TLS 证书验证)INFLUX_SKIP_VERIFY
-t--token (令牌)API token (API 令牌)string (字符串)INFLUX_TOKEN
-u--user (用户)Username (用户名)string (字符串)
--write-annotations (写入注释)Grant permission to create annotations (授予创建注释的权限)
--write-bucket (写入存储桶)Grant permission to write to specified a bucket ID (授予写入指定存储桶 ID 的权限)stringArray (字符串数组)
--write-buckets (写入存储桶)Grant permission to create and update all organization buckets (授予创建和更新所有组织存储桶的权限)
--write-checks (写入检查)Grant permission to create checks (授予创建检查的权限)
--write-dashboards (写入仪表盘)Grant permission to create and update dashboards (授予创建和更新仪表盘的权限)
--write-dbrps (写入 DBRP)Grant permission to create database retention policy mappings (授予创建数据库保留策略映射的权限)
--write-notificationEndpoints (写入通知端点)Grant permission to create notificationEndpoints (授予创建通知端点的权限)
--write-notificationRules (写入通知规则)Grant permission to create notificationRules (授予创建通知规则的权限)
--write-orgs (写入组织)Grant permission to create and update organizations (授予创建和更新组织的权限)
--write-remotes (写入远程)Grant permission to create and update remote configurations (授予创建和更新远程配置的权限)
--write-replications (写入复制)Grant permission to create and update replication configurations (授予创建和更新复制配置的权限)
--write-tasks (写入任务)Grant permission to create and update tasks (授予创建和更新任务的权限)
--write-telegrafs (写入 Telegrafs)Grant permission to create and update Telegraf configurations (授予创建和更新 Telegraf 配置的权限)
--write-users (写入用户)Grant permission to create and update organization users (授予创建和更新组织用户的权限)
--write-variables (写入变量)Grant permission to create and update variables (授予创建和更新变量的权限)

Examples (示例)

Authentication credentials (身份验证凭证)

The examples below assume your InfluxDB host, organization, and token are provided by either the active influx CLI configuration or by environment variables (INFLUX_HOST, INFLUX_ORG, and INFLUX_TOKEN). If you do not have a CLI configuration set up or the environment variables set, include these required credentials for each command with the following flags (以下示例假定您的 InfluxDB 主机组织令牌活动的 influx CLI 配置或环境变量(INFLUX_HOSTINFLUX_ORGINFLUX_TOKEN)提供。 如果您没有设置 CLI 配置或设置环境变量,请使用以下标志为每个命令包含这些必需的凭证)

  • --host: InfluxDB host (--host: InfluxDB 主机)
  • -o, --org or --org-id: InfluxDB organization name or ID (-o, --org--org-id: InfluxDB 组织名称或 ID)
  • -t, --token: InfluxDB API token (-t, --token: InfluxDB API 令牌)

创建全部权限 API 令牌

创建全部权限令牌,以授予对组织中所有资源的权限。

influx auth create \
  --all-access 

创建 Operator API 令牌

创建Operator 令牌,以授予对所有组织中所有资源的权限。

influx auth create \
  --operator

创建具有指定读写权限的 API 令牌

influx auth create \
  --read-buckets \
  --read-checks \
  --read-dashboards \
  --read-dbrps \
  --read-notificationEndpoints \
  --read-notificationRules \
  --read-orgs \
  --read-remotes \
  --read-replications \
  --read-tasks \
  --read-telegrafs \
  --read-users \
  --write-annotations \
  --write-buckets \
  --write-checks \
  --write-dashboards \
  --write-dbrps \
  --write-notificationEndpoints \
  --write-notificationRules \
  --write-orgs \
  --write-remotes \
  --write-replications \
  --write-tasks \
  --write-telegrafs \
  --write-users \
  --write-variables

创建具有对特定存储桶的读写访问权限的 API 令牌

influx auth create \
  --read-bucket 0000000000000001 \
  --read-bucket 0000000000000002 \
  --write-bucket 0000000000000001 \
  --write-bucket 0000000000000002

创建只读 API 令牌

influx auth create \
  --read-buckets \
  --read-checks \
  --read-dashboards \
  --read-dbrps \
  --read-notificationEndpoints \
  --read-notificationRules \
  --read-orgs \
  --read-remotes \
  --read-replications \
  --read-tasks \
  --read-telegrafs \
  --read-users

此页面是否对您有帮助?

感谢您的反馈!


Flux 的未来

Flux 将进入维护模式。您可以继续按目前的方式使用它,而无需更改任何代码。

阅读更多

InfluxDB 3 开源版本现已发布公开 Alpha 版

InfluxDB 3 开源版本现已发布以供 Alpha 测试,并根据 MIT 或 Apache 2 许可获得许可。

作为 alpha 版本的一部分,我们将发布两款产品。

InfluxDB 3 Core 是我们新的开源产品。它是用于时序和事件数据的最新数据引擎。 InfluxDB 3 Enterprise 是一个商业版本,它建立在 Core 的基础上,增加了历史查询功能、读取副本、高可用性、可扩展性和细粒度的安全性。

有关如何开始使用的更多信息,请查看