1.Influxdb使用1

原创 George555   公众号:测试江湖路 

如果这些内容对你有帮助,也可以打开微信扫一扫,加关注:

一、简介

    InfluxDB:是一款用Go语言编写的开源分布式时序、事件和指标数据库, 一般主要用于存储涉及大量的时间戳数据,如DevOps监控数据,APP metrics, loT传感器数据和实时分析数据。

二、安装

1.centos下下载和安装

下载命令:wget et https://dl.influxdata.com/influxdb/releases/influxdb-1.6.2.x86_64.rpm

[root@georgeComputer georgeProject]# wget et https://dl.influxdata.com/influxdb/releases/influxdb-1.6.2.x86_64.rpm

。。。。。。。此处省略1万字

Saving to: “influxdb-1.6.2.x86_64.rpm”

100%[===============================================>] 24,691,802  6.06M/s   in 5.0s

2020-06-24 19:20:59 (4.71 MB/s) - “influxdb-1.6.2.x86_64.rpm” saved [24691802/24691802]

FINISHED --2020-06-24 19:20:59--

Downloaded: 1 files, 24M in 5.0s (4.71 MB/s)

    安装命令:yum localinstall influxdb-1.6.2.x86_64.rpm

[root@georgeComputer georgeProject]# yum localinstall influxdb-1.6.2.x86_64.rpm

Loaded plugins: fastestmirror

Setting up Local Package Process

Examining influxdb-1.6.2.x86_64.rpm: influxdb-1.6.2-1.x86_64   | 3.7 kB     00:00

。。。。。。。此处省略1万字

Installed:

influxdb.x86_64 0:1.6.2-1

2.windows下下载安装

    InfluxDB1.2.0可自行下载

    

    注:由于1.3后就不提供web管理端了,所以如果想用管理端的需要下载1.3之前版本,这里提供了1.2版本,这个包比较难找到,如果网络上未找到请微信联系笔者。

    InfluxDB1.2.0安装:

    InfluxDB的windows版本是绿色包,不需要安装,下载后解压即可使用,内部文件如下图:

    

三、配置-Centos环境

    安装成功后,就需要去修改配置文件,以便可以和Jmeter或其他工具进行连通使用了。

    当然这里windows和linux环境配置稍微有些差异,这里以linux为例进行说明:

    修改如下文件:/etc/influxdb/influxdb.conf

    因为jmeter把数据写入到influxdb中,需要用graphite协议或http协议(两种方式见下文中进行区分),所以需要修改如下板块内容:

[http]

# Determines whether HTTP endpoint is enabled.

enabled = true

# The bind address used by the HTTP service.

bind-address = ":8086"

# Determines whether user authentication is enabled over HTTP/HTTPS.

# auth-enabled = false

# The default realm sent back when issuing a basic auth challenge.

# realm = "InfluxDB"

# Determines whether HTTP request logging is enabled.

log-enabled = true

[[graphite]]

# Determines whether the graphite endpoint is enabled.

enabled = true

database = "jmeterTest"

retention-policy = ""

bind-address = ":2003"

protocol = "tcp"

consistency-level = "one"

# These next lines control how batching works. You should have this enabled

# otherwise you could get dropped metrics or poor performance. Batching

# will buffer points in memory if you have many coming in.

# Flush if this many points get buffered

batch-size = 5000

# number of batches that may be pending in memory

batch-pending = 10

# Flush at least this often even if we haven't hit buffer limit

batch-timeout = "1s"

# UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max.

udp-read-buffer = 0

### This string joins multiple matching 'measurement' values providing more control over the final measurement name.

separator = "."

    修改完成后可以使用命令:Influxd config ,查询下修改后的配置信息,如下图:


[root@georgeComputer georgeProject]# influxd config
Merging with configuration at: /etc/influxdb/influxdb.conf
reporting-disabled = false
bind-address = "127.0.0.1:8088"
。。。。此处省略1万字
[http]
  # Determines whether HTTP endpoint is enabled.
  enabled = true

  # The bind address used by the HTTP service.
  bind-address = ":8086"

  # Determines whether user authentication is enabled over HTTP/HTTPS.
  # auth-enabled = false

  # The default realm sent back when issuing a basic auth challenge.
  # realm = "InfluxDB"

  # Determines whether HTTP request logging is enabled.
  log-enabled = true
