3、ES Rally 配置

作者: MasonChan | 来源:发表于2019-12-10 17:23 被阅读0次

    参考:Docs » Configuration

    初次配置 Rally,需要运行命令

    esrally configure --advanced-config

    压测结果的存储类型分 2 类:

    • in-memory 临时存储,打印到标准输出后就没了
    • elasticsearch 存储在一个指定的 ES 集群中,方便对比

    跑上面的命令时,在选择存储类型时开始不一样:

    in-memory

    Enter the benchmark root directory (default: /home/apps/.rally/benchmarks): 
      Using default value '/home/apps/.rally/benchmarks'
    
    Enter your Elasticsearch project directory: (default: /home/apps/.rally/benchmarks/src/elasticsearch): 
      Using default value '/home/apps/.rally/benchmarks/src/elasticsearch'
    
    Where should metrics be kept?
    
    (1) In memory (simpler but less options for analysis)
    (2) Elasticsearch (requires a separate ES instance, keeps all raw samples for analysis)
    
     (default: 1): 1
    
    Do you want Rally to keep the Elasticsearch benchmark candidate installation including the index (will use several GB per trial run)? (default: False): 
    
    Configuration successfully written to /home/apps/.rally/rally.ini. Happy benchmarking!
    
    

    elasticsearch

    Enter the benchmark root directory (default: /home/apps/.rally/benchmarks): 
      Using default value '/home/apps/.rally/benchmarks'
    
    Enter your Elasticsearch project directory: (default: /home/apps/.rally/benchmarks/src/elasticsearch): 
      Using default value '/home/apps/.rally/benchmarks/src/elasticsearch'
    
    Where should metrics be kept?
    
    (1) In memory (simpler but less options for analysis)
    (2) Elasticsearch (requires a separate ES instance, keeps all raw samples for analysis)
    
     (default: 1): 2
    
    Enter the host name of the ES metrics store (default: localhost): 
      Using default value 'localhost'
    
    Enter the port of the ES metrics store: 9200
    
    Use secure connection (True, False) (default: False): 
    
    Username for basic authentication (empty if not needed) (default: ): 
    
    Password for basic authentication (empty if not needed) (default: ): 
    
    Enter a descriptive name for this benchmark environment (ASCII, no spaces) (default: local): rally_demo
    
    Do you want Rally to keep the Elasticsearch benchmark candidate installation including the index (will use several GB per trial run)? (default: False): 
    
    Configuration successfully written to /home/apps/.rally/rally.ini. Happy benchmarking!
    
    

    配置项说明

    • Benchmark root directory:Rally 存放测试数据的根目录,默认为 ~/.rally/benchmarks。可能需要几十 GB,因为某些场景的测试数据解压后很大。

    • Elasticsearch project directory:存放 ES 源代码的目录。Rally 默认建立一个本地的 ES 实例,对其进行性能测试。用 Gradle Wrapper 来编译源代码:

    ./gradlew clean
    ./gradlew :distribution:tar:assemble
    
    
    • Metrics store type:压测结果数据的存储类型
    in-memory:默认,压测报告的数据比较少
    elasticsearch:用户指定单独的 ES 集群来存储报告,压测结果非常详细
    
    
    • Metrics store settings:ES 实例连接信息配置,压测结果存储类型为 elasticsearch 时生效。单实例已经足够用了。另外,ssl 配置其实也用不上的,如果使用了的话,需要配置一下:
    datastore.ssl.verification_mode 开关 ssl 认证,默认为 none
    datastore.ssl.certificate_authorities 指定 ca 证书存放路径
    
    
    • Name for this benchmark environment:压测结果存储类型为 elasticsearc 时当做索引名称使用,便于区分不同压测的报告数据。

    端口说明

    esrally 建立 ES 集群时,使用这些端口:

    39200-39300 (HTTP)
    39300-39400 (transport)
    
    

    所以使用本地 ES 实例来存储压测结果时,ES 实例要避开这些端口

    脚本说明

    ~/.rally/rally.ini 这个无法自定义目录,每次执行 esrally configure --advanced-config 命令,都会覆盖它。这个设定太不友好,所以第一次跑 config 命令后,后续的修改推荐使用 vim 方式。

    查看配置内容

    tree ~/.rally/

    /home/apps/.rally/
    ├── logging.json
    ├── logs
    │   └── rally.log
    └── rally.ini
    
    1 directory, 3 files
    
    

    cat rally.ini

    in-memory

    [meta]
    config.version = 17
    
    [system]
    env.name = local
    
    [node]
    root.dir = /home/apps/.rally/benchmarks
    src.root.dir = /home/apps/.rally/benchmarks/src
    
    [source]
    remote.repo.url = https://github.com/elastic/elasticsearch.git
    elasticsearch.src.subdir = elasticsearch
    
    [benchmarks]
    local.dataset.cache = /home/apps/.rally/benchmarks/data
    
    [reporting]
    datastore.type = in-memory
    datastore.host = 
    datastore.port = 
    datastore.secure = 
    datastore.user = 
    datastore.password = 
    
    [tracks]
    default.url = https://github.com/elastic/rally-tracks
    
    [teams]
    default.url = https://github.com/elastic/rally-teams
    
    [defaults]
    preserve_benchmark_candidate = False
    
    [distributions]
    release.cache = true
    
    

    elasticsearch

    [meta]
    config.version = 17
    
    [system]
    env.name = rally_demo
    
    [node]
    root.dir = /home/apps/.rally/benchmarks
    src.root.dir = /home/apps/.rally/benchmarks/src
    
    [source]
    remote.repo.url = https://github.com/elastic/elasticsearch.git
    elasticsearch.src.subdir = elasticsearch
    
    [benchmarks]
    local.dataset.cache = /home/apps/.rally/benchmarks/data
    
    [reporting]
    datastore.type = elasticsearch
    datastore.host = localhost
    datastore.port = 9200
    datastore.secure = False
    datastore.user = 
    datastore.password = 
    
    [tracks]
    default.url = https://github.com/elastic/rally-tracks
    
    [teams]
    default.url = https://github.com/elastic/rally-teams
    
    [defaults]
    preserve_benchmark_candidate = False
    
    [distributions]
    release.cache = true
    
    
    配置项 说明
    [meta]
    [system]
    [node] root.dir 为压测数据存放根目录
    [source] ES 源代码的下载配置,从 github 下载
    [benchmarks] 样本数据存放目录配置
    [reporting] 压测结果存储配置,in-memory or elasticsearch
    [tracks] tracks 配置文件下载地址,从 github 下载,一个业务类型称为一个 track
    [teams] es 配置文件下载地址,从 github 下载,这里提供多种 es 配置,一种配置统称称为一个 car

    对比发现,只有 reporting 这一项不同。

    reporting 为 elasticsearch 时,如果没有安全认证,那么 datastore.secure 必须为 False,不能留空,不然报错:

    [ERROR] Cannot race. Error in race control (Cannot convert [] to bool.)
    

    相关文章

      网友评论

        本文标题:3、ES Rally 配置

        本文链接:https://www.haomeiwen.com/subject/kvbggctx.html