influxdb Measurements
第一次看influxdb的代码实例时不明白influxdb Measurements是什么意思。经过研究总结一下。
1)measurement,相当于关系数据库中的table,包含tag,field,time,例如:select * from cpu_usage

2)field是必须的,并且不能根据field来排序
3)tag是可选的,tag可以用来做索引,tag是以字符串的形式存放的
4)InfluxDb可以随意添加measurements, tags, fields, time
5)points相当于表中的一条数据
6)InfluxDb的概念,Point由时间戳(time)、数据(field)、标签(tags)组成
time 每个数据记录时间,是数据库中的主索引(会自动生成)
fields 各种记录值(没有索引的属性)也就是记录的值:温度, 湿度,每条记录可以不同
tags 各种有索引的属性:地区,海拔
7)go操作Measurements代码
package main import (
"log"
"time"
"github.com/influxdata/influxdb/client/v2"
) const (
MyDB = "nfdump" //数据库名
username = "zhja" //用户名
password = "zhjazhja" //密码
) func main(){
//链接数据库
c, err := client.NewHTTPClient(client.HTTPConfig{
Addr: "http://192.168.210.130:8086",
Username: username,
Password: password,
}) if err != nil {
log.Fatalln("Error: ", err)
} // Create a new point batch
bp, err := client.NewBatchPoints(client.BatchPointsConfig{
Database: MyDB,
Precision: "s",
}) if err != nil {
log.Fatalln("Error: ", err)
} // Create a point and add to batch
tags := map[string]string{"cpu1": "cpu-total1"}
fields := map[string]interface{}{
"idle1": 10.1,
"system1": 53.3,
"user1": 46.6,
}
pt, err := client.NewPoint("cpu_usage", tags, fields, time.Now()) if err != nil {
log.Fatalln("Error: ", err)
} bp.AddPoint(pt) // Write the batch
c.Write(bp)
}
influxdb Measurements的更多相关文章
- influxDB学习总结
1.安装 请参考http://www.cnblogs.com/zhja/p/5996191.html, 安装完毕运行influxd,http://域名:8083为控制台界面:http://域名:808 ...
- Introducing Outflux: a smart way out of InfluxDB
转自:https://blog.timescale.com/migrate-outflux-a-smart-way-out-of-influxdb/ Migrate your workload fro ...
- Jmeter + Grafana + InfluxDB 性能测试监控
阅读目录 1. 安装InfluxDB 2. 安装Grafana 3. 配置Jmeter 序章 前几天在群里看到大神们在讨论Jmeter + InfluxDB + Grafana监控.说起来Jmeter ...
- InfluxDB学习之InfluxDB的基本操作
InfluxDB提供类SQL语法,如果熟悉SQL的话会非常容易上手.本文就为大家介绍一下InfluxDB的基本操作. InfluxDB提供类SQL语法,如果熟悉SQL的话会非常容易上手. 本文 ...
- InfluxDb系列:几个关键概念(主要是和关系数据库做对比)
https://docs.influxdata.com/influxdb/v0.9/concepts/key_concepts/ #,measurement,就相当于关系数据库中的table,他就是 ...
- Influxdb原理详解
本文属于<InfluxDB系列教程>文章系列,该系列共包括以下 15 部分: InfluxDB学习之InfluxDB的安装和简介 InfluxDB学习之InfluxDB的基本概念 Infl ...
- 使用python操作InfluxDB
环境: CentOS6.5_x64InfluxDB版本:1.1.0Python版本 : 2.6 准备工作 启动服务器 执行如下命令: service influxdb start 示例如下: [roo ...
- Spring Boot Actutaur + Telegraf + InFluxDB + Grafana 构建监控平台
完成一套精准,漂亮图形化监控系统从这里开始第一步 Telegraf是收集和报告指标和数据的代理 它是TICK堆栈的一部分,是一个用于收集和报告指标的插件驱动的服务器代理.Telegraf拥有插件或集成 ...
- 时序数据库InfluxDB使用详解
1 安装配置 这里说一下使用docker容器运行influxdb的步骤,物理机安装请参照官方文档.拉取镜像文件后运行即可,当前最新版本是1.3.5.启动容器时设置挂载的数据目录和开放端口.Influx ...
随机推荐
- 设置TextView控件的背景透明度和字体透明度
TextView tv = (TextView) findViewById(R.id.xx); 第1种:tv.setBackgroundColor(Color.argb(255, 0, 255, 0) ...
- [转]Linux下which、whereis、locate、find 命令的区别
转自:http://312788172.iteye.com/blog/730280 我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索.这些是从网上找到的资料,因为有 ...
- iframe根据子页面自动调整大小
//iframe高度自适应 function IFrameReSize(iframename) { var pTar = document.getElementById(iframename); if ...
- list 容器 排序函数.xml
pre{ line-height:1; color:#f0caa6; background-color:#2d161d; font-size:16px;}.sysFunc{color:#e54ae9; ...
- 【C#】如何创建xml文件以及xml文件的增、改
增: using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpre ...
- [转载]我读过最好的Epoll模型讲解
转载来自:http://blog.csdn.net/mango_song/article/details/42643971 首先我们来定义流的概念,一个流可以是文件,socket,pipe等等可以进行 ...
- java webservice的多种实现方法汇总
一.基于EJB容器管理webservice : 1.首先建立一个Web services EndPoint: package cn.test.service.impl; import java ...
- geeksforgeeks@ Minimum sum partition (Dynamic Programming)
http://www.practice.geeksforgeeks.org/problem-page.php?pid=166 Minimum sum partition Given an array, ...
- Office 365 plans, SharePoint Online, and SharePoint 2013 on-premises 功能对比列表
Andrew ConnellSharePoint大牛整理了一个各个版本SharePoint功能对比列表,是SharePoint相关人员必备资料.赶紧收藏起来. SharePoint 2013 Feat ...
- HDU 1079 Calendar Game(简单博弈)
Calendar Game Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...