Goreplay最新版本的安装和简单使用

一:概述

Gor 是一个开源工具,用于捕获实时 HTTP 流量并将其重放到测试环境中,以便使用真实数据持续测试您的系统。它可用于提高对代码部署、配置更改和基础设施更改的信心。简单易用。

项目地址:buger/goreplay: GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.https://github.com/buger/goreplay?tab=readme-ov-file

GoReplay 提供了一种独特的阴影方法。GoReplay 不是代理,而是在后台侦听网络接口上的流量,无需更改生产基础设施,只需在与服务相同的计算机上运行 GoReplay 守护程序即可。

二:具体说明

2.1 Golang环境安装以及配置

去此页面 All releases - The Go Programming Language下载

这个是配置GO环境的,然后一开始那个项目地址可以下载最新的Goreplay的tar包。

2.1.1 解压到/usr/local/soft/Go

bash 复制代码
tar -zxvf go1.24.3.linux-amd64.tar.gz && rm go1.24.3.linux-amd64.tar.gz

2.1.2 配置环境变量

bash 复制代码
pwd
/usr/local/soft/Go/go
[root@localhost go]# vim /etc/profile

export GOROOT=/usr/local/soft/Go/go
export $PATH=$PATH:GOROOT/bin
# 编译生效
source /etc/profile

配置完成之后,输入以下命令可以查看Golang的版本

bash 复制代码
[root@localhost go]# go version
go version go1.24.3 linux/amd64

2.2 安装Goreplay

2.2.1 解压文件到/usr/local/soft/goreplay

bash 复制代码
tar -zxvf gor_1.3.3_x64.tar.gz && rm -f gor_1.3.3_x64.tar.gz

[root@localhost goreplay]# ls
gor

2.3 测试案例

2.3.1 利用python开启一个自带的http服务

bash 复制代码
python3.13 -m http.server

前提是你已经安装了python

bash 复制代码
[root@localhost python]# python3.13 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...

2.3.2重新开一个服务器窗口在/usr/local/soft/goreplay目录执行命令

bash 复制代码
./gor --input-raw :8000 --output-stdout
bash 复制代码
./gor --input-raw :8000 --output-file requests.log
bash 复制代码
./gor --input-raw  ip:8000 --output-file requests.log
bash 复制代码
./gor --input-file requests.log --output-http  http://ip:8000
[DEBUG][elapsed 338.732µs]: [INPUT-FILE] No files match pattern:  requests.log
2025/06/01 17:44:12 [PPID 118115 and PID 161981] Version:1.3.0
相关推荐
..过云雨15 分钟前
网络计算器实现 - 自定义套接字+序列化+守护进程
网络·网络协议·tcp/ip
hugerat1 小时前
在AI的帮助下,用C++构造微型http server
linux·c++·人工智能·http·嵌入式·嵌入式linux
三两肉1 小时前
HTTPS ECDHE 握手全解析
网络协议·https·github·rsa·echde
txinyu的博客2 小时前
HTTP服务实现用户级窗口限流
开发语言·c++·分布式·网络协议·http
西京刀客2 小时前
golang路由与框架选型(对比原生net/http、httprouter、Gin)
http·golang·gin
掘根3 小时前
【仿Muduo库项目】HTTP模块1——Util子模块
网络·网络协议·http
嘿嘿4 小时前
charles iOS 配置证书,抓取https请求
http·测试
CCPC不拿奖不改名5 小时前
网络与API:从HTTP协议视角理解网络分层原理+面试习题
开发语言·网络·python·网络协议·学习·http·面试
liulilittle5 小时前
OPENPPP2 网络驱动模式
开发语言·网络·c++·网络协议·信息与通信·通信
tzy2335 小时前
分享一个 HTTP(S) 代理&抓包工具,拦截和Mock Web客户端请求和服务端响应
前端·网络协议·http