美文网首页
[Prometheus] Using Docker to ins

[Prometheus] Using Docker to ins

作者: Mokaffee | 来源:发表于2019-02-19 20:23 被阅读32次

    参看资料:
    Prometheus 官网
    Install Prometheus: prometheus installation
    Prometheus Image: prom/prometheus
    Helm : Prometheus Chart

    最简单的docker install 方法

    Running Prometheus on Docker is as simple as docker run -p 9090:9090 prom/prometheus. This starts Prometheus with a sample configuration and exposes it on port 9090.

    下载Prometheus image: docker pull prom/prometheus:latest
    从Prometheus官网文档可以知道,最简单的方式启动Prometheus是运行以下命令:docker run -p 9090:9090 prom/prometheus

    docker run -p 9090:9090 prom/prometheus

    访问 http://localhost:9090

    Prometheus GUI.png

    生产环境应该做的事

    可以为Prometheus配置Volume

    The Prometheus image uses a volume to store the actual metrics. For production deployments it is highly recommended to use the Data Volume Container pattern to ease managing the data on Prometheus upgrades.
    To provide your own configuration, there are several options. Here are two examples.

    上面的启动方式太简单了,不能应对生产环境,所以还需要配置Volume。

    方法一:Bind-mount prometheus.yaml from the host by running
    docker run -p 9090:9090 -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

    将自己的 /tmp/prometheus.yml 映射到容器的/etc/prometheus/prometheus.yml

    方法二:Use an additional volume for the config
    docker run -p 9090:9090 -v /prometheus-data prom/prometheus --config.file=/prometheus-data/prometheus.yml

    或者构建自己的Prometheus Custom image

    To avoid managing a file on the host and bind-mount it, the configuration can be baked into the image. This works well if the configuration itself is rather static and the same across all environments.

    当然,也可以选择自己创建新的Prometheus镜像,将配置文件嵌在image中。

    Custom image.png

    其他方法

    A more advanced option is to render the configuration dynamically on start with some tooling or even have a daemon update it periodically.

    还有一些更高级的方式可以,是在启动时使用某些工具动态呈现配置,或者让守护程序定期更新它.

    Questions

    Using configuration management systems
    If you prefer using configuration management systems you might be interested in the following third-party contributions.
    这一部分未接触,待研究。

    相关文章

      网友评论

          本文标题:[Prometheus] Using Docker to ins

          本文链接:https://www.haomeiwen.com/subject/rtzfyqtx.html