1 Ganglia 的安装与部署
(1)安装
安装规划:
在hadoop102、103、104安装epel-release:
sudo yum -y install epel-release
在102安装:web、gmetad、gmod:
sudo yum -y install ganglia-gmetad
sudo yum -y install ganglia-web
sudo yum -y install ganglia-gmond
在103、104安装gmod:
sudo yum -y install ganglia-gmond
(2)配置
在主机上cmd看ip:
在 102 修改配置文件/etc/httpd/conf.d/ganglia.conf:
sudo vim /etc/httpd/conf.d/ganglia.conf
#修改为
# Ganglia monitoring system php web frontend#
Alias /ganglia /usr/share/ganglia
<Location/ganglia> # Require local
# 通过 windows 访问 ganglia,需要配置 Linux 对应的主机(windows)ip 地址
Require ip 192.168.30.1
# Require ip 10.1.2.3
# Require host example.org
</Location>
在 102 修改配置文件/etc/ganglia/gmetad.conf:
sudo vim /etc/ganglia/gmetad.conf
#修改为:
data_source "my cluster" hadoop102
在 102 103 104 修改配置文件/etc/ganglia/gmond.conf:
sudo vim /etc/ganglia/gmond.conf
#修改为:
cluster {
name = "my cluster"
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 resolvesto the machine's hostname.
Without
# this, the metricsmay 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
# 数据发送给 hadoop102
host = hadoop102
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
}
在 102 修改配置文件/etc/selinux/config:
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 these two values: #targeted - Targeted processes are protected, #mls - Multi Level Security protection.
SELINUXTYPE=targeted
尖叫提示:selinux 生效需要重启,如果不想重启,可以临时生效:
sudo setenforce 0
(3)启动
在 102 103 104 启动:
sudo systemctl start gmond
在 102 启动:
sudo systemctl start httpd
sudo systemctl start gmetad
修改/var/lib/ganglia 目录的权限:
sudo chmod -R 777 /var/lib/ganglia
在Windows浏览器中打开ganglia 页面:http://hadoop102/ganglia
2 操作 Flume 测试监控
启动Flume任务时多输入:
-Dflume.root.logger=INFO,console
-Dflume.monitoring.type=ganglia
-Dflume.monitoring.hosts=hadoop102:8649