集群分组部署ganglia监控服务,ganglia是常用的集群监控软件,默认为不分组的,即所有的机器都放在一个组里。
1、服务端服务器安装与配置
配置安装源
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
yum install ganglia ganglia-devel ganglia-gmetad ganglia-gmond ganglia-web ganglia-gmond-python
vim /etc/ganglia/gmetad.conf
其实Ganglia的分组很简单,就是分端口,不同的组配置不同的监听端口就完事了。
data_source "BDC_Hadoop" 10.4.22.121:8649 data_source "BDC_Collector" bdc100:8646 data_source "BDC_HBase" bdc110:8647 data_source "BDC_ES" bdc211:8645 data_source "BDC_LoadBalance" 10.4.23.211:8644 data_source "BDC_OPC" 10.4.22.237:8648 gridname "BDC"
配置客户端文件
vim /etc/ganglia/gmond.conf
cluster { name = "BDC_OPC" 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 { #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 = 8648 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 = 8648 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 } /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ tcp_accept_channel { port = 8648 # If you want to gzip XML output gzip_output = no }
httpd的配置
vim /etc/httpd/conf.d/ganglia.conf
# # Ganglia monitoring system php web frontend # Alias /ganglia /usr/share/ganglia <Location /ganglia> Order deny,allow Allow from all #Allow from 127.0.0.1 #Allow from ::1 # Allow from .example.com </Location>
重启服务并设置随系统自动启动
service gmond restart service httpd restart service gmetad restart chkconfig gmond on chkconfig --list gmond chkconfig httpd on chkconfig --list httpd chkconfig gmetad on chkconfig --list gmetad
2、客户端服务器安装与配置
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 yum install ganglia ganglia-gmond配置与服务端的
一致
重启并设置服务自启动
service gmond restart chkconfig gmond on chkconfig --list gmond
vim /etc/sysconfig/selinux
# 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重启系统完成