IfluxDB是一个开源分布式时序、事件和指标数据库。使用Go语言编写,无需外部依赖。其设计目标是实现分布式和水平伸缩扩展。IfluxDB包括用于存储和查询数据,在后台处理ETL或监视和警报目的,用户仪表板以及可视化和探索数据等的API。
以下是IfluxDB目前支持的一些功能,使其成为处理时间序列数据的绝佳选择:
专为时间序列数据编写的自定义高性能数据存储。TSM引擎允许高摄取速度和数据压缩完全用Go语言编写。它编译成单个二进制文件,没有外部依赖项简单,高性能的写入和查询HTTPAPI插件支持其他数据提取协议,如Graphite,collectd和OpeTSDB专为类似SQL的查询语言量身定制,可轻松查询聚合数据标签允许对系列进行索引以实现快速有效的查询保留策略有效地自动使过时数据过期连续查询自动计算聚合数据,以提高频繁查询的效率IfluxDB的开源版本只支持一个节点。
示例代码:
//初始化ifluxdb = ew IfluxDB(host, port, userame, password, database);// with server set timestampsifluxdb.writePoits("some_series", [ {"value": 23.0, "state": "NY", "email": "paul@ifluxdb.org"}, {"value": 191.3, "state": "CO", "email": "foo@bar.com"}]);// with a specified timestampifluxdb.writePoits("respose_times", [ {time: ew Date(), "value": 232}]);// get the latest poit from the evets time seriesseries = ifluxdb.query( "select * from evets limit 1;");// get the cout of evets (usig the colum type)// i 5 miute periods for the last 4 hoursseries = ifluxdb.query( "select cout(regio) from evets " + "group by time(5m) where time > ow() - 4h;");// get the cout of uique evet types i 10 secod// itervals for the last 30 miutesseries = ifluxdb.query( "select cout(type) from evets " + "group by time(10s), type where time > ow() - 30m;");// get the 90th percetile for the value colum of respose// times i 1 hour icremets for the last 2 daysseries = ifluxdb.query( "select percetile(value, 90) from respose_times " + "group by time(1h) where time > ow() - 2d;");// get the media i 1 hour icremets for the last dayseries = ifluxdb.query( "select media(value) from respose_times " + "group by time(1h) where time > ow() - 1d;");// get evets from ew yorkseries = ifluxdb.query( "select * from evets " + "where state = 'y';");// get the umber of uique users i 1 hour periods// for the last 48 hoursseries = ifluxdb.query( "select cout(distict(email)) from evets " + "group by time(1h) " + "where time > ow() - 2d;");// get the cout of evets i 10 miute icremets// from users with gmail addressesseries = ifluxdb.query( "select cout(email) from evets " + "group by time(10m) " + "where email =~ /.*gmail\.com/;");
评论