生产环境 hadoop集群监控工具--ganglia的搭建(YUM的方式)

2 篇文章 0 订阅
2 篇文章 0 订阅

集群简介:

ip              主机名       集群角色     监控角色
192.168.20.161  oncloud0    NameNode    gmond,gmetad
192.168.20.162  oncloud1    DataNode    gmond
192.168.20.163  oncloud2    DataNode    gmond
192.168.20.164  oncloud3    DataNode    gmond
192.168.20.165  oncloud4    DataNode    gmond
192.168.20.166  oncloud5    DataNode    gmond
192.168.20.167  oncloud6    DataNode    gmond
192.168.20.168  oncloud7    DataNode    gmond
192.168.20.169  oncloud8    DataNode    gmond

安装epel源

[root@oncloud0 ~]# wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@oncloud0 ~]# rpm -vih epel-release-latest-7.noarch.rpm 

这里没有配置root账户的ssh免密,所以需要每次都输入密码
[root@oncloud0 ~]# i=1
[root@oncloud0 ~]# while [[ $i -lt 10 ]]
> do
>   ssh -p 9777 root@115.182.40.16${i} " wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ;rpm -vih epel-release-latest-7.noarch.rpm "
>   echo "Executing.........[${i}]"
>   i=`expr $i + 1` 
> done

安装ganglia

# oncloud0
[root@oncloud0 ~]# yum -y install ganglia-gmetad 
[root@oncloud0 ~]# yum -y install ganglia-web
# oncloud1-oncloud9
yum -y install ganglia-gmond

配置文件

[root@oncloud0 ~]# vim /etc/ganglia/gmetad.conf
data_source "oncloud_Cluster" 115.182.40.160
[root@oncloud0 ~]# vim /etc/httpd/conf.d/ganglia.conf

<Location /ganglia>
  Order deny,allow
  Allow from all

  # Require local
  # Require ip 10.1.2.3
  # Require host example.org
</Location>
[root@oncloud0 ~]# vi /etc/ganglia/gmond.conf
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
  mcast_join = 115.182.40.160
  port = 8649
  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 = 8649
  #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 = 8649
  # If you want to gzip XML output
  gzip_output = no
}

分发到其他节点,保持一致

[root@oncloud0 ~]# i=1
[root@oncloud0 ~]# while [[ $i -lt 10 ]]
> do
>   scp -P 9777  /etc/ganglia/gmond.conf root@115.182.40.16${i}:/etc/ganglia
>   echo "Executing.........[${i}]"
>   i=`expr $i + 1` 
> done

启动服务

[root@oncloud0 ~]# service gmetad restart 
[root@oncloud0 ~]# service gmond  restart  
[root@oncloud0 ~]# service httpd  restart  

配置开机启动服务

[root@oncloud0 ~]# chkconfig gmetad on
[root@oncloud0 ~]# chkconfig gmond on
[root@oncloud0 ~]# systemctl enable httpd.service  

oncloud01-oncloud9

service gmond  restart  
chkconfig gmond on

web页面访问403,需要配置如下

[root@oncloud0 ~]#  vim /etc/httpd/conf/httpd.conf
<Directory />
   # AllowOverride none
   # Require all denied
 Options FollowSymLinks
 AllowOverride None
 Order deny,allow
 allow from all
</Directory>

需要重启httpd服务

[root@oncloud0 ~]#  service httpd  restart

上一篇博文,再加上这篇博文ganglia中配置hadoop
搭建成功。

访问url
http://ip_address/ganglia/

使用 Apache 提供的基本认证功能,为 Ganglia Web 界面(/usr/share/ganglia)配置身份认证。

为完成这个目标,我们需要创建一个用户名并设定一个密码,以访问被 Apache 保护的资源。在本例中,我们先来创建一个叫 ${your_name} 的用户名,然后给它分配一个密码,它将被储存在/etc/httpd/conf.d/passwords
(可以随意选择另一个目录 和/或 文件名, 只要 Apache 对此有读取权限就可以 。)

①
htpasswd -c /etc/httpd/conf.d/passwords  ${your_name} 

②
// 创建apache目录密码文件,并写入下面内容
vim /usr/share/ganglia/.htaccess
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/httpd/conf.d/passwords
Require user  ${your_name} 

③
vi /etc/httpd/conf/httpd.conf 
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

修改为:

<Directory />
    Options FollowSymLinks
    AllowOverride AuthConfig
</Directory>

再访问url http://ip_address/ganglia/ 需要输入用户名密码


参考网址:
http://heipark.iteye.com/blog/1183270
http://blog.csdn.net/u014743697/article/details/54999356

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值