上一篇简要的了解了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安装)
安装相关依赖包
1
apt-get install build-essential bison flex libboost-all-dev
2
apt-get install libevent-dev libglib2.0-dev libboost-dev libssl-dev python-dev
3
apt-get install libboost-system-dev libboost-filesystem-dev libtool
4
apt-get install git automake
1 安装boost
1
wget 'http://nchc.dl.sourceforge.net/project/boost/boost/1.45.0/boost_1_45_0.tar.gz'
2
tar zxvf boost_1_45_0.tar.gz
3
cd boost_1_45_0
4
./bjam -s HAVE_ICU=1 --prefix=/usr/local/boost --includedir=/usr/local/boost/include --libdir=/usr/local/boost/lib
5
./bjam install --prefix=/usr/local/boost
6
export BOOST_ROOT=/usr/local/boost
7
export LD_LIBRARY_PATH=/usr/local/boost/lib:/usr/lib:/usr/local/lib
2 安装thrift&&fb303(fb303在thrift源码包中)
01
wget 'https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz'
02
tar zxvf thrift-0.9.0.tar.gz
03
cd thrift-0.9.0
04
./configure --with-boost=/usr/local/boost
05
make
06
make install
07
08
cd contrib/fb303
09
./bootstrap.sh --with-boost=/usr/local/boost/
10
make
11
make install
3 安装scribe
1
git clone https://github.com/facebook/scribe
2
cd scribe
3
./bootstrap.sh --with-boost=/usr/local/boost --prefix=/usr/local/scribe
4
./configure --with-boost=/usr/local/boost --prefix=/usr/local/scribe CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DBOOST_FILESYSTEM_VERSION=2"
5
make
6
make install
4 在debian中需要做如下调整,因为生成的scribe模块并未在默认的搜索路径中
1
cp -a /usr/lib/python2.6/site-packages/* /usr/lib/python2.6/dist-packages/
5 测试
01
#配置scribe配置文件,scribe源码中有简单的模版
02
mkdir /usr/local/scribe/conf
03
cp scribe/examples/example1.conf /usr/local/scribe/conf
04
cp scribe/examples/scribe_cat /sbin/
05
cp scribe/examples/scribe_ctrl /sbin/
06
#启动scribe
07
cd /usr/local/scribe/bin/
08
./scribed -c ../conf/example1.conf
09
#出现如下则说明启动成功
10
[Fri Feb 22 21:12:11 2013] "STATUS: STARTING"
11
[Fri Feb 22 21:12:11 2013] "STATUS: configuring"
12
[Fri Feb 22 21:12:11 2013] "got configuration data from file <../conf/example1.conf>"
13
[Fri Feb 22 21:12:11 2013] "CATEGORY : default"
14
[Fri Feb 22 21:12:11 2013] "Creating default store"
15
[Fri Feb 22 21:12:11 2013] "configured <1> stores"
16
[Fri Feb 22 21:12:11 2013] "STATUS: "
17
[Fri Feb 22 21:12:11 2013] "STATUS: ALIVE"
18
[Fri Feb 22 21:12:11 2013] "Starting scribe server on port 1463"
19
Thrift: Fri Feb 22 21:12:11 2013 TNonblockingServer: Serving on port 1463, 1 io threads.
20
Thrift: Fri Feb 22 21:12:11 2013 TNonblockingServer: using libevent 1.4.13-stable method epoll
21
Thrift: Fri Feb 22 21:12:11 2013 TNonblocking: IO thread #0 registered for listen.
22
Thrift: Fri Feb 22 21:12:11 2013 TNonblocking: IO thread #0 registered for notify.
23
Thrift: Fri Feb 22 21:12:11 2013 TNonblockingServer: IO thread #0 entering loop...
24
25
#另开窗口进行测试
26
mkdir /tmp/scribetest
27
echo "hello world"| scribe_cat test
28
#可以看到输入scribe的内容
29
cat /tmp/scribetest/test/test_current
30
#查看scribe的状态
31
scribe_ctrl status
32
#停止和重新加载scribe
33
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
[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安装)
安装相关依赖包
1
apt-get install build-essential bison flex libboost-all-dev
2
apt-get install libevent-dev libglib2.0-dev libboost-dev libssl-dev python-dev
3
apt-get install libboost-system-dev libboost-filesystem-dev libtool
4
apt-get install git automake
1 安装boost
1
wget 'http://nchc.dl.sourceforge.net/project/boost/boost/1.45.0/boost_1_45_0.tar.gz'
2
tar zxvf boost_1_45_0.tar.gz
3
cd boost_1_45_0
4
./bjam -s HAVE_ICU=1 --prefix=/usr/local/boost --includedir=/usr/local/boost/include --libdir=/usr/local/boost/lib
5
./bjam install --prefix=/usr/local/boost
6
export BOOST_ROOT=/usr/local/boost
7
export LD_LIBRARY_PATH=/usr/local/boost/lib:/usr/lib:/usr/local/lib
2 安装thrift&&fb303(fb303在thrift源码包中)
01
wget 'https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz'
02
tar zxvf thrift-0.9.0.tar.gz
03
cd thrift-0.9.0
04
./configure --with-boost=/usr/local/boost
05
make
06
make install
07
08
cd contrib/fb303
09
./bootstrap.sh --with-boost=/usr/local/boost/
10
make
11
make install
3 安装scribe
1
git clone https://github.com/facebook/scribe
2
cd scribe
3
./bootstrap.sh --with-boost=/usr/local/boost --prefix=/usr/local/scribe
4
./configure --with-boost=/usr/local/boost --prefix=/usr/local/scribe CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DBOOST_FILESYSTEM_VERSION=2"
5
make
6
make install
4 在debian中需要做如下调整,因为生成的scribe模块并未在默认的搜索路径中
1
cp -a /usr/lib/python2.6/site-packages/* /usr/lib/python2.6/dist-packages/
5 测试
01
#配置scribe配置文件,scribe源码中有简单的模版
02
mkdir /usr/local/scribe/conf
03
cp scribe/examples/example1.conf /usr/local/scribe/conf
04
cp scribe/examples/scribe_cat /sbin/
05
cp scribe/examples/scribe_ctrl /sbin/
06
#启动scribe
07
cd /usr/local/scribe/bin/
08
./scribed -c ../conf/example1.conf
09
#出现如下则说明启动成功
10
[Fri Feb 22 21:12:11 2013] "STATUS: STARTING"
11
[Fri Feb 22 21:12:11 2013] "STATUS: configuring"
12
[Fri Feb 22 21:12:11 2013] "got configuration data from file <../conf/example1.conf>"
13
[Fri Feb 22 21:12:11 2013] "CATEGORY : default"
14
[Fri Feb 22 21:12:11 2013] "Creating default store"
15
[Fri Feb 22 21:12:11 2013] "configured <1> stores"
16
[Fri Feb 22 21:12:11 2013] "STATUS: "
17
[Fri Feb 22 21:12:11 2013] "STATUS: ALIVE"
18
[Fri Feb 22 21:12:11 2013] "Starting scribe server on port 1463"
19
Thrift: Fri Feb 22 21:12:11 2013 TNonblockingServer: Serving on port 1463, 1 io threads.
20
Thrift: Fri Feb 22 21:12:11 2013 TNonblockingServer: using libevent 1.4.13-stable method epoll
21
Thrift: Fri Feb 22 21:12:11 2013 TNonblocking: IO thread #0 registered for listen.
22
Thrift: Fri Feb 22 21:12:11 2013 TNonblocking: IO thread #0 registered for notify.
23
Thrift: Fri Feb 22 21:12:11 2013 TNonblockingServer: IO thread #0 entering loop...
24
25
#另开窗口进行测试
26
mkdir /tmp/scribetest
27
echo "hello world"| scribe_cat test
28
#可以看到输入scribe的内容
29
cat /tmp/scribetest/test/test_current
30
#查看scribe的状态
31
scribe_ctrl status
32
#停止和重新加载scribe
33
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