使用telegraf,influxdb,grafana打造颜值爆表的监控系统(二)-influxdb安装

简介

InfluxDB是一个从头开始处理高写入和查询负载的时间序列数据库。它是TICK堆栈的第二部分。InfluxDB旨在用作涉及大量时间戳数据的任何用例的后备存储,包括DevOps监视,应用程序度量,IoT传感器数据和实时分析。

安装

我用的是Centos6,使用yum安装

1
2
3
4
5
6
7
8
9
10
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF
sudo yum install influxdb
sudo service influxdb start

国外yum源比较慢,可以通过浏览器翻墙直接下载rpm包放到服务器再安装

1
yum localinstall influxdb-1.2.0.x86_64.rpm

启动之后默认监听8083,8086,8088这3个端口

1
2
3
tcp        0      0 :::8083                     :::*                        LISTEN      6962/influxd        
tcp 0 0 :::8086 :::* LISTEN 6962/influxd
tcp 0 0 :::8088 :::* LISTEN 6962/influxd

提供cli

1
2
3
4
 influx
Connected to http://localhost:8086 version 1.1.1
InfluxDB shell version: 1.2.0
>

提供web管理界面,访问本地的8083端口即可

默认的用户名和密码都是root

简单的语法

influxdb的语法是一个类sql的语法,但是又有一点不同。

先说几个基本概念,和mysql对比一下。

influxdb - mysql

database -> database

mesurements -> tables

创建一个数据库

1
create database telegraf

查询表里的所有数据

1
select * from table

查询指定数据

1
select a,b,c form table

其他更多语法参考官档即可

参考

https://docs.influxdata.com/influxdb/v1.2/

坚持原创技术分享,您的支持将鼓励我继续创作!