influx bucket-schema create
与 InfluxDB Cloud bucket schema 协同工作
influx bucket-schema
及其子命令与 InfluxDB Cloud bucket schema 协同工作。此功能在 InfluxDB OSS v2.3 中不可用。
influx bucket-schema create
命令为一个具有 explicit
schema-type 的 InfluxDB bucket 中的 measurement 设置 schema。
用法
influx bucket-schema create [flags]
标志
标志 | 描述 | 输入类型 | 映射到 ? | |
---|---|---|---|---|
-c | --active-config | 用于命令的 CLI 配置 | 字符串 | |
-n | --bucket | (必需)Bucket 名称(与 --bucket-id 互斥) | 字符串 | |
-i | --bucket-id | (必需)Bucket ID(与 --bucket 互斥) | 字符串 | |
--columns-file | (必需)列定义文件路径。更多信息,参见 创建列文件。 | 字符串 | ||
--columns-format | 列文件格式 (csv , ndjson , json , 默认: auto )。更多信息,参见 使用列格式创建 Schema | 字符串 | ||
--configs-path | influx CLI 配置的路径 (默认 ~/.influxdbv2/configs ) | 字符串 | INFLUX_CONFIGS_PATH | |
-x | --extended-output | 为每个 measurement schema 打印列信息(默认: false) | ||
-h | --help | create 命令的帮助信息 | ||
--hide-headers | 隐藏表格标题 (默认 false ) | INFLUX_HIDE_HEADERS | ||
--host | InfluxDB 的 HTTP 地址 (默认 https://127.0.0.1:8086 ) | 字符串 | INFLUX_HOST | |
--json | 以 JSON 格式输出数据 (默认 false ) | INFLUX_OUTPUT_JSON | ||
-n | --name | (必需)Measurement 名称 | 字符串 | |
-o | --org | 组织名称 (与 --org-id 互斥) | 字符串 | INFLUX_ORG |
--org-id | 组织 ID (与 --org 互斥) | 字符串 | INFLUX_ORG_ID | |
--skip-verify | 跳过 TLS 证书验证 | INFLUX_SKIP_VERIFY | ||
-t | --token | API Token | 字符串 | INFLUX_TOKEN |
示例
认证凭据
以下示例假设你的 InfluxDB **host**、**organization** 和 **token** 由 激活的 influx
CLI 配置 或环境变量 (INFLUX_HOST
, INFLUX_ORG
, 和 INFLUX_TOKEN
) 提供。如果你没有设置 CLI 配置或环境变量,请为每个命令包含以下必需的凭据,使用以下标志:
--host
: InfluxDB Host-o, --org
或--org-id
: InfluxDB 组织名称或 ID-t, --token
: InfluxDB API Token
使用 influx CLI 创建 Schema
influx bucket-schema create \
--bucket example-bucket \
--name temperature \
--columns-file columns.csv
创建 Schema 并打印列信息
influx bucket-schema create \
--bucket example-bucket \
--name cpu \
--columns-file columns.csv \
--extended-output
使用列格式创建 Schema
默认情况下,InfluxDB 尝试检测**列文件**格式。如果你的文件扩展名与格式不匹配,请使用 columns-format
标志设置格式。
influx bucket-schema create \
--bucket example-bucket \
--name cpu \
--columns-file columns.json \
--columns-format ndjson
influx bucket-schema create \
--bucket example-bucket \
--name cpu \
--columns-file columns.txt \
--columns-format csv
此页面是否对您有帮助?
感谢您的反馈!