­

Prometheus安裝

  • 2019 年 10 月 4 日
  • 筆記

Prometheus安裝

下載地址: https://prometheus.io/download/

現在時間是: 2019.09.07

安裝環境: Linux centos7 minimal 虛擬機; 宿主主機 MacOS; 軟件: virtualBox 6.0.10 r132072

選用版本:

二進制包安裝

1.安裝虛擬機

2.配置 以及 安裝依賴

  • 配置網絡使用網絡地址轉換模式
  • 主機名 配置主機名可以快速辨識
  • 時鐘 prometheus是個時序數據庫,對時間要求極高,所以安裝時間同步的工具,設置時區為東八區, Asia/shanghai 資料 #安裝服務 > yum install ntp -y #開機啟動 > systemctl enable ntpd #設置時區 > timedatectl set-timezone Asia/Shanghai #查看時區 > timedatectl

3.安裝prometheus

我是本地加速下載好壓縮包上傳的,所以要另外配置 Linux上傳下載文件的命令 rz

資料

#上傳下載命令  > yum install lrzsz -y  #下載  > wget https://github.com/prometheus/prometheus/releases/download/v2.12.0/prometheus-2.12.0.linux-amd64.tar.gz  #解壓  > tar -zxvf prometheus-2.12.0.linux-amd64.tar.gz  # 配置環境變量  > vi /etc/profile  # 加入以下  # 設置prometheus的環境變量  PATH=$PATH  PATH=$PATH:/root/prometheus/server/prometheus-2.12.0.linux-amd64  export PATH  ....  > source /etc/profile    # 啟動promethus  > promethus 

4.測試聯通性

看看輸入對應ip:9090能否進入.

如果不能,檢查 ping網絡狀態, telnet端口是否開啟

# 停止防火牆  > systemctl stop firewalld  # 關閉開機啟動防火牆  > systemctl disable firewalld  # 關閉安全策略  > vi /etc/sysconfig/selinux    # This file controls the state of SELinux on the system.  # SELINUX= can take one of these three values:  #     enforcing - SELinux security policy is enforced.  #     permissive - SELinux prints warnings instead of enforcing.  #     disabled - No SELinux policy is loaded.  # 這裡修改為disabled  SELINUX=disabled  # SELINUXTYPE= can take one of three values:  #     targeted - Targeted processes are protected,  #     minimum - Modification of targeted policy. Only selected processes are protected.  #     mls - Multi Level Security protection.  SELINUXTYPE=targeted

centos7關閉防火牆

5.安裝成功

Docker安裝

docker run --name prometheus -d -p 127.0.0.1:9090:9090 quay.io/prometheus/prometheus