资讯专栏INFORMATION COLUMN

docker image 实践之容器化 ganglia

Eminjannn / 3131人阅读

摘要:基础镜像单播模式下检测效果使用作为基础镜像因为没有使用作为系统服务管理工具这在后面启动进程的时候会带来很多麻烦但是有解决方案由社区微信群大神给出的解决方案个人并未尝试使用来统一管理进行管理进程

基础镜像

单播模式下检测效果

使用centos:6作为基础镜像,因为centos:7没有使用systemd作为系统服务管理工具.这在后面启动ganglia进程的时候会带来很多麻烦,但是有解决方案(由dockone社区微信群大神给出的解决方案,个人并未尝试):

使用supervisor来统一管理进行

runt管理进程

Dockerfile
FROM centos:6
MAINTAINER wlu wlu@linkernetworks.com

RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

RUN yum install -y php-common php-cli php-gb php

# install ganglia server
RUN yum install -y rrdtool rrdtool-devel ganglia-web ganglia-gmetad 
    ganglia-gmond ganglia-gmond-python httpd apr-devel zlib-devel 
    libconfuse-devel expat-devel pcre-devel

# install ganglia client
#RUN yum install -y ganglia-gmond

RUN mkdir -p /var/lib/ganglia && 
    chown nobody:nobody /var/lib/ganglia && 
    chmod 777 /var/lib/ganglia

ADD supervisord.conf /etc/supervisord.conf
RUN yum install -y python-setuptools && 
    easy_install supervisor && 
    yum clean all

RUN yum install -y vim && 
    ln -f -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]

注意:这里可以把多个指令合并以减少镜像层数.

ganglia的配置 原理图:

ganglia可以监控整个集群的信息.这里有两个概念:

ganglia 中央机器...对应gmetad进程.对应配置信息在/etc/ganglia/gmetad.conf(centos6下)

ganglia client...对应gmond进程.对应配置信息在/etc/ganglia/gmond.conf(centos6下)
有点类似于master和slave的关系.

在集群中需要有一个中央机器来统一接收其它机器上收集到的监控信息(也可以包括中央机器自身),在这个中央机器上运行gmetad进程.

在其它机器上运行gmond进程,用来收集机器上的监控信息.

ganglia的两种模式 单播模式

这种模式下client上的数据会发送给中央机器,下面看下client(即gmond)的配置(只摘取部分需要的配置项):

gmond.conf
......
cluster {
  name = "unspecified"
  owner = "unspecified"
  latlong = "unspecified"
  url = "unspecified"
}
......
udp_send_channel {
  #bind_hostname = yes # Highly recommended, soon to be default.
                       # This option tells gmond to use a source address
                       # that resolves to the machine"s hostname.  Without
                       # this, the metrics may appear to come from any
                       # interface and the DNS names associated with
                       # those IPs will be used to create the RRDs.
  mcast_join = 239.2.11.71
  port = 8649
  ttl = 1
}
......
/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
  mcast_join = 239.2.11.71
  port = 8649
  bind = 239.2.11.71
  retry_bind = true
  # Size of the UDP buffer. If you are handling lots of metrics you really
  # should bump it up to e.g. 10MB or even higher.
  # buffer = 10485760
}
......

cluster name,这个必须指定并且相同集群使用相同的name

udp_send_channel,因为单播模式下各个client把数据以udp协议发给中央机器,所以需要配置中央机器的ip,配置后的结果:

udp_send_channel {
  #bind_hostname = yes # Highly recommended, soon to be default.
                       # This option tells gmond to use a source address
                       # that resolves to the machine"s hostname.  Without
                       # this, the metrics may appear to come from any
                       # interface and the DNS names associated with
                       # those IPs will be used to create the RRDs.
  #mcast_join = 239.2.11.71
  host = host_ip
  port = 8649
  ttl = 1
}

这条需要注释:#mcast_join = 239.2.11.71,ganglia默认是多播.

注释掉多播的配置:

