TL;DR InfluxDB Tech Tips - CQs & Weeks, SHOW FIELD KEYS & Field Type Discrepancies, & Local Configuration Settings & v1.1

Navigate to:

In this weekly post we recap the most interesting InfluxDB and TICK-stack related issues, workarounds, how-tos and Q&A from GitHub, IRC and the InfluxDB Google Group that you might have missed in the last week or so.

CQs and weeks

Q: I’m using a continuous query (CQ) to downsample data on a weekly basis. I’m having trouble understanding the time ranges that the queries are generating. When the query runs today (January 10, 2017) it covers the time range between January 09, 2017 up to January 16, 2017. I’d expect it to cover the time range between January 03, 2017 up to January 10, 2017. Is what I’m experiencing the expected behavior?

My CQ:

CREATE CONTINUOUS QUERY "whats_a_week" ON "telegraf"
RESAMPLE EVERY 5m
BEGIN
  SELECT MEAN("usage_idle")
  INTO "weekly_dataz"
  FROM "cpu"
  GROUP BY time(1w)
END
A: The behavior you're seeing is the result of InfluxDB's preset epoch time boundaries. By default, InfluxDB uses those preset time boundaries, not the time at which you created the CQ, to define when a week begins and when a week ends. The current epoch week starts on January 09, 2017 and ends just before January 16, 2017. If you want to personalize the CQ time boundaries you can use an offset_interval of one day in the GROUP BY time() clause:
CREATE CONTINUOUS QUERY "whats_a_week" ON "telegraf"
RESAMPLE EVERY 5m
BEGIN
  SELECT MEAN("usage_idle")
  INTO "weekly_dataz"
  FROM "cpu"
  GROUP BY time(1w,1d)
END
Check out Example 4 in the basic CQ syntax docs for another example.

SHOW FIELD KEYS and field type discrepancies

Q: Is there an easy way to tell if a field has more than one field value type? I know I can run something like the following query but I have a feeling that there’s an easier way.

> SELECT value::integer,value::float,value::boolean,value::string FROM mixed_feelings
name: mixed_feelings
time                  value  value_1  value_2  value_3
----                  -----  -------  -------  -------
2017-01-06T17:00:00Z  4      4.5
2017-01-07T17:00:00Z  2      2
2017-01-08T17:00:00Z                  true
2017-01-09T17:00:00Z                           string cheese

A: The SHOW FIELD KEYS query automatically returns every data type in a field:

> SHOW FIELD KEYS

name: mixed_feelings
fieldKey  fieldType
--------  ---------
value     float
value     string
value     boolean
value     integer

Note that data types can only differ across shards, not within a shard. In the same shard, InfluxDB will return an error if you attempt to write a data type to a field that previously accepted a different data type.

Local configuration settings and v1.1

Q: I’ve enabled the web admin interface in the configuration file and I’ve restarted InfluxDB several times but the I’m unable to access the interface. Is there another step that I’m missing?

My configuration file:

# [admin]
# Determines whether the admin service is enabled.
enabled = true

A: In InfluxDB v1.1, the section headers in the local configuration file are commented out by default. You’ll need to uncomment the [admin] header and restart InfluxDB one more time to enable the web admin interface. We’ve changed this in version 1.2 - the section headers in the configuration file will be uncommented by default.

What's Next:

  • Downloads for the TICK-stack are live on our "downloads" page.
  • Deploy on the Cloud: Get started with a FREE trial of InfluxDB Cloud featuring fully-managed clusters, Kapacitor and Grafana.
  • Deploy on Your Servers: Want to run InfluxDB clusters on your servers? Try a FREE 14-day trial of InfluxDB Enterprise featuring an intuitive UI for deploying, monitoring and rebalancing clusters, plus managing backups and restores. 
  • Tell Your Story: Over 300 companies have shared their story on how InfluxDB is helping them succeed. Submit your testimonial and get a limited edition hoodie as a thank you.