Prometheus安装

环境

系统:CentOS 7.5
软件:prometheus-2.18.1.linux-amd64.tar.gz

安装

  • 下载二进制包
    地址:https://prometheus.io/download/

  • 安装

    # tar -xzvf prometheus-2.18.1.linux-amd64.tar.gz
    # mkdir /usr/local/prometheus
    # mv prometheus-2.18.1.linux-amd64 /usr/local/prometheus/prometheus
    
  • 创建数据目录

    # mkdir -p /data/prometheus/prometheus/data
    
  • 创建用户并授权

    # useradd prometheus
    # chown -R prometheus:prometheus /usr/local/prometheus /data/prometheus
    

启动

  • 添加启动服务

    # vim /usr/lib/systemd/system/prometheus.service
    [Unit]
    Description= Prometheus
    After=network.target
    
    [Service]
    Type=simple
    User=prometheus
    ExecStart=/usr/local/prometheus/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus/prometheus/data
    ExecReload=/bin/kill -HUP $MAINPID
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    
  • 启动

    # systemctl enable prometheus.service
    # systemctl start prometheus.service
    
  • 访问
    web地址:http://ip:9090




posted @ 2020-06-29 16:30  CloudNativeBJ  阅读(128)  评论(0编辑  收藏  举报