Scribe的安裝
一、安裝前提:
1:
libevent
解壓縮安裝
./configure
make
make install
2:
boost (版本>=1.36)
解壓縮安裝
./configure
make
make install
3:Facebook基礎服務
thrift (版本>=0.5.0)
fb303
先安裝thrift,再安裝fb303
解壓並進入thrift目錄
./bootstrap.sh
./configure –with-boost=/usr/local/include/boost/ -- with-php-config=/phppath /bin/php-config
make
make install
在當前目錄 cd 到contrib/fb303/ :
./bootstrap.sh
./configure –with-boost=/usr/local/include/boost/
make
make install
4:
Hadoop(可選 版本>=0.19.1)
5:
設置PYTHON_PATH
二、安裝Scribe
./bootstrap
./configure –with-boost=/usr/local/include/boost/ --enable-hdfs
make
make install
注意:
可以通過./configure --help 查看configure選項
例如
#禁用優化,打開調試模式(默認情況下是打開優化的)
./configure --disable-opt
# To disable static libraries and enable shared libraries. [ default has been set to static]
./configure --disable-static
# To build scribe with Hadoop support
./configure --enable-hdfs
# If the build process cannot find your Hadoop/Jvm installs, you may need to specify them manually:
./configure --with-hadooppath=/usr/local/hadoop --enable-hdfs CPPFLAGS="-I/usr/local/java/include -I/usr/local/java/include/linux" LDFLAGS="-ljvm -lhdfs"
# To set thrift home to a non-default location
./configure --with-thriftpath=/myhome/local/thrift
# If Boost is installed in a non-default location or there are multiple Boost versions
# installed, you will need to specify the Boost path and library names
./configure --with-boost=/usr/local --with-boost-system=boost_system-gcc40-mt-1_36 --with-boost-filesystem=boost_filesystem-gcc40-mt-1_36
三、配置環境變量
BOOST_ROOT=/usr/local/include/boost/
LD_LIBRARY_PATH=/usr/local/include/boost/lib::/usr/lob:/usr/local/lib
四、使用例子
這個例子展示瞭如何配置和發送信息到Scribe服務器
1:創建一個目錄用於存放日誌信息
mkdir /tmp/scribetest
2:使example1.conf中的配置信息啓動Scribe服務
./bin/scribed ./../examples/example1.conf
3:打開一個新的終端控制檯,使用scribe_cat發送一條信息到Scribe
echo "hello..." | ./bin/scribe_cat test
4:確定日誌是否被記錄
cat /tmp/scribetest/test/test_current
5:使用root查看Scribe的運行狀態
./bin/scribe_ctrl status
6:查看Scribe計算器
./bin/scribe_ctrl counters
7:關閉 Scribe
./bin/scribe_ctrl stop
附example1.conf :