大数据应用日志采集之Scribe 安装配置指南

简介: 大数据应用日志采集之Scribe 安装配置指南 1.概述 Scribe是Facebook开源的日志收集系统,在Facebook内部已经得到大量的应用。它能从各种日志源收集日志,存储到一个中央存储系统上,便于进行集中统计分析处理。

大数据应用日志采集之Scribe 安装配置指南

1.概述

Scribe是Facebook开源的日志收集系统,在Facebook内部已经得到大量的应用。它能从各种日志源收集日志,存储到一个中央存储系统上,便于进行集中统计分析处理。它为日志的”分布式收集,统一处理”提供了一个可扩展的,高容错的方案。scribe代码很简单,但是安装配置却很复杂,本文记录了作者实际的一次安装的过程,感觉真是不一般的琐碎,另外Scribe开源社区的版本已经是几年前的版本了,最新的维护信息一致没有看到,HDFS和Thrift的版本使用的都是比较旧的版本,考虑另开一个分支,升级一下Scribe,看到时候有没有时间了。

2.Scribe 安装

Scribe 依赖于多个环境,有pthyon,boost,thirft,libevent,openssl等。在编译的时候还有一些编译错误需要进行修正,安装的和准备如下。

2.1 环境准备

  1.安装编译环境

#yum install gcc-c++ libevent libevent-devel automake autoconf m4 bison zlib zlib-devel bzip2 bzip2-devel flex pkgconfig python python-devel ruby ruby-devel mono-devel libxml2 libxml2-devel ant openssl-devel

  2.安装boost环境:最低版本1.36

        #wget http://nchc.dl.sourceforge.net/project/boost/boost/1.45.0/boost_1_45_0.tar.gz

        #tar zxvf boost_1_45_0.tar.gz

        #cd boost_1_45_0

        #./bootstrap.sh 

        #./bjam

      #./bjam --s HAVE_ICU=1 --prefix=/usr/local/boost --includedir=/usr/local/boost/include  --libdir=/usr/local/boost/lib

       #./bjam install –prefix=/usr/local/boost

       #echo "/usr/local/boost/lib" >> /etc/ld.so.conf

       #echo /usr/local/boost/include >> /etc/ld.so.conf

     #ldconfig

  3. 安装thrift环境

  #wget https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz

      #tar xzvf thrift-0.9.0.tar.gz

      #./configure --prefix=/usr/local/thrift --with-boost=/usr/local/boost --with-java=no  --with-erlang=no  --with-perl=no  --with-php=no  --with-ruby=no

 备注:如果提示找不到libcrpty增加openssl路径

 ./configure --prefix=/usr/local/thrift --with-boost=/usr/local/boost --with-java=no  --with-erlang=no --with-perl=no --with-php=no  --with-  ruby=no CPPFLAGS="-I/usr/local/openssl/include" LDFLAGS="-ldl -L/usr/local/openssl/lib"

 修改文件:

  Thrift/lib/ src/thrift/Thrift.cpp 增加头文件:#include<stdlib.h>     

同时修改config.h文件,注释掉:

/* Define to rpl_malloc if the replacement function should be used. */

//modby zhangzl++:

//#define malloc rpl_malloc

//--

/* Define to rpl_realloc if the replacement function should be used. */

//modby zhangzl++:

//#define realloc rpl_realloc

//--

#make

#make install

# echo "/usr/local/thrift/lib" >> /etc/ld.so.conf

#ldconfig

#cd contrib.

  4.安装fb303

#cd fb303

#./bootstrap.sh

#./configure --prefix=/usr/local/thrift/fb303 --with-boost=/usr/local/boost/ --with-thriftpath=/usr/local/thrift

#make

//注意修改观察生成的Makefile关于头文件和库文件路径的信息是否正确,如果正确则可以直接编译。

  #make install  

4.安装scribe

https://github.com/facebook/scribe下载zip包。

#unzip scribe-master.zip

#cd scribe-master

# export BOOST_ROOT=/usr/local/boost

#export LD_LIBRARY_PATH=/usr/local/thrift/lib:/usr/lib:/usr/local/lib:/usr/local/boost/lib:/usr/local/thrift/fb303/lib

#./bootstrap.sh  --with-boost=/usr/local/boost --with-boost-filesystem=boost_filesystem

遇到问题:

checking whether the Boost::System library is available… yes

checking whether the Boost::Filesystem library is available… yes

configure: error: Could not link against  !

解决办法,在configure 后加一个参数 --with-boost-filesystem=boost_filesystem

 

#./configure --prefix=/usr/local/scribe --with-boost=/usr/local/boost --with-thriftpath=/usr/local/thrift  --with-fb303path=/usr/local/thrift/fb303 --with-boost-filesystem=boost_filesystem

#make

遇到问题:

  1. thrift/server/TNonblockingServer.h:40:19: error: event.h: No such file or directory
  2. 安装Libevent

#tar zxvf libevent-2.0.18-stable.tar.gz
#cd libevent-2.0.18-stable
#./configure –prefix=/usr/local/libevent
#make
#make install

  3.安装libevent-devel

yum install libevent-devel

error: there are no arguments to 'htons' that depend on a template parameter, so a declaration of 'htons' must be available

需要自己修改一下文件:

vim /usr/local/thrift/include/thrift/protocol/TBinaryProtocol.tcc

在首行添加头文件引用: #include <arpa/inet.h>

