原文链接:Prometheus – 04 – 配置Prometheus开机自启


相关文章:


Linux 版本: Centos7


一、编辑 prometheus.service 文件

  • vim /lib/systemd/system/prometheus.service

    [Unit]
    Description=Prometheus
    After=network.target
    
    [Service]
    Type=simple
    ExecStart=/usr/local/prometheus/prometheus-2.17.1.linux-amd64/prometheus --config.file=/usr/local/prometheus/prometheus-2.17.1.linux-amd64/prometheus.yml
    
    [Install]
    WantedBy=multi-user.target
    
  • :wq


二、重新载入配置文件

  • systemctl daemon-reload

三、设置为开机自启

  • systemctl enable prometheus.service

四、其他常用命令

  • systemctl start prometheus.service

    • 启动 prometheus 服务
  • systemctl stop prometheus.service

    • 关闭 prometheus 服务
  • systemctl restart prometheus.service

    • 重启 prometheus 服务
Logo

更多推荐