1.集群内分别安装epel-release依赖,更新yum源
sudo yum -y install epel-release
2.各节点上分别安装gmond
sudo yum -y install ganglia-gmond
3.监控节点上安装gmetad和web(这里安装在node1上)
sudo yum -y install ganglia-gmetad
sudo yum -y install ganglia-web
4.修改配置
4.1node1上修改gmetad配置
sudo vim /etc/ganglia/gmetad.conf
找到data_source并且修改
data_source "mycluster" node1
这里的mycluser是你这套集群你想取的名字,而后面的node1就是监控的节点
4.2 node1上修改ganglia配置
sudo vim /etc/httpd/conf.d/ganglia.conf
<Location /ganglia>
Require all granted # 表示不需要权限管理
</Location>
4.3 在node1上修改selinux/config(重启系统生效)
sudo vim /etc/selinux/config
SELINUX=disable # 使linux能兼容PHP
使配置临时生效 sudo setenforce 0
4.4 在所有节点上修改gmond配置
sudo vim /etc/ganglia/gmond.conf
cluster {
name = "mycluster" # 集群名,即gmetad的data_source里的名字
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
udp_send_channel {
# mcast_join = 239.2.11.71 # 注释掉
host = node1 # 绑定监控节点
port = 8649
ttl = 1
}
udp_recv_channel {
# mcast_join = 239.2.11.71 # 注释掉
port = 8649
bind = 0.0.0.0 # 表示接收来自任意连接的数据
retry_bind = true
}
4.5 配置hadoop和hbase
4.5.1修改hadoop的配置文件
vim /export/server/hadoop/etc/hadoop/ hadoop-metrics2.properties
添加内容
# namenode 所在的节点 多个用英文下的逗号隔开
namenode.sink.ganglia.servers = node1
# resourcemanager 所在的节点
resourcemanager.sink.ganglia.servers = node2
# datanode 所在的节点 多个用英文下的逗号隔开
datanode.sink.ganglia.servers = node1,node2,node3
nodemanager.sink.ganglia.servers= node1,node2,node3
# namenode 所在的节点 多个用英文下的逗号隔开
namenode.sink.ganglia.servers = node1
# resourcemanager 所在的节点
resourcemanager.sink.ganglia.servers = node2
# datanode 所在的节点 多个用英文下的逗号隔开
datanode.sink.ganglia.servers = node1,node2,node3
nodemanager.sink.ganglia.servers= node1,node2,node3
maptask.sink.ganglia.servers = node1
jobhistoryserver.sink.ganglia.servers = node1
分发到各个节点
xsync hadoop-metrics2.properties
4.5.2 修改hbase的配置文件
vim /export/server/hbase/conf/hadoop-metrics2-hbase.properties
hbase.sink.ganglia.period=10
hbase.sink.ganglia.servers=node1
分发到各个节点
xsync hadoop-metrics2-hbase.properties
5.在各节点上启动gmond,在node1上启动web、gemetad
sudo systemctl start gmond
sudo systemctl start httpd
sudo systemctl start gmetad
在网页上查看:http://node1/ganglia
5.1对flume的监控
在执行flume任务时添加以下参数
flume-ng agent -n a1 -c conf/ -f flume1.conf -Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts=node1:8649