Scribe配置

[url]https://github.com/facebook/scribe/wiki/Scribe-Configuration[/url]

安装目录facebook-scribe-2ee14d3/examples下

examples/
├── example1.conf #模拟服务端
├── example2central.conf #在同一台机器模拟服务端的配置
├── example2client.conf #在同一台机器模拟客户端的配置
├── hdfs_example2.conf
├── hdfs_example.conf
├── README
├── scribe_cat #python客户端
└── scribe_ctrl #管理scribe实例的工具


[size=X-large]Scribe can be configured with[/size]
1.scribe运行时的配置文件可以在命令行用-c指定
2.默认的配置位置在env_default.h中的DEFAULT_CONF_FILE_LOCATION设置(/usr/local/scribe/scribe.conf)

[size=X-large]Global Configuration Variables[/size]
[b]port[/b]
1.设置scribe server监听在哪个端口上
2.默认是0,可以在命令行通过-p指定。

[b]max_msg_per_second [/b]
1.used in scribeHandler::throttleDeny
2.default 0
3.the default value is 0 and this parameter is ignored if the value is 0. With recent changes this parameter has become less relevant, and max_queue_size should be the parameter used for throttling business

[b]max_queue_size[/b] in bytes
1.设置消息队列的大小,用在scribeHandler::Log中
2.默认值是5,000,000 bytes。

[b]check_interval[/b] in seconds
1.设置多长时间检测一次存储,
2.默认值是5秒。

[b]new_thread_per_category[/b] yes/no
1.值如果是yes,则会为每一个category创建一个线程,如果是no,则所有定义的store只创建一个线程,
2.对于prefix stores或者default store,如果值是no,则会导致所有匹配这个category的消息都由一个单独的存储来处理,否则,将为每一个唯一的category创建存储。
3.默认yes

[b]num_thrift_server_threads [/b]
1.监听进入消息的线程数
2.默认是3。

Example:

port=1463
max_msg_per_second=2000000
max_queue_size=10000000
check_interval=3


[size=x-large]Store Configuration[/size]
scribe server根据配置文件中store的定义来记录消息,每一个store必须指定消息category用来处理三种异常情况:
[b]default store [/b]
默认category处理任何不能被其他store处理的category,只能有一个默认store
[list]
[*]category=default
[/list]
[b]prefix stores [/b]
如果一个指定的category以*结尾,这个存储将处理所有以指定前缀开头的category 。
[list]
[*]category=web*
[/list]
[b]multiple categories [/b]
在一个store的定义中可以使用'categories='创建多个store
[list]
[*]categories=rock paper* scissors
[/list]
在上面三种情况下,scribe将为每一个唯一的category创建一个子目录,除非new_thread_per_category被设置为false。


[size=x-large]Store Configuration Variables[/size]
[b]category [/b]
设置哪些消息被这个store处理。
[b]type [/b]
[list]
[*]file
[*]buffer
[*]network
[*]bucket
[*]thriftfile
[*]null
[*]mutil
[/list]。

[b]target_write_size[/b] 默认是16,384 bytes
消息在被处理之前,category的消息队列可以增长到多大。

[b]max_batch_size[/b]默认是1,024,000 bytes
在内存存储队列中一次可以被处理的数据量。

[b]max_write_interval [/b] 默认是1秒
决定在这些消息处理之前在给定category的消息队列可以用多长时间。

[b]must_succeed [/b]yes/no
1.如果一个store处理消息失败,是否重新进入消息队列排队。
2.如果设置为no,一个store不能处理这些消息的话,消息将被丢弃。
3.建议:使用缓存来指一个定二级存储来处理失败的日志。
4.默认是yes

Example:

<store>
category=statistics
type=file
target_write_size=20480
max_write_interval=2
</store>


[size=x-large]File Store Configuration[/size]
file store把信息写入文件中。

[b]file_path[/b]
默认路径是‘/tmp’。

[b]base_filename [/b]
默认category名称。

[b]use_hostname_sub_directory[/b]yes/no, default no
是否使用server的hostname建立子目录

[b]sub_directory[/b] string
使用指定的名称创建子目录。

[b]rotate_period[/b] “hourly”, “daily”, “never”, or number[suffix]; “never” by default
1.设置多久创建一个文件,
2.suffix可以是“s”, “m”, “h”, “d”, “w”,‘s’是默认值。

[b]rotate_hour[/b]0-23, 1 by default
如果rotate_period是daily,设置每天何时创建新文件

[b]rotate_minute [/b] 0-59, 15 by default
如果rotate_period是daily或者hourly,设置一个小时多久后可以创建新文件,值可以是0-59,默认是15。

[b]max_size[/b]1,000,000,000 bytes by default
在轮转一个文件前,该文件可以增长到多大

[b]write_meta[/b]“yes” or anything else; false by default
如果文件被轮转,最后一行将包含"scribe_meta",跟着就是下一个文件名。

[b]fs_type [/b]
支持两种类型std和hdfs,默认是std。

[b]chunk_size[/b]
默认是0,如果一个chunk大小被指定,在文件内没有消息能够跨越chunk的边界,除非有消息的大小超过chunk的大小。

[b]add_newlines [/b] 0 or 1, 0 by default
默认是0,如果是1,则在每行后面加入换行符。

[b]create_symlink [/b] “yes” or anything else; “yes” by default
默认值是yes,如果是真,则维护一个符号连接到最近被写入的文件。

