Influxdb 安装

简介: 本文将引导您安装、配置并开始使用InfluxDB.准备安装 InfluxDB 需要 root 权限(Linux系统)或Administrator权限(Windows系统)网络默认情况下,InfluxDB开放如下端口:TCP 8086 用于 HTTP APITCP 8088 用于RPC服务(主要用于备份还原)除此以外,InfluxDB还提供了多个端口. 供一些插件使用,如Graphite、OpenTSDB、 Collectd。

本文将引导您安装、配置并开始使用InfluxDB.

准备

安装 InfluxDB 需要 root 权限(Linux系统)或Administrator权限(Windows系统)

网络

默认情况下,InfluxDB开放如下端口:

  • TCP 8086 用于 HTTP API
  • TCP 8088 用于RPC服务(主要用于备份还原)

除此以外,InfluxDB还提供了多个端口. 供一些插件使用,如GraphiteOpenTSDBCollectd
所有的端口都可以通过配置文件进行修改。配置文件的默认位置为/etc/influxdb/influxdb.conf.

网络时间协议(NTP)

InfluxDB使用本地UTC时间来为数据分配时间戳并用于协调。使用网络时间协议(NTP)在服务器之间同步时间;如果某台服务器的时钟不与NTP同步,写入InfluxDB的数据的时间戳可能不准确。

安装

对于不想安装任何软件的用户,可以选择托管的InfluxDB服务.

1、Ubuntu & Debian

添加软件源

For Ubuntu

curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

For Debian

curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
test $VERSION_ID = "7" && echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "9" && echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

使用apt-get 安装并启动

sudo apt-get update && sudo apt-get install influxdb
sudo service influxdb start

PS: 在Ubuntu 15.04+, Debian 8+,可以使用sydtemd启动服务

sudo apt-get update && sudo apt-get install influxdb
sudo systemctl start influxdb

2、CentOS & RHEL

通过yum软件包管理器安装

添加源

cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF

安装并启动

sudo yum install influxdb
sudo service influxdb start

CentOS 7+, RHEL 7+使用systemd启动

sudo yum install influxdb
sudo systemctl start influxdb

配置

安装好后的系统,采用了默认的配置项,通过invluxd config查看配置情况。

img_90d8607fa251b2179ade84d2988fa174.png
influxd

我们打开/etc/influxdb/influxdb.conf,可以看到绝大部分都是被注释掉的内容,这些配置项将采用默认值(即注释掉的配置等号后的值)。当我们要自定义配置时,去掉#号注释,修改配置,重启服务即可生效。

当我们编写了另一个配置文件时,我们可以通过- config选项让它生效。

    influxd -config /etc/influxdb/influxdb.conf

或者将路径设置给环境变量 INFLUXDB_CONFIG_PATH并重启服务。

    echo $INFLUXDB_CONFIG_PATH
    /etc/influxdb/influxdb.conf


    influxd

InfluxDB 启动时, -config 选项优先,若没有此选项,再读取环境变量 INFLUXDB_CONFIG_PATH

更多内容,请参见 官方配置文档

相关文章
|
7月前
|
存储 缓存 固态存储
时序数据库 InfluxDB(四)
时序数据库 InfluxDB(四)
114 1
|
4天前
|
网络协议 API 数据库
InfluxDB集群
InfluxDB集群
21 0
|
Prometheus 监控 Cloud Native
Prometheus VS InfluxDB
前言 除了传统的监控系统如 Nagios,Zabbix,Sensu 以外,基于时间序列数据库的监控系统随着微服务的兴起越来越受欢迎,比如 Prometheus,比如 InfluxDB。gtt 也尝试了一下这两个系统,希望能找到两者的差别,为以后选型提供一些帮助。
8517 0
|
4天前
|
存储 监控 物联网
InfluxDB简介与场景
InfluxDB简介与场景
13 1
|
19天前
|
存储 监控 Java
InfluxDB时序数据库安装和使用
InfluxDB时序数据库安装和使用
39 2
|
7月前
|
存储 缓存 数据库
时序数据库 InfluxDB(三)
时序数据库 InfluxDB(三)
120 0
|
7月前
|
存储 文件存储 数据库
时序数据库 InfluxDB(二)
时序数据库 InfluxDB(二)
95 0
|
7月前
|
存储 监控 Go
时序数据库 InfluxDB(五)
时序数据库 InfluxDB(五)
106 1
|
7月前
|
存储 监控 Unix
时序数据库 InfluxDB(六)
时序数据库 InfluxDB(六)
73 0
|
7月前
|
SQL 存储 NoSQL
时序数据库 InfluxDB(一)
时序数据库 InfluxDB(一)
173 0