First, install
Then step by step install.
Or to perform the following steps:
brew update
brew install influxdb
ln -sfv /usr/local/opt/influxdb/*.plist ~/Library/LaunchAgents
# Profile /etc/influxdb/influxdb.conf, if the past is not a copy will be /usr/local/etc/influxdb.conf
Configure the cache: cache-max-memory-size
# Start Service
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.influxdb.plist
#Out of service
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.influxdb.plist
# Foreground start
influxd -config /usr/local/etc/influxdb.conf
View influxdb running configuration
influxd config
Second, the database operation
1. Create a database
create database mydb
2, delete the database
drop database mydb
3, using the database
use mydb
4, inserted into the database
insert mt,type=item,sensor=sensor01 value=3,is_delete=0
Note: The first type of data determined data will be inserted, after insertion of the data types can not change.
Insert same time the data will overwrite the old, time is the primary key. It may be inserted out of sequence.
5, the query
select * from mt
where filtering of the string must be enclosed in single quotes, tag default string type
Three, InfluxDB conduct HTTP API query
The query using HTTP API InfluxDB mainly transmits the GET request to InfluxDB / query terminal, call example is shown below:
curl -GET 'http://localhost:8086/query?pretty=true' --data-urlencode "db=mydb"
--data-urlencode "q=SELECT value FROM mt WHERE name = 'mengtao'"
Db parameter specifies the database to be queried, q represents the query to be executed.
We may need to make multiple queries with InfluxDB, format query multiple HTTP API provides as follows:
curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=mydb" --data-urlencode "q=SELECT value FROM mt WHERE name='mengtao';
SELECT count(value) FROM mt WHERE name='mengtao'"
The same format with a single query, just between multiple statements use the semicolon ";" to separate.
The return value is a string containing json results.