第2步:配置influxDB
默认情况下,influxdb配置文件在下面 /etc/influxdb/influxdb.conf
。
其许多配置都被注释出并未使用。
根据我们的环境修改配置文件。
完成后,保存文件并退出。
例如,要允许HTTP身份验证,请启用该行 [http]
如下面的文件所示:
sudo nano /etc/influxdb/influxdb.conf
编辑显示并保存的行。
[http] # Determines whether HTTP endpoint is enabled. enabled = true # Determines whether the Flux query endpoint is enabled. # flux-enabled = false
更改其配置文件后需要重新启动 Influx 。
我们现在可以使用以下命令创建管理员帐户:
curl -XPOST "http://localhost:8086/query" --data-urlencode "q=CREATE USER superadmin WITH PASSWORD 'type_password_here' WITH ALL PRIVILEGES"
Superadmin和Type_password_here 是 用户名和密码。
访问inforuxdB终端控制台:
influx -username 'superadmin' -password 'your_password_here'
应该登录控制台。
Connected to http://localhost:8086 version 1.7.10 InfluxDB shell version: 1.7.10
默认情况下,它在端口8086上通信。
我们可以使用CURL运行查询。
例如,要列出数据库,请运行以下curl命令:
curl -G http://localhost:8086/query -u superadmin:password_here --data-urlencode "q=SHOW DATABASES"
第1步:安装influxdb
有多种方法可以在Ubuntu上安装influxDB。
但是,最简单且最快的方式是将其从其官方存储库安装。
为此,请运行下面的命令将其存储库键添加到Ubuntu
sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add
添加密钥后,请执行以下命令以创建存储库文件
sudo echo "deb https://repos.influxdata.com/ubuntu bionic stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
当我们完成添加存储库键和文件时,请运行以下命令以更新Ubuntu Packages索引并安装influxDB
sudo apt update sudo apt install influxdb
安装后,下面的命令可用于停止,启动和启用 Influx 和启用 Influx 服务,以在服务器引导时自动启动。
sudo systemctl stop influxdb sudo systemctl start influxdb sudo systemctl enable --now influxdb sudo systemctl is-enabled influxdb
要检查和验证安装inforuxDB并运行,请运行以下状态命令:
sudo systemctl status influxdb
输出示例:
influxdb.service - InfluxDB is an open-source, distributed, time series database Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2016-04-14 21:42:56 CDT; 22s ago Docs: https://docs.influxdata.com/influxdb/ Main PID: 23788 (influxd) Tasks: 10 (limit: 4666) CGroup: /system.slice/influxdb.service └─23788 /usr/bin/influxd -config /etc/influxdb/influxdb.conf Apr 14 21:43:01 ubuntu1804 influxd[23788]: ts=2016-04-15T02:43:01.763007Z lvl=info msg="Starting precreation Apr 14 21:43:01 ubuntu1804 influxd[23788]: ts=2016-04-15T02:43:01.763013Z lvl=info msg="Starting snapshot ser
InfluxDB是一个以Go编写的开源时间序列数据库,它针对时间序列数据集(如监控、分析、度量和其他)的快速、高可用性存储和检索进行了优化。
日期:2020-07-07 20:55:03 来源:oir作者:oir