[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>
### 安装与配置 Scribe Chrome 扩展 要在 Chrome 浏览器中安装使用 Scribe 插件,用户可以通过 Chrome 网上商店直接搜索并添加扩展。具体操作为在浏览器地址栏输入“Chrome 网上应用店”,然后在搜索框中输入“Scribe AI”或相关关键词,找到官方发布的插件后点击“添加到 Chrome”即可完成安装[^3]。 安装完成后,Scribe 的图标会出现在浏览器右上角的扩展工具栏中。此时点击该图标,可以打开插件的侧边栏界面。如果尚未注册账号,需要先进行注册并登录以激活插件功能[^3]。登录之后,可以在浏览器侧边栏中看到一个抓取框,用于记录网页操作流程。 要开始记录操作步骤,点击右侧的“Start Capture”按钮,插件将自动跟踪用户的每一步操作,并生成图文说明。例如,在测试某个思维导图工具时,Scribe 会在侧边栏中实时显示操作路径,包括鼠标点击的具体位置页面变化情况,确保每个细节都被准确记录下来[^1]。 记录完成后,点击“Stop Capture”按钮,Scribe 将自动生成一个包含完整截图描述的文档。该文档可以在插件内部进行编辑、复制或导出。需要注意的是,免费版本仅支持 PDF 格式导出,其他格式如 Word 或 HTML 需要订阅付费版本才能使用[^3]。 此外,Scribe 还提供了 API 接口,允许开发者将其集成到现有系统中。例如,通过调用 SDK 可以实现自动化记录、远程控制等功能,适用于企业级的知识管理或培训材料制作场景。以下是一个示例代码片段,展示如何通过假想的 Node.js 模块调用 Scribe SDK 启动记录会话: ```javascript const scribe = require('scribe-sdk'); async function startRecording() { try { const session = await scribe.startSession({ apiKey: 'YOUR_API_KEY', projectId: 'PROJECT_ID' }); console.log(`Recording started with session ID: ${session.id}`); } catch (error) { console.error(`Failed to start recording:`, error); } } startRecording(); ``` 以上代码仅为示意,实际使用时应参考 Scribe 官方提供的最新 API 文档进行调整。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值