INFLUXDB port, data structure, write data

Source: Internet
Author: User
Tags influxdb

InfluxDB is an open source, distributed, time series, event, measurable and non-externally dependent database.

Influxdb has three main features:

    1. Time series (timeseries): You can use time-related functions (such as Max, Min, sum, etc.)
    2. Metrics (Metric): You can calculate large amounts of data in real time
    3. Events (Event): It supports arbitrary event data
Port exposure

The INFLUXDB will listen for 4 ports:

TCP 0 0 0.0.0.0:8099 0.0.0.0:* LISTEN 29458/influxdb
TCP 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 29458/influxdb
TCP 0 0 0.0.0.0:8086 0.0.0.0:* LISTEN 29458/influxdb
TCP 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 29458/influxdb

Only two are used for single use, and the other two are distributed deployment

    • 8083 WEB Management Interface
    • 8086 HTTP API Interface Service

Data

In Influxdb, the database, series, and point are similar to the concepts of databases, tables, and columns in a database system.

All data items are automatically incremented by two fields when they are created:

    • Time data is created, timestamp type
    • The Sequence_number field is maintained by the INFLUXDB database, similar to the primary key concept of MySQL.

For example, we create a Series with the following data

He will produce data stored in the following data format:

As you can see here, the system automatically adds 2 fields: Time and Sequence_number.

Interface protocol

InfluxDB supports two API modes:

    • HTTP API, already available
    • Protobuf API, plan to provide

How do I operate with the HTTP API?

For example foo_production , for this database, insert a series of data, you can find the POST request /db/foo_production/series?u=some_user&p=some_password , the data into the body.

The data looks like this:

The following "name": "Events", where "events" is a series table that resembles a relational database

[  {    "name": "Events",    "columns": ["state", "email", "type"],    "points": [      ["NY", "[email protected ] "," follow "],      [" NY "," [email protected] "," open "]  },  {    " name ":" Errors ",    " columns " : ["Class", "File", "User", "severity"],    "points": [[      "DivideByZero", "example.py", "[email protected]", " Fatal "]  }]

The format is JSON, can be POST sent in one request multiple series , each series can be points multiple, but the index to and columns corresponding.

The above data does not contain time columns, INFLUXDB will add themselves, but can also be specified time , such as:

[  {    "name": "Response_times",    "columns": ["Time", "value"],    "points": [      [1382819388, 234.3],      [1382819389, 120.1],      [1382819380, 340.9]  }]

Time is very important in influxdb, after all, Influxdb istime series database
There's another field in Influxdb that sequence_number is database-maintained, similar to MySQL's primary key concept

Of course sequence_number can also be specified, similar to the following:

[  {    "name": "Log_lines",    "columns": ["Time", "Sequence_number", "line"],    "points": [      [ 1400425947368, 1, "This was first"],      [1400425947368, 2, "and this is second"]]  }
Http://influxdb.com/docs/v0.8/api/reading_and_writing_data.html

InfluxDB additions and deletions are done with the HTTP API, and even support the use of regular expressions to delete data, as well as scheduled tasks.

Like what:

Send the POST request to /db/:name/scheduled_deletes , body as follows,

{  "regex": "Stats\. * ",  " Olderthan ":" 14d ",  " RunAt ": 3}

This query deletes data that is greater than 14 days and any data that begins with stats and is run every day.

Resources:

InfluxDB Open source distributed timing, event, and metrics database
http://segmentfault.com/blog/lds/1190000000444617

Open Source Monitoring Tool Grafana
Http://www.cnblogs.com/txwsqk/p/3974915.html

INFLUXDB port, data structure, write data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.