流量回放goreplay

1.网关权重\mirror旁路 (生产)

2.goreplay编译测试

<==============================
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/bin/ld: cannot find -lpthread
/bin/ld: cannot find -lc
===============================>
yum install glibc-static.x86_64 -y
<==============================
# github.com/google/gopacket/pcap
vendor/github.com/google/gopacket/pcap/pcap_unix.go:34:18: fatal error: pcap.h: No such file or directory
===============================>
https://www.tcpdump.org/#source
libpcap-1.10.1.tar.gz
./configure
make
make install
<==============================
git clone https://github.com/buger/goreplay.git
cd goreplay
make build
======================================
windows:
https://github.com/buger/goreplay/pull/940
https://github.com/buger/goreplay/wiki/Running-on-Windows
1.
--input-raw :8888 --input-raw-bpf-filter "port 8888"  --output-stdout
2.
--input-raw :8888 --input-raw-bpf-filter "port 8888"  --output-http "http://11.11.11.112:30010" --output-http-elasticsearch http://11.11.11.114:9200/idc_goreplay_record --output-http-track-response=true

linux:
elastigo---->elasticsearch7
cat go.mod
replace github.com/mattbaird/elastigo v0.0.0-20170123220020-2fe47fd29e4b => ./out/mattbaird/elastigo

	upstream goreplay {
        server 127.0.0.1:9000;# or other proxy
    }
	server {
        listen       9000;
        server_name  localhost;
		location / {
            default_type application/json;
			return 200 '{"status":"success","result":"nginx json"}';
        }
		
	}
	server {
        listen       8443 ssl;
        server_name  localhost;

        ssl_certificate      /opt/server.crt;
        ssl_certificate_key  /opt/server.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

		ssl_protocols SSLv2 SSLv3 TLSv1;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
		
	
        location / {
			 mirror /mirror_gorepaly;
             proxy_pass http://11.11.11.114:30009/;
        }
		location = /mirror_gorepaly {
            internal;
			proxy_redirect     off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_pass http://goreplay$request_uri;
        }
    }
1.libpcap数据包
https://www.cnblogs.com/10087622blog/p/8320234.html 

2.goreplay
--input-raw-engine "libpcap"
如果http request数据包大于一定值,丢弃

--input-raw-override-snaplen 
65536+200



nohup ./gor --input-raw :4438  --output-http "" --http-allow-header host:.*xxx.*  --input-raw-override-snaplen  --output-http-elasticsearch http://username:123456@xxx:9200/goreplay_record  > gor.log.80 2>&1 &

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值