[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>
页:
[1]