Ganglia 由 gmond、gmetad 和 gweb 三部分组成。
通过这三个组件的协作,Ganglia 可以实现对分布式系统的实时监控和分析,帮助用户快速发现和解决系统问题。
注意:
Ganglia 是由PHP语言所编写。而非JVM框架
kk01 | kk02 | kk03 |
---|---|---|
web、gmated、gmod | gmod | gmod |
该操作是为了更新yum源
[nhk@kk01 flume]$ sudo yum -y install epel-release
[nhk@kk02 flume]$ sudo yum -y install epel-release
[nhk@kk03 flume]$ sudo yum -y install epel-release
[nhk@kk01 flume]$ sudo yum -y install ganglia-gmetad
[nhk@kk01 flume]$ sudo yum -y install ganglia-web
[nhk@kk01 flume]$ sudo yum -y install ganglia-gmond
[nhk@kk02 flume]$ sudo yum -y install ganglia-gmond
[nhk@kk03 flume]$ sudo yum -y install ganglia-gmond
[nhk@kk01 flume]$ sudo vim /etc/httpd/conf.d/ganglia.conf
参考修改内容如下
Alias /ganglia /usr/share/ganglia
<Location /ganglia>
# Require local
# Require ip 10.1.2.3
# Require host example.org
Requeire all granted
</Location>
[nhk@kk01 flume]$ sudo vim /etc/ganglia/gmetad.conf
参考修改内容如下
data_source "kk01" kk01
[nhk@kk01 flume]$ sudo vim /etc/ganglia/gmond.conf
参考修改内容如下
cluster {
name = "kk01"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
# mcast_join = 239.2.11.71
# 数据发送给kk01
host = kk01
port = 8649
ttl = 1
udp_recv_channel {
mcast_join = 239.2.11.71
port = 8649
# 接收来自任意连接的数据
bind = 0.0.0.0
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
}
我们以kk01为例,kk02、kk03重复上述操作
[nhk@kk01 flume]$ sudo vim /etc/selinux/config
参考配置如下
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
提示:selinux本次生效关闭必须重启,如果此时不想重启,可以使用如下命令临时生效
[nhk@kk01 flume]$ sudo setenforce 0
在 kk01、kk02、kk03启动
[nhk@kk01 flume]$ sudo systemctl start gmond
[nhk@kk02 flume]$ sudo systemctl start gmond
[nhk@kk03 flume]$ sudo systemctl start gmond
在 kk01 启动
[nhk@kk01 flume]$ sudo systemctl start httpd
[nhk@kk01 flume]$ sudo systemctl start gmetad
http://kk01/ganglia
提示:
如果完成上述操作以后,依然出现权限不足错误,可以修改 /var/lib/ganglia 目录的权限
sudo chmod -R 777 /var/lib/ganglia
[nhk@kk01 flume]$ bin/flume-ng agent -n a1 -c conf/ -f job/nc-flume-log.conf -Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts=kk01:8649
[nhk@kk01 ~]$ nc localhost 44444