在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
出现如下提示,启动成功:
[Wed Nov 9 10:35:52 2011] "STATUS: STARTING"
[Wed Nov 9 10:35:52 2011] "STATUS: configuring"
[Wed Nov 9 10:35:52 2011] "got configuration data from file <conf/example1.conf>"
[Wed Nov 9 10:35:52 2011] "CATEGORY : default"
[Wed Nov 9 10:35:52 2011] "Creating default store"
[Wed Nov 9 10:35:52 2011] "configured <1> stores"
[Wed Nov 9 10:35:52 2011] "STATUS: "
[Wed Nov 9 10:35:52 2011] "STATUS: ALIVE"
[Wed Nov 9 10:35:52 2011] "Starting scribe server on port 1463"
Thrift: Wed Nov 9 10:35:52 2011 libevent 1.4.13-stable method epoll
3、验证scribe能正常工作
examples文件夹下有Readme,按照这个操作就行,简单来说
先启动scribe:
scribe安装路径/bin/scribed -c scribe解压路径/examples/example1.conf
出现提示信息:
[Wed Dec 21 17:12:01 2011] "STATUS: STARTING"
[Wed Dec 21 17:12:01 2011] "STATUS: configuring"
[Wed Dec 21 17:12:01 2011] "got configuration data from file <conf/example1.conf>"
[Wed Dec 21 17:12:01 2011] "CATEGORY : default"
[Wed Dec 21 17:12:01 2011] "Creating default store"
[Wed Dec 21 17:12:01 2011] "configured <1> stores"
[Wed Dec 21 17:12:01 2011] "STATUS: "
[Wed Dec 21 17:12:01 2011] "STATUS: ALIVE"
[Wed Dec 21 17:12:01 2011] "Starting scribe server on port 1463"
然后在examples目录下,发个数据给scribe
echo "hello world test" | ./scribe_cat test
发现scribe出现提示信息:
[Wed Dec 21 17:14:30 2011] "[test] Creating new category store from model default"
[Wed Dec 21 17:14:30 2011] "store thread starting"
[Wed Dec 21 17:14:30 2011] "[test] Opened file </tmp/scribetest/test/test_00000> for writing"
[Wed Dec 21 17:14:30 2011] "[test] Opened file </tmp/test/test_00000> for writing"
[Wed Dec 21 17:14:30 2011] "[test] Changing state from <DISCONNECTED> to <SENDING_BUFFER>"
[Wed Dec 21 17:14:30 2011] "[test] read <0> entries of <0> bytes from file </tmp/test/test_00000>"
[Wed Dec 21 17:14:30 2011] "[test] No more buffer files to send, switching to streaming mode"
[Wed Dec 21 17:14:30 2011] "[test] Changing state from <SENDING_BUFFER> to <STREAMING>"
查看log
cat /tmp/scribetest/test/test_00000
出现:
hello world test
表示安装成功。