Influxdb数据库:
# rpm -i influxdb-1.3.6.x86_64.rpm (端口8086)
配置文件路径:/etc/influxdb/influxdb.conf
数据存放路径:/var/lib/influxdb/data (路径可自定义)
日志路径:/var/log/influxdb/
# service influxdb start
# chkconfig influxdb --level 35 on
进入数据库命令(默认无密码):
# influx
influxdb里的time默认为时间戳格式,如果想显示为正常时间格式:
# influx -precision rfc3339
不进入数据库执行命令:
# influx -execute 'select * from "nrpe-cpu" limit 3;' -database="icinga2" -precision=rfc3339 -format=csv
查看所有表:
> show measurements;
查看所有表的字段:
> show field keys;
删除表aa(会保留内容):
> drop measurement aa;
删除表aa(带内容一同删除):
> delete from aa;
查询nrpe-cpu表hostname为bjaa01所有数据的前3行:
> select * from "nrpe-cpu" where "hostname" = 'bjaa01' limit 3;
查看数据库保留策略:
> show retention policies on "icinga2";
创建新的保留策略(h:小时,d:天,w:周,replication 1代表副本个数,一般为1即可):
> create retention policy "1y" on "icinga2" duration 365d replication 1 default;
对已有保留策略修改:
> alter retention policy "autogen" on "icinga2" duration 365d default;
删除保留策略:
> drop retention policy "1y";