[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'

posted @ 2019-11-28 23:44  唯一客服系统开发笔记  阅读(410)  评论(0编辑  收藏  举报