zoukankan      html  css  js  c++  java
  • 大数据之Ganglia安装1


    0、前期准备
    修改主机名、ip、iptables关闭;时间同步:ntpdate -s time.windows.com;
    软件准备
    ganglia-3.7.1.tar.gz、ganglia-web-3.7.0.tar.gz 地址:http://ganglia.info/?page_id=66
    confuse-2.7.tar.gz 地址:http://www.nongnu.org/confuse/
    Python-2.7.10.tgz 地址:https://www.python.org/downloads/release/python-2710/
    httpd-2.2.31.tar.gz 地址:http://httpd.apache.org/download
    php-5.6.12.tar.gz 地址:http://php.net/downloads.php

    1、集群规划
    cat /etc/redhat-release
    主机名称    ip    系统版本    作用
    cloud02     192.168.1.202    CentOS 6.4 x86_64    监控服务主节点
    cloud03     192.168.1.203    CentOS 6.4 x86_64    监控服务从节点
    cloud04     192.168.1.204     CentOS 6.4 x86_64    监控服务从节点

    2、软件规划
    Ganglia监控服务的主节点需要安装:ganglia、ganglia-web、php、apache
    Ganglia被监控从节点需要安装:ganglia

    安装路径
    ganglia-core安装路径    /usr/local/ganglia
    php安装路径    /usr/local/php
    apache安装路径    /usr/local/apache2
    ganglia-web安装路径    /opt/ganglia/ganglia-web
    rrds数据路径    /opt/ganglia/rrds

    3、检查依赖
    rpm -q gcc glibc glibc-common rrdtool rrdtool-devel expat expat-devel  pcre pcre-devel dejavu-lgc-sans-mono-fonts dejavu-sans-mono-fonts zlib-devel pcre pcre-devel apr  apr-devel apr-util apr-util-devel
    yum安装:
    yum install gcc glibc glibc-common rrdtool rrdtool-devel expat expat-devel  dejavu-lgc-sans-mono-fonts dejavu-sans-mono-fonts zlib-devel pcre pcre-devel apr  apr-devel apr-util apr-util-devel

    yum install perl libxml2 libxml2-devel

    //pcre (Perl Compatible Regular Expressions)正则表达式处理
    // apr Apache可移植运行库

    4、安装ganglia[所有节点]

        1、 confuse
        //libconfuse 是一个用C实现配置文件解析器库
        tar -zxf confuse-2.7.tar.gz
        cd confuse-2.7
        ./configure CFLAGS=-fPIC --disable-nls
        //-fPIC 作用于编译阶段,告诉编译器产生与位置无关代码(Position-Independent Code)则产生的代码中,没有绝对地址,全部使用相对地址,故而代码可以被加载器加载到内存的任意位置,都可以正确的执行。这正是共享库所要求的,共享库被加载时,在内存的位置不是固定的。
        //--disable-nls:禁止对国际化支持
        make && make install

        2、python[默认的python.so路径/usr/lib64/]
        tar -zvxf Python-2.7.10.tgz
        ./configure  --prefix=/usr/local  --enable-shared
        make && make install
        //安装后libpython2.7.so在/usr/local/lib下

        配置共享库
        vi /etc/ld.so.conf
     
        -- 增加如下内容#python.so所在位置
        /usr/local/lib

        启用配置
        ldconfig
        //ldconfig 命令的用途,主要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录下,搜索出可共享的动态链接库(格式如前介绍,lib*.so*),
        检查是否生效
        ldconfig -v |grep "libpython2.7.so"

        3、安装ganglia (全部节点都要安装 使用scp)
        # tar -zxf ganglia-3.7.1.tar.gz
        # cd ganglia-3.7.1
        # ./configure --prefix=/usr/local/ganglia --with-gmetad --enable-gexec --with-python=/usr/local
        # make && make install

        4、配置gmond (全部节点配置)
            cd /opt/ganglia-3.7.1
            cp ./gmond/gmond.init /etc/init.d/gmond
            ./gmond/gmond -t > /usr/local/ganglia/etc/gmond.conf  (生成文件gmond.conf)
            vi /etc/init.d/gmond  --修改如下内容
            GMOND=/usr/local/ganglia/sbin/gmond
            vi /usr/local/ganglia/etc/gmond.conf      -- 修改如下内容
            cluster {
                  name = "cloud-cluster"
                  owner = "nobody"
                  latlong = "unspecified"
                  url = "unspecified"
            }
            //[id nobody]
            udp_send_channel {
              mcast_join = cloud02
              port = 8649
              ttl = 1
            }
            /* You can specify as many udp_recv_channels as you like as well. */
            udp_recv_channel {
              port = 8649
            }

            复制python module到ganglia部署目录
            /opt/ganglia-3.7.1
            mkdir /usr/local/ganglia/lib64/ganglia/python_modules
            cp ./gmond/python_modules/*/*.py  /usr/local/ganglia/lib64/ganglia/python_modules
            安装程序ganglia-3.7.1默认提供了一些python module的配置文件,只需要部署到 /usr/local/ganglia/etc/conf.d 目录下面即可生效
            mkdir /usr/local/ganglia/etc/conf.d
            cp ./gmond/python_modules/conf.d/*.pyconf  /usr/local/ganglia/etc/conf.d
           
            同步 其他节点
            scp -r /usr/local/ganglia/ root@cloud03:/usr/local/ganglia/
            scp -r /etc/init.d/gmond root@cloud03:/etc/init.d/gmond
           
            启动gmond服务,并设为开机自动运行# ssh root@cloud02 'cmd'
            service gmond  restart
            chkconfig --add  gmond


            telnet localhost 8649
    5、配置gmetad(主节点配置)
        cd /opt/ganglia-3.7.1
        cp ./gmetad/gmetad.init /etc/init.d/gmetad
        cp ./gmetad/gmetad.conf /usr/local/ganglia/etc/

        vi /etc/init.d/gmetad 修改如下内容
        GMETAD=/usr/local/ganglia/sbin/gmetad

        vi /usr/local/ganglia/etc/gmetad.conf     -- 修改如下内容
        gridname "cloud-grid"
        --从第一台响应主机开始收集状态数据
        data_source "cloud-cluster" 10 cloud02  cloud03  cloud04
        --gmetad侦听端口
        xml_port 8651
        --gmetad交互式侦听端口
        interactive_port 8652
        rrd_rootdir "/opt/ganglia/rrds"
        case_sensitive_hostnames 0
        修改rrds数据目录所有者
        mkdir /opt/ganglia/rrds
        chown -R nobody:nobody /opt/ganglia/rrds
        启动gmetad服务,并设为开机自动运行
        service gmetad restart
        chkconfig --add gmetad
       
        telnet localhost 8651


    6、安装ganglia-web (主节点安装)
        1、安装apache
        tar -zxf httpd-2.2.31.tar.gz
         cd httpd-2.2.31
         ./configure --prefix=/usr/local/apache2
         make && make install
         问题:   
        [APR  is required]
        [configure: error: Cannot use an external APR with the bundled APR-util]
        2、安装php
        #vi /usr/local/apache2/bin/apxs
        #有的版本要将第一行改为perl位置即:#!/usr/bin/perl -w
        tar -zxf php-5.6.12.tar.gz
        cd php-5.6.12【gmond gmetad拓扑】
        ./configure --prefix=/usr/local/php  --with-apxs2=/usr/local/apache2/bin/apxs
        make  && make install
        [Perl is not installed]
        [xml2-config not found]
        3、ganglia-web

        # tar -zxf ganglia-web-3.7.0.tar.gz -C /opt/ganglia
        # mv /opt/ganglia/ganglia-web-3.7.0 /opt/ganglia/ganglia-web
        # cd /opt/ganglia/ganglia-web
        # cp conf_default.php conf.php
        vi conf.php
        $conf['gweb_confdir'] = "/opt/ganglia/ganglia-web";
        $conf['gmetad_root'] = "/opt/ganglia";
        vi header.php
        <?php
        session_start();
        ini_set('date.timezone','PRC');      --修改时区为本地时区
        
        if (isset($_GET['date_only'])) {
          $d = date("r");
          echo $d;
          exit(0);
        }
        配置临时目录:
        cd /opt/ganglia/ganglia-web/dwoo
        mkdir cache compiled
        chmod 777 cache compiled
       
        配置服务器设置
        vi /usr/local/apache2/conf/httpd.conf
        ....
        Listen 80
        ....
        
        <IfModule dir_module>
            DirectoryIndex index.html index.php
            AddType application/x-httpd-php .php
        </IfModule>
        ....
        
        # 在文件最后增加如下内容
    # ganglia
    Alias /ganglia "/opt/ganglia/ganglia-web"
    <Directory "/opt/ganglia/ganglia-web">
    AuthType Basic
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
        #ServerName www.example.com:80   把#去掉 修改成ip或者hostName[ServerName cloud02:80]

        启动httpd服务
        /usr/local/apache2/bin/apachectl restart

  • 相关阅读:
    UVA 10817 Headmaster's Headache(状压DP)
    UVA 11795 Mega Man's Mission(状态压缩DP)
    ZOJ3777 Problem Arrangement(状态压缩DP)
    NYOJ832 合并游戏(简单状压DP)
    UVA 1252 Twenty Questions(状压DP)
    UVA 10911 Forming Quiz Teams(状压DP)
    HDU 2196 Computer(经典树形DP)
    内连接、左外连接、右外连接、交叉连接区别 羽毛
    javaweb学习总结<转> 羽毛
    HIbernate基础 羽毛
  • 原文地址:https://www.cnblogs.com/chaoren399/p/4774189.html
Copyright © 2011-2022 走看看