CentOS集群上安装Ganglia(3)

八、服务端的WEB配置
PHP程序需要依赖Apache来运行,因此需要安装如下依赖

# yum -y install php httpd

# service httpd start //启动httpd 服务

# yum -y install php httpd # service httpd start //启动httpd 服务

九、测试安装是否成功

# vi /var/www/html/index.php

# vi /var/www/html/index.php

输入:

<?php

phpinfo();

?>

<?php phpinfo(); ?>

保存,然后浏览器 master/index.php
正常是看到php的信息。

#cd /home/ruifeng.shan

#wget

#tar -xf ganglia-web-3.5.10.tar.gz

#cd ganglia-web-3.5.10

#make install

#cd /home/ruifeng.shan #wget #tar -xf ganglia-web-3.5.10.tar.gz #cd ganglia-web-3.5.10 #make install

这样 在/var/www/html/下 生成了 ganglia 目录
注:
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

#service httpd restart

使用查看对应的ganglia信息。(注:master为运行gmetad的主机的hostname)

Hadoop和HBase社区一直使用它作为监控集群的业界标准方案。在maste上安装gmetad,在master、node、slave上安装gmond。为了监控Hadoop和HBase,需要对它们做一些配置。这里Hadoop使用的是2.2.0版本,HBase使用的是0.96.0这个版本。这里监控的分布式集群也是文章《UbuntuCentOS中分布式配置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

# 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

#

#

#

# 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

# # 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 # # # # 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

为了让ganglia监控hbase,需要配置hbase-0.96.0目录下的conf目录中的hadoop-metrics2-hbase.properties文件。内容如下:

# 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

HBase 的详细介绍请点这里
HBase 的下载地址请点这里

相关阅读

Hadoop+HBase搭建云存储总结 PDF

HBase 结点之间时间不一致造成regionserver启动失败

Hadoop+ZooKeeper+HBase集群配置

Hadoop集群安装&HBase实验环境搭建

基于Hadoop集群的HBase集群的配置

Hadoop安装部署笔记之-HBase完全分布模式安装

单机版搭建HBase环境图文教程详解

# 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相关信息见CentOS 专题页面 ?tid=14

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/f4ce6c13e1145e136ae75dc9ead81fb0.html