blob: 9e6269fef13ba073d2eebe0900125e94ab511b88 [file] [log] [blame]
Filip Pytlound6fa6ab2016-08-03 15:59:49 +02001
2========
3InfluxDB
4========
5
6InfluxData is based on the TICK stack, the first open source platform for managing IoT time-series data at scale.
7
8Sample pillars
9==============
10
11Single-node influxdb, enabled http frontend and admin web interface:
12
13.. code-block:: yaml
14
15 influxdb:
16 server:
17 enabled: true
18 http:
19 enabled: true
20 bind:
21 address: 0.0.0.0
22 port: 8086
23 admin:
24 enabled: true
25 bind:
26 address: 0.0.0.0
27 port: 8083
28
29Single-node influxdb, SSL for http frontend:
30
31.. code-block:: yaml
32
33 influxdb:
34 server:
35 enabled: true
36 http:
37 bind:
38 ssl:
39 enabled: true
40 key_file: /etc/influxdb/ssl/key.pem
41 cert_file: /etc/influxdb/ssl/cert.pem
42
abednarik61b864c2017-09-19 08:08:25 -030043Single-node influxdb where you specify paths for data and metastore directories. Custom
44directories are created by this formula:
Guillaume Thouvenin1091d462016-11-14 11:53:10 +010045
46.. code-block:: yaml
47
48 influxdb:
49 server:
50 enabled: true
51 data:
52 dir: '/opt/influxdb/data'
53 wal_dir: '/opt/influxdb/wal'
54 meta:
55 dir: '/opt/influxdb/meta'
56
Simon Pasquier8fa8f712017-06-22 12:04:05 +020057InfluxDB server with customized parameters for the data service:
58
59.. code-block:: yaml
60
61 influxdb:
62 server:
63 enabled: true
64 data:
65 max_series_per_database: 20000000
Simon Pasquier9ae08ff2017-06-22 12:28:29 +020066 cache_max_memory_size: 524288000
67 cache_snapshot_memory_size: 26214400
68 cache_snapshot_write_cold_duration: "5m"
69 compact_full_write_cold_duration: "2h"2h"
70 max_values_per_tag: 5000
Simon Pasquier8fa8f712017-06-22 12:04:05 +020071
Guillaume Thouvenin071a93e2016-10-24 17:22:23 +020072Single-node influxdb with an admin user:
73
74.. code-block:: yaml
75
76 influxdb:
77 server:
78 enabled: true
79 http:
80 enabled: true
81 bind:
82 address: 0.0.0.0
83 port: 8086
84 admin:
85 enabled: true
86 bind:
87 address: 0.0.0.0
88 port: 8083
89 user:
90 enabled: true
91 name: root
92 password: secret
93
94Single-node influxdb with new users:
95
96.. code-block:: yaml
97
98 influxdb:
99 server:
100 user:
101 user1:
102 enabled: true
103 admin: true
104 name: username1
105 password: keepsecret1
106 user2:
107 enabled: true
108 admin: false
109 name: username2
110 password: keepsecret2
111
112Single-node influxdb with new databases:
113
114.. code-block:: yaml
115
116 influxdb:
117 server:
118 database:
119 mydb1:
120 enabled: true
121 name: mydb1
122 mydb2:
123 enabled: true
124 name: mydb2
125
Swann Croiset1eaf3612016-12-02 14:42:48 +0100126Manage the retention policies for a database:
127
128.. code-block:: yaml
129
130 influxdb:
131 server:
132 database:
133 mydb1:
134 enabled: true
135 name: mydb1
136 retention_policy:
137 - name: rp_db1
138 duration: 30d
139 replication: 1
140 is_default: true
141
142Where default values are:
143
144* name = autogen
145* duration = INF
146* replication = 1
147* is_default: false
148
149
Guillaume Thouvenin071a93e2016-10-24 17:22:23 +0200150Here is how to manage grants on database:
151
152.. code-block:: yaml
153
154 influxdb:
155 server:
156 grant:
157 username1_mydb1:
158 enabled: true
159 user: username1
160 database: mydb1
161 privilege: all
162 username2_mydb1:
163 enabled: true
164 user: username2
165 database: mydb1
166 privilege: read
167 username2_mydb2:
168 enabled: true
169 user: username2
170 database: mydb2
171 privilege: write
172
Filip Pytlound6fa6ab2016-08-03 15:59:49 +0200173InfluxDB relay:
174
175.. code-block:: yaml
176
177 influxdb:
178 server:
179 enabled: true
180 http:
181 enabled: true
182 output:
183 idb01:
184 location: http://idb01.local:8086/write
185 timeout: 10
186 idb02:
187 location: http://idb02.local:8086/write
188 timeout: 10
189 udp:
190 enabled: true
191 output:
192 idb01:
193 location: idb01.local:9096
194 idb02:
195 location: idb02.local:9096
196
Filip Pytloune93852a2016-08-03 16:42:42 +0200197InfluxDB cluster:
198
199.. code-block:: yaml
200
201 influxdb:
202 server:
203 enabled: true
204 meta:
205 bind:
206 address: 0.0.0.0
207 port: 8088
208 http_address: 0.0.0.0
209 http_port: 8091
210 cluster:
211 members:
212 - host: idb01.local
213 port: 8091
214 - host: idb02.local
215 port: 8091
216 - host: idb03.local
217 port: 8091
218
Filip Pytlound6fa6ab2016-08-03 15:59:49 +0200219Deploy influxdb apt repository (using linux formula):
220
221.. code-block:: yaml
222
223 linux:
224 system:
225 os: ubuntu
226 dist: xenial
Guillaume Thouveninfa42e982016-10-21 12:23:23 +0200227 repo:
228 influxdb:
229 enabled: true
230 source: 'deb https://repos.influxdata.com/${linux:system:os} ${linux:system:dist} stable'
231 key_url: 'https://repos.influxdata.com/influxdb.key'
Filip Pytlound6fa6ab2016-08-03 15:59:49 +0200232
Simon Pasquierf6169652017-07-17 14:04:19 +0200233InfluxDB client for configuring databases, users and retention policies:
234
235.. code-block:: yaml
236
237 influxdb:
238 client:
239 enabled: true
240 server:
241 protocol: http
242 host: 127.0.0.1
243 port: 8086
244 user: admin
245 password: foobar
246 user:
247 user1:
248 enabled: true
249 admin: true
250 name: username1
251 database:
252 mydb1:
253 enabled: true
254 name: mydb1
255 retention_policy:
256 - name: rp_db1
257 duration: 30d
258 replication: 1
259 is_default: true
260 grant:
261 username1_mydb1:
262 enabled: true
263 user: username1
264 database: mydb1
265 privilege: all
266
Petr Michalec81e6bc52018-01-09 16:48:03 +0100267InfluxDB client state's that uses curl can be forced to retry query if curl call fails:
268
269.. code-block:: yaml
270
271 influxdb:
272 client:
273 enabled: true
274 retry:
275 count: 3
276 delay: 3
Petr Michaleca20e4992017-12-06 13:32:13 +0100277
278Create an continuous queries:
279
280.. code-block:: yaml
281
282 influxdb:
283 client:
284 database:
285 mydb1:
Petr Michalec5fc20582017-12-11 15:00:38 +0100286 continuous_query:
Petr Michaleca20e4992017-12-06 13:32:13 +0100287 cq_avg_bus_passengers: >-
288 SELECT mean("passengers") INTO "transportation"."three_weeks"."average_passengers" FROM "bus_data" GROUP BY time(1h)
289
Petr Michalecb4cb8ab2018-02-22 16:43:14 +0100290
Marek Knapped1334892018-05-21 18:56:39 +1000291Example how to add options to http/udp/data/admin that are not supported by the formula yet:
292
293.. code-block:: yaml
294
295 influxdb:
296 server:
297 enabled: true
298 http:
299 enabled: true
300 raw_rules:
301 - 'max-row-limit = 20000'
302 udp:
303 enabled: true
304 raw_rules:
305 - 'max-row-limit = 20000'
306 data:
307 enabled: true
308 raw_rules:
309 - 'something_else = 10'
310 admin:
311 raw_rules:
312 - 'something_here = 55'
313
314
Petr Michalecb4cb8ab2018-02-22 16:43:14 +0100315Rich example for RP and CQ for Telegraf vmstats collected:
316
317.. code-block:: yaml
318
319 influxdb:
320 client:
321 database:
322 vmstats:
323 enabled: true
324 name: vmstats
325 retention_policy:
326 - name: a_week
327 duration: 10d
328 replication: 1
329 - name: a_month
330 duration: 30d
331 replication: 1
332 - name: a_quater
333 duration: 15w
334 replication: 1
335 is_default: true
336 - name: a_year
337 duration: 52w
338 replication: 1
339 - name: a_decade
340 duration: 520w
341 replication: 1
342 continuous_query:
343 cq_ds_all_1m: >-
344 SELECT sum(*) as sum_1m, count(*) as count_1m, median(*) as median_1m, mode(*) as mode_1m, mean(*) as mean_1m, max(*) as max_1m, min(*) as min_1m INTO "vmstats"."a_week".:MEASUREMENT FRO
345 cq_ds_all_10m: >-
346 SELECT sum(*) as sum_10m, count(*) as count_10m, median(*) as median_10m, mode(*) as mode_10m, mean(*) as mean_10m, max(*) as max_10m, min(*) as min_10m INTO "vmstats"."a_month".:MEASURE
347 cq_ds_all_h: >-
348 SELECT sum(*) as sum_h, count(*) as count_h, median(*) as median_h, mode(*) as mode_h, mean(*) as mean_h, max(*) as max_h, min(*) as min_h INTO "vmstats"."a_month".:MEASUREMENT FROM /.*/
349 cq_ds_all_d: >-
350 SELECT sum(*) as sum_d, count(*) as count_d, median(*) as median_d, mode(*) as mode_d, mean(*) as mean_d, max(*) as max_d, min(*) as min_d INTO "vmstats"."a_year".:MEASUREMENT FROM /.*/
351 cq_ds_all_w: >-
352 SELECT sum(*) as sum_w, count(*) as count_w, median(*) as median_w, mode(*) as mode_w, mean(*) as mean_w, max(*) as max_w, min(*) as min_w INTO "vmstats"."a_year".:MEASUREMENT FROM /.*/
353 cq_ds_all_m: >-
354 SELECT sum(*) as sum_m, count(*) as count_m, median(*) as median_m, mode(*) as mode_m, mean(*) as mean_m, max(*) as max_m, min(*) as min_m INTO "vmstats"."a_decade".:MEASUREMENT FROM /.*
355 cq_ds_all_y: >-
356 SELECT sum(*) as sum_y, count(*) as count_y, median(*) as median_y, mode(*) as mode_y, mean(*) as mean_y, max(*) as max_y, min(*) as min_y INTO "vmstats"."a_decade".:MEASUREMENT FROM /.*
357
358
Petr Michalec5fc20582017-12-11 15:00:38 +0100359Prunning data and data management:
360
361Intended to use in scheduled jobs, executed to maintain data life cycle above retention policy. These states are executed by
362``query.sls`` and you are expected to trigger ``sls_id`` individually.
363
364.. code-block:: yaml
365
366 influxdb:
367 client:
368 database:
369 mydb1:
370 query:
371 drop_measurement_h2o: >-
372 DROP MEASUREMENT h2o_quality
373 drop_shard_h2o: >-
374 DROP SHARD h2o_quality
375 drop_series_h2o_feet: >-
376 DROP SERIES FROM "h2o_feet"
377 drop_series_h2o_feet_loc_smonica: >-
378 DROP SERIES FROM "h2o_feet" WHERE "location" = 'santa_monica'
379 delete_h2o_quality_rt3: >-
380 DELETE FROM "h2o_quality" WHERE "randtag" = '3'
381 delete_h2o_quality: >-
382 DELETE FROM "h2o_quality"
383
384
385.. code-block:: shell
386
387 salt \* state.sls_id influxdb_query_delete_h2o_quality influxdb.query
388
Petr Michaleca20e4992017-12-06 13:32:13 +0100389
Simon Pasquier6f515562017-08-29 11:55:02 +0200390InfluxDB relay with HTTP outputs:
391
392.. code-block:: yaml
393
394 influxdb:
395 relay:
396 enabled: true
Simon Pasquier91782662017-09-08 11:36:06 +0200397 telemetry:
398 enabled: true
399 bind:
400 address: 127.0.0.1
401 port: 9196
Simon Pasquier6f515562017-08-29 11:55:02 +0200402 listen:
403 http_backend:
404 type: http
405 bind:
406 address: 127.0.0.1
407 port: 9096
408 output:
409 server1:
410 location: http://server1:8086/write
411 timeout: 20s
412 buffer_size_mb: 512
413 max_batch_kb: 1024
414 max_delay_interval: 30s
415 server2:
416 location: http://server2:8086/write
417
Filip Pytlound6fa6ab2016-08-03 15:59:49 +0200418Read more
419=========
420
421* https://influxdata.com/time-series-platform/influxdb/
Filip Pytloun1523e422017-02-02 13:02:03 +0100422
423Documentation and Bugs
424======================
425
426To learn how to install and update salt-formulas, consult the documentation
427available online at:
428
429 http://salt-formulas.readthedocs.io/
430
431In the unfortunate event that bugs are discovered, they should be reported to
432the appropriate issue tracker. Use Github issue tracker for specific salt
433formula:
434
435 https://github.com/salt-formulas/salt-formula-influxdb/issues
436
437For feature requests, bug reports or blueprints affecting entire ecosystem,
438use Launchpad salt-formulas project:
439
440 https://launchpad.net/salt-formulas
441
442You can also join salt-formulas-users team and subscribe to mailing list:
443
444 https://launchpad.net/~salt-formulas-users
445
446Developers wishing to work on the salt-formulas projects should always base
447their work on master branch and submit pull request against specific formula.
448
449 https://github.com/salt-formulas/salt-formula-influxdb
450
451Any questions or feedback is always welcome so feel free to join our IRC
452channel:
453
454 #salt-formulas @ irc.freenode.net