InfluxDB 是一种流行的开源时间序列数据库,通常用于存储和分析带时间戳的数据,例如性能指标和传感器数据。InfluxDB 是用 Go 编程语言编写的,针对时间序列数据的快速、高可用性存储和检索进行了优化。它可以在各种平台上运行,包括Linux。
在 Rocky Linux 9 上安装 InfluxDB
第 1 步。第一步是将系统更新到最新版本的软件包列表。为此,请运行以下命令:
<span class="pln">sudo dnf check</span><span class="pun">-</span><span class="pln">update sudo dnf install dnf</span><span class="pun">-</span><span class="pln">utils</span>
第 2 步。在 Rocky Linux 9 上安装 InfluxDB
默认情况下,InfluxDB 在 Rocky Linux 9 AppStream 存储库上不可用。现在运行以下命令,将 InfluxDB 存储库添加到您的 Rocky Linux 系统中:
<span class="pln">cat </span><span class="pun"><<</span><span class="pln">EOF </span><span class="pun">|</span><span class="pln"> sudo tee </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">yum</span><span class="pun">.</span><span class="pln">repos</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">influxdb</span><span class="pun">.</span><span class="pln">repo </span><span class="pun">[</span><span class="pln">influxdb</span><span class="pun">]</span><span class="pln"> name </span><span class="pun">=</span><span class="pln"> influxdb </span><span class="typ">Repository</span> <span class="pun">-</span><span class="pln"> RHEL \$releasever baseurl </span><span class="pun">=</span><span class="pln"> https</span><span class="pun">:</span><span class="com">//repos.influxdata.com/rhel/\$releasever/\$basearch/stable</span><span class="pln"> enabled </span><span class="pun">=</span> <span class="lit">1</span><span class="pln"> gpgcheck </span><span class="pun">=</span> <span class="lit">1</span><span class="pln"> gpgkey </span><span class="pun">=</span><span class="pln"> https</span><span class="pun">:</span><span class="com">//repos.influxdata.com/influxdb.key</span><span class="pln"> EOF</span>
接下来,使用以下命令安装最新版本的 InfluxDB:dnf
<span class="pln">sudo dnf update sudo dnf install influxdb2</span>
安装完成后,启动 InfluxDB 的服务,然后启用它,以便它可以在系统重新启动时自动启动:
<span class="pln">sudo systemctl start influxdb sudo systemctl status influxdb sudo systemctl enable influxdb</span>
第 3 步。配置防火墙。
若要使页面向公众开放,必须使用以下命令编辑防火墙规则以允许 Web 服务器上的 HTTP 和 HTTPS 请求:
<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">port</span><span class="pun">=</span><span class="lit">8086</span><span class="pun">/</span><span class="pln">tcp </span><span class="pun">--</span><span class="pln">permanent sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">reload</span>
第 4 步。访问 InfluxDB Web 界面。
成功安装后,打开您的 Web 浏览器并使用 URL 访问 InfluxDB。您将被重定向到以下页面:http://your-IP-address:8086
感谢您使用本教程在您的 Rocky Linux 9 系统上安装 InfluxDB 开源时间序列数据库。有关其他帮助或有用信息,我们建议您查看InfluxDB官方网站。