influxctl
influxctl
命令行界面 (CLI) 用于在 InfluxDB 集群中写入、查询和执行管理任务。
用法
influxctl [global-flags] [command]
命令
命令 | 描述 |
---|---|
auth | 登录或退出 InfluxDB 3 |
cluster | 列出 InfluxDB 3 集群信息 |
database | 管理 InfluxDB 3 数据库 |
help | 输出 influxctl 帮助信息 |
management | 管理 InfluxDB 3 管理令牌 |
query | 从 InfluxDB 3 查询数据 |
token | 管理 InfluxDB 3 数据库令牌 |
user | 管理 InfluxDB 3 集群用户 |
version | 输出当前的 influxctl 版本 |
write | 将 Line Protocol 写入 InfluxDB 3 |
全局标志
标志 | 描述 | |
---|---|---|
--debug | 启用调试日志记录 | |
--account | 覆盖配置文件中的帐户 ID 值 | |
--cluster | 覆盖配置文件中的集群 ID 值 | |
--config | 要使用的配置文件的路径 | |
--profile | 指定要使用的连接配置文件(默认为 default ) | |
--timeout | 为 API 调用指定超时时长(默认为 1m0s ) | |
--trace | 启用更详细的调试日志记录 | |
-h | --help | 显示帮助 |
下载并安装 influxctl
使用以下选项之一在 macOS 上下载并安装 influxctl
使用 Homebrew 安装 influxctl
使用
brew tap
将influxdata/tap
存储库添加到 Homebrew 跟踪、更新和安装的公式列表中brew tap influxdata/tap
安装
influxctl
包brew install influxctl
手动下载并安装 influxctl 二进制文件
下载适合您 CPU 类型的
influxctl
CLI 包。从浏览器或命令行下载包。浏览器
influxctl CLI v2.9.9 (x86_64) influxctl CLI v2.9.9 (arm64)
命令行
# x86_64 curl -Oo ~/Downloads/ https://dl.influxdata.com/influxctl/releases/influxctl-v2.9.9-darwin-x86_64.zip # arm64 curl -Oo ~/Downloads/ https://dl.influxdata.com/influxctl/releases/influxctl-v2.9.9-darwin-arm64.zip
解压下载的包.
执行以下操作之一
- 在 Finder 中,双击下载的包文件。
- 从命令行中,运行适合您 CPU 类型的以下命令
# x86_64 unzip ~/Downloads/influxctl-v2.9.9-darwin-x86_64.zip # arm64 unzip ~/Downloads/influxctl-v2.9.9-darwin-arm64.zip
(可选)将二进制文件放在您的
$PATH
中.# x86_64 sudo cp ~/Downloads/influxctl-v2.9.9-darwin-x86_64/influxctl /usr/local/bin/ # arm64 sudo cp ~/Downloads/influxctl-v2.9.9-darwin-arm64/influxctl /usr/local/bin/
创建连接配置文件,用于存储您的集群的连接凭据。
要下载 Linux influxctl
包,请执行以下操作之一
使用包管理器
# influxdata-archive_compat.key GPG fingerprint:
# 9D53 9D90 D332 8DC7 D6C8 D3B9 D8FF 8E1F 7DF8 B07E
wget -q https://repos.influxdata.com/influxdata-archive_compat.key
echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c influxdata-archive_compat.key' | sha256sum -c && cat influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list
sudo apt-get update && sudo apt-get install influxctl
# influxdata-archive_compat.key GPG fingerprint:
# 9D53 9D90 D332 8DC7 D6C8 D3B9 D8FF 8E1F 7DF8 B07E
cat <<EOF | sudo tee /etc/yum.repos.d/influxdata.repo
[influxdata]
name = InfluxData Repository - Stable
baseurl = https://repos.influxdata.com/stable/\$basearch/main
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdata-archive_compat.key
EOF
sudo yum install influxctl
手动下载包
下载适合您 CPU 类型的
influxctl
CLI 包。从浏览器或命令行下载包。浏览器
influxctl CLI v2.9.9 (x86_64) influxctl CLI v2.9.9 (arm64)
命令行
# amd64 curl -O https://dl.influxdata.com/influxctl/releases/influxctl-v2.9.9-linux-x86_64.tar.gz # arm64 curl -O https://dl.influxdata.com/influxctl/releases/influxctl-v2.9.9-linux-arm64.tar.gz
解压下载的包.
# amd64 tar zxvf influxctl-v2.9.9-linux-x86_64.tar.gz # arm64 tar zxvf influxctl-v2.9.9-linux-arm64.tar.gz
(可选)将二进制文件放在您的
$PATH
中.# amd64 sudo cp influxctl-v2.9.9-darwin-x86_64/influxctl /usr/local/bin/ # arm64 sudo cp influxctl-v2.9.9-darwin-arm64/influxctl /usr/local/bin/
创建连接配置文件,用于存储您的集群的连接凭据。
下载
influxctl
CLI 包.展开下载的存档.
将下载的存档展开到 C:\Program Files\InfluxData\,并根据需要重命名。
Expand-Archive .\influxctl-v2.9.9-windows-x86_64.zip ` -DestinationPath 'C:\Program Files\InfluxData\' mv 'C:\Program Files\InfluxData\influxctl-v2.9.9-windows-x86_64' ` 'C:\Program Files\InfluxData\influxctl'
授予 influxctl CLI 网络访问权限.
首次使用
influxctl
CLI 时,Windows Defender 会显示以下消息Windows Defender 防火墙阻止了此应用的部分功能。
要授予
influxctl
CLI 所需的访问权限,请执行以下操作选择专用网络,如我的家庭或工作网络。单击允许访问。
创建连接配置文件,用于存储您的集群的连接凭据。
配置连接配置文件
要连接到您的 InfluxDB 集群,influxctl
需要以下凭据
- InfluxDB 集群主机
- InfluxDB 集群端口
- OAuth 提供商凭据(所需的凭据取决于您的 OAuth 提供商)
创建配置文件
创建一个包含必要凭据的 config.toml
文件。如果存储在默认位置,influxctl
会自动检测并使用连接配置文件配置。如果存储在非默认位置,请在每个 influxctl
命令中包含 --config
标志,并提供您的配置文件路径。
默认连接配置文件存储位置
influxctl
CLI 在默认位置的 config.toml
文件中检查连接配置文件,具体位置取决于您的操作系统
操作系统 | 默认配置文件路径 |
---|---|
Linux | ~/.config/influxctl/config.toml |
macOS | ~/Library/Application Support/influxctl/config.toml |
Windows | %APPDATA%\influxctl\config.toml |
身份验证
influxctl
CLI 使用 Auth0 来验证对您的 InfluxDB 集群的访问。当您发出 influxctl
命令时,CLI 会检查是否有活动的 Auth0 令牌。如果不存在,系统会引导您使用在设置 InfluxDB Cloud Dedicated 集群时应已创建的凭据通过浏览器登录到 Auth0。Auth0 颁发一个短时(1 小时)令牌,用于验证对您的 InfluxDB 集群的访问。
故障排除
未加载模块“atk-bridge”:进行身份验证时,某些 Linux 系统可能会在终端(在 stderr 上)报告以下警告
Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
要在使用
influxctl
命令时消除警告,请取消设置GTK_MODULES
环境变量(或从其值中删除gail:atk-bridge
)——例如GTK_MODULES= influxctl ...
此页是否对您有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一份子!我们欢迎并鼓励您提供关于 InfluxDB 集群和本文档的反馈和错误报告。要获得支持,请使用以下资源
拥有年度合同或支持合同的客户可以联系 InfluxData 支持。