日志收集系统 scribe on centos 安装

来源:互联网 发布:中国工业经济数据库 编辑:程序博客网 时间:2024/04/29 08:21
由于scribe是基于thrift服务框架开发的,所以需要先安装thrift,thrift又依赖很多工具和库.

首先安装依赖库

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

安装boost,当前安装的1.45 最低版本1.36
下载   boost_1_45_0.tar.bz2 
解压 后进入目录
运行如下
./bootstrap.sh
./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
.
添加环境变量 
export BOOST_ROOT=/usr/local/boost 
export LD_LIBRARY_PATH=/usr/local/boost/lib:/usr/local/lib/:/usr/lib/ 

安装thrift 
        http://incubator.apache.org/thrift/ 
(版本>=0.5.0) 
1)先安装thrift, 
解压并进入thrift目录      

./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"  --without-csharp  --with-boost=/usr/local/boost
  947  make
  948  make install
查看版本  thrift -version
安装 fb303
在thrift 目录下已经存在此文件 
cd contrib/
cd fb303/
 ./bootstrap.sh 
 ./configure --with-boost=/usr/local/boost
make
make install

安装scribe (从官网下载2.2 安装失败。。。。。)
https://github.com/facebook/scribe  
下载2.0版本
解压后,进入scribe 目录 
  1. ./bootstrap  --with-boost=/usr/local/boost
  2. ./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H" --with-boost=/usr/local/boost --prefix=/usr/local/scribe

  3. make  
  4. make install


三、测试 
进入安装后的目录/usr/local/scribe 

代码  收藏代码
  1. mkdir conf  
  2. cp ~/facebook-scribe-2ee14d3/examples/example1.conf /usr/local/scribe/conf/  

启动,默认端口是1463 
python代码  收藏代码
  1. /usr/local/scribe/bin/scribed -c /usr/local/scribe/conf/example1.conf  
[root@hadoop-1 bin]# scribed -c /usr/local/scribe/conf/example1.conf
[Tue Mar 25 18:01:12 2014] "STATUS: STARTING" 
[Tue Mar 25 18:01:12 2014] "STATUS: configuring" 
[Tue Mar 25 18:01:12 2014] "got configuration data from file </usr/local/scribe/conf/example1.conf>" 

如能看到如上结果,表示运行成功

测试程序: 

代码  收藏代码
  1. mkdir  /tmp/scribetest  

测试写入: 
代码  收藏代码
  1. echo  "hello world"|  原目录/examples/scribe_cat test  

查看结果: 
代码  收藏代码
  1. cat  /tmp/scribetest/test/test_current  
如果能看到hello world 表示正常

错误解决

安装scribe在make的时候出现如下错误:

1undefined reference to `boost::system::generic_category()'
2undefined reference to `boost::system::generic_category()'
3undefined reference to `boost::system::system_category()'
4解决办法1:
5进入scribe源码包的scr目录执行如下:
6g++  -Wall -O3 -L/usr/lib  -o scribed store.o store_queue.o conf.o file.o conn_pool.o scribe_server.o network_dynamic_config.o dynamic_bucket_updater.o  env_default.o  -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lfb303 -lthrift -lthriftnb -levent -lpthread  libscribe.a libdynamicbucketupdater.a -lboost_system-mt -lboost_filesystem-mt
7解决办法2:
8在configure的时候加上-lboost_system-mt -lboost_filesystem-mt参数

-DBOOST_FILESYSTEM_VERSION=2 参数只有在你的boost版本大于1.46的时候需要添加

测试时错误:

view source
print?
1root@py-6:~/scribe/examples# echo  "hello world"|./scribe_cat test
2Traceback (most recent call last):
3  File "./scribe_cat", line 24, in <module>
4    from scribe import scribe
5ImportError: No module named scribe
6 
7解决办法
8在debian/ubuntu系列安装完毕后,python的scribe模块并没有在默认搜索路径中,所以:
9cp -a /usr/lib/python2.7/site-packages/* /usr/lib/python2.7/dist-packages/
库连接错误:

1root@vm-6:~/scribe# scribed -c examples/example1.conf
2scribed: error while loading shared libraries: libthrift-0.9.0.so: cannot open shared object file: No such file or directory
3 
4ldd /usr/local/bin/scribed 发现
5    libthrift-0.9.0.so => not found
6    libthriftnb-0.9.0.so => not found
7在/usr/local/lib/中都已经有该so文件,因为是环境变量有问题
8 
9export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib







0 0
原创粉丝点击