Metabase Influxdb



This is archived documentation for InfluxData product versions that are no longer maintained.For newer documentation, see the latest InfluxData documentation.

InfluxQL offers a full suite of administrative commands.

  • Data management
    ◦ Create a database with CREATE DATABASE
    ◦ Delete a database with DROP DATABASE
    ◦ Delete series with DROP SERIES
    ◦ Delete measurements with DROP MEASUREMENT

  • Retention policy management
    ◦ Create retention policies with CREATE RETENTION POLICY
    ◦ Modify retention policies with ALTER RETENTION POLICY
    ◦ Delete retention policies with DROP RETENTION POLICY

If you’re looking for SHOW queries (for example, SHOW DATABASES or SHOW RETENTION POLICIES), see Schema Exploration.

Now that we have a database, InfluxDB is ready to accept queries and writes. First, a short primer on the datastore. Data in InfluxDB is organized by “time series”, which contain a measured value, like “cpuload” or “temperature”. Time series have zero to many points, one for each discrete sample of the metric. It provides H2, Mysql, ES, and InfluxDB storage methods. RecordDataTTL is how long data is stored. The default is 7 days Here, select es7 to comment out other storage methods. Then select elastic search 7 in the selector option of the storage.

The examples in the sections below use InfluxDB’s Command Line Interface (CLI).You can also execute the commands using the HTTP API; simply send a GET request to the /query endpoint and include the command in the URL parameter q.See the Querying Data guide for more on using the HTTP API.

Note: When authentication is enabled, only admin users can execute most of the commands listed on this page.See the documentation on authentication and authorization for more information.

Data Management

Create a database with CREATE DATABASE

The CREATE DATABASE query takes the following form:

Create the database NOAA_water_database:

Create the database NOAA_water_database only if it doesn’t exist:

Create the database NOAA_water_database with a new retention policy called liquid:

When specifying a retention policy you can include one or more of the attributes DURATION, REPLICATION, and NAME.For more on retention policies, see Retention Policy Management

A successful CREATE DATABASE query returns an empty result.

Metbase

Note: Specifying a retention policy in the CREATE DATABASE query is available in InfluxDB versions 0.9.6+.

Delete a database with DROP DATABASE

The DROP DATABASE query deletes all of the data, measurements, series, continuous queries, and retention policies from the specified database.The query takes the following form:

Drop the database NOAA_water_database:

Drop the database NOAA_water_database only if it exists:

A successful DROP DATABASE query returns an empty result.

Delete series with DROP SERIES

The DROP SERIES query deletes all points from series in a database.The query takes the following form, where you must specify either the FROM clause or the WHERE clause:

Delete all series from a single measurement:

Delete series that have a specific tag set from a single measurement:

Delete all points in the series that have a specific tag set from all measurements in the database:

A successful DROP SERIES query returns an empty result.

DROP SERIES does not support time intervals in the WHERE clause.See GitHub Issue #1647 for more information).

Currently, InfluxDB does not support regular expressions with DROP SERIES.See GitHub Issue #4276 for more information.

Delete measurements with DROP MEASUREMENT

The DROP MEASUREMENT query deletes all data and series from the specified measurement and, unlike DROP SERIES, it also deletes the measurement from the index.The query takes the following form:

Delete the measurement h2o_feet:

Influxdb Dump

Note:DROP MEASUREMENT drops all data and series in the measurement.It does not drop the associated continuous queries.

A successful DROP MEASUREMENT query returns an empty result.

Currently, InfluxDB does not support regular expressions with DROP MEASUREMENTS.See GitHub Issue #4275 for more information.

Retention Policy Management

The following sections cover how to create, alter, and delete retention policies.Note that when you create a database, InfluxDB automatically creates a retention policy named default which has infinite retention.You may disable that auto-creation in the configuration file.

Create retention policies with CREATE RETENTION POLICY

The CREATE RETENTION POLICY query takes the following form, where DEFAULT is optional:

  • DURATION determines how long InfluxDB keeps the data - the options for specifying the duration of the retention policy are listed below.Note that the minimum retention period is one hour.
    m minutes
    h hours
    d days
    w weeks
    INF infinite

    Currently, the DURATION attribute supports only single units.For example, you cannot express the duration 7230m as 120h 30m.See GitHub Issue #3634 for more information.

  • REPLICATION determines how many independent copies of each point are stored in the cluster, where n is the number of data nodes.

  • DEFAULT sets the new retention policy as the default retention policy for the database. Sky go without app.

Create a retention policy called one_day_only for the database NOAA_water_database with a one day duration and a replication factor of one:

Create the same retention policy as the one in the example above, but set it as the default retention policy for the database.

A successful CREATE RETENTION POLICY query returns an empty response.

Note: If you’re using InfluxDB versions 0.9.6+, you can also specify a new retention policy in the CREATE DATABASE query.See Create a database with CREATE DATABASE.

Modify retention policies with ALTER RETENTION POLICY

The ALTER RETENTION POLICY query takes the following form, where you must declare at least one of the retention policy attributes DURATION, REPLICATION, or DEFAULT:

First, create the retention policy what_is_time with a DURATION of two days:

Modify what_is_time to have a three week DURATION and make it the DEFAULT retention policy for NOAA_water_database.

In the last example, what_is_time retains its original replication factor of 1.

A successful ALTER RETENTION POLICY query returns an empty result.

Delete retention policies with DROP RETENTION POLICY

Influxdb dump

Delete all measurements and data in a specific retention policy with:

Delete the retention policy what_is_time in the NOAA_water_database database:

Metbase

A successful DROP RETENTION POLICY query returns an empty result.

Create Influxdb Database

Note: If you attempt DROP a retention policy that is the default retention policy for the database InfluxDB does not delete the policy and returns the error: ERR: retention policy is default.CREATE a new default policy or ALTER an already existing policy to be the default before deleting the retention policy.