時序、事件和指標數據庫:InfluxDB
InfluxDB 是一個開源分布式時序、事件和指標數據庫。使用 Go 語音編寫,無需外部依賴。其設計目標是實現分布式和水平伸縮擴展。
示例代碼:
//初始化 influxdb = new InfluxDB(host, port, username, password, database); // with server set timestamps influxdb.writePoints("some_series", [ {"value": 23.0, "state": "NY", "email": "paul@influxdb.org"}, {"value": 191.3, "state": "CO", "email": "foo@bar.com"} ]); // with a specified timestamp influxdb.writePoints("response_times", [ {time: new Date(), "value": 232} ]); // get the latest point from the events time series series = influxdb.query( "select * from events limit 1;"); // get the count of events (using the column type) // in 5 minute periods for the last 4 hours series = 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 minutes series = 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 days series = 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 day series = influxdb.query( "select median(value) from response_times " + "group by time(1h) where time > now() - 1d;"); // get events from new york series = influxdb.query( "select * from events " + "where state = 'ny';"); // get the number of unique users in 1 hour periods // for the last 48 hours series = 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 addresses series = influxdb.query( "select count(email) from events " + "group by time(10m) " + "where email =~ /.*gmail\.com/;");
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!