Tuesday, November 8, 2016

Influxdb Installation and Playing


InfluxDB Testing


Get influxdb apt repository

wget -O- https://repos.influxdata.com/influxdb.key | apt-key add -
root@influxdb:~# apt-key list

pub   4096R/2582E0C5 2015-09-28
uid                  InfluxDB Packaging Service <support@influxdb.com>
sub   4096R/87F70D56 2015-09-28
root@influxdb:~# source /etc/lsb-release
root@influxdb:~# echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | tee /etc/apt/sources.list.d/influxdb.list

Update Repository and install influxdb

root@influxdb1:~#apt-get update
root@influxdb1:~# apt-get -y install influxdb
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 174 not upgraded.
Need to get 17.8 MB of archives.
After this operation, 64.0 MB of additional disk space will be used.
Fetched 17.8 MB in 57s (308 kB/s)
Selecting previously unselected package influxdb.
(Reading database ... 49929 files and directories currently installed.)
Preparing to unpack .../influxdb_1.0.2-1_amd64.deb ...
Unpacking influxdb (1.0.2-1) ...
Processing triggers for man-db ( ...
Setting up influxdb (1.0.2-1) ...
 Adding system startup for /etc/init.d/influxdb ...
   /etc/rc0.d/K20influxdb -> ../init.d/influxdb
   /etc/rc1.d/K20influxdb -> ../init.d/influxdb
   /etc/rc6.d/K20influxdb -> ../init.d/influxdb
   /etc/rc2.d/S20influxdb -> ../init.d/influxdb
   /etc/rc3.d/S20influxdb -> ../init.d/influxdb
   /etc/rc4.d/S20influxdb -> ../init.d/influxdb
   /etc/rc5.d/S20influxdb -> ../init.d/influxdb

Start playing

Use 8086 port.

Create DB first

root@influxdb1:~# curl -X POST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE mydb"

Write data

root@influxdb1:~# curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server02 value=0.67'
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: bef013e7-a593-11e6-8004-000000000000
X-Influxdb-Version: 1.0.2
Date: Tue, 08 Nov 2016 09:14:26 GMT

Query data

root@influxdb1:~# curl -i 'http://localhost:8086/query?db=mydb' --data-urlencode "q=SELECT value FROM cpu_load_short"
HTTP/1.1 200 OK
Connection: close
Content-Type: application/json
Request-Id: 0707f706-a594-11e6-8007-000000000000
X-Influxdb-Version: 1.0.2
Date: Tue, 08 Nov 2016 09:16:27 GMT
Transfer-Encoding: chunked


No comments:

Post a Comment