时序、事件和指标数据库:InfluxDB -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.com - 电脑资料】

    InfluxDB 是一个开源分布式时序、事件和指标数据库,

时序、事件和指标数据库:InfluxDB

。使用 Go 语音编写,无需外部依赖。其设计目标是实现分布式和水平伸缩扩展。

    示例代码:

//初始化influxdb = new InfluxDB(host, port, username, password, database);// with server set timestampsinfluxdb.writePoints("some_series", [    {"value": 23.0,  "state": "NY", "email": "paul@influxdb.org"},    {"value": 191.3, "state": "CO", "email": "foo@bar.com"}]);// with a specified timestampinfluxdb.writePoints("response_times", [  {time: new Date(), "value": 232}]);// get the latest point from the events time seriesseries = influxdb.query(  "select * from events limit 1;");// get the count of events (using the column type)// in 5 minute periods for the last 4 hoursseries = influxdb.query(  "select count(region) from events " +  "group by time(5m) where time > now() - 4h;");// get the count of unique event types in 10 second// intervals for the last 30 minutesseries = influxdb.query(  "select count(type) from events " +  "group by time(10s), type where time > now() - 30m;");// get the 90th percentile for the value column of response// times in 1 hour increments for the last 2 daysseries = influxdb.query(  "select percentile(value, 90) from response_times " +  "group by time(1h) where time > now() - 2d;");// get the median in 1 hour increments for the last dayseries = influxdb.query(  "select median(value) from response_times " +  "group by time(1h) where time > now() - 1d;");// get events from new yorkseries = influxdb.query(  "select * from events " +  "where state = 'ny';");// get the number of unique users in 1 hour periods// for the last 48 hoursseries = influxdb.query(  "select count(distinct(email)) from events " +  "group by time(1h) " +  "where time > now() - 2d;");// get the count of events in 10 minute increments// from users with gmail addressesseries = influxdb.query(  "select count(email) from events " +  "group by time(10m) " +  "where email =~ /.*gmail\.com/;");

    项目主页:http://www.open-open.com/lib/view/home/1384088621758

最新文章