目录
一、Ganglia安装
1.1 三台机器安装epel源
1.2 在node01安装web,meta和monitor
1.3 在node02、node03安装monitor
1.4 node01修改配置文件/etc/httpd/conf.d/ganglia.conf
1.5 node01修改配置文件/etc/ganglia/gmetad.conf
1.6 node01,node02,node03上修改/etc/ganglia/gmond.conf
1.7 修改配置文件/etc/selinux/config
1.8 三台机器各自启动服务
1.9 打开监控页面
二、功能测试
2.1 Flume conf编写
2.2 启动服务
2.3 启动netcat发送数据
一、Ganglia安装
1.1 三台机器安装epel源
[usr@node01 flume]$ sudo yum install -y epel-release
[usr@node02 flume]$ sudo yum install -y epel-release
[usr@node01 flume]$ sudo yum install -y epel-release
[usr@node02 flume]$ sudo yum install -y epel-release
[usr@node03 flume]$ sudo yum install -y epel-release
1.2 在node01安装web,meta和monitor
[usr@node01 flume]$ sudo yum -y install ganglia-gmetad ganglia-web ganglia-gmond
1.3 在node02、node03安装monitor
[usr@node02 flume]$ sudo yum -y install ganglia-gmond
[usr@node03 flume]$ sudo yum -y install ganglia-gmond
1.4 node01修改配置文件/etc/httpd/conf.d/ganglia.conf
#
# Ganglia monitoring system php web frontend
#
Alias /ganglia /usr/share/ganglia
#Order deny,allow
#Deny from all
#Allow from all
#Allow from 127.0.0.1
#Allow from ::1
# Allow from .example.com
Require all granted
1.5 node01修改配置文件/etc/ganglia/gmetad.conf
data_source "node01" node01 #第44行
1.6 node01,node02,node03上修改/etc/ganglia/gmond.conf
cluster {
name = "node01"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
host {
location = "unspecified"
}
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
host = node01
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
}
1.7 修改配置文件/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
1.8 三台机器各自启动服务
[usr@node01 flume]$ sudo systemctl start httpd
[usr@node01 flume]$ sudo systemctl start gmetad
[usr@node01 flume]$ sudo systemctl start gmond
[usr@node02 flume]$ sudo systemctl start gmond
[usr@node03 flume]$ sudo systemctl start gmond
1.9 打开监控页面
1.3 在node02、node03安装monitor
[usr@node02 flume]$ sudo yum -y install ganglia-gmond [usr@node03 flume]$ sudo yum -y install ganglia-gmond
1.4 node01修改配置文件/etc/httpd/conf.d/ganglia.conf
#
# Ganglia monitoring system php web frontend
#
Alias /ganglia /usr/share/ganglia
#Order deny,allow
#Deny from all
#Allow from all
#Allow from 127.0.0.1
#Allow from ::1
# Allow from .example.com
Require all granted
1.5 node01修改配置文件/etc/ganglia/gmetad.conf
data_source "node01" node01 #第44行
1.6 node01,node02,node03上修改/etc/ganglia/gmond.conf
cluster {
name = "node01"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
host {
location = "unspecified"
}
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
host = node01
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
}
1.7 修改配置文件/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
1.8 三台机器各自启动服务
[usr@node01 flume]$ sudo systemctl start httpd
[usr@node01 flume]$ sudo systemctl start gmetad
[usr@node01 flume]$ sudo systemctl start gmond
[usr@node02 flume]$ sudo systemctl start gmond
[usr@node03 flume]$ sudo systemctl start gmond
1.9 打开监控页面
data_source "node01" node01 #第44行
1.6 node01,node02,node03上修改/etc/ganglia/gmond.conf
cluster {
name = "node01"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
host {
location = "unspecified"
}
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
host = node01
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
}
1.7 修改配置文件/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
1.8 三台机器各自启动服务
[usr@node01 flume]$ sudo systemctl start httpd
[usr@node01 flume]$ sudo systemctl start gmetad
[usr@node01 flume]$ sudo systemctl start gmond
[usr@node02 flume]$ sudo systemctl start gmond
[usr@node03 flume]$ sudo systemctl start gmond
1.9 打开监控页面
# 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
1.8 三台机器各自启动服务
[usr@node01 flume]$ sudo systemctl start httpd
[usr@node01 flume]$ sudo systemctl start gmetad
[usr@node01 flume]$ sudo systemctl start gmond
[usr@node02 flume]$ sudo systemctl start gmond
[usr@node03 flume]$ sudo systemctl start gmond
1.9 打开监控页面
http://node01/ganglia
在红框处进行数据源选择,可以看到选择自己关注的机器进行查看。
二、功能测试
2.1 Flume conf编写
#Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = node03
a1.sources.r1.port = 44444
# Describe the sink
a1.sinks.k1.type = logger
# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
2.2 启动服务
[usr@node03 flume]# bin/flume-ng agent --conf conf/ --name a1 --conf-file job/flume-netcat-logger.conf -Dflume.root.logger=INFO,console -Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts=node01:8649
2.3 启动netcat发送数据
[usr@node03flume]$ nc node03 44444
#Name the components on this agent a1.sources = r1 a1.sinks = k1 a1.channels = c1 # Describe/configure the source a1.sources.r1.type = netcat a1.sources.r1.bind = node03 a1.sources.r1.port = 44444 # Describe the sink a1.sinks.k1.type = logger # Use a channel which buffers events in memory a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100 # Bind the source and sink to the channel a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1
2.2 启动服务
[usr@node03 flume]# bin/flume-ng agent --conf conf/ --name a1 --conf-file job/flume-netcat-logger.conf -Dflume.root.logger=INFO,console -Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts=node01:8649
2.3 启动netcat发送数据
[usr@node03flume]$ nc node03 44444
[usr@node03flume]$ nc node03 44444
| 图表名称 | 含义 |
| ChannelCapacity | channel 的容量 |
| ChannelFillPercentage | channel 占用百分比 |
| ChannelSize | 目前 channel 中事件的总数量 |
| EventPutAttemptCount | source 尝试写入 channel 的事件总数量 |
| EventPutSuccessCount | 成功写入 channel 且提交的事件总数量 |
| EventTakeAttemptCount | sink 尝试从 channel 拉取事件的总数量 |
| EventTakeSuccessCount | sink 成功读取的事件的总数量 |
| StartTime | channel 启动的时间(毫秒) |
| StopTime | channel 停止的时间(毫秒) |



