centos集群上安装ganglia-3.6.0监控hadoop-2.2.0和hbase-0.96.0
来源:互联网 发布:时时彩后二大底软件 编辑:程序博客网 时间:2024/04/27 03:28
Ganglia 是 UC Berkeley 发起的一个开源监视项目,设计用于测量数以千计的节点。每台计算机都运行一个收集和发送度量数据(如处理器速度、内存使用量等)的名为 gmond 的守护进程。它将从操作系统和指定主机中收集。接收所有度量数据的主机可以显示这些数据并且可以将这些数据的精简表单传递到层次结构中。正因为有这种层次结构模式,才使得 Ganglia 可以实现良好的扩展。gmond 带来的系统负载非常少,这使得它成为在集群中各台计算机上运行的一段代码,而不会影响用户性能。
一、Ganglia组件
Ganglia 监控套件包括三个主要部分:gmond,gmetad,和网页接口,通常被称为ganglia-web。
Gmond :是一个守护进程,他运行在每一个需要监测的节点上,收集监测统计,发送和接受在同一个组播或单播通道上的统计信息 如果他是一个发送者(mute=no)他会收集基本指标,比如系统负载(load_one),CPU利用率。他同时也会发送用户通过添加C/Python模块来自定义的指标。 如果他是一个接收者(deaf=no)他会聚合所有从别的主机上发来的指标,并把它们都保存在内存缓冲区中。
Gmetad:也是一个守护进程,他定期检查gmonds,从那里拉取数据,并将他们的指标存储在RRD存储引擎中。他可以查询多个集群并聚合指标。他也被用于生成用户界面的web前端。
Ganglia-web :顾名思义,他应该安装在有gmetad运行的机器上,以便读取RRD文件。 集群是主机和度量数据的逻辑分组,比如数据库服务器,网页服务器,生产,测试,QA等,他们都是完全分开的,你需要为每个集群运行单独的gmond实例。
一般来说每个集群需要一个接收的gmond,每个网站需要一个gmetad。
Ganglia工作流如图所示:
左边是运行在各个节点上的gmond进程,这个进程的配置只由节点上/etc/gmond.conf的文件决定。所以,在各个监视节点上都需要安装和配置该文件。
右上角是更加负责的中心机(通常是这个集群中的一台,也可以不是)。在这个台机器上运行这着gmetad进程,收集来自各个节点上的信息并存储在rrdtool上,该进程的配置只由/etc/gmetad.conf决定。
右下角显示了关于网页方面的一些信息。我们的浏览网站时调用php脚本,从RRDTool数据库中抓取信息,动态的生成各类图表。
二、安装依赖
注:建议使用超级用户安装
- #yum install –y gcc gcc-c++ libpng freetype zlib libdbi apr* libxml2-devel pkg-config glib pixman \
- pango pango-devel freetye-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel pcre* rrdtool*
- #cd /home/aaron
- #wget http://jaist.dl.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz
- #tar -xf expat-2.1.0.tar.gz
- #cd expat-2.1.0
- #./configure --prefix=/usr/local/expat
- #make
- #make install
对于64位操作系统,需要手动的拷贝下动态链接库到lib64下
- #mkdir /usr/local/expat/lib64
- #cp -a /usr/local/expat/lib/* /usr/local/expat/lib64/
四、安装confuse
- #cd /home/aaron
- #wget http://ftp.twaren.net/Unix/NonGNU//confuse/confuse-2.7.tar.gz
- #tar -xf confuse-2.7.tar.gz
- #cd confuse-2.7
- #./configure CFLAGS=-fPIC --disable-nls --prefix=/usr/local/confuse
- #make
- #make install
- #mkdir -p /usr/local/confuse/lib64
- #cp -a -f /usr/local/confuse/lib/* /usr/local/confuse/lib64/
- #cd /home/aaron
- #wget http://jaist.dl.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.6.0/ganglia-3.6.0.tar.gz
- #tar -xf ganglia-3.6.0.tar.gz
- #cd ganglia-3.6.0
- #./configure --with-gmetad --enable-gexec --with-libconfuse=/usr/local/confuse --with-libexpat=/usr/local/expat --prefix=/usr/local/ganglia --sysconfdir=/etc/ganglia
- #make
- #make install
创建rrdtool数据目录,看$ganglia-3.2.0/web/conf.php里面的gmetad_root变量,并根据apache的运行用户创建权限,例如apache运行于apache用户上 。
- #mkdir -p /var/lib/ganglia/rrds
- #mkdir -p /var/lib/ganglia/dwoo
- #chown -R root:root /var/lib/ganglia
- data_source "hadoop" 192.168.1.108:8649
- setuid_username "root"
添加自启动脚本
- #cp -f gmetad/gmetad.init /etc/init.d/gmetad
- #cp -f /usr/local/ganglia/sbin/gmetad /usr/sbin/gmetad
- #chkconfig --add gmetad
- #service gmetad start
七、客户端配置(gmond节点)
本机安装如下:
- #cp -f gmond/gmond.init /etc/init.d/gmond
- #cp -f /usr/local/ganglia/sbin/gmond /usr/sbin/gmond
- #chkconfig --add gmond
- #gmond --default_config > /etc/ganglia/gmond.conf
- globals {
- daemonize = yes
- setuid = yes
- user = root /*运行Ganglia的用户*/
- debug_level = 0
- max_udp_msg_len = 1472
- mute = no
- deaf = no
- host_dmax = 120 /*secs */
- cleanup_threshold = 300 /*secs */
- gexec = no
- send_metadata_interval = 15 /*发送数据的时间间隔*/
- }
- cluster {
- name = "hadoop" /*集群名称*/
- owner = "root" /*运行Ganglia的用户*/
- latlong = "unspecified"
- url = "unspecified"
- }
- udp_send_channel {
- # mcast_join = 239.2.11.71 /*注释掉组播*/
- host = 192.168.1.108/*发送给安装gmetad的机器*/
- port = 8649
- ttl = 1
- }
- udp_recv_channel { #接受UDP包配置
- # mcast_join = 239.2.11.71
- port = 8649
- # bind = 239.2.11.71
- }
- #service gmond start
八、服务端的WEB配置
PHP程序需要依赖Apache来运行,因此需要安装如下依赖
- # yum -y install php httpd
- # service httpd start //启动httpd 服务
九、测试安装是否成功
- # vi /var/www/html/index.php
- <?php
- phpinfo();
- ?>
正常是看到php的信息。
- #cd /home/ruifeng.shan
- #wget http://jaist.dl.sourceforge.net/project/ganglia/ganglia-web/3.5.10/ganglia-web-3.5.10.tar.gz
- #tar -xf ganglia-web-3.5.10.tar.gz
- #cd ganglia-web-3.5.10
- #make install
注:
Ganglia访问失败:
There was an error collecting ganglia data (127.0.0.1:8652): fsockopen error: Permission denied
解决:
需要关闭selinux:vi /etc/selinux/config,把SELINUX=enforcing改成SELINUX=disable;需要重启机器。
可以使用命令setenforce 0来关闭selinux而不需要重启,刷新页面,即可访问。但此方法只是一权宜之计。要想永久修改selinux设置,还是要使用第一种方法。
重启httpd服务器即可看到效果
- #service httpd restart
Hadoop和HBase社区一直使用它作为监控集群的业界标准方案。在maste上安装gmetad,在master、node、slave上安装gmond。为了监控Hadoop和HBase,需要对它们做一些配置。这里Hadoop使用的是2.2.0版本,HBase使用的是0.96.0这个版本。这里监控的分布式集群也是文章《Ubuntu和CentOS中分布式配置Hadoop-2.2.0》和《CentOS分布式环境安装HBase-0.96.0》中布置的hadoop和hbase。
为了能让ganglia监控hadoop,Hadoop2.2.0需要配置hadoop-2.2.0/etc/hadoop/目录下的hadoop-metrics.properties和hadoop-metrics2.properties文件。其中,hadoop-metrics.properties配置如下:
- # Configuration of the "dfs" context for null
- dfs.class=org.apache.hadoop.metrics.spi.NullContext
- # Configuration of the "dfs" context for file
- #dfs.class=org.apache.hadoop.metrics.file.FileContext
- #dfs.period=10
- #dfs.fileName=/tmp/dfsmetrics.log
- # Configuration of the "dfs" context for ganglia
- # Pick one: Ganglia 3.0 (former) or Ganglia 3.1 (latter)
- # dfs.class=org.apache.hadoop.metrics.ganglia.GangliaContext
- # dfs.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
- # dfs.period=10
- # dfs.servers=localhost:8649
- # Configuration of the "mapred" context for null
- mapred.class=org.apache.hadoop.metrics.spi.NullContext
- # Configuration of the "mapred" context for file
- #mapred.class=org.apache.hadoop.metrics.file.FileContext
- #mapred.period=10
- #mapred.fileName=/tmp/mrmetrics.log
- # Configuration of the "mapred" context for ganglia
- # Pick one: Ganglia 3.0 (former) or Ganglia 3.1 (latter)
- # mapred.class=org.apache.hadoop.metrics.ganglia.GangliaContext
- # mapred.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
- # mapred.period=10
- # mapred.servers=localhost:8649
- # Configuration of the "jvm" context for null
- #jvm.class=org.apache.hadoop.metrics.spi.NullContext
- # Configuration of the "jvm" context for file
- #jvm.class=org.apache.hadoop.metrics.file.FileContext
- #jvm.period=10
- #jvm.fileName=/tmp/jvmmetrics.log
- # Configuration of the "jvm" context for ganglia
- # jvm.class=org.apache.hadoop.metrics.ganglia.GangliaContext
- # jvm.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
- # jvm.period=10
- # jvm.servers=localhost:8649
- # Configuration of the "rpc" context for null
- rpc.class=org.apache.hadoop.metrics.spi.NullContext
- # Configuration of the "rpc" context for file
- #rpc.class=org.apache.hadoop.metrics.file.FileContext
- #rpc.period=10
- #rpc.fileName=/tmp/rpcmetrics.log
- # Configuration of the "rpc" context for ganglia
- # rpc.class=org.apache.hadoop.metrics.ganglia.GangliaContext
- # rpc.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
- # rpc.period=10
- # rpc.servers=localhost:8649
- # Configuration of the "ugi" context for null
- ugi.class=org.apache.hadoop.metrics.spi.NullContext
- # Configuration of the "ugi" context for file
- #ugi.class=org.apache.hadoop.metrics.file.FileContext
- #ugi.period=10
- #ugi.fileName=/tmp/ugimetrics.log
- # Configuration of the "ugi" context for ganglia
- # ugi.class=org.apache.hadoop.metrics.ganglia.GangliaContext
- # ugi.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
- # ugi.period=10
- # ugi.servers=localhost:8649
hadoop-metrics2.properties文件配置如下:
- #
- # Licensed to the Apache Software Foundation (ASF) under one or more
- # contributor license agreements. See the NOTICE file distributed with
- # this work for additional information regarding copyright ownership.
- # The ASF licenses this file to You under the Apache License, Version 2.0
- # (the "License"); you may not use this file except in compliance with
- # the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #
- # syntax: [prefix].[source|sink].[instance].[options]
- # See javadoc of package-info.java for org.apache.hadoop.metrics2 for details
- ##############一定要注释掉原来的这块,否则会监控不到#########
- #*.sink.file.class=org.apache.hadoop.metrics2.sink.FileSink
- # default sampling period, in seconds
- #*.period=10
- #############################################################
- # The namenode-metrics.out will contain metrics from all context
- #namenode.sink.file.filename=namenode-metrics.out
- # Specifying a special sampling period for namenode:
- #namenode.sink.*.period=8
- #datanode.sink.file.filename=datanode-metrics.out
- # the following example split metrics of different
- # context to different sinks (in this case files)
- #jobtracker.sink.file_jvm.context=jvm
- #jobtracker.sink.file_jvm.filename=jobtracker-jvm-metrics.out
- #jobtracker.sink.file_mapred.context=mapred
- #jobtracker.sink.file_mapred.filename=jobtracker-mapred-metrics.out
- #tasktracker.sink.file.filename=tasktracker-metrics.out
- #maptask.sink.file.filename=maptask-metrics.out
- #reducetask.sink.file.filename=reducetask-metrics.out
- *.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31
- *.sink.ganglia.period=10
- *.sink.ganglia.slope=jvm.metrics.gcCount=zero,jvm.metrics.memHeapUsedM=both
- *.sink.ganglia.dmax=jvm.metrics.threadsBlocked=70,jvm.metrics.memHeapUsedM=40
- namenode.sink.ganglia.servers=master:8649
- resourcemanager.sink.ganglia.servers=master:8649
- datanode.sink.ganglia.servers=master:8649
- nodemanager.sink.ganglia.servers=master:8649
- maptask.sink.ganglia.servers=master:8649
- reducetask.sink.ganglia.servers=master:8649
- # syntax: [prefix].[source|sink].[instance].[options]
- # See javadoc of package-info.java for org.apache.hadoop.metrics2 for details
- ##############一定要注释掉原来的这块,否则会监控不到#########
- #*.sink.file*.class=org.apache.hadoop.metrics2.sink.FileSink
- # default sampling period
- #*.period=10
- #############################################################
- # Below are some examples of sinks that could be used
- # to monitor different hbase daemons.
- # hbase.sink.file-all.class=org.apache.hadoop.metrics2.sink.FileSink
- # hbase.sink.file-all.filename=all.metrics
- # hbase.sink.file0.class=org.apache.hadoop.metrics2.sink.FileSink
- # hbase.sink.file0.context=hmaster
- # hbase.sink.file0.filename=master.metrics
- # hbase.sink.file1.class=org.apache.hadoop.metrics2.sink.FileSink
- # hbase.sink.file1.context=thrift-one
- # hbase.sink.file1.filename=thrift-one.metrics
- # hbase.sink.file2.class=org.apache.hadoop.metrics2.sink.FileSink
- # hbase.sink.file2.context=thrift-two
- # hbase.sink.file2.filename=thrift-one.metrics
- # hbase.sink.file3.class=org.apache.hadoop.metrics2.sink.FileSink
- # hbase.sink.file3.context=rest
- # hbase.sink.file3.filename=rest.metrics
- *.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31
- *.sink.ganglia.period=10
- hbase.sink.ganglia.period=10
- hbase.sink.ganglia.servers=master:8649
- centos集群上安装ganglia-3.6.0监控hadoop-2.2.0和hbase-0.96.0
- centos集群上安装ganglia-3.6.0监控hadoop-2.2.0和hbase-0.96.0
- 64位centos上用ganglia-3.6.0监控hadoop-2.2.0集群
- centos下安装ganglia监控hadoop集群
- Ganglia监控hadoop、hbase集群
- CentOS下安装与配置Ganglia监控Hadoop集群及HBase
- Ganglia 3.6.0 监控 Hadoop 2.2.0
- CentOS-5.9系统下Ganglia-3.6.0监控集群安装配置实践
- CentOS-6.3系统下Ganglia-3.6.0监控集群安装配置实践
- Ganglia监控Hadoop及Hbase集群性能(安装配置)
- wang-----Ganglia监控Hadoop及Hbase集群性能(安装配置)
- Ganglia监控Hadoop及Hbase集群性能(安装配置)
- Ubuntu1604安装ganglia并监控Hadoop/HBase/Spark集群
- Ganglia监控Hadoop及Hbase集群性能(安装配置)
- 安装ganglia监控hadoop集群
- 使用ganglia监控hadoop及hbase集群
- 使用ganglia监控hadoop及hbase集群
- 使用ganglia监控hadoop及hbase集群
- 新兴可信认证领域,谁将领风骚?
- iOS7 cell分割线左对齐
- IE11 中的兼容性更改
- SpringMVC配置方案
- linux 技巧:使用 screen 管理你的远程会话
- centos集群上安装ganglia-3.6.0监控hadoop-2.2.0和hbase-0.96.0
- map遍历的方法
- USB linux NCM usbnet驱动详解
- 设定中文环境,cout不显示千位上的逗号
- JS日期选择器
- OJ_1057
- 防备电脑死机实用技巧
- Java 使用Calendar 工具类时 设置时区
- 2014新的开始-需要潜心修炼的一年