Scribe源码安装

    上一篇简要的了解了scribe的原理,这个一篇可以实践一下scribe。scribe在安装的时候依赖关系还是蛮多的,官方解释如下:

    [libevent] Event Notification library
    [boost] Boost C++ library (version 1.36 or later)
    [thrift] Thrift framework (version 0.5.0 or later)
    [fb303] Facebook Bassline (included in thrift/contrib/fb303/)
       fb303 r697294 or later is required.

详细如下图:


安装环境:debian6

安装组件:boost、thrift、fb303、scribe。(其余依赖包通过apt-get安装)

安装相关依赖包

apt-get install build-essential bison flex libboost-all-dev
apt-get install libevent-dev libglib2.0-dev  libboost-dev libssl-dev python-dev 
apt-get install libboost-system-dev libboost-filesystem-dev libtool 
apt-get install git automake

1 安装boost

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
./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/lib:/usr/local/lib

2 安装thrift&&fb303(fb303在thrift源码包中)

wget 'https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz'
tar zxvf thrift-0.9.0.tar.gz
cd thrift-0.9.0
./configure --with-boost=/usr/local/boost
make 
make install

cd contrib/fb303
./bootstrap.sh --with-boost=/usr/local/boost/
make 
make install
3 安装scribe

git clone https://github.com/facebook/scribe
cd scribe
./bootstrap.sh --with-boost=/usr/local/boost --prefix=/usr/local/scribe
./configure --with-boost=/usr/local/boost --prefix=/usr/local/scribe CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DBOOST_FILESYSTEM_VERSION=2"
make
make install
4 在debian中需要做如下调整,因为生成的scribe模块并未在默认的搜索路径中

cp -a /usr/lib/python2.6/site-packages/* /usr/lib/python2.6/dist-packages/

5 测试

#配置scribe配置文件,scribe源码中有简单的模版
mkdir /usr/local/scribe/conf
cp scribe/examples/example1.conf /usr/local/scribe/conf
cp scribe/examples/scribe_cat /sbin/
cp scribe/examples/scribe_ctrl /sbin/
#启动scribe
cd /usr/local/scribe/bin/
./scribed -c ../conf/example1.conf
#出现如下则说明启动成功
[Fri Feb 22 21:12:11 2013] "STATUS: STARTING" 
[Fri Feb 22 21:12:11 2013] "STATUS: configuring" 
[Fri Feb 22 21:12:11 2013] "got configuration data from file <../conf/example1.conf>" 
[Fri Feb 22 21:12:11 2013] "CATEGORY : default" 
[Fri Feb 22 21:12:11 2013] "Creating default store" 
[Fri Feb 22 21:12:11 2013] "configured <1> stores" 
[Fri Feb 22 21:12:11 2013] "STATUS: " 
[Fri Feb 22 21:12:11 2013] "STATUS: ALIVE" 
[Fri Feb 22 21:12:11 2013] "Starting scribe server on port 1463" 
Thrift: Fri Feb 22 21:12:11 2013 TNonblockingServer: Serving on port 1463, 1 io threads.
Thrift: Fri Feb 22 21:12:11 2013 TNonblockingServer: using libevent 1.4.13-stable method epoll
Thrift: Fri Feb 22 21:12:11 2013 TNonblocking: IO thread #0 registered for listen.
Thrift: Fri Feb 22 21:12:11 2013 TNonblocking: IO thread #0 registered for notify.
Thrift: Fri Feb 22 21:12:11 2013 TNonblockingServer: IO thread #0 entering loop...

#另开窗口进行测试
mkdir  /tmp/scribetest
echo  "hello world"| scribe_cat test
#可以看到输入scribe的内容
cat  /tmp/scribetest/test/test_current
#查看scribe的状态
scribe_ctrl status
#停止和重新加载scribe
scribe_ctrl stop/reload

   终于安装完毕,网上也有很多安装过程可以参考,安装过程中出现问题最多的是boost库的依赖问题。


参考:

http://www.cnblogs.com/oubo/archive/2011/10/28/2394607.html

http://blog.veryamt.com/play-with-scribe-in-debian-6.html


转载于:https://my.oschina.net/guol/blog/110183

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值