如何在Fedora 30/29/28安装influxDB

时间:2020-02-23 14:33:16  来源:igfitidea点击:

如何在Fedora 30/29/28上安装influxDB。
influxdb是一款开放源时间序列数据库。
28安装influxDB为快速,高可用性存储和检索时间序列数据进行优化,用于度量分析。

第1步:添加influxData RPM存储库

influxData提供用于在CentOS 7/Fedora上安装28安装influxDB的存储库。
将其添加到系统中如下:

添加:

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

第2步:在Fedora 30/29/28安装influxdB

既然涌入存储库已添加到系统中,我们可以继续在Fedora 30/29/28安装influxDB。

sudo dnf install influxdb

当被要求导入存储库的GPG密钥时,按Y键

Importing GPG key 0x2582E0C5:
Userid : "InfluxDB Packaging Service <Hyman@theitroad>"
Fingerprint: 05CE 1508 5FC0 9D18 E99E FB22 684A 14CF 2582 E0C5
From : https://repos.influxdata.com/influxdb.key
Is this ok [y/N]: y

安装的influx可以使用该版本 rpm命令:

$rpm -qi influxdb
Name        : influxdb
Version     : 1.7.1
Release     : 1
Architecture: x86_64
Install Date: Wed 21 Nov 2016 07:10:14 PM UTC
Group       : default
Size        : 105622407
License     : Proprietary
Signature   : RSA/SHA256, Thu 15 Nov 2016 01:26:48 AM UTC, Key ID 684a14cf2582e0c5
Source RPM  : influxdb-1.7.1-1.src.rpm
Build Date  : Thu 15 Nov 2016 12:22:46 AM UTC
Build Host  : 561b607543bc
Relocations :/
Packager    : Hyman@theitroad
Vendor      : InfluxData
URL         : https://influxdata.com
Summary     : Distributed time-series database.
Description :
Distributed time-series database.

第3步:启动并启用influx服务

安装后缺省缺少填充服务不会启动。
我们需要手动启动它。

sudo systemctl start influxdb

还启用服务以启动OS启动。

sudo systemctl enable influxdb

如果开始成功,则检查状态应指示"正在运行"

$sudo systemctl status influxdb
● influxdb.service - InfluxDB is an open-source, distributed, time series database
   Loaded: loaded (/usr/lib/systemd/system/influxdb.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2016-11-21 19:17:50 UTC; 1min 7s ago
     Docs: https://docs.influxdata.com/influxdb/
 Main PID: 11074 (influxd)
    Tasks: 8 (limit: 1149)
   Memory: 10.3M
   CGroup: /system.slice/influxdb.service
           └─11074 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.321738Z lvl=info msg="Starting precreation service" log_id=0Bu>
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.321896Z lvl=info msg="Starting snapshot service" log_id=0Buw9k>
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.322058Z lvl=info msg="Starting continuous query service" log_i>
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.322305Z lvl=info msg="Starting HTTP service" log_id=0Buw9ktl00>
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.322526Z lvl=info msg="opened HTTP access log" log_id=0Buw9ktl0>
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.323043Z lvl=info msg="Listening on HTTP" log_id=0Buw9ktl000 se>
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.323352Z lvl=info msg="Starting retention policy enforcement se>
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.323662Z lvl=info msg="Listening for signals" log_id=0Buw9ktl000
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.324301Z lvl=info msg="Storing statistics" log_id=0Buw9ktl000 s>
Nov 21 19:17:51 fed29 influxd[11074]: ts=2016-11-21T19:17:51.324810Z lvl=info msg="Sending usage statistics to usage.influx

第4步:使用influx - 基础知识

一些基础influx的用法是:

1.创建数据库

$influx
Connected to http://localhost:8086 version 1.7.1
InfluxDB shell version: 1.7.1
Enter an InfluxQL query
> CREATE DATABASE monitoring

2.使用数据库

> SHOW DATABASES
name: databases
name
---
_internal
monitoring
> 
> USE monitoring

3.显示数据库测量

> SHOW MEASUREMENTS

4.从测量中选择

SELECT * FROM disk

我们已在Fedora 29/Fedora 28上成功安装了influx。