debian6 搭建scribe

首先看一篇网上的文章“Play with scribe in debian 6” http://blog.veryamt.com/play-with-scribe-in-debian-6.html

安装过程中有些小的改动才安装成功:

1. 我本机安装了ruby 1.8 导致thrift编译不过

./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"  --with-ruby=no

强制禁掉ruby

2.提示找不到boost,下载旧版boost手动编译,如果有编译过更新的版本一定删除干净

wget -O boost_1_42_0.tar.gz http://downloads.sourceforge.net/project/boost/boost/1.42.0/boost_1_42_0.tar.gz?use_mirror=softlayer
tar zxf boost_1_42_0.tar.gz
cd boost_1_42_0
./boostrap.sh
./bjam
./bjam install

 

方便起见,原文复制如下:

 

Scribe 其实也没那么难弄,尤其是在Debian6下,在本文指导下目测你应该能在30min跑起来你的scribed.

依赖

先来看一下依赖

[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.
[hadoop] optional. version 0.19.1 or higher (http://hadoop.apache.org)

还可以嘛,其中前两个都是debian自带的,而且boost只要>1.36就行,这里debian6 的boost版本是1.42,恩没有问题,开搞。

root@debian:~/scribe# apt-cache show libboost-dev

Package: libboost-dev
...
Architecture: amd64
Source: boost-defaults
Version: 1.42.0.1
Depends: libboost1.42-dev
Filename: pool/main/b/boost-defaults/libboost-dev_1.42.0.1_amd64.deb
Size: 1958
...
Boost version (currently 1.42).
Homepage: http://www.boost.org/

apt-get

经过多次测试,全部的依赖可以通过安装以下包来解决

apt-get install build-essential bison flex# 额,你要build东西…
apt-get install libevent-dev libglib2.0-dev automake libboost-dev libssl-dev python-dev # 编译thrift
apt-get install gawk libboost-system-dev libboost-filesystem-dev libtool # 编译 scribe
apt-get install git # 额 git

编译安装thrift

Apache Thrift ™Apache.org的产品,目前的版本是v0.9.0,恩,没有问题,开搞:

wget https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz
tar xvf thrift-0.9.0.tar.gz
cd thrift-0.9.0
./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"
make
make install

注释:至于为什么要加CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"的参数,可以参考StackOverflow上的解答

注释2:如果你有俩cpu核心可以使用make -j2提升编译速度,如果你有4个,请使用-j4

编译安装fb303

这货还是比较好装的:

cd contrib/fb303/
./bootstrap.sh
make 
make install

编译安装scribe

这货也比较好装,复制粘贴党请先自己先执行一下cd

git clone git://github.com/facebook/scribe.git
cd scribe
./bootstrap.sh
./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DBOOST_FILESYSTEM_VERSION=2"
make 
make install

到这里应该就ok了

注:这里的参数前面俩是已经说过的,后面那个是因为系统用的bootstrap版本是1.42,我们得给他个提示

跑起来试一试

先建立一个scribe.conf文件,内容如下:

port=1463
max_msg_per_second=2000000
check_interval=3

<store>
  category=default

  type=file
  fs_type=std
  file_path=./logs/
  base_filename=tmpdata
  max_size=1000000000
</store>

说的是用文件的形式把日志放到./logs/目录下。 然后走之:

scribed -c scribe.conf

[Tue Dec 18 16:37:55 2012] "STATUS: STARTING" 
[Tue Dec 18 16:37:55 2012] "STATUS: configuring" 
......
[Tue Dec 18 16:37:55 2012] "STATUS: ALIVE" 
[Tue Dec 18 16:37:55 2012] "Starting scribe server on port 1463" 
Thrift: Tue Dec 18 16:37:55 2012 TNonblockingServer: Serving on port 1463, 1 io threads.
Thrift: Tue Dec 18 16:37:55 2012 TNonblockingServer: using libevent 1.4.13-stable method epoll
Thrift: Tue Dec 18 16:37:55 2012 TNonblocking: IO thread #0 registered for listen.
Thrift: Tue Dec 18 16:37:55 2012 TNonblocking: IO thread #0 registered for notify.
Thrift: Tue Dec 18 16:37:55 2012 TNonblockingServer: IO thread #0 entering loop...

恭喜你,你成功了,成功的消磨了人生中的30min.

上一篇: 查看远端的端口是否通畅3个简单实用案例   下一篇: PostgreSQL 的PHP扩展安装错误

提交疑问

回顶部