[Go] 时序数据库influxdb的安装

前端之家收集整理的这篇文章主要介绍了[Go] 时序数据库influxdb的安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

日志类的数据时候存储在时序数据库中,下面就是时序数据库influxdb的安装

curl -sL https://repos.influxdata.com/influxdb.key | apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,} ${DISTRIB_CODENAME} stable" | tee /etc/apt/sources.list.d/influxdb.list

apt-get update
apt-get install influxdb
service influxdb start

输入influx进入管理终端
influx
create database sinamail
use sinamail
select * from webmail_log

这个sql语句这样理解,空格分割开,空格前面的叫tag,后面的叫field
tag有索引 field没有索引,如果查询比较多就把要查的定义成tag
多个tag用逗号分割 ,多个field也要逗号分割

插入和查询,注意引号的使用,使用不对插不进去,查不出来
insert webmail_log,ip=111.222.333.444,username=taoshihan method="/index.PHP",ua="ios"

select * from webmail_log where ip='111.222.333.444'

猜你在找的Go相关文章