温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

02-influxdb的权限管理

发布时间:2020-07-05 11:27:04 来源:网络 阅读:3758 作者:qq850900633 栏目:数据库
  • 01-InfluxDB介绍请添加链接描述

  • 02-influxdb的权限管理

  • 03-Influxdb的备份与恢复

介绍

其实influxdb的权限语法和mysql基本相似,看完以后你基本就能了解;

授权语法

  1. 创建用户:CREATE USER <username> WITH PASSWORD '<password>'
  2. 授权权限:GRANT [READ,WRITE,ALL] ON <database_name> TO <username>
  3. 创建并授权:CREATE USER <username> WITH PASSWORD '<password>' WITH ALL PRIVILEGES
  4. 取消授权:REVOKE ALL PRIVILEGES FROM <username>
  5. 修改密码:SET PASSWORD FOR <username> = '<password>'
  6. 删除用户:DROP USER <username>

开启登录认证
vim /etc/influxdb/influxdb.conf

[http]
auth-enabled = true

[root@localhost tmp]# influx

Connected to http://localhost:8086 version 1.7.1
InfluxDB shell version: 1.7.1
Enter an InfluxQL query
> 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>".
> auth
username: monitor
password:
> show databases
name: databases
name
----
_internal
zabbix
telegraf
chronograf
> quit

授权操作

1.创建超级用户
创建用户:monitor
密码:zabbix
权限:全部权限(超级用户)
create user monitor with password 'zabbix' with all privileges

2.创建只读用户
用户:monitor_ro
数据库:monitordb
权限:指定数据库的只读权限

create user monitor_ro with password 'zabbix_apipwd'
grant read on monitordb to monitor_ro

3.创建可以写用户
用户:monitor_rw
数据库:monitordb
权限:指定数据库的写权限

create user monitor_rw with password 'zabbix_apipwd'
grant write on monitordb to monitor_rw

4.取消用户授权
取消用户授权:

REVOKE ALL PRIVILEGES FROM monitor_rw

5.查看所有用户

SHOW USERS
user admin


monitor true
monitor_ro false
monitor_rw false

6.删除用户

DROP USER monitor_rw

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI