您的位置:首页 > 其它

回文字符串的判断解题报告

2013-01-25 12:01 483 查看
https://github.com/facebook/scribe/wiki/Scribe-Configuration

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


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

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

max_msg_per_second
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

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

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

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

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

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


Store Configuration
scribe server根据配置文件中store的定义来记录消息,每一个store必须指定消息category用来处理三种异常情况:
default store
默认category处理任何不能被其他store处理的category,只能有一个默认store
category=default

prefix stores
如果一个指定的category以*结尾,这个存储将处理所有以指定前缀开头的category 。
category=web*

multiple categories
在一个store的定义中可以使用'categories='创建多个store
categories=rock paper* scissors

在上面三种情况下,scribe将为每一个唯一的category创建一个子目录,除非new_thread_per_category被设置为false。

Store Configuration Variables
category
设置哪些消息被这个store处理。
type
file
buffer
network
bucket
thriftfile
null
mutil


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

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

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

must_succeed 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>


File Store Configuration
file store把信息写入文件中。

file_path
默认路径是‘/tmp’。

base_filename
默认category名称。

use_hostname_sub_directoryyes/no, default no
是否使用server的hostname建立子目录

sub_directory string
使用指定的名称创建子目录。

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

rotate_hour0-23, 1 by default
如果rotate_period是daily,设置每天何时创建新文件

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

max_size1,000,000,000 bytes by default
在轮转一个文件前,该文件可以增长到多大

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

fs_type
支持两种类型std和hdfs,默认是std。

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

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

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

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

max_write_size
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>


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

remote_host
远程主机的ip或者名称。

remote_port
远程主机的端口。

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

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

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


Buffer Store Configuration
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。

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

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

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

replay_buffer 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>


Bucket Store Configuration
bucket stores使用消息前缀作为key,将消息hash到多个文件中去
num_bucketsdefaults to 1
1.hash到buckets的个数
2.不能被hash进bucket的消息将被放入一个特别的0号bucket。

bucket_type
“key_hash”, “key_modulo”, or “random”。

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

remove_key
是否移除key的前缀,默认是no。

bucket_subdir
如果使用一个单独定义的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>


Null Store Configuration
Null store告诉scribe对给定的category,忽略所有的消息。
Example:
<store>
category=tps_report*
type=null
</store>


Multi Store Configuration
一个multi store会将消息转发到多个子stores中去
子store以“store0”, “store1”, “store2”命名。

report_success “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>


Thriftfile Store Configuration
Thriftfile Store 类似与 File store,只是它将消息存储在Thrift的 TFileTransport file.

file_path: defaults to “/tmp”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: