如何在InfluxDB中设置身份验证?

时间:2019-02-04 13:04:26

标签: influxdb

我在InfluxDB中遇到设置身份验证的麻烦。首先,以下教程告诉我更改配置文件:

https://docs.influxdata.com/influxdb/v1.7/administration/authentication_and_authorization/#set-up-authentication

[http]
  enabled = true
  bind-address = ":8086"
  auth-enabled = true # ✨
  log-enabled = true
  write-tracing = false
  pprof-enabled = false
  https-enabled = false
  https-certificate = "/etc/ssl/influxdb.pem"

但是当我更改时,重新加载服务器。我无法创建用户。

 CREATE USER paul WITH PASSWORD 'timeseries4days' WITH ALL PRIVILEGES
 ERR: unable to parse Basic Auth credentials
 Warning: It is possible this error is due to not setting a database.
 Please set a database with the command "use <database>".

因此,当使用我创建的数据库时:

 USE example
 ERR: unable to parse Basic Auth credentials

现在,我不知道我该怎么做才能将身份验证设置为仅向用户(在此情况下为paul)授予读取和写入数据库example的权限。

1 个答案:

答案 0 :(得分:1)

现在Authenticationenabled,您需要先对自己进行身份验证,然后才能在数据库中执行任何操作。

错误unable to parse Basic Auth credentials表示您未传递任何凭据。

如果您尝试使用influx二进制文件创建用户,则必须设置-username-password选项。

例如:

influx -username "my_username" -password "my_password" \
        -execute "CREATE USER parul WITH PASSWORD 'timeseries4days'