[[graphite]]
  enabled = false
  bind-address = ":2003"
  database = "jmeterTest"
  retention-policy = ""
  protocol = "tcp"
  batch-size = 5000
  batch-pending = 10
  batch-timeout = "1s"
  consistency-level = "one"
  separator = "."
  udp-read-buffer = 0

四、配置-Win环境

    windows环境下的influxdb.conf配置文件中,需要配置如下8大板块内容:

    A.meta:数据库源meta存储路径,默认是linux路径,需要改为windows目录,注意 \\

[meta]
  # Where the metadata/raft database is stored
  #dir = "/var/lib/influxdb/meta"
  dir = "d:\\influx\\meta"
  # Automatically create a default retention policy when creating a database.
    retention-autocreate = true
  # If log messages are printed for the meta service
     logging-enabled = true

    B.data:TSM存储引擎存放TSM文件目录

[data]
  # The directory where the TSM storage engine stores TSM files.
  # dir = "/var/lib/influxdb/data"
  dir = "d:\\influx\\data"
  # The directory where the TSM storage engine stores WAL files.
  #wal-dir = "/var/lib/influxdb/wal"
  wal-dir = "d:\\influx\\waldir"
  # Trace logging provides more verbose output around the tsm engine. Turning
  # this on can provide more useful output for debugging tsm engine issues.
  # trace-logging-enabled = false
  # Whether queries should be logged before execution. Very useful for troubleshooting, but will
  # log any sensitive data contained within a query.
    query-log-enabled = true

    C.retention:确定是否启用执行保留策略

[retention]
  # Determines whether retention policy enforcment enabled.
  enabled = true

  # The interval of time when retention policy enforcement checks run.
  check-interval = "30m"

    D.shard-precreation:确定是否开启 分片预创建,默认开启

[shard-precreation]
  # Determines whether shard pre-creation service is enabled.
  enabled = true

  # The interval of time when the check to pre-create new shards runs.
  check-interval = "10m"

  # The default period ahead of the endtime of a shard group that its successor
  # group is created.
  advance-period = "30m"

    E.monitor:是否记录内部统计数据

[monitor]
  # Whether to record statistics internally.
  store-enabled = true

  # The destination database for recorded statistics
  store-database = "_internal"

  # The interval at which to record statistics
  store-interval = "10s"

    F.admin:web端管理配置

[admin]
  # Determines whether the admin service is enabled.
  enabled = true

  # The default bind address used by the admin service.
  bind-address = ":8083"

  # Whether the admin service should use HTTPS.
  # https-enabled = false

  # The SSL certificate used when HTTPS is enabled.
  # https-certificate = "/etc/ssl/influxdb.pem"

    备注:admin板块是针对influxdb的web后台管理端做的设置,只有在V1.3版本之前可用,之后版本中官方配置文件取消了这个配置项,不能直接用web后台配置管理了,这时候可以用chronograf,此工具使用见后面分享。

    G.http:http协议配置。用于http协议访问influxdb,比如jmeter中后端监听器(Backend Listener)中选influxdb方式

[http]
  # Determines whether HTTP endpoint is enabled.
  enabled = true

  # The bind address used by the HTTP service.
  bind-address = ":8086"

    H.graphite:graphite协议配置。用于graphite协议访问influxdb,比如jmeter中后端监听器(Backend Listener)中选graphite方式

[[graphite]]
  # Determines whether the graphite endpoint is enabled.是否启用
  enabled = true
  #数据库名配置
  database = "jmeterTest"
  retention-policy = ""
  #数据库连接ip和端口配置
  bind-address = ":2003"
  #协议配置
  protocol = "tcp"
  consistency-level = "one"

 

 

#####欢迎加好友交流切磋####

QQ:464314378

微信群请先加群主微信,群主会拉各位小伙伴进群,注意添加备注。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值