influxdb(三)

创建用户

创建root用户

> create user root with password '123456'
> show users
user     admin
----     -----
root     false

给root用户授予admin权限

> grant  all privileges to root
> show users
user     admin
----     -----
root     true

也可以在创建的时候直接用户授权为admin

> create user root with password 'root' with all privileges

删除用户

> drop user root
> show users
user     admin
----     -----

用户认证开启

在配置文件中的[http]部分开启用户认证

   220    # Determines whether user authentication is enabled over HTTP/HTTPS.
   221    auth-enabled = true 

然后重启influxdb

[root@influxdb influxdb]# systemctl restart influxdb

登录influxdb

[root@influxdb influxdb]# influx -username admin -password admin -port 8086 -host 127.0.0.1
Connected to http://127.0.0.1:8086 version 1.6.0
InfluxDB shell version: 1.6.0 

InfluxQL

表操作

查看全部表

> show measurements
name: measurements
name
----
cpu
disk
diskio
example
kernel
mem
processes
swap
system
test

查看表的字段(如果要指定database ,请在查询语句末尾加上 on database_name,默认使用当前数据库,不指定measurement名称,将查询当前库的全部measurement)

> show field keys from system
name: system
fieldKey      fieldType
--------      ---------
load1         float
load15        float
load5         float
n_cpus        integer
n_users       integer
uptime        integer
uptime_format string

查询表的tag

SHOW TAG KEYS" [on_clause] [ from_clause ] [ where_clause ] [ limit_clause ] [ offset_clause ]

> show tag keys from system on telegraf
name: system
tagKey
------
host
panshucheng
posted @ 2018-09-03 00:52  长风七万里  阅读(138)  评论(0编辑  收藏  举报