#echo /usr/local/libevent/include >> /etc/ld.so.conf

#ldconfig

#make install

2.2 测试

#cp example/example1.conf  /tmp

#/usr/local/scribe/bin/scribed /tmp/example1.conf

进行测试。

如果失败,根据提示信息,进行相应修改。

我启动时出现下面的错误:

./scribed: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

解决办法是find这个库文件libevent-2.0.so.5,拷贝到/usr/lib64目录下。

启动成功后,出现下面的界面:

    

3.Scribe配置   

Scribe 的配置解析见http://my.oschina.net/guol/blog/110258

测试通过的server端和client端的配置文件如下:

  1. Server.conf

port=1463

max_msg_per_second=100000000

max_queue_size=10000000

check_interval=1

new_thread_per_category=true      

<store>

category=squid

type=file

file_path=/tmp/test/logcollect/

base_filename=21vianet__squid_access_all_

rotate_period=daily

rotate_hour=0

rotate_minute=0

max_size=1610612736

add_newlines=0

</store>

  1. Client.conf

port=1464

max_msg_per_second=2000000

max_queue_size=1000000

check_interval=1

new_thread_per_category=true      

 

<store>

category=default

type=buffer

target_write_size=20480

max_write_interval=1

buffer_send_rate=2

retry_interval=30

retry_interval_range=10

 

<primary>

type=network

#remote_host=218.93.205.106

remote_host=192.168.11.95

remote_port=1463

</primary>

 

<secondary>

type=file

fs_type=std

write_meta=no

file_path=/tmp/test/scribed

base_filename=accesslog

max_size=100000000

add_newlines=0

</secondary>

</store>

注意:

 在server端接收的日志,将以文件的方式来记录log,这个文件不能删除,它是个软连接。需要先copy过去,再调用touch命令将文件清空。


作者:张子良
出处:http://www.cnblogs.com/hadoopdev
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
相关文章
|
14天前
|
存储 消息中间件 监控
【Flume】Flume在大数据分析领域的应用
【4月更文挑战第4天】【Flume】Flume在大数据分析领域的应用
|
26天前
|
监控 Serverless 数据库
Serverless 应用引擎常见问题之biphon-education-配置了SLS后一直重启如何解决
Serverless 应用引擎(Serverless Application Engine, SAE)是一种完全托管的应用平台,它允许开发者无需管理服务器即可构建和部署应用。以下是Serverless 应用引擎使用过程中的一些常见问题及其答案的汇总:
28 5
|
27天前
|
Cloud Native 数据处理 云计算
探索云原生技术在大数据分析中的应用
随着云计算技术的不断发展,云原生架构作为一种全新的软件开发和部署模式,正逐渐引起企业的广泛关注。本文将探讨云原生技术在大数据分析领域的应用,介绍其优势与挑战,并探讨如何利用云原生技术提升大数据分析的效率和可靠性。
|
24天前
|
数据采集 分布式计算 大数据
Java语言在大数据处理中的应用
传统的大数据处理往往依赖于庞大的数据中心和高性能的服务器,然而随着大数据时代的到来,Java作为一种强大的编程语言正在被广泛应用于大数据处理领域。本文将探讨Java语言在大数据处理中的优势和应用,以及其在分布式计算、数据处理和系统集成等方面的重要作用。
|
16天前
|
NoSQL 大数据 数据挖掘
现代数据库技术与大数据应用
随着信息时代的到来,数据量呈指数级增长,对数据库技术提出了前所未有的挑战。本文将介绍现代数据库技术在处理大数据应用中的重要性,并探讨了一些流行的数据库解决方案及其在实际应用中的优势。
|
21天前
|
机器学习/深度学习 人工智能 数据可视化
基于Python的数据可视化技术在大数据分析中的应用
传统的大数据分析往往注重数据处理和计算,然而数据可视化作为一种重要的技术手段,在大数据分析中扮演着至关重要的角色。本文将介绍如何利用Python语言中丰富的数据可视化工具,结合大数据分析,实现更直观、高效的数据展示与分析。
|
27天前
|
存储 SQL Serverless
Serverless 应用引擎常见问题之应用下的【应用事件】以及企业级特性下的【事件中心】没有日志如何解决
Serverless 应用引擎(Serverless Application Engine, SAE)是一种完全托管的应用平台,它允许开发者无需管理服务器即可构建和部署应用。以下是Serverless 应用引擎使用过程中的一些常见问题及其答案的汇总:
34 0
|
29天前
|
存储 NoSQL 大数据
新型数据库技术在大数据分析中的应用与优势探究
随着大数据时代的到来,传统数据库技术已经无法满足海量数据处理的需求。本文将探讨新型数据库技术在大数据分析中的应用情况及其所带来的优势,为读者解析数据库领域的最新发展趋势。
|
2月前
|
分布式计算 DataWorks IDE
MaxCompute数据问题之忽略脏数据如何解决
MaxCompute数据包含存储在MaxCompute服务中的表、分区以及其他数据结构;本合集将提供MaxCompute数据的管理和优化指南,以及数据操作中的常见问题和解决策略。
47 0
|
2月前
|
SQL 存储 分布式计算
MaxCompute问题之下载数据如何解决
MaxCompute数据包含存储在MaxCompute服务中的表、分区以及其他数据结构;本合集将提供MaxCompute数据的管理和优化指南,以及数据操作中的常见问题和解决策略。
38 0