2015-08-15 19:56:52 +02:00
|
|
|
influxdb
|
|
|
|
========
|
|
|
|
|
2016-05-24 05:29:59 +02:00
|
|
|
> :warning: Please use the official image [influxdb](https://hub.docker.com/_/influxdb/)!
|
|
|
|
|
2016-03-26 02:34:17 +02:00
|
|
|
[InfluxDB][1] is an open source distributed time series database with no external
|
2015-08-15 19:56:52 +02:00
|
|
|
dependencies. It's useful for recording metrics, events, and performing
|
|
|
|
analytics.
|
2016-03-26 02:34:17 +02:00
|
|
|
|
2016-05-02 16:42:42 +02:00
|
|
|
## docker-compose.yml
|
|
|
|
|
2016-06-01 07:50:01 +02:00
|
|
|
For official image:
|
|
|
|
|
2016-05-24 05:29:59 +02:00
|
|
|
```yaml
|
|
|
|
influxdb:
|
|
|
|
image: influxdb:alpine
|
|
|
|
ports:
|
|
|
|
- "8083:8083"
|
|
|
|
- "8086:8086"
|
|
|
|
volumes:
|
|
|
|
- ./data:/var/lib/influxdb
|
|
|
|
restart: always
|
|
|
|
```
|
|
|
|
|
2016-06-01 07:50:01 +02:00
|
|
|
For unofficial image:
|
|
|
|
|
2016-05-02 16:42:42 +02:00
|
|
|
```yaml
|
|
|
|
influxdb:
|
|
|
|
image: vimagick/influxdb
|
|
|
|
ports:
|
|
|
|
- "8083:8083"
|
|
|
|
- "8086:8086"
|
|
|
|
- "8088:8088"
|
|
|
|
- "25826:25826/udp"
|
|
|
|
restart: always
|
|
|
|
```
|
2016-03-26 02:34:17 +02:00
|
|
|
|
2016-05-10 08:58:37 +02:00
|
|
|
## up and running
|
|
|
|
|
2016-12-13 13:34:39 +02:00
|
|
|
```bash
|
|
|
|
$ docker-compose up -d
|
|
|
|
$ docker-compose exec influxdb influx
|
|
|
|
>>> show databases
|
|
|
|
name: databases
|
|
|
|
name
|
|
|
|
----
|
|
|
|
_internal
|
|
|
|
db_name
|
|
|
|
|
|
|
|
>>> use db_name
|
|
|
|
Using database db_name
|
|
|
|
|
|
|
|
>>> show series
|
|
|
|
key
|
|
|
|
---
|
|
|
|
cpu
|
|
|
|
|
|
|
|
>>> quit
|
|
|
|
```
|
|
|
|
|
2016-05-10 08:58:37 +02:00
|
|
|
- Open url: <http://localhost:8083>
|
|
|
|
- Create user: `CREATE USER "username" WITH PASSWORD 'password'`
|
|
|
|
- Create database: `CREATE DATABASE "db_name"`
|
|
|
|
- Select database: `db_name`
|
|
|
|
- Write data: `INSERT cpu,host=serverA,region=us_west value=0.64`
|
|
|
|
- Query data: `SELECT * FROM cpu`
|
|
|
|
|
2016-03-26 02:34:17 +02:00
|
|
|
[1]: https://influxdata.com/
|