jdxyzlh 发表于 2018-9-21 09:10:56

goreplay使用

  最新版的发布公告:https://leonsbox.com/goreplay-v0-16-and-4th-anniversary-5408b1fd72e0
  主要提到:中间件、报文解压、从kafka读取数据、把数据写到kafka
  开发语音:go,因此需要go语言环境,下载地址 https://golang.org/,mac安装 https://golang.org/doc/install?download=go1.9.1.darwin-amd64.pkg,linux安装 https://golang.org/doc/install?download=go1.9.1.linux-amd64.tar.gz
  gorepaly的mac安装:下载压缩包后解压后,是一个名字为goreplay的二机制文件,直接扔进/usr/bin/目录里,就可以使用了
  唯一依赖:libpcap, https://github.com/buger/goreplay/wiki/Compilation
  主要功能:回放真实http流量
  是否免费:有可以免费的功能,专业版需要收费
  文档地址:https://github.com/buger/goreplay/wiki
  下载地址:https://github.com/buger/goreplay/releases,linux和mac可以直接安装使用,也可以自编译 https://github.com/buger/goreplay/wiki/Compilation
  三大收费功能:support for binary protocols like Thrift or ProtocolBuffers, saving and replaying from cloud storage, TCP sessions replication, etc

  基本工作原理:gorelplay在生产环境监听真实流量,生成文件用于回放,或者直接把这些真实流量转发到目标服务
  goreplay可以启动一个简单的web服务器:goreplay file-server :8000,浏览器本地访问,可以看到启动命令行的目录文件,可以本地启动多个端口,进行测试goreplay的各个功能
  goreplay的几个问题:https://github.com/buger/goreplay/wiki/FAQhttps://github.com/buger/goreplay/wiki/Troubleshooting
  1、回放会话问题
  2、如何截取https流量
  3、如何以非root帐号运行 https://github.com/buger/goreplay/wiki/Running-as-non-root-user
  4、使用output-http时,http请求的大小有没有限制?
  举例:
  1、输出两份相同流量
  

goreplay --input-tcp :28020 --output-http "http://staging.com"--output-http "http://dev.com"  

  

2、一份流量平均分配到两个目标网站
  

goreplay --input-raw :80 --output-http "http://staging.com"--output-http "http://dev.com" --split-output true  

  

3、 默认goreplay不记录响应信息,可以通过--input-raw-track-response开启
  4、可以读取kafka的流量,把流量输出到kafka
  5、可以把流量输出倒ElasticSearch
  6、可以使用中间件,对发出goreplay的报文进行处理
  goreplay并没有系统性能分析情况,它只负责发数据,被测应用性能情况,需要用户自己统计
  参考:
  1、https://goreplay.org
  2、https://github.com/buger/goreplay
  3、https://github.com/buger/goreplay/wiki
  4、https://leonsbox.com/goreplay-v0-16-and-4th-anniversary-5408b1fd72e0
  5、https://mp.weixin.qq.com/s?__biz=MzA4Nzc4MjI4MQ%3D%3D&mid=2652402185&idx=1&sn=845546cee445fbf359e69a3ccb3e22c5&scene=0##


页: [1]
查看完整版本: goreplay使用