从服务名和端口看V2和V1版本,不建议安装在同一台计算机。
InfluxDB版本 |
服务名 |
数据端口号 |
可执行文件 |
|
V1 |
Influxdb |
8086 |
同名 |
|
V2 |
Influx |
9999 |
同名 |
|
如果之前设置了1.x的路径,由于2.0的可执行文件与1.x一致,此时可以通过替换或重命名文件实现。
Both InfluxDB 1.x and 2.x include influx and influxd binaries. If InfluxDB 1.x binaries are already in your $PATH, run the 2.0 binaries in place or rename them before putting them in your $PATH. If you rename the binaries, all references to influx and influxd in this documentation refer to your renamed binaries.
2.0不提供Windows版本了,提供MacOS、Linux及Docker Image
删除1.8.4版本的InfluxDB
[root@localhost ~]# yum remove influxdb
已加载插件:fastestmirror, langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 influxdb.x86_64.0.1.8.4-1 将被 删除
--> 解决依赖关系完成
rabbitmq_erlang/x86_64/signature | 833 B 00:00:00
rabbitmq_erlang/x86_64/signature | 1.0 kB 00:00:00 !!!
rabbitmq_erlang-source/signature | 819 B 00:00:00
rabbitmq_erlang-source/signature | 951 B 00:00:00 !!!
依赖关系解决
==========================================================================
Package 架构 版本 源 大小
==========================================================================
正在删除:
influxdb x86_64 1.8.4-1 installed 166 M
事务概要
============================================================================
移除 1 软件包
安装大小:166 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在删除 : influxdb-1.8.4-1.x86_64 1/1
警告:/etc/influxdb/influxdb.conf 已另存为 /etc/influxdb/influxdb.conf.rpmsave
Removed symlink /etc/systemd/system/multi-user.target.wants/influxdb.service.
Removed symlink /etc/systemd/system/influxd.service.
验证中 : influxdb-1.8.4-1.x86_64 1/1
删除:
influxdb.x86_64 0:1.8.4-1
完毕!
wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.0.4.x86_64.rpm
yum localinstall influxdb2-2.0.4.x86_64.rpm
[root@localhost ~]# yum localinstall influxdb2-2.0.4.x86_64.rpm
已加载插件:fastestmirror, langpacks
正在检查 influxdb2-2.0.4.x86_64.rpm: influxdb2-2.0.4-1.x86_64
influxdb2-2.0.4.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 influxdb2.x86_64.0.2.0.4-1 将被 安装
--> 解决依赖关系完成
依赖关系解决
====================================================================================
Package 架构 版本 源 大小
====================================================================================
正在安装:
influxdb2 x86_64 2.0.4-1 /influxdb2-2.0.4.x86_64 126 M
事务概要
================================================================================
安装 1 软件包
总计:126 M
安装大小:126 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : influxdb2-2.0.4-1.x86_64 1/1Created symlink from /etc/systemd/system/influxd.service to /usr/lib/systemd/system/influxdb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/influxdb.service to /usr/lib/systemd/system/influxdb.service.
验证中 : influxdb2-2.0.4-1.x86_64 1/1
已安装:
influxdb2.x86_64 0:2.0.4-1
完毕!
yum remove influxdb2
查到的版本号:
[root@localhost ~]# influx version
Influx CLI 2.0.4 (git: 4e7a59bb9a) build_date: 2021-02-08T17:47:02Z
监听端口(官方说是9999,可能是安装了V1版本的关系):
[root@localhost ~]# netstat -a -n | grep 8086
tcp6 0 0 :::8086 :::* LISTEN
[root@localhost ~]# influx telegrafs
Error: At least one of org, org-id, or id must be provided.
Error: The instance at "http://localhost:8086" has not been setup. Please run `influx setup` before issuing any additional commands.
See 'influx telegrafs -h' for help
至少需要一个组织设定,看来是走多租户路线。需要初始化实例:
[root@localhost ~]# influx setup
Welcome to InfluxDB 2.0!
Please type your primary username: admin
Please type your password: 【adminadmin】
Please type your password again:
Please type your primary organization name: Sunpower
Please type your primary bucket name: telegraf
Please type your retention period in hours.
Or press ENTER for infinite.:
You have entered:
Username: admin
Organization: Sunpower
Bucket: telegraf
Retention Period: infinite
Confirm? (y/n): y
Config default has been stored in /root/.influxdbv2/configs.
User Organization Bucket
admin Sunpower telegraf
初始化有三种方式:
(1)使用UI界面设置
访问http://localhost:9999
点击Get Started
按要求输入Username、Password、Confirm Password、Organization Name、Bucket Name
点击Continue
(2)使用CLI命令设置
influx setup
按要求依次输入primary username、password、Confirm Password、Organization Name、Bucket Name、retention period
(3)使用CLI命令快速设置
此方法在github的readme中提到。
influx setup --username marty --password F1uxKapacit0r85 --org InfluxData --bucket telegraf --retention 168 --token where-were-going-we-dont-need-roads --force
通过http://192.168.1.23:8086访问:
InfluxDB V2的管理功能模块:
InfluxDB V2之下telegraf采用了采集入口:
[[outputs.influxdb_v2]]
客户端连接增强了安全性,采用了Token
为Telegraf生成token
管理端Data——Telegraf
调整Telegraf的输出配置:
[[outputs.influxdb_v2]]
## The URLs of the InfluxDB cluster nodes.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
## urls exp: http://127.0.0.1:8086
#urls = ["http://192.168.1.23:8086"]
urls = ["http://127.0.0.1:8086"]
# Token for authentication.
#token = "$INFLUX_TOKEN"
token="8bWFhN5trYwf3JNUxu4paHctvC-LiindWnBBBoHze9HvN3Pm-mrZT85WA4AakULQqIkP7CoXVsgV9desxfGqBw=="
## Organization is the name of the organization you wish to write to; must exist.
organization = "Sunpower"
## Destination bucket to write into.
bucket = "telegraf"
及时清查Telegraph中的配置的正确性,错误的配置可能导致Telegraf停止数据收集。