time series database, influxdb & php
DESCRIPTION
Time series database, InfluxDB and monitoring PHP applicationsTRANSCRIPT
TSDBINFLUXDB A TIME SERIES DATABASE
Created by / Gianluca Arbezzano @GianArb
TSDBTIME SERIES DATABASE
It is a software system that is optimized for handling time seriesdata, arrays of numbers indexed by time (a datetime or a
datetime range)
LEARN STARTUPEric Ries
The Lean Startup: How Today's Entrepreneurs Use ContinuousInnovation to Create Radically Successful Businesses
TIME SERIES DATAA time series is a sequence of data points, measured typically at
successive points in time spaced at uniform time intervals
OTHER POSSIBILITYGoogle AnalyticsAmazon CloudWatch...
INFLUXDB
An open-source distributed time series database with noexternal dependencies
it is written in Golang
wget http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.debsudo dpkg -i influxdb_latest_amd64.deb
Docs
WHY?Real timeEasyScalableHttp api & Client(php, python, ruby...)Single source
GRAFANA
An open source, feature rich metrics dashboard and graph editorfor Graphite, InfluxDB & OpenTSDB.
GETTING STARTEDcurl -X POST -d '[ { "name" : "hd_used", "columns" : ["value", "host", "mount"], "points" : [ [23.2, "serverA", "/mnt"] ] } ]' 'http://localhost:8086/db/mydb/series?u=root&p=root'
MORE POINTS FOR INSERT[ { "name": "log_lines", "columns": ["time", "sequence_number", "line"], "points": [ [1400425947368, 1, "this line is first"], [1400425947368, 2, "and this is second"] ] }]
IMPLEMENT UDPPROTOCOL
[input_plugins.udp] enabled = true port = 4444 database = "search"
InfluxDB is down? Your APP works!
BENCHMARK UDP VS TCPCorley\Benchmarks\InfluxDB\AdapterEvent Method Name Iterations Average Time Ops/second ------------------------ ------------ -------------- ------------- sendDataUsingHttpAdapter: [1,000 ] [0.0026700308323] [374.52751] sendDataUsingUdpAdapter : [1,000 ] [0.0000436344147] [22,917.69026]
QUERYcurl 'http://localhost:8086?u=root&p=root&q=select * from log_lines limit 1'
[ { "name": "log_lines", "columns": ["time", "sequence_number", "line"], "points": [ [1400425947368, 287780001, "here's some useful log info"] ] }]
ADMIN PANEL:8083
FEATURESCreate databaseManage usersQuery and Graphs
GRAFANAIs an Javascript DashboardOpenSource
Drag and drop panelsClick and select region to zoomBars, Lines, PointsMix lines, bars and pointsInfluxDB query editorAnnotation lines
ANNOTATIONS?!
You can mark deploy and monitoring differences between twoversions
CORLEY/INFLUXDB-PHP-SDKAnother influxdb SDK written in PHP
INSTALLphp composer.phar require corley/influxdb-sdk:dev-master
ADAPTER SYSTEMVery flexible
UDP AdapterGuzzle AdapterYour implementation..
CREATE CLIENT$options = new \InfluxDB\Options();$adapter = new \InfluxDB\Adapter\UdpAdapter($options);
$client = new \InfluxDB\Client();$client->setAdapter($adapter);
FACTORY PATTERN$options = [ "adapter" => [ "name" => "InfluxDB\\Adapter\\GuzzleAdapter", "options" => [ // guzzle options ], ], "options" => [ "host" => "my.influx.domain.tld", ], "filters" => [ "query" => [ "name" => "InfluxDB\\Filter\\ColumnsPointsFilter" ], ],];$client = \InfluxDB\ClientFactory::create($options);
MARK YOUR EVENT$client->mark("error.404", ["page" => "/a-missing-page"]);$client->mark("app.search", $points, "s");
QUERY$influx->query("select * from mine");$influx->query("select * from mine", "s");
$client->setFilter(new ColumnsPointsFilter());$data = $client->query("select * from hd_used");
THE KEY OF MEASURE
GitHub - Making MySql Better at GitHub
RICHARD FEYNMAN - THE KEY TO SCIENCE
1. Guess2. Compute Consequences3. Compare with experiment/experience
"IF IT DISAGREES WITH EXPERIMENT, IT’S WRONG"
FUTUREStar 12 Star this project
Use it and help us with your issues & PR