1.下载
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.7.8_linux_amd64.tar.gz
2.解压
tar zxvf influxdb-1.7.8_linux_amd64.tar.gz
3.创建目录
mkdir -p /home/fengjun/influxdb/data
mkdir -p /home/fengjun/influxdb/log
mkdir -p /home/fengjun/influxdb/meta
mkdir -p /home/fengjun/influxdb/wal
4.修改配置
进入解压后的influxdb-1.7.8-1/etc/influxdb目录,配置indluxdb.conf
启动influxdb服务器
[fengjun@hadoop101 bin]$ ./influxd -config ../../etc/influxdb/influxdb.conf
启动influxdb客户端
[fengjun@hadoop101 bin]$ ./influx
> create database influxdb
> show databases
> use influxdb;
数据保留策略
创建 create retention policy "influx_retention" on "influxdb" duration 30d replication 1 default
查看 show retention policies on influxdb
修改 alter retention policy "influx_retention" on influxdb duration 15d
删除 drop retention policy "influx_retention" on influxdb
表增删查操作
显示所有表
> show measurements
> insert weather,altitude=1000,area=北 temperature=11,humidity=4
> insert weather,altitude=500,area=北 temperature=18,humidity=5
> select * from weather
设置以下时间格式
> precision rfc3339
删除表
> drop measurement weather
> show measurements
influxdb插入语句怎么自动区分表名,tag,field,其实是用空格。
> show tag keys from weather
> show field keys from weather
插入>insert weather,altitude=613,area=东 humidity=12,temperature=12
创建用户
> show users
user admin
---- -----
> create user influx with password 'influxdb'
> create user "admin" with password 'admin' with all privileges;
> show users;
user admin
---- -----
influx false
admin true
设置用户密码
> set password for influx = 'influx'
删除用户
> drop user admin
数据库访问权限
用户授权
授权用户数据库操作权限
> grant all privileges on influxdb to influx
赋予用户管理员权限
> grant all privileges to influx
撤销用户数据库操作权限
> revoke all privileges on influxdb from influx
撤销用户管理员权限
> revoke all privileges from influx
设置登录密码验证,进入influxdb-1.7.8-1/etc/influxdb目录,配置indluxdb.conf
将auth-enabled 改为true并去除#号注释
重启服务器:[fengjun@hadoop101 bin]$ ./influxd -config ../../etc/influxdb/influxdb.conf
客户端登录服务器,需要密码
[fengjun@hadoop101 bin]$ ./influx -username influx -password influx
Grafana安装部署
1.下载
[fengjun@hadoop101 software]$ wget https://dl.grafana.com/oss/release/grafana-7.2.0.linux-amd64.tar.gz
2.解压
[fengjun@hadoop101 software]$ tar -zxvf grafana-7.2.0.linux-amd64.tar.gz
3.启动服务
[fengjun@hadoop101 bin]$ ./grafana-server web
4.外网访问
输入本机ip和端口在浏览器访问http://192.168.224.129:3000/
输入账号admin,密码admin