This page documents an earlier version of InfluxDB.InfluxDB v2.0 is the latest stable version.See the equivalent InfluxDB v2.0 documentation:Get started with InfluxDB.
With InfluxDB open source (OSS) installed, you’re ready to start doing some awesome things.In this section we’ll use the influx
command line interface (CLI), which is included in allInfluxDB packages and is a lightweight and simple way to interact with the database.The CLI communicates with InfluxDB directly by making requests to the InfluxDB API over port 8086
by default.
From the openhabian-config output it is obvious that the InfluxDB daemon fails to start. The most common reasons are port already in use (as @jswim788 already mentioned), and access rights. Since the setup is done with openHABian, the 2nd option is unlikely. The first option can easily be checked with. 無料で使えるossのbiツール比較6選 biツールとは. InfluxDB is meant for visualizing data by time, not by IDs like an order ID, and so it may need to be used in addition to a second database (such as MySQL, Postgresql or a NoSQL alternative) which can query by primary keys / IDs. Improve this answer. Follow answered Apr 5 at 15:26.
Note: The database can also be used by making raw HTTP requests.See Writing Data and Querying Datafor examples with the curl
application.
Creating a database
- 無料で使えるossのbiツール比較6選 biツールとは.
- Findコマンドでfind 全ディレクトリを検索対象する方法を記述してます。ちなみに、locateはデータが肥大化するのが嫌なので、遅いけどfindを利用してます。.
If you’ve installed InfluxDB locally, the influx
command should be available via the command line.Executing influx
will start the CLI and automatically connect to the local InfluxDB instance(assuming you have already started the server with service influxdb start
or by running influxd
directly).The output should look like this:
Notes:
- The InfluxDB API runs on port
8086
by default.Therefore,influx
will connect to port8086
andlocalhost
by default.If you need to alter these defaults, runinflux --help
. - The
-precision
argument specifies the format/precision of any returned timestamps.In the example above,rfc3339
tells InfluxDB to return timestamps in RFC3339 format (YYYY-MM-DDTHH:MM:SS.nnnnnnnnnZ
).
The command line is now ready to take input in the form of the Influx Query Language (a.k.a InfluxQL) statements.To exit the InfluxQL shell, type exit
and hit return.
Install Systemd On Ubuntu
A fresh install of InfluxDB has no databases (apart from the system _internal
),so creating one is our first task.You can create a database with the CREATE DATABASE <db-name>
InfluxQL statement,where <db-name>
is the name of the database you wish to create.Names of databases can contain any unicode character as long as the string is double-quoted.Names can also be left unquoted if they contain only ASCII letters,digits, or underscores and do not begin with a digit.
Throughout this guide, we’ll use the database name mydb
:
Note: After hitting enter, a new prompt appears and nothing else is displayed.In the CLI, this means the statement was executed and there were no errors to display.There will always be an error displayed if something went wrong.No news is good news!
Now that the mydb
database is created, we’ll use the SHOW DATABASES
statementto display all existing databases:
Note: The _internal
database is created and used by InfluxDB to store internal runtime metrics.Check it out later to get an interesting look at how InfluxDB is performing under the hood.
Unlike SHOW DATABASES
, most InfluxQL statements must operate against a specific database.You may explicitly name the database with each query,but the CLI provides a convenience statement, USE <db-name>
,which will automatically set the database for all future requests. For example:
Metabase Query Builder
Now future commands will only be run against the mydb
database.
Influxdb Dump
Writing and exploring data
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 “cpu_load” or “temperature”.Time series have zero to many points
, one for each discrete sample of the metric.Points consist of time
(a timestamp), a measurement
(“cpu_load”, for example),at least one key-value field
(the measured value itself, e.g.“value=0.64”, or “temperature=21.2”), and zero to many key-value tags
containing any metadata about the value (e.g.“host=server01”, “region=EMEA”, “dc=Frankfurt”).
Conceptually you can think of a measurement
as an SQL table,where the primary index is always time.tags
and fields
are effectively columns in the table.tags
are indexed, and fields
are not.The difference is that, with InfluxDB, you can have millions of measurements,you don’t have to define schemas up-front, and null values aren’t stored.
Points are written to InfluxDB using the InfluxDB line protocol, which follows the following format:
The following lines are all examples of points that can be written to InfluxDB:
Note: For details on the InfluxDB line protocol, see InfluxDB line protocol syntax page.
To insert a single time series data point into InfluxDB using the CLI, enter INSERT
followed by a point:
A point with the measurement name of cpu
and tags host
and region
has now been written to the database, with the measured value
of 0.64
.
Now we will query for the data we just wrote:
Note: We did not supply a timestamp when writing our point.When no timestamp is supplied for a point, InfluxDB assigns the local current timestamp when the point is ingested.That means your timestamp will be different.
Let’s try storing another type of data, with two fields in the same measurement:
To return all fields and tags with a query, you can use the *
operator:
Warning: Using *
without a LIMIT
clause on a large database can cause performance issues.You can use Ctrl+C
to cancel a query that is taking too long to respond.
InfluxQL has many features and keywords that are not covered here,including support for Go-style regex. For example:
This is all you need to know to write data into InfluxDB and query it back.To learn more about the InfluxDB write protocol,check out the guide on Writing Data.To further explore the query language,check out the guide on Querying Data.For more information on InfluxDB concepts, check out the [Key Concepts](/influxdb/v1.8/concepts/key_concepts/) page.
Support and feedback
Thank you for being part of our community!We welcome and encourage your feedback and bug reports for InfluxDB and this documentation.To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.