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 ...
随机推荐
- shell history 命令
1.history命令可以显示历史执行过的命令: 2.使用!+序号执行该序号对应的命令: 例子 $ history sed 's/haha/hello/g' test cat test cat tes ...
- [FUZZ]文件上传fuzz字典生成脚本—使用方法
文件上传fuzz字典生成脚本-使用方法 原作者:c0ny1 项目地址:https://github.com/c0ny1/upload-fuzz-dic-builder 项目预览效果图: 帮助手册: 脚 ...
- 两个对象key相同但是value不同,将value不同的键值对以对象形式输出
let obj={ name:'jack', age:18, sex:'girl' } let obj2={ name:'rose', age:18, sex:'boy' } var str={} f ...
- Zk单机多实例部署
一.环境准备 当前环境:centos7.3一台软件版本:zookeeper-3.5.2部署目录:/usr/local/zookeeper启动端口:2181,2182,2183配置文件:/usr/loc ...
- js检测手机上是否有此APP,有的话打开应用,没有的话跳转到appstore
//html代码中 的 a 标签,以微信为例,默认的是调用weixin scheme,去打开本机的微信,如果没有则跳转到相应连接 <a href="weixin://" cl ...
- RabbitMQ入门学习系列(五) Exchange的Direct类型
快速阅读 利用Exchange的Direct类型,实现对队列的过滤,消费者启动以后,输入相应的key值,攻取该key值对应的在队列中的消息 . 从一节知道Exchange有四种类型 Direct,To ...
- springcloud config自动刷新中文乱码问题
摘录一段网上盛传的,如下: 在使用 spring cloud config 时,如果在 properties 文件里面有中文的话,会出现乱码. 乱码的原因是:spring 默认使用org.spring ...
- html中a标签的常见用法
html中a标签的常见用法 一.总结 一句话总结: a.页面跳转 b.使用锚点定位 c.下载文件 二.html中<a>标签的用法 转自或参考:html中<a>标签的用法http ...
- SpringBoot整合Hibernate
编写配置文件 <!--配置读取properties文件--> <context:property-placeholder location="classpath:jdbc. ...
- uefi下如何启动linux?
1. 有两种方式 1.1 直接从uefi shell启动linux内核 1.2 从uefi shell启动grub,然后再从grub启动linux内核 2. 需要哪些东西? 2.1 linux内核 2 ...