zoukankan      html  css  js  c++  java
  • scribe conf,编译了一天,鬼知道用不用得到,找到的conf解释

     Scribe的配置文件由全局的section和一个或多个store的section组成。这篇来了解一下scribe的配置文件,在源码包的examples目录下有多个配置文件实例:

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

        scribe运行时的配置文件可以在命令行用-c指定,默认的配置位置在env_default.h中的DEFAULT_CONF_FILE_LOCATION设置,也就是/usr/local/scribe/scribe.conf。

    Global Configuration Variables

    port  

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

    max_msg_per_second  

    max_queue_size  

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

    check_interval  

        设置多长时间检测一次存储,默认值是5秒。

    new_thread_per_category  

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

    num_thrift_server_threads  

        监听进入消息的线程数,默认是3。

    Store Configuration

        scribe server根据配置文件中store的定义来记录消息,每一个store必须指定消息category用来处理三种异常情况:

    default store  

        默认category处理任何不能被其他store处理的category,只能有一个默认store,category=default。

    prefix stores  

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

    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,如果一个store处理消息失败,是否重新进入消息队列排队。如果设置为no,一个store不能处理这些消息的话,消息将被丢弃。建议使用缓存来指一个定二级存储来处理失败的日志。

    1
    2
    3
    4
    5
    6
    <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_directory  

        是否使用server的hostname建立子目录,默认是no。

    sub_directory  

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

    rotate_period  

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

    rotate_hour  

        如果rotate_period是daily,设置每天何时创建新文件,值可以是0-23,默认是1。

    rotate_minute  

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

    max_size  

        在轮转一个文件前,该文件可以增长到多大,默认是1,000,000,000 bytes 。

    write_meta  

        值可以是yes或者其他值,false是默认值,如果文件被轮转,最后一行将包含"scribe_meta",跟着就是下一个文件名。

    fs_type  

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

    chunk_size  

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

    add_newlines  

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

    create_symlink  

        默认值是yes,如果是真,则维护一个符号连接到最近被写入的文件。

    write_stats  

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

    max_write_size

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <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。


    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,在check_interval周期内,执行多少次secondary store读出一组消息并且发送到primary store中。

    retry_interval  

        默认是300秒,primary store写入失败后,等待多久尝试重新发送primary store。

    retry_interval_range  

        默认是60秒,将在retry_interval的区间内随机的选择一个重新发送时间。

    replay_buffer  

        默认是yes,如果设置为no,将不会从secondary store迁移消息到primary store。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <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_buckets  

        默认值是1,hash到buckets的个数,不能被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的数量编号生成。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    <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>

    Null Store Configuration

        Null store告诉scribe对给定的category,忽略所有的消息。

    1
    2
    3
    4
    <store>
    category=tps_report*
    type=null
    </store>


    Multi Store Configuration

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

    report_success  

        值可以是all或者any,默认是any,是否所有substores或任何substores必须成功地记录消息。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    <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>
  • 相关阅读:
    在UltraEdit中如何像NotePad++一样实现双击单词在全文中高亮
    记人生第一次做面试官的经历
    error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MTd_StaticDebug”不匹配值“MDd_DynamicDebug
    压缩感知中的数学知识:稀疏、范数、符号arg min
    Tensorflow timeline trace
    tensorflow serving
    日志分析工具ELK(一)
    Zabbix3.0安装部署最佳实践
    防cc攻击利器之Httpgrard
    反向代理负载均衡之haproxy
  • 原文地址:https://www.cnblogs.com/cavehubiao/p/4002437.html
Copyright © 2011-2022 走看看