I. INTRODUCTION
Certification authority mechanism, by definition, add InfluxDB database access control, by default, InfluxDB rights authentication mechanism is turned off, which means that all users have all permissions.
The old rules, immediate practical use, the lower figure is the InfluxDB permission to open authentication mechanism, after logging database 'show databases;' prompt permission authentication failure that can not view the database information.
$ influx -precision rfc3339 Connected to http://localhost:8086 version 1.7.7 InfluxDB shell version: 1.7.7 > show databases; ERR: unable to parse authentication credentials Warning: It is possible this error is due to not setting a database. Please set a database with the command "use <database>". >
Next, we perform the auth authentication for user rights, authentication is successful is able to view the information in the database user rights.
> auth username: rw_influxdb_de password: > show databases; name: databases name ---- _internal kwang_db
See here, you should probably understand the fundamental role InfluxDB rights authentication mechanism of it, how it InfluxDB permission to open authentication mechanism it, do not worry, read on.
Second, open InfluxDB rights authentication mechanism
Open InfluxDB rights authentication mechanism has three steps:
- Adding admin accounts, add at least one admin account;
- InfluxDB modify the configuration file;
- Restart InfluxDB services;
2.1 Adding admin accounts
In the initial login, InfluxDB certification authority is not turned on, you can add an admin account by the following:
> create user rw_influxdb with password '12345' with all privileges;
Check whether the account belongs to the admin account rw_influxdb
> show users; user admin ---- ----- rw_influxdb true
ok, admin account has been added successfully.
2.2 InfluxDB modify configuration files
/Etc/influxdb/influxdb.conf modify the configuration file:
[http] auth-enabled = true
The auth-enabled parameter configuration file [HTTP] module configured true, it means that permission to open authentication mechanism, is not so easy.
2.3 Restart InfluxDB Service
service influxdb restart
Log InfluxDB appear again the following results indicates permission authentication mechanism successfully opened.
$ influx -precision rfc3339 Connected to http://localhost:8086 version 1.7.7 InfluxDB shell version: 1.7.7 > show databases; ERR: unable to parse authentication credentials Warning: It is possible this error is due to not setting a database. Please set a database with the command "use <database>". >
See here, you might also have a lot of doubt, add in the 2.1 admin account that in InfluxDB the account / user is how to manage it, will be introduced in "InfluxDB User Management" in an article.
[References]