centos下安装influxdb

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


前言

打算再centos下安装influxdb并结合granfna做系统资源监控

一、centso下安装influxdb

cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL $releasever
baseurl = https://repos.influxdata.com/rhel/$releasever/$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF
操作结果
在这里插入图片描述

二、安装服务

sudo yum install influxdb

安装成功示图
在这里插入图片描述
图上安装失败了:
检查仓库配置文件:
通常,InfluxDB 的仓库配置文件位于 /etc/yum.repos.d/ 目录下。您可以查看该目录下的 influxdb.repo 文件(或者类似的文件名),确保其中的 gpgcheck 设置为 enabled,并且 gpgkey URL 指向正确的 GPG 公钥位置。

ini
[influxdb]
name = InfluxDB Repository - RHEL 7
baseurl = https://repos.influxdata.com/rhel/7/x86_64/stable/
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key

如果仓库配置文件中的 gpgkey URL 正确,但 GPG 公钥尚未导入到您的系统中,您可以通过以下命令导入它:

bash
rpm --import https://repos.influxdata.com/influxdb.key
这将导入 GPG 公钥,使您的系统能够验证来自 InfluxDB 仓库的软件包签名。

清除缓存并重新尝试安装:
清除 YUM 缓存,然后再次尝试安装 InfluxDB。

bash
yum clean all
yum makecache
yum install influxdb

sudo yum install influxdb-1.8.10-1.x86_64 --nogpgcheck
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile

  • base: mirrors.ustc.edu.cn
  • epel: mirrors.bfsu.edu.cn
  • extras: mirrors.ustc.edu.cn
  • updates: mirrors.ustc.edu.cn
    正在解决依赖关系
    –> 正在检查事务
    —> 软件包 influxdb.x86_64.0.1.8.10-1 将被 安装
    –> 解决依赖关系完成

依赖关系解决

=================================================================================================================================================================================================================================================
Package 架构 版本 源 大小

正在安装:
influxdb x86_64 1.8.10-1 influxdb 52 M

事务概要

安装 1 软件包

总计:52 M
安装大小:146 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : influxdb-1.8.10-1.x86_64 1/1
Created 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.
验证中 : influxdb-1.8.10-1.x86_64 1/1

已安装:
influxdb.x86_64 0:1.8.10-1

完毕!

总结

更新中

### 安装 InfluxDB 2.x 版本于 CentOS 7 #### 准备工作 为了确保顺利安装 InfluxDB 2.x,在开始之前确认系统已更新至最新状态并拥有必要的工具。 ```bash sudo yum update -y sudo yum install wget tar -y ``` #### 下载与解压 创建专门用于存放 InfluxDB 文件的目录,并下载对应版本的压缩包。对于 InfluxDB 2.x 的安装,推荐使用官方提供的二进制文件进行部署[^3]。 ```bash mkdir /opt/influxdb-cli cd /opt/ wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.7.5_linux_amd64.tar.gz tar -zxvf influxdb2-2.7.5_linux_amd64.tar.gz -C /opt/influxdb-cli/ ``` #### 配置环境变量 为了让命令行能够全局识别 `influx` 和其他相关指令,需将 `/opt/influxdb-cli/usr/bin/` 添加到系统的 PATH 中。 编辑 `.bashrc` 或者 `/etc/profile` 文件: ```bash echo 'export PATH=$PATH:/opt/influxdb-cli/usr/bin/' >> ~/.bashrc source ~/.bashrc ``` #### 启动服务 启动 InfluxDB 并设置开机自启。由于这是通过二进制方式安装的服务,可能需要手动配置 systemd 来管理进程。 创建一个新的 Systemd 单元文件来定义如何运行 InfluxDB 进程: ```bash cat <<EOF | sudo tee /etc/systemd/system/influxdb.service [Unit] Description=InfluxDB is an open-source, distributed, time series database Documentation=https://v2.docs.influxdata.com/v2.0/ After=network.target [Service] ExecStart=/opt/influxdb-cli/usr/bin/influxd Restart=on-failure [Install] WantedBy=default.target EOF ``` 重新加载守护程序并启用该服务以便自动启动: ```bash sudo systemctl daemon-reload sudo systemctl enable influxdb sudo systemctl start influxdb ``` 验证服务是否正常运作: ```bash systemctl status influxdb ``` 如果一切顺利,则可以通过浏览器访问 http://localhost:8086/ui 登录图形界面完成后续初始化操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值