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 ...
随机推荐
- ZR#984
ZR#984 解法: 异或的一个性质: $ a+b \geq a \bigoplus b$ 所以一边读入一边把读进来的值加到答案就行了. #include<iostream> #inclu ...
- MySQL之级联删除、级联更新、级联置空
1. 准备测试表 # 专业表major ))engine=innodb default charset=utf8; # 学生表mstudent ), major int)engine=innodb d ...
- 第十四周助教工作总结——NWNU李泓毅
助教博客链接:https://www.cnblogs.com/NWNU-LHY/ 本次作业的要求:团队项目需求改进与系统设计:https://www.cnblogs.com/nwnu-daizh/p/ ...
- Java ArrayList,LinkedList使用
1.ArrayList底层采用数组实现,当使用不带参数的构造方法生成ArrayList对象时,实际上回在底层生成一个长度为10的Object类型数组. 2.如果增加的元素个数超过10个,那么Array ...
- Spring事务原理分析--手写Spring事务
一.基本概念和原理 1.Spring事务 基于AOP环绕通知和异常通知的 2.Spring事务分为编程式事务.声明事务.编程事务包括注解方式和扫包方式(xml) Spring事务底层使用编程事务(自己 ...
- Android通过ksoap2这个框架调用webservice大讲堂
昨天有人问我Android怎么连接mysql数据库,和对数据库的操作呀,我想把,给他说说json通信,可是他并不知道怎么弄,哎算了吧,直接叫他用ksoap吧,给他说了大半天,好多零碎的知识,看来还是有 ...
- SHELL/VIM删除重复行(去重)text handle
vim 删除重复行 - 国内版 Binghttps://cn.bing.com/search?FORM=U227DF&PC=U227&q=vim+%E5%88%A0%E9%99%A4% ...
- (转)设置了RemoveIPC=yes 的RHEL7.2 会crash掉Oracle asm 实例和Oracle database实例
设置了RemoveIPC=yes 的RHEL7.2 会crash掉Oracle asm 实例和Oracle database实例,该问题也会在使用Shared Memory Segment (SHM ...
- AndoridSQLite数据库开发基础教程(4)
AndoridSQLite数据库开发基础教程(4) 安装SQLiteManager 以下是SQLiteManager的安装步骤: (1)双击下载的.exe文件,弹出SQLiteManager Setu ...
- tr -d命令删除与字符无关的符号
echo "/192.168"| tr -d '/' 结果:192.168