[2] Scribe的安裝和簡單使用例子

 

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 :

port=1463
max_msg_per_second=2000000
check_interval=3

# DEFAULT
<store>
category=default
type=buffer

target_write_size=20480
max_write_interval=1
buffer_send_rate=2
retry_interval=30
retry_interval_range=10

<primary>
type=file
fs_type=std
file_path=/tmp/scribetest
base_filename=thisisoverwritten
max_size=1000000
add_newlines=1
</primary>

<secondary>
type=file
fs_type=std
file_path=/tmp
base_filename=thisisoverwritten
max_size=3000000
</secondary>
</store>
發佈了24 篇原創文章 · 獲贊 0 · 訪問量 6372
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章