lidonghe 发表于 2015-11-28 16:38:14

日志统计scribe安装简介

  在centos 6安装,操作步骤如下:
  1、gcc和gcc-c++

系统有gcc,版本不要太老,至少3.4.6版本是不行的,我后来用的gcc是4.1.2


2、ruby(不知版本有啥要求,我用的1.8.5)

包括ruby和ruby-devel


3、python(不知版本有啥要求,我用的2.4.3)

包括python和python-devel


4、libevent(不知版本有啥要求,我用的1.4)

包括libevent和libevent-devel

注:如果忘了libevent-devel会导致返工的。。。


还有其它一些依赖,比如openssl-devel, bison, autoconf(>2.65版本), bzip2-devel, automake等,见后面的“遇到的问题及解决办法”


5、boost

它需要依赖gcc、g++(即gcc-c++)、openssl-devel、bzip2-devel

可以先查看一下机器上也许有boost了,比如可以用find / -name "*boost*"

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

tar jxvf boost_1_45_0.tar.bz2

cd boost_1_45_0

./bootstrap.sh

./bjam install

装完要加环境变量

export BOOST_ROOT=/usr/local

export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib

这种方式改比较不靠谱,我就修改/etc/profile,加上这两行,然后source /etc/profile搞定的。


6、Trift(依赖yum install automake byacc libtool flex bison)

A、装Trift

wget http://mirror.bjtu.edu.cn/apache//thrift/0.7.0/thrift-0.7.0.tar.gz

tar zxvf thrift-0.7.0.tar.gz

cd thrift-0.7.0.tar.gz

./configure

make

make install


B、装fb303

cd contrib/fb303/

./bootstrap.sh

./configure

make

make install


C、运行一下Thrift的例子

在tutorial目录下

thrift -r –gen cpp tutorial.thrift

cd cpp

make

./CppServer 可以启动Server

./CppClient 可以启动Client


6、scribe

https://github.com/halorgium/scribe-install/downloads这里有zip和tar.gz,下一个

解压后进入scribe目录

./bootstrap.sh

./configure --prefix=/usr/local/scribe

make

make install



验证scribe是否安装成功:

1、配置scribe

首先我的scribe装在/usr/local/scribe中,在该目录/usr/local/scribe下,

mkdir conf

然后将facebook-scribe下的examples/example1.conf拷到conf中


2、启动scribe

cd /usr/local/scribe

bin/scribed -c conf/example1.conf

出现如下提示,启动成功:

"STATUS: STARTING"
"STATUS: configuring"
&quot;got configuration data from file <conf/example1.conf>&quot;
&quot;CATEGORY : default&quot;
&quot;Creating default store&quot;
&quot;configured <1> stores&quot;
&quot;STATUS: &quot;
&quot;STATUS: ALIVE&quot;
&quot;Starting scribe server on port 1463&quot;
Thrift: Wed Nov9 10:35:52 2011 libevent 1.4.13-stable method epoll



3、验证scribe能正常工作

examples文件夹下有Readme,按照这个操作就行,简单来说

先启动scribe:

scribe安装路径/bin/scribed -c scribe解压路径/examples/example1.conf

出现提示信息:

&quot;STATUS: STARTING&quot;

&quot;STATUS: configuring&quot;

&quot;got configuration data from file <conf/example1.conf>&quot;

&quot;CATEGORY : default&quot;

&quot;Creating default store&quot;

&quot;configured <1> stores&quot;

&quot;STATUS: &quot;

&quot;STATUS: ALIVE&quot;

&quot;Starting scribe server on port 1463&quot;


然后在examples目录下,发个数据给scribe

echo &quot;hello world test&quot; | ./scribe_cat test

发现scribe出现提示信息:

&quot; Creating new category store from model default&quot;

&quot;store thread starting&quot;

&quot; Opened file </tmp/scribetest/test/test_00000> for writing&quot;

&quot; Opened file </tmp/test/test_00000> for writing&quot;

&quot; Changing state from <DISCONNECTED> to <SENDING_BUFFER>&quot;

&quot; read <0> entries of <0> bytes from file </tmp/test/test_00000>&quot;

&quot; No more buffer files to send, switching to streaming mode&quot;

&quot; Changing state from <SENDING_BUFFER> to <STREAMING>&quot;



查看log

cat /tmp/scribetest/test/test_00000

出现:

hello world test


表示安装成功。
页: [1]
查看完整版本: 日志统计scribe安装简介