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 ...
随机推荐
- Note_4.1
2019/4/1 奇奇怪怪的笔记 多项式除法 问题描述 给定\(n\)次多项式\(A(x)\)和\(m\)次多项式\(B(x)\) 求: \[ A(x)=B(x)*C(x)+R(x) \] 我们要求\ ...
- MAC 上抓取网页数据的工具有哪些?
我希望能够从网页上, 比如气象局数据, 财经数据等等, 我看到官方提供的数据都比较混乱, 有的是一个php文件, 有的是一个文本, 有的干脆不提供数据, 我想问, Mac上, 用什么工具去抓数据, 以 ...
- 【mybatis源码学习】与spring整合Mapper接口执行原理
一.重要的接口 org.mybatis.spring.mapper.MapperFactoryBean MapperScannerConfigurer会向spring中注册该bean,一个mapper ...
- java/spring boot/dubbo/spring cloud/微服务/SOA/分布式经典电子书籍pdf下载
微服务系列 官方文档是最好的资料了. spring cloud官方文档:https://cloud.spring.io/spring-cloud-static/Greenwich.RELEASE/si ...
- Tosca:设置执行结束时间
- Python3基础 函数 返回值 利用元组返回多个值
Python : 3.7.3 OS : Ubuntu 18.04.2 LTS IDE : pycharm-community-2019.1.3 ...
- @ServeletComponentScan和@ComponentScan的区别
一.SpringBoot中使用Servlet在SpringBootApplication上使用@ServletComponentScan注解后,Servlet.Filter.Listener可以直接通 ...
- svn使用步骤
这里只是记录大概使用过程,操作步骤只供参考,不要按部就班. 1.安装SVN 服务端Setup-Subversion-1.6.5.msi和客户端TortoiseSVN-1.6.5.16974-win32 ...
- SeetaFaceEngine2 实例
LOG: Creating layer(6):LOG: Creating layer(0):LOG: Creating layer(9):LOG: Creating layer(0):LOG: Cre ...
- 123457123456#2#----com.MC.DishuGame368----前拼后广--儿童打地鼠Game-mc2222222
com.MC.DishuGame368----前拼后广--儿童打地鼠Game-mc