influxDB安装及简单使用


从influxdb官网下载

 

 然后解压,进入lib中先./influxd  再./influx ,就可以用了。

环境:
CentOS 6.5
InfluxDB 1.2

一、下载安装

1、下载RPM

 https://dl.influxdata.com/influxdb/releases/influxdb-1.2.0.x86_64.rpm 

wget下载链接有问题,直接复制到浏览器下载很快,然后上传至linux机器即可

2、安装

sudo yum install influxdb-1.2.0.x86_64.rpm

3、启动

sudo service influxdb start

查看状态

[hadoop@hadoop000 ~]$ sudo service influxdb status influxdb process is running [ OK ] 

二、使用语法

1、登录

influx -precision rfc3339

参数含义

  • The -precision argument specifies the format/precision of any returned timestamps. In the example above, rfc3339 tells InfluxDB to return timestamps in RFC3339 format (YYYY-MM-DDTHH:MM:SS.nnnnnnnnnZ).

2、创建数据库

> CREATE DATABASE mydb

选择数据库

> use mydb; Using database mydb 

3、创建表并插入数据

3.1、Conceptually you can think of a measurement as an SQL table,在概念你要将measurement 看成我们常见数据中的表,所以在InfluxDB中查看表为:

> show measurements; 

3.2、插入数据,在InfluxDB中是不需要创建表的,可以直接:

> INSERT cpu,host=serverA,region=us_west value=0.64 

cpu代表的就表(measurement),host=serverA为tags,后面的为fields.

格式为

<measurement>[,<tag-key>=<tag-value>...] <field-key>=<field-value>[,<field2-key>=<field2-value>...] [unix-nano-timestamp] 

3.3查看数据

> show measurements name: measurements name ---- cpu -------------------------------------- > select * from cpu name: cpu time host region value ---- ---- ------ ----- 2019-07-09T14:45:56.543728445Z serverA us_west 0.64 

在InfluxDB中主索引永远都是time。

1.2版本语法及文档请参考
https://docs.influxdata.com/influxdb/v1.2/introduction/getting_started/

目前最新稳定版本为1.7.x,具体参考
https://docs.influxdata.com/influxdb/v1.7/introduction/getting-started/

1.7版本下载安装
https://portal.influxdata.com/downloads/



作者:喵星人ZC
链接:https://www.jianshu.com/p/057eacfd2521
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM