步骤1.首先,通过apt
在终端中运行以下以下命令,确保所有系统软件包都是最新的。
sudo apt update
sudo apt upgrade
步骤2.在Ubuntu 20.04上安装InfluxDB。
现在,我们将InfluxDB存储库添加到Ubuntu系统:
wget -qO- 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
接下来,我们将继续更新系统并安装并启动InfluxDB:
sudo apt update
sudo apt install influxdb
成功安装后,启动并启用服务以在启动时启动:
sudo systemctl enable --now influxdb
步骤3.配置InfluxDB。
配置文件位于 /etc/influxdb/influxdb.conf:
nano /etc/influxdb/influxdb.conf
[http]
# Determines whether HTTP endpoint is enabled.
enabled = true
# Determines whether the Flux query endpoint is enabled.
flux-enabled = true
# The bind address used by the HTTP service.
bind-address = ":8086"
步骤4.配置防火墙。
我们将打开端口8086。默认情况下,InfluxDB使用以下网络端口:TCP端口8086用于通过InfluxDB的HTTP API进行客户端-服务器通信,而TCP端口8088用于RPC服务进行备份和还原:
sudo ufw enable
sudo ufw allow 8086/tcp
步骤5.在Influxdb上连接并创建数据库。
一旦完成安装和InfluxDB的配置,我们将尝试连接到InfluxDB并创建一个新的用户和数据库。
- 用户名:ranty
- 密码:拉特纳
- 数据库名称:wahyuni
命令行如下:
curl -XPOST "http://localhost:8086/query" \
--data-urlencode "q=CREATE USER ranty WITH PASSWORD 'ratna' WITH ALL PRIVILEGES"
{"results":[{"statement_id":0}]}
influxdb相关操作:https://www.cnblogs.com/gaoguangjun/p/8513005.html