udp_recv_channel {
  #mcast_join = 239.2.11.71
  port = 8649
  #bind = 239.2.11.71
  retry_bind = true
  # Size of the UDP buffer. If you are handling lots of metrics you really
  # should bump it up to e.g. 10MB or even higher.
  # buffer = 10485760
}

note:这里注释掉多播和绑定的ip.我还不是太明白,详情参考这里

配置好后就可以通过service gmond start来启动client上的gmond进程了.

gmetad.conf
data_source "my cluster" localhost

改为

data_source "your cluster name" host_ip #host_ip指中央机器的配置

配置好后就可以通过service gmetad start来启动中央机器上的gmetad进程了.

多播模式

多播的特点:

集群中的每个client把自己的数据发送给集群中的其它client

中央机器指定一个client作为数据源.

个人觉得这种方式很浪费,因为单播模式下数据传输次数要少

参考连接

reference 1
reference 2
本项目对应的GitHub地址
httpd访问控制问题

ps

南京docker meetup已经于2015年3月份成立,将于2016年开始举办线下技术分享.诚挚欢迎各位对docker及容器技术感兴趣的同学加入Docker Nanjing meetup

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/26510.html

相关文章

  • Docker Swarm的前世今生

    摘要:当然此时的局限性较大,比如没有副本和负载均衡的概念,这导致服务无法高可用当然也更不存在什么服务网络管理和跨节点数据存储这些东西没有服务模型集群中服务间关系和启动顺序编排也很复杂于是就有了下面的的诞生。 showImg(https://segmentfault.com/img/remote/1460000015317037?w=1885&h=1153); 概述 在我的《Docker S...

    lemon 评论0 收藏0
  • 利用K8S技术栈打造个人私有云(连载:K8S环境理解和练手)

    摘要:常见的和等都是属于某一个的默认是,而等则不属于任何。其实其的命令和上面都差不多,这里不一一列出了创建查看启动情况是一个定义了一组的策略的抽象,可以理解为抽象到用户层的一个宏观服务。其实这个概念在集群里也有,可以参照理解。 showImg(https://segmentfault.com/img/remote/1460000013229549); 【利用K8S技术栈打造个人私有云系列文...

    kid143 评论0 收藏0
  • 利用K8S技术栈打造个人私有云(连载:K8S环境理解和练手)

    摘要:常见的和等都是属于某一个的默认是,而等则不属于任何。其实其的命令和上面都差不多,这里不一一列出了创建查看启动情况是一个定义了一组的策略的抽象,可以理解为抽象到用户层的一个宏观服务。其实这个概念在集群里也有,可以参照理解。 showImg(https://segmentfault.com/img/remote/1460000013229549); 【利用K8S技术栈打造个人私有云系列文...

    30e8336b8229 评论0 收藏0
  • docker到istio二 - 使用compose部署应用

    摘要:使用导出端口,使用挂载数据卷。清理应用使用一键清理应用总结已经实现了容器扩容自动挡更直观的控制容器启动顺序及依赖。从部署到编排,单字面理解,看起来能够维护的容器量都增长了。推荐应用包括多个服务,推荐部署方式就是。前言 容器化,云原生越演越烈,新概念非常之多。信息爆炸的同时,带来层层迷雾。我尝试从扩容出发理解其脉路,经过实践探索,整理形成一个入门教程,包括下面四篇文章。 容器化实践之路-从d...

    yy13818512006 评论0 收藏0
  • 容器环境下的持续集成最佳实践:构建基于 Drone + GitFlow + K8s 的云原生语义

    摘要:集成测试完成后,由运维同学从发起一个到分支,此时会会运行单元测试,构建镜像,并发布到预发布环境测试人员在预发布环境下再次验证功能,团队做上线前的其他准备工作运维同学合并,将为本次发布的代码及镜像自动打上版本号并书写,同时发布到生产环境。 云原生 (Cloud Native) 是伴随的容器技术发展出现的的一个词,最早出自 Pivotal 公司(即开发了 Spring 的公司)的一本技术小...

    asoren 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<