Influxdb身份验证使用Ruby失败

时间:2016-11-05 23:08:15

标签: ruby influxdb

我正在尝试使用influxdb-ruby gem连接到Influxdb。

使用:

influx -username admin -password secret 
> SHOW DATABASES;
name: databases
---------------
name
_internal
metrics

工作正常。

但是如果我尝试使用Ruby:

client = InfluxDB::Client.new(host: "host", port: 8086, database: "metrics", user:"admin", password: "secret")
client.list_databases
InfluxDB::AuthenticationError: {"error":"authorization failed"}

这里有什么提示吗?

提前致谢

1 个答案:

答案 0 :(得分:0)

您必须将user参数替换为username

client = InfluxDB::Client.new(host: "host", port: 8086, database: "metrics", username:"admin", password: "secret")