q9989 发表于 2017-5-23 14:12:57

scribe安装记录

折腾了快2天,终于装上了,内流满面
scribe安装较复杂,官网无详细安装手册,所以自己装成功了还是记录下吧~
1.系统版本:基于CentOS-6.3-x86_64
2.gcc
   安装版本为4.4.6 官方要求>=3.3.5,但低于4会有各种问题
    g++ 如果g++的结果是no input files表示已安装,不是则安装:
    yum -y install gcc+gcc-c++

3.flex
   确认是否安装,无则:
   yum -y install flex

4.pkgconfig
   确认是否安装,无则:
   yum -y install pkgconfig

5.m4
   确认是否安装,无则:
   yum -y install m4

6.python
   安装版本为2.6.6
   
yum -y install python.x86_64
yum -y install python-devel.x86_64


7.ruby
   安装版本为1.8.7
   
yum -y install ruby.x86_64
yum -y install ruby-devel.x86_64


8.libevent
   安装版本为1.4.13
   
yum -y install libevent.x86_64
yum -y install libevent-devel.x86_64


9.openssl-devel
   安装版本为1.0.0
   
yum -y install openssl.x86_64
yum -y install openssl-devel.x86_64


10.bz2-devel
   安装版本为1.0.5
   
yum -y install openssl.x86_64
yum -y install openssl-devel.x86_64


11.zlib-devel
   安装版本为1.2.3
   
yum -y install zlib.x86_64
yum -y install zlib-devel.x86_64


12.bison
   安装版本为2.4.1
   
yum -y install bison.x86_64
yum -y install bison-devel.x86_64


13.automake
   安装版本为2.69   thrift要求>=2.65
   
wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar zxvf autoconf-2.69.tar.gz -C /usr/local/
cd /usr/local/autoconf-2.69/
./configure --prefix=/usr
make
make install


14.autoconf
   安装版本为1.10   thrift安装警告,要求>=1.9
   
wget http://ftp.gnu.org/gnu/automake/automake-1.10.tar.gz
tar zxvf automake-1.10.tar.gz -C /usr/local/
cd /usr/local/automake-1.10
./configure --prefix=/usr
make
make install


15.libtool
   安装版本为2.24
   
wget http://ftp.gnu.org/gnu/libtool/libtool-2.2.4.tar.gz
tar zxvf automake-1.10.tar.gz -C /usr/local/
cd /usr/local/automake-1.10
./configure --prefix=/usr
make
make install


16.安装boost
   安装版本为1.45.0 官方版本要求>=1.36
   确认系统中目前没有别的boost版本,有必须清楚干净,否则多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 -C /usr/local/
cd /usr/local/boost_1_45_0
./bootstrap.sh
./bjam install

   在/etc/profile中加入:
   
export BOOST_ROOT=/usr/local
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib
source /etc/profile


17.thrift + fb303
   安装版本为0.7.0官网要求>=0.5.0
   
wget http://archive.apache.org/dist/thrift/0.7.0/thrift-0.7.0.tar.gz
tar zxvf thrift-0.7.0.tar.gz -C /usr/local/
cd /usr/local/thrift-0.7.0
chmod +x configure
./configure
make
make install


   开始安装fb303 cd contrib/fb303
   
chmod +x bootstrap.sh
./bootstrap.sh
./configure
make
make install


18.scribe
   下载地址https://github.com/facebook/scribe/downloads,下载当前版本63e4824,(版本2.2安装失败)
   
tar zxvf facebook-scribe-63e4824.tar.gz -C /usr/local/
cd facebook-scribe-63e4824
./bootstrap.sh
./configure --prefix=/usr/local/scribe
make
make install


检验安装是否成功(纯转):

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"
"got configuration data from file <conf/example1.conf>"
"CATEGORY : default"
"Creating default store"
"configured <1> stores"
"STATUS: "
"STATUS: ALIVE"
"Starting scribe server on port 1463"
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
出现提示信息:
"STATUS: STARTING"
"STATUS: configuring"
"got configuration data from file <conf/example1.conf>"
"CATEGORY : default"
"Creating default store"
"configured <1> stores"
"STATUS: "
"STATUS: ALIVE"
"Starting scribe server on port 1463"
然后在examples目录下,发个数据给scribe
echo "hello world" | ./scribe_cat test
发现scribe出现提示信息:

" Creating new category store from model default"
"store thread starting"
" Opened file </tmp/scribetest/test/test_00000> for writing"
" Opened file </tmp/test/test_00000> for writing"
" Changing state from <DISCONNECTED> to <SENDING_BUFFER>"
" read <0> entries of <0> bytes from file </tmp/test/test_00000>"
" No more buffer files to send, switching to streaming mode"
" Changing state from <SENDING_BUFFER> to <STREAMING>"

查看log
cat /tmp/scribetest/test/test_00000
出现:
hello world
表示安装成功。

4、用rb验证scribe能正常工作(这一步并不是必须的。3验证成功后scribe就已经正常工作了。)
cd /usr/local/scribe
mkdir testapp
cd testapp
/usr/local/bin/thrift -o . -I /usr/local/share/ --gen rb /opt/apps_install/scribe/facebook-scribe-6600084/if/scribe.thrift
/usr/local/bin/thrift -o . -I /usr/local/share/ --gen rb /usr/local/share/fb303/if/fb303.thrift
mv get_rb scribe
此时/usr/local/scribe/testapp/scribe下有6个文件
-rw-r--r-- 1 root root 15879 Nov9 10:17 facebook_service.rb
-rw-r--r-- 1 root root   140 Nov9 10:17 fb303_constants.rb
-rw-r--r-- 1 root root   414 Nov9 10:17 fb303_types.rb
-rw-r--r-- 1 root root   141 Nov9 10:17 scribe_constants.rb
-rw-r--r-- 1 root root1943 Nov9 10:17 scribe.rb
-rw-r--r-- 1 root root   643 Nov9 10:17 scribe_types.rb

然后再testapp中新建一个test.rb文件,内容是
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/scribe')
require 'scribe'
begin
   socket = Thrift::Socket.new('localhost', 1463)
   transport = Thrift::FramedTransport.new(socket)
   protocol = Thrift::BinaryProtocol.new(transport, false)
   client = Scribe::Client.new(protocol)
   transport.open()
   log_entry = LogEntry.new(:category => 'test', :message => 'This is a test message')
   client.Log()
   transport.close()
rescue Thrift::Exception => tx
   print 'Thrift::Exception: ', tx.message, "\n"
end
修改test.rb的执行权限,chmod +x test.rb
执行test.rb,./test.rb
scribe出现提示信息:
" Creating new category store from model default"
"store thread starting"
" Opened file </tmp/scribetest/test/test_00000> for writing"
" Opened file </tmp/test/test_00000> for writing"
" Changing state from <DISCONNECTED> to <SENDING_BUFFER>"
" read <0> entries of <0> bytes from file </tmp/test/test_00000>"
" No more buffer files to send, switching to streaming mode"
" Changing state from <SENDING_BUFFER> to <STREAMING>"
查看/tmp/scribetest/test/test_00000,它的内容是:
This is a test message
表示scribe工作正常啦~~

对这位博主表示无与伦比的感谢:
http://abentotoro.blog.sohu.com/190515962.html
页: [1]
查看完整版本: scribe安装记录