[b]write_stats [/b] yes/no, yes by default
是否对每一个store创建一个scribe_stats文件用来跟踪文件的写入轨迹,默认yes。

[b]max_write_size[/b]
1000000 bytes by default. The file store will try to flush the data out to the file system in chunks of max_write_size of bytes. max_write_size cannot be more than max_size. Say due to target_write_size a certain number of messages were buffered. And then the file store was called to save these messages. The file-store will save these messages at least max_write_size bytes sized chunks at a time. The last write that the file store will make can be smaller than max_write_size.


Example:

<store>
category=sprockets
type=file
file_path=/tmp/sprockets
base_filename=sprockets_log
max_size=1000000
add_newlines=1
rotate_period=daily
rotate_hour=0
rotate_minute=10
max_write_size=4096
</store>


[size=x-large]Network Store Configuration[/size]
network store向其它scribe server发送消息,Scribe保持持久的链接打开以至于它能够发送消息。在正常运行的情况下,scribe会基于当前缓存中存在多少条消息等待发送而分批次的发送。

[b]remote_host [/b]
远程主机的ip或者名称。

[b]remote_port[/b]
远程主机的端口。

[b]timeout[/b]
socket超时时间,毫秒,默认为DEFAULT_SOCKET_TIMEOUT_MS,在store.h中设定默认为5000毫秒。

[b]use_conn_pool[/b]
是否使用连接池代替为每一个远程主机打开的链接,默认是false。

Example:

<store>
category=default
type=network
remote_host=hal
remote_port=1465
</store>


[size=x-large]Buffer Store Configuration[/size]
buffer store中包含两个子store:primary和secondary。日志会先尝试写到primary store中,如果primary store出现故障,则scribe会将日志暂存到secondary store中,待primary store恢复性能后,再将secondary store中的数据拷贝到primary store中(除非replay_buffer=no)。其中,secondary store仅支持两种store:file和null。

[b]buffer_send_rate [/b]1 by default
在check_interval周期内,执行多少次secondary store读出一组消息并且发送到primary store中。

[b]retry_interval[/b] 300 seconds by default
primary store写入失败后,等待多久尝试重新发送primary store。

[b]retry_interval_range [/b] 60 seconds by default
将在retry_interval的区间内随机的选择一个重新发送时间。

[b]replay_buffer [/b] yes/no, default yes
如果设置为no,将不会从secondary store迁移消息到primary store。

Example:

<store>
category=default
type=buffer
buffer_send_rate=1
retry_interval=30
retry_interval_range=10
<primary>
type=network
remote_host=wopr
remote_port=1456
</primary>
<secondary>
type=file
file_path=/tmp
base_filename=thisisoverwritten
max_size=10000000
</secondary>
</store>



[size=x-large]Bucket Store Configuration[/size]
bucket stores使用消息前缀作为key,将消息hash到多个文件中去
[b]num_buckets[/b]defaults to 1
1.hash到buckets的个数
2.不能被hash进bucket的消息将被放入一个特别的0号bucket。

[b]bucket_type [/b]
“key_hash”, “key_modulo”, or “random”。

[b]delimiter[/b]
值必须是1~255之间的ascii,默认是':'
第一次出现在消息前缀中的delimiter在‘hash/modulo’中将被用作key。

[b]remove_key [/b]
是否移除key的前缀,默认是no。

[b]bucket_subdir[/b]
如果使用一个单独定义的bucket,则每一个子目录的名称根据bucket的数量编号生成。

Example:

<store>
category=bucket_me
type=bucket
num_buckets=5
bucket_subdir=bucket
bucket_type=key_hash
delimiter=58
<bucket>
type=file
fs_type=std
file_path=/tmp/scribetest
base_filename=bucket_me
</bucket>
</store>

Instead of using a single ‘bucket’ definition for all buckets, you can specify each bucket explicitly:

<store>
category=bucket_me
type=bucket
num_buckets=2
bucket_type=key_hash
<bucket0>
type=file
fs_type=std
file_path=/tmp/scribetest/bucket0
base_filename=bucket0
</bucket0>
<bucket1>
...
</bucket1>
<bucket2>
...
</bucket2>
</store>

You can also bucket into network stores as well:

<store>
category=bucket_me
type=bucket
num_buckets=2
bucket_type=random
<bucket0>
type=file
fs_type=std
file_path=/tmp/scribetest/bucket0
base_filename=bucket0
</bucket0>
<bucket1>
type=network
remote_host=wopr
remote_port=1463
</bucket1>
<bucket2>
type=network
remote_host=hal
remote_port=1463
</bucket2>
</store>


[size=x-large]Null Store Configuration[/size]
Null store告诉scribe对给定的category,忽略所有的消息。
Example:

<store>
category=tps_report*
type=null
</store>


[size=x-large]Multi Store Configuration[/size]
一个multi store会将消息转发到多个子stores中去
子store以“store0”, “store1”, “store2”命名。

[b]report_success [/b] “all” or “any”, defaults to “all”
是否所有substores或任何substores必须成功地记录消息。

Example:

<store>
category=default
type=multi
target_write_size=20480
max_write_interval=1
<store0>
type=file
file_path=/tmp/store0
</store0>
<store1>
type=file
file_path=/tmp/store1
</store1>
</store>


[size=x-large]Thriftfile Store Configuration[/size]
Thriftfile Store 类似与 File store,只是它将消息存储在Thrift的 TFileTransport file.

[b]file_path[/b]: defaults to “/tmp”
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值