Prometheus入门到放弃(1)之Prometheus安装部署
规划:
IP | 角色 | 版本 |
10.10.0.13 | prometheus-server | 2.10 |
10.10.0.11 | node_exporter | 0.18.1 |
10.10.0.12 | node_exporter | 0.18.1 |
1、下载
官网:https://prometheus.io/download/
[root@prometheus-server ~]# wget https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz
2、创建运行用户
[root@prometheus-server ~]# groupadd -r prometheus
[root@prometheus-server ~]# useradd -r -g prometheus -d / -s /sbin/nologin -c "prometheus user" prometheus
3、安装
安装这里介绍两种方式:
1、docker部署
2、二进制部署 (本文采用)
3.1 二进制部署
[root@prometheus-server ~]# tar -xf prometheus-2.10.0.linux-amd64.tar.gz
[root@prometheus-server ~]# mkdir /etc/prometheus
[root@prometheus-server ~]# mkdir /var/lib/prometheus
[root@prometheus-server ~]# cp prometheus-2.10.0.linux-amd64/prometheus /usr/local/bin/
[root@prometheus-server ~]# cp prometheus-2.10.0.linux-amd64/prometheus.yml /etc/prometheus/
[root@prometheus-server ~]# chown -R prometheus:prometheus /etc/prometheus
[root@prometheus-server ~]# chown -R prometheus:prometheus /var/lib/prometheus/
[root@prometheus-server ~]# vim /usr/lib/systemd/system/prometheus.service
## 配置启动脚本
[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus \
--storage.tsdb.retention=15d \
--web.read-timeout=5m \
--web.max-connections=10 \
--query.max-concurrency=20 \
--query.timeout=2m \
--web.enable-lifecycle
Restart=on-failure
[Install]
WantedBy=multi-user.target
## 启动
[root@prometheus-server ~]# systemctl enable prometheus
[root@prometheus-server ~]# systemctl start prometheus
[root@prometheus-server ~]# netstat -anlptu|grep :9090
tcp 0 0 127.0.0.1:39868 127.0.0.1:9090 ESTABLISHED 3080/prometheus
tcp6 0 0 :::9090 :::* LISTEN 3080/prometheus
tcp6 0 0 ::1:52200 ::1:9090 ESTABLISHED 3080/prometheus
tcp6 0 0 127.0.0.1:9090 127.0.0.1:39868 ESTABLISHED 3080/prometheus
tcp6 0 0 ::1:9090 ::1:52200 ESTABLISHED 3080/prometheus
参数解释:
--config.file=/etc/prometheus/prometheus.yml ### prometheus配置文件
--storage.tsdb.path=/var/lib/prometheus ### prometheus 存储数据路径
--storage.tsdb.retention=15d ### prometheus采集数据保留时间
--web.read-timeout=5m ### 请求链接的最大等待时间
--web.max-connections=10 ### 最大链接数
--query.max-concurrency=20 ### 最大支持的并发查询量
--query.timeout=2m ### 单个查询超时时间
--web.enable-lifecycle ### 热加载
3.2 docker部署
官方介绍:https://github.com/prometheus/prometheus/tree/master
docker方式部署需要先创建prometheus.yml文件
[root@prometheus-server ~]# mkdir /opt/prometheus/
[root@prometheus-server ~]# vim /opt/prometheus/prometheus.yml
global:
scrape_interval: 15s # 抓取数据的周期,默认为1min
evaluation_interval: 15s # 更新rules文件的周期,默认为1min
# scrape_timeout is set to the global default (10s).
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# scheme defaults to 'http'.
- targets: ['localhost:9090']
## 运行
[root@prometheus-server ~]# docker run -d -p : --user="root" --name prometheus -v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -v /opt/prometheus/data:/prometheus prom/prometheus
说明:
1、--user:指定运行用户
2、需要宿主机创建prometheus.yml配置文件
3、浏览器访问
启动后,直接浏览器访问端口9090
这样,prometheus服务就安装好了。
Prometheus入门到放弃(1)之Prometheus安装部署的更多相关文章
- Prometheus入门到放弃(2)之Node_export安装部署
1.下载安装 node_exporter服务需要在三台机器都安装,这里我们以一台机器为例: 地址:https://prometheus.io/download/ ### 另外两个节点部署时,需要先创建 ...
- Prometheus入门到放弃(5)之AlertManager部署
alertmanager与exporters.cadvisor一样,都是独立于prometheus项目,这里我们也使用docker方式部署alertmanager. 1.下载镜像 镜像地址:https ...
- 《区块链:从入门到放弃》之obc安装步骤
obc安装步骤 朋友们可能会好奇,厨师不研究菜谱怎么改研究兵法了,哈哈,我原本是app出身,最近被安排去预研区块链和比特币技术,2个月下来,颇有斩获.期间得到IBM的CC同学指导我一步一步安装obc的 ...
- Kubernetes入门(一)——Kubernetes v1.18.5 安装部署
Kubernetes的安装有两种方式:一是使用各个厂商封装的Kubernetes发行版,优点是可以一键安装部署,操作简单,缺点也很明显,若安装过程中某一步骤出现问题,很难定位处理:二是使用官方提供的k ...
- Hadoop入门进阶课程13--Chukwa介绍与安装部署
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,博主为石山园,博客地址为 http://www.cnblogs.com/shishanyuan ...
- Apache入门篇(一)之安装部署apache
一.HTTPD特性 (1)高度模块化:core(核心) + modules(模块) = apache(2)动态模块加载DSO机制: Dynamic Shared Object(动态共享对象)(3)MP ...
- Prometheus入门到放弃(7)之redis_exporter部署
redis监控,prometheus需要使用redis_exporter客户端. 这里我们采用docker方式部署,既可以部署在redis所在服务器,也可以部署在其他机器: docker镜像地址:ht ...
- Prometheus入门到放弃(6)之AlertManager进阶
前面几个篇幅,我们介绍了alertmanger报警配置,在实际运维过程中,我们都会遇到,报警的重复发送,以及报警信息关联性报警.接下来我们就介绍下通过alertmanger对告警信息的收敛.一.告警分 ...
- Prometheus入门到放弃(4)之cadvisor监控docker容器
Prometheus监控docker容器运行状态,我们用到cadvisor服务,cadvisor我们这里也采用docker方式直接运行. 1.下载镜像 [root@prometheus-server ...
随机推荐
- webbench 源代码
WebBench源码:https://github.com/EZLippi/WebBench Webbench是一个在linux下使用的非常简单的网站压测工具.它使用fork()模拟多个客户端同时访问 ...
- mpvue开发坑点总结
最近一直在开发微信小程序,趁着空闲时间总结下使用情况. 现在项目目前使用的是 mpvue:^1.0.11 版本,后续看看更新情况. 文档在此: http://mpvue.com/mpvue/#_2 # ...
- SpringMVC之请求部分
1.接收请求之限定请求类型 只接受Post请求 @RequestMapping(value="",method=RequestMethod.POST) 只接受get请求 @Requ ...
- avalon在公共页面里面写的功能,怎么让某些页面不引用到这个方法和html?
每一个页面都用用到head.html里面的东西,但是有些页面我不想调用这个js,但是在head.html我已经调用了怎么办? 比如我是这个页面不需要去调用 https://*******/mytry ...
- 熔断机制hystrix
一.问题产生 雪崩效应:是一种因服务提供者的不可用导致服务调用者的不可用,并将不可用逐渐放大的过程 正常情况下的服务: 某一服务出现异常,拖垮整个服务链路,消耗整个线程队列,造成服务不可用,资源耗尽: ...
- 配置Windows实例NTP服务
本文介绍如何开启和配置Windows NTP服务,保证实例本地时间精确同步. Windows实例NTP服务介绍 目前,所有地域下ECS实例默认采用CST(China Standard Time)时区, ...
- web常用服务架构
架构风格就是一种项目的设计模式.常见的架构风格有基于客户端与服务端的.基于组件模型的(EJB).分层架构(MVC).面向服务架构(SOA)等. 一.单体架构 单体架构也称为单体系统或单体应用,就是一种 ...
- nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied)
现象 1.centos6.9 用rpm包安装nginx 2.修改Nginx的多个配置文件和配置项 3.service nginx restart 报错: nginx: [emerg] open() & ...
- Ionic4 Cordova 调用原生硬件 Api 实现扫码功能
QR Scanner 速度快,样式随心所欲,默认只能扫二维码 https://ionicframework.com/docs/native/qr-scanner/ 安装插件 ionic cordova ...
- Python设计模式之MVC模式
# -*- coding: utf-8 -*- # author:baoshan quotes = ('A man is not complete until he is married. Then ...