配置/etc/gmond.conf,配置相同如下所示:
globals { daemonize = yes #以后台的方式运行 setuid = yes user = ganglia #运行gmond的用户 debug_level = 0 #调试级别 max_udp_msg_len = 1472 mute = no #哑巴,本节点将不会再广播任何自己收集到的数据在网络上 deaf = no #聋子,本节点不会再接收任何其他节点广播的数据包 host_dmax = 0 /*secs */ cleanup_threshold = 300 /*secs */ gexec = no #是否使用gexec send_metadata_interval = 10 #节点发送间隔/*secs*/ } /* If a cluster attribute is specified, then all gmond hosts are wrapped inside * of a tag. If you do not specify a cluster tag, then all will * NOT be wrapped inside of a tag. */ cluster { name = "hadoop" #本节点属于哪个cluster owner = "unspecified" #谁是该节点的所有者 latlong = "unspecified" #在地球上的坐标 url = "unspecified" } /* The host section describes attributes of the host, like the location */ host { location = "unspecified" } /* Feel free to specify as many udp_send_channels as you like. Gmond used to only support having a single channel */ udp_send_channel { #udp包的发送通道 host = 10.82.58.211 #多播,工作在239.2.11.71通道下。单播,则指向主节点,单播模式下也可以配置多个udp_send_channel port = 8649 #监听端口 ttl = 1 } /* You can specify as many udp_recv_channels as you like as well. */ udp_recv_channel { #接受UDP包配置 # mcast_join = 239.2.11.71 port = 8649 # bind = 239.2.11.71 } |
请注意send_metadata_interval被设置为10秒。Ganglia的度量指标从他的元数据间隔发送得到的。元数据包含诸如度量分组,类型等等。假如你重启了接收的gmond主机,那么元数据就会丢失,gmond就不知道如何处理度量数据,因此会把他们抛弃。这会导致生成空白的图表。在组播模式下,gmonds可以和其他任意一台主机通信,在元数据丢失情况请求重新获取。但这在单播模式下是不可能的,因此你需要命令gmond定期的发送元数据。
在主节点上(10.82.58.211)上还需要配置/etc/gmetad.conf,这里面的名字“hadoop”和上面gmond.conf中应该是一致的。
data_source "hadoop" 10.82.58.211:8649