部署Influx CLI

发布时间 2023-03-25 23:18:44作者: 小吉猫

部署Influx CLI

下载 Influx CLI

# wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.6.1-linux-amd64.tar.gz

解压 Influx CLI

# tar xf influxdb2-client-2.6.1-linux-amd64.tar.gz 
# cp influxdb2-client-2.6.1-linux-amd64/influx /usr/local/bin/

设置 InfluxDB

使用token进行身份验证

# influx config create  --config-name  wgs-01  --host-url http://localhost:8086 --org wgs --token Tlx-SqIxVAL6yPi12m4PTuGH9PwbDiMuwNglGdf9_Tm0KNfw_NLxvNbFho_sHAIsYit0aeOfUfg_jITHm-HRvA== --active
Active	Name	URL			Org
*	wgs-01	http://localhost:8086	wgs

使用用户名和密码进行身份验证

# influx config create -n wgs-02 -u http://localhost:8086  -p wgs-user:wgs-password -o wgs -a
Active	Name	URL			Org
*	wgs-02	http://localhost:8086	wgs

查看configs

# cat ~/.influxdbv2/configs
[wgs-01]
  url = "http://localhost:8086"
  token = "Tlx-SqIxVAL6yPi12m4PTuGH9PwbDiMuwNglGdf9_Tm0KNfw_NLxvNbFho_sHAIsYit0aeOfUfg_jITHm-HRvA=="
  org = "wgs"
  previous = true

[wgs-02]
  url = "http://localhost:8086"
  token = ""
  org = "wgs"
  active = true
  cookie = "d2dzLXVzZXI6d2dzLXBhc3N3b3Jk"
# 
# [eu-central]
#   url = "https://eu-central-1-1.aws.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""
# 
# [us-central]
#   url = "https://us-central1-1.gcp.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""
# 
# [us-west]
#   url = "https://us-west-2-1.aws.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""

启用 shell 补全

# echo "source <(influx completion bash)" >> /root/.bashrc

influx config path

参考文档

https://docs.influxdata.com/influxdb/v2.6/tools/influx-cli/