上一篇了解了scribe的源码安装法,在安装过程中boost库和后面的scribe在安装时出现多次的库依赖问题,为了更快速的部署scribe,打算boost采用apt安装(只要版本大于1.33即可)。
1 提前安装好相关依赖包
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
2 安装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 CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"
make
make install
cd contrib/fb303/
./bootstrap.sh
make
make install
3 安装scribe
git clone https://github.com/facebook/scribe
cd scribe/
cd src/
g++ -Wall -O3 -L/usr/lib -o scribed store.o store_queue.o conf.o file.o conn_pool.o scribe_server.o network_dynamic_config.o dynamic_bucket_updater.o env_default.o -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lfb303 -lthrift -lthriftnb -levent -lpthread libscribe.a libdynamicbucketupdater.a -lboost_system-mt -lboost_filesystem-mt
cd ..
./bootstrap.sh
./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DBOOST_FILESYSTEM_VERSION=2"
make
make install
错误解决
安装scribe在make的时候出现如下错误:
undefined reference to `boost::system::generic_category()'
undefined reference to `boost::system::generic_category()'
undefined reference to `boost::system::system_category()'
解决办法1:
进入scribe源码包的scr目录执行如下:
g++ -Wall -O3 -L/usr/lib -o scribed store.o store_queue.o conf.o file.o conn_pool.o scribe_server.o network_dynamic_config.o dynamic_bucket_updater.o env_default.o -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lfb303 -lthrift -lthriftnb -levent -lpthread libscribe.a libdynamicbucketupdater.a -lboost_system-mt -lboost_filesystem-mt
解决办法2:
在configure的时候加上-lboost_system-mt -lboost_filesystem-mt参数
-DBOOST_FILESYSTEM_VERSION=2 参数只有在你的boost版本大于1.46的时候需要添加
测试时错误:
root@py-6:~/scribe/examples# echo "hello world"|./scribe_cat test
Traceback (most recent call last):
File "./scribe_cat", line 24, in <module>
from scribe import scribe
ImportError: No module named scribe
解决办法
在debian/ubuntu系列安装完毕后,python的scribe模块并没有在默认搜索路径中,所以:
cp -a /usr/lib/python2.7/site-packages/* /usr/lib/python2.7/dist-packages/
库连接错误:
root@vm-6:~/scribe# scribed -c examples/example1.conf
scribed: error while loading shared libraries: libthrift-0.9.0.so: cannot open shared object file: No such file or directory
ldd /usr/local/bin/scribed 发现
libthrift-0.9.0.so => not found
libthriftnb-0.9.0.so => not found
在/usr/local/lib/中都已经有该so文件,因为是环境变量有问题
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
更进一步的做法是把scribe做成deb包
参考连接:
http://www.nosql.se/2012/10/tutorial-installing-scribe-on-debianubuntu/
https://groups.google.com/forum/#!msg/scribe-server/cPGx9JkyWE8/SbGzl7Fd1P8J