• 分布式日志系统Scribe安装


    分布式日志系统Scribe

    scribe 是facebook 开源的分布式日志系统。其使用了thrift传输log,由于使用thrift,所以不论是什么语言的项目都可以实现日志收集,可达到远程或者是本地同步远程的分布式日志收集效果,在其示例配置中,并发量可达到max_msg_per_second=2000000,对普通的应用来说,每秒上百万的访问量可能性很小,因此基本上即使最简单的配置,远程收集所有项目的log也是可靠的,如果压力大的话,可以采取主从的配置,将日志打到本地后由scribe的主从配置来自动同步。下面讲述如何安装和使用scribe。

    1 下载boost、thrift、scribe

    software: boost_1_45_0.tar.gz
    download: http://www.boost.org/users/history/
    description: Boost库是为C++语言标准库提供扩展的一些C++程序库。

    software: thrift-0.7.0.tar.gz
    download: http://archive.apache.org/dist/thrift/
    descriotion: thrift是一个软件框架,用来进行可扩展且跨语言的服务的开发。

    software: facebook-scribe-2ee14d3.tar.gz
    download: https://github.com/pcting/scribe/
    descriotion: scribe 是facebook 开源的分布式日志系统。


    2 安装需要的依赖

    使用apt-get

    sudo apt-get install libghc6-http-dev
    sudo apt-get install libghc6-binary-dev
    sudo apt-get install libboost-iostreams-dev
    sudo apt-get install libboost-filesystem-dev
    sudo apt-get install libboost-dev automake
    sudo apt-get install libtool flex bison pkg-config
    sudo apt-get install g++ ant ivy libslf4j-java
    sudo apt-get install libcommons-lang-java
    sudo apt-get install liblog4j1.2-java automake1.10

    使用yum

    yum install libevent libevent-devel python-devel
    yum install gcc-c++
    yum install automake
    yum install byacc flex

    3 安装boost

    tar -zxvf boost_1_45_0.tar.gz
    ./bootstrap.sh
    ./bjam install --prefix=/usr/local/boost


    4 安装thrift-0.7.0

    tar -zxvf thrift-0.7.0.tar.gz
    ./configure --with-boost=/usr/local/boost/ --with-java --prefix=/usr/local/thrift
    make
    make install

    5 安装fb303

    cd contrib/fb303

    ./bootstrap.sh --prefix=/usr/local/thrift/fb303 --with-boost=/usr/local/boost/ --with-thriftpath=/usr/local/thrift/

    make
    make install


    6 安装scribe

    tar -zxvf facebook-scribe-2ee14d3.tar.gz
    cd facebook-scribe-2ee14d3

    export BOOST_ROOT=/usr/local/boost/
    export LD_LIBRARY_PATH=/usr/local/thrift/lib:/usr/lib:/usr/local/lib:/usr/local/boost/lib/

    ./bootstrap.sh --prefix=/usr/local/scribe --with-boost=/usr/local/boost/ --with-thriftpath=/usr/local/thrift/

    make
    make install

    7 启动scribe服务

    cd facebook-scribe-2ee14d3
    cp example/exmaple1.conf /usr/local/scribe/bin
    cd /usr/local/scribe/bin/

    export BOOST_ROOT=/usr/local/boost/
    export LD_LIBRARY_PATH=/usr/local/thrift/lib:/usr/lib:/usr/local/lib:/usr/local/boost/lib/

    ./scibed example1.conf

    8 生成客户端使用scribe

    先产生java的thrift代码:

    cd facebook-scribe-2ee14d3/if/
    thrift -r -I http://www.cnblogs.com/thrift-0.7.0/contrib/(这里需要指到你的thrift的源码目录) -gen java scribe.thrift


    9 使用

    gen-java目录下有thrift的客户端,即取即用。javaeye里有一篇写配置log4j使用

  • 相关阅读:
    23. call和apply和bind的区别
    22.call方法的深入
    21.函数的三种角色
    20.原型深入
    2.9 原型链综合复习参考
    2.8深入扩展原型链模式常用的六种继承方式
    2.7原型链模式扩展-批量设置公有属性
    php数组函数有哪些操作?php数组函数的应用
    PHP常见的一些问题总结(收藏)
    yii框架 隐藏index.php 以及美化URL(pathinfo模式访问)
  • 原文地址:https://www.cnblogs.com/rilley/p/2295651.html
Copyright © 2020-2023  润新知