概述
下面介绍如何使用docker安装Prometheus,使其对本机服务器性能进行监控。
安装步骤
docker基于epel安装,需要先配置epel源
yum -y install wget
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum -y install epel-release
关闭selinux和防火墙
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
systemctl stop firewalld
安装docker
[root@localhost ~]# yum -y install docker
如果启动起不来,就重启一下操作系统
[root@localhost ~]# systemctl restart docker
[root@localhost ~]# systemctl enable docker
[root@localhost ~]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://ca7fxpxa.mirror.aliyuncs.com"]
}
[root@localhost ~]# systemctl restart docker
拉取镜像包
[root@localhost ~]# docker pull prometheus
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/prom/prometheus latest de242295e225 9 days ago 140 MB
安装prometheus
[root@localhost ~]# docker run -d --name prometheus -p 9090:9090 docker.io/prom/prometheus
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f51af4597d14 docker.io/prom/prometheus "/bin/prometheus -..." 30 seconds ago Up 29 seconds 0.0.0.0:9090->9090/tcp prometheus
网友评论