GoReplay v1.3.3 安装指南
在 Ubuntu 22.04 上从零安装 GoReplay 1.3.3:官方 tar.gz/deb/源码编译三方案实测,含 systemd 托管与生产到测试回放链路验证,附真实排障实录。
GoReplay v1.3.3 安装指南
目标:在 Ubuntu 22.04 服务器上从零完成 GoReplay(命令
gor)的下载、安装、验证与 systemd 常驻托管,覆盖官方 tar.gz 二进制、官方 deb 包、源码编译三种安装方案,并以「生产服务器 → 测试服务器」回放链路验证安装结果。本文全部命令与回显已在 Ubuntu 22.04.4 LTS(x86_64)环境、GoReplay 1.3.3(2021-10-06 官方发布)实测通过;产品背景与选型见 《GoReplay v1.3.3 介绍与选型指南》。
一、环境信息
- 操作系统:Ubuntu 22.04.4 LTS(x86_64),两台:
- 生产服务器:IP
10.89.56.2,运行示例业务应用(监听8000端口)+ GoReplay 捕获进程 - 测试服务器:IP
10.89.56.3,主机名test-server,运行同款业务应用(监听8000端口)作为回放目标
- 生产服务器:IP
- GoReplay 版本:1.3.3(官方最新稳定版,发布于 2021-10-06;来源 GitHub Releases,2026-10-25 查证)
- 示例业务应用:Python 3 内置 HTTP 服务
python3 -m http.server 8000(用于产生与接收流量,验证抓包回放链路) - 安装方案来源:官方 GitHub Releases(https://github.com/buger/goreplay/releases ),2026-10-25 实测官方源可直连下载
- ⚠️ 网络说明:本次实测官方源
github.com直连可用(10.6MB 二进制实测 4.2s 下载完成),未发生下载降级;若所在网络访问 GitHub 困难,可用 HTTP 代理(curl -x http://<代理地址>:<端口> …)或国内 GitHub 加速镜像,方法见「九、常见问题」Q1
二、前置条件
- root 或 sudo 权限:GoReplay 的流量捕获(
--input-raw)基于 libpcap 抓包,需要 root 权限运行(官方起步示例即sudo ./gor)。 - 基础工具:
curl/wget(下载)、tar(解压)、sha256sum(校验);Debian/Ubuntu 系执行:
apt-get update && apt-get install -y curl wget tar
- 两台服务器互通(回放链路验证用):生产服务器需能访问测试服务器的 8000 端口。验证(在生产服务器执行):
curl -s -o /dev/null -w "cross to target:%{http_code}\n" http://test-server:8000/
实测回显(生产服务器 10.89.56.2 → 测试服务器 test-server):
cross to target:200
⚠️ 注意:上例通过主机名
test-server访问,生产环境需在/etc/hosts配置两台服务器的主机名映射,或直接使用对端 IP(如10.89.56.3)。
- 示例业务应用就位(两台服务器相同,用于后续验证):
# 在两台服务器各启动一个示例业务应用,监听 8000 端口
nohup python3 -m http.server 8000 --bind 0.0.0.0 >/var/log/app.log 2>&1 &
curl -s -o /dev/null -w "local app:%{http_code}\n" http://127.0.0.1:8000/
实测回显(生产服务器;测试服务器同):
local app:200
三、版本选型说明
GoReplay 官方在 GitHub Releases 发布多平台安装物,选型对照如下(2026-10-25 实查 release 资产清单):
| 资产文件 | 平台/形态 | 适用系统 |
|---|---|---|
gor_1.3.3_x64.tar.gz | Linux x86_64 裸二进制(tar.gz) | 任意 Linux 发行版,本指南方案 A |
gor_1.3.3_amd64.deb | Debian 系软件包 | Ubuntu/Debian 及衍生系统,本指南方案 B |
gor-1.3.3-1.x86_64.rpm | RedHat 系软件包 | CentOS/RHEL/Rocky 等 |
gor_1.3.3_mac.tar.gz | macOS 裸二进制 | macOS 调试环境 |
gor_1.3.3_windows.zip | Windows 二进制 | Windows(v1.3.0 起官方支持) |
gor-1.3.3.pkg | macOS 安装包 | macOS |
源码(codeload tarball) | Go 源码 | 自行编译,本指南方案 C |
关键差异解读:裸二进制(tar.gz)部署最直接、路径可控,适合脚本化批量安装;deb 包走包管理器、可 dpkg -l 追踪、卸载干净,适合 Debian/Ubuntu 系标准化运维;源码编译仅在需要修改 GoReplay 自身或无匹配平台包时使用。版本口径注意:release 的 tag 无 v 前缀(下载 URL 用 1.3.3 而非 v1.3.3),而 release 标题显示为 v1.3.3,混用会导致 404(详见 FAQ Q2)。
四、在线安装方案(A:官方 tar.gz 二进制)
本方案从官方 GitHub Releases 直接下载 Linux x64 裸二进制并放入系统 PATH,是官方 README 推荐的安装方式,适用任意 Linux 发行版。
4.1 下载官方二进制
在服务器上创建下载目录并拉取 gor_1.3.3_x64.tar.gz:
mkdir -p /opt/gor-dl && cd /opt/gor-dl
curl -sL --connect-timeout 10 -m 300 -o gor_1.3.3_x64.tar.gz \
-w "http:%{http_code} size:%{size_download} bytes time:%{time_total}s\n" \
https://github.com/buger/goreplay/releases/download/1.3.3/gor_1.3.3_x64.tar.gz
实测回显(2026-10-25,官方源直连):
http:200 size:11067794 bytes time:4.170660s
💡 说明:
-w参数让 curl 打印 HTTP 状态码、下载字节数与耗时,用于确认下载完整(本例约 10.6MB)。GoReplay 官方未随 release 发布 checksums 文件,可用下方实测记录的 SHA256 作参考基准。
4.2 校验与解压安装
cd /opt/gor-dl
echo "== SHA256 校验 =="
sha256sum gor_1.3.3_x64.tar.gz
echo "== 包内容清单 =="
tar tzf gor_1.3.3_x64.tar.gz
echo "== 解压并安装到 PATH =="
tar xzf gor_1.3.3_x64.tar.gz
mv gor /usr/local/bin/gor && chmod +x /usr/local/bin/gor
实测回显:
== SHA256 校验 ==
d65e252847d869ece773a72589924cb242308746408a2f56f7a218bcf9f8512d gor_1.3.3_x64.tar.gz
== 包内容清单 ==
gor
== 解压并安装到 PATH ==
💡 说明:压缩包内只有一个
gor二进制文件,无配置文件、无文档,安装动作就是把单文件放进 PATH(本文选/usr/local/bin/)。
4.3 验证安装
验证 1:二进制为静态链接,无系统库依赖——GoReplay 官方二进制静态编译,目标服务器无需安装 libpcap:
ldd /usr/local/bin/gor
实测回显:
not a dynamic executable
验证 2:程序可运行并输出版本。注意:gor 没有 --version 标志(实测输入 gor --version 会报 flag provided but not defined: -version 并打印完整帮助),版本信息看两个位置——无参数启动时的首行日志、帮助文本尾部的 Current Version 字段:
gor 2>&1 | tail -8
实测回显:
2026/10/25 00:13:07 [PPID 2667 and PID 2673] Version:1.3.0
2026/10/25 00:13:07 Required at least 1 input and 1 output
⚠️ 注意:二进制包文件与 release 均为 1.3.3,但程序运行时自报
Version:1.3.0——这是上游未随 1.3.3 更新版本常量的已知现象,以安装包文件名与dpkg -l(方案 B)记录的 1.3.3 为准。Required at least 1 input and 1 output表示程序正常、只是没给输入/输出插件参数,属预期输出。
验证 3:抓包回放链路联通(完整验证安装可用性):在生产服务器启动捕获回放进程,产生生产流量后到测试服务器核对:
# 生产服务器(10.89.56.2)启动回放:抓 8000 端口流量 → 回放到测试服务器
nohup gor --input-raw :8000 --output-http http://test-server:8000 > /var/log/gor.log 2>&1 &
sleep 2
# 产生两笔生产流量
curl -s -o /dev/null -w "req1:%{http_code}\n" http://127.0.0.1:8000/index.html
curl -s -o /dev/null -w "req2:%{http_code}\n" http://127.0.0.1:8000/tmp/
实测回显(生产服务器):
req1:404
req2:200
req1 返回 404 是因为示例应用根目录没有 index.html,属正常业务响应。此时查看 GoReplay 日志可见其抓包范围(eth0 与 lo 两块网卡的 BPF 过滤器):
tail -3 /var/log/gor.log
实测回显:
Interface: eth0 . BPF Filter: ((tcp dst port 8000) and (dst host 10.89.56.2))
Interface: lo . BPF Filter: ((tcp dst port 8000) and (dst host 127.0.0.1 or dst host ::1))
2026/10/25 00:17:15 [PPID 2893 and PID 2899] Version:1.3.0
验证 4:测试服务器核对回放请求到达。查看测试服务器业务应用访问日志(/var/log/app.log):
tail -6 /var/log/app.log
实测回显(测试服务器 10.89.56.3):
127.0.0.1 - - [25/Oct/2026 00:17:08] "GET / HTTP/1.1" 200 -
10.89.56.2 - - [25/Oct/2026 00:17:08] "GET / HTTP/1.1" 200 -
10.89.56.2 - - [25/Oct/2026 00:17:17] "GET /tmp/ HTTP/1.1" 200 -
10.89.56.2 - - [25/Oct/2026 00:17:17] code 404, message File not found
10.89.56.2 - - [25/Oct/2026 00:17:17] "GET /index.html HTTP/1.1" 404 -
💡 解读:来源 IP 为
10.89.56.2(生产服务器)的两条记录即 GoReplay 回放过来的请求——生产侧GET /tmp/(200)与GET /index.html(404)被原样复制到了测试服务器,含状态码语义都一致(测试环境同样没有index.html)。首行127.0.0.1是此前直连测试产生的本地请求,与回放无关。至此安装验证闭环完成。
五、deb 包安装方案(B:Debian/Ubuntu 系)
本方案使用官方发布的 gor_1.3.3_amd64.deb 走 dpkg 包管理器安装,适合标准化运维(包可追踪、可一键卸载)。
5.1 下载 deb 包
mkdir -p /opt/gor-dl && cd /opt/gor-dl
curl -sL -m 180 -o gor_1.3.3_amd64.deb \
-w "deb http:%{http_code} size:%{size_download}\n" \
https://github.com/buger/goreplay/releases/download/1.3.3/gor_1.3.3_amd64.deb
实测回显:
deb http:200 size:11068878
5.2 安装前检视包内容
安装前先看包里装什么、装到哪(养成检视习惯):
dpkg -c gor_1.3.3_amd64.deb
实测回显:
drwxr-xr-x 0/0 0 2021-10-09 14:35 ./
drwxr-xr-x 0/0 0 2021-10-09 14:35 ./usr/
drwxr-xr-x 0/0 0 2021-10-09 14:35 ./usr/local/
drwxr-xr-x 0/0 0 2021-10-09 14:35 ./usr/local/bin/
-rwxr-xr-x 0/0 25110896 2021-10-09 14:35 ./usr/local/bin/gor
drwxr-xr-x 0/0 0 2021-10-09 14:35 ./usr/share/
drwxr-xr-x 0/0 0 2021-10-09 14:35 ./usr/share/doc/
drwxr-xr-x 0/0 0 2021-10-09 14:35 ./usr/share/doc/gor/
-rw-r--r-- 0/0 139 2021-10-09 14:35 ./usr/share/doc/gor/changelog.gz
再核对包元信息(版本、维护方、架构):
dpkg -I gor_1.3.3_amd64.deb | head -20
实测回显:
new Debian package, version 2.0.
size 11068878 bytes: control archive=518 bytes.
382 bytes, 11 lines control
117 bytes, 2 lines md5sums
Package: gor
Version: 1.3.3
License: unknown
Vendor: Leonid Bugaev
Architecture: amd64
Maintainer: <support@goreplay.org>
Installed-Size: 24522
Section: default
Priority: extra
Homepage: https://goreplay.org
Description: GoReplay is an open-source network monitoring tool which can record your live traffic, and use it for shadowing, load testing, monitoring and detailed analysis.
💡 解读:deb 包只包含
/usr/local/bin/gor(约 24.5MB)与一份 changelog,不含 systemd unit——常驻托管需要手写 unit 文件(见「八、配置说明」)。
5.3 dpkg 安装
dpkg -i /opt/gor-dl/gor_1.3.3_amd64.deb
echo "== 安装位置 =="
which gor
实测回显:
Selecting previously unselected package gor.
(Reading database ... 4973 files and directories currently installed.)
Preparing to unpack .../opt/gor-dl/gor_1.3.3_amd64.deb ...
Unpacking gor (1.3.3) ...
Setting up gor (1.3.3) ...
== 安装位置 ==
/usr/local/bin/gor
5.4 验证与包信息
dpkg -l | grep gor
实测回显:
ii gor 1.3.3 amd64 GoReplay is an open-source network monitoring tool which can record your live traffic, and use it for shadowing, load testing, monitoring and detailed analysis.
💡 说明:
ii状态表示已正确安装;后续dpkg -r gor即可卸载(见「十、卸载与清理」)。方案 B 与方案 A 装的是同一个二进制(同为 25,110,896 字节),验证方式与 4.3 相同。
六、源码编译安装方案(C:自建构建)
当目标平台没有预编译包(如特定架构),或需要修改 GoReplay 源码时,用 Go 工具链自行编译。本方案实测于 Ubuntu 22.04,全程使用国内 Go 模块代理,供无国际网络环境参考。
6.1 安装 Go 构建环境
GoReplay 1.3.3 的 go.mod 声明 go 1.15,用更高版本 Go 可正常构建(本文实测 Go 1.21.13,从国内官方镜像 golang.google.cn 下载):
apt-get install -y curl git build-essential libpcap-dev
curl -sL -m 300 -o /tmp/go1.21.13.linux-amd64.tar.gz \
-w "go-dl http:%{http_code} size:%{size_download}\n" \
https://golang.google.cn/dl/go1.21.13.linux-amd64.tar.gz
tar -C /usr/local -xzf /tmp/go1.21.13.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version
实测回显:
go-dl http:200 size:66660837
go version go1.21.13 linux/amd64
⚠️ 注意:
libpcap-dev必须安装——源码编译走 CGO 链接 libpcap(与官方静态二进制不同,自行编译产物是动态链接的)。export PATH只对当前会话生效,长期使用写入/etc/profile.d/go.sh或~/.bashrc。
6.2 下载源码
mkdir -p /opt/src && cd /opt/src
curl -sL -m 180 -o goreplay-1.3.3.tar.gz \
-w "src http:%{http_code} size:%{size_download}\n" \
https://codeload.github.com/buger/goreplay/tar.gz/refs/tags/1.3.3
tar xzf goreplay-1.3.3.tar.gz && cd goreplay-1.3.3
head -5 go.mod
实测回显:
src http:200 size:167822
== go.mod 声明 ==
module github.com/buger/goreplay
go 1.15
require (
6.3 编译与安装
设置国内 Go 模块代理后编译(依赖会自动下载):
export PATH=$PATH:/usr/local/go/bin
export GOPROXY=https://goproxy.cn,direct
cd /opt/src/goreplay-1.3.3
go build -o gor .
ls -la gor && ./gor 2>&1 | head -2
实测回显(依赖下载为节选):
go: downloading github.com/hashicorp/go-uuid v1.0.2
go: downloading github.com/jmespath/go-jmespath v0.3.0
go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: downloading gopkg.in/jcmturner/rpc.v1 v1.1.0
go: downloading gopkg.in/jcmturner/aescts.v1 v1.0.1
-rwxr-xr-x 1 root root 16954064 Oct 25 00:16 gor
2026/10/25 00:16:35 [PPID 3632 and PID 6358] Version:1.3.0
2026/10/25 00:16:35 Required at least 1 input and 1 output
安装到系统 PATH:
mv /opt/src/goreplay-1.3.3/gor /usr/local/bin/gor-src
chmod +x /usr/local/bin/gor-src
gor-src 2>&1 | head -1
实测回显(与官方包同源,运行时同样自报 1.3.0):
2026/10/25 00:16:35 [PPID 3632 and PID 6358] Version:1.3.0
💡 说明:自编译产物约 16.9MB,比官方包(24.5MB)小(构建选项与符号裁剪差异),功能等价。生产建议把二进制命名为独立名字(如
gor-src)与官方包并存验证,确认无误后再替换。
七、方案对比与选择建议
| 维度 | A:官方 tar.gz | B:官方 deb | C:源码编译 |
|---|---|---|---|
| 是否需联网 | 是(GitHub Releases) | 是(GitHub Releases) | 是(源码 + Go 依赖,可全走国内源) |
| 安装方式 | 解压单文件到 PATH | dpkg -i 包管理器 | Go 工具链构建 |
| 安装路径 | 自定(本文 /usr/local/bin/gor) | 固定 /usr/local/bin/gor | 自定 |
| 是否含 systemd unit | 否 | 否(需手写) | 否 |
| libpcap 系统库 | 不需要(静态链接) | 不需要(静态链接) | 需要(libpcap-dev) |
| 版本追踪 | 手动(文件名) | dpkg -l 可查 | git tag/源码目录 |
| 卸载 | 删文件 | dpkg -r gor | 删二进制 |
| 适用场景 | 通用、脚本化批量装机 | Debian/Ubuntu 标准化运维 | 无预编译包平台/二次开发 |
选择建议:可联网的 Linux 服务器首选方案 A(一个文件搞定、路径可控、静态零依赖);Debian/Ubuntu 系且要求包管理可追溯选方案 B;仅在内网无法出国际网络(源码与依赖可走国内 Go 代理)或需修改 GoReplay 自身时选方案 C。三种方案安装的是同一份代码,功能无差异,后续配置与命令完全一致。
八、配置说明(抓包权限与 systemd 托管)
8.1 抓包权限
GoReplay 运行时唯一的环境要求是捕获流量需要 root。官方起步示例均以 sudo ./gor 运行;生产环境建议直接以 root 托管(8.2 的 systemd unit 默认即 root)。若安全策略不允许 root 运行,需授予 gor 二进制抓包能力(setcap cap_net_raw,cap_net_admin+eip /usr/local/bin/gor),但需注意部分内核对非 root 进程抓环回口有限制,出现抓不到包时回到 root 运行。
8.2 systemd 托管(常驻捕获)
生产上 GoReplay 通常作为常驻守护进程运行。官方包不附带 unit 文件,手写 /etc/systemd/system/gor.service:
cat > /etc/systemd/system/gor.service <<'EOF'
[Unit]
Description=GoReplay traffic capture daemon
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/bin/gor --input-raw :8000 --output-stdout
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable gor
systemctl start gor
实测回显(enable 一行):
Created symlink /etc/systemd/system/multi-user.target.wants/gor.service → /etc/systemd/system/gor.service.
逐行说明:ExecStart 先用 --output-stdout 验证捕获链路(抓到的请求直接进 journald,便于 journalctl 观察),生产上把输出插件换成 --output-http http://<测试环境>:8000 或 --output-file;Restart=on-failure 保证异常退出后自动拉起;WantedBy=multi-user.target 使开机自启(systemctl enable 即建立上面回显中的软链)。
验证托管状态:
systemctl is-active gor
systemctl status gor --no-pager
实测回显:
active
● gor.service - GoReplay traffic capture daemon
Loaded: loaded (/etc/systemd/system/gor.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2026-10-25 00:15:53 UTC; 2s ago
Main PID: 2670 (gor)
Tasks: 10 (limit: 3852)
Memory: 10.3M
CPU: 14ms
再产生一笔业务流量,用 journalctl 验证捕获进程真实在抓包(业务应用监听 8000,curl 触发后观察):
curl -s -o /dev/null -w "traffic1:%{http_code}\n" http://127.0.0.1:8000/
curl -s -o /dev/null -w "traffic2:%{http_code}\n" http://127.0.0.1:8000/etc/
sleep 3
journalctl -u gor --no-pager | tail -12
实测回显(前两行为 curl 回显,其余为 journal 抓包记录节选):
traffic1:200
traffic2:200
Oct 25 00:18:37 systemd-server gor[2700]: Host: 127.0.0.1:8000
Oct 25 00:18:37 systemd-server gor[2700]: User-Agent: curl/7.81.0
Oct 25 00:18:37 systemd-server gor[2700]: Accept: */*
Oct 25 00:18:37 systemd-server gor[2700]:
Oct 25 00:18:37 systemd-server gor[2700]: 🐵🙈🙉
Oct 25 00:18:37 systemd-server gor[2700]: 1 cc7c1f407f000001270dcb2e 1792887517185008009 0
Oct 25 00:18:37 systemd-server gor[2700]: GET /etc/ HTTP/1.1
Oct 25 00:18:37 systemd-server gor[2700]: Host: 127.0.0.1:8000
Oct 25 00:18:37 systemd-server gor[2700]: User-Agent: curl/7.81.0
Oct 25 00:18:37 systemd-server gor[2700]: Accept: */*
Oct 25 00:18:37 systemd-server gor[2700]:
Oct 25 00:18:37 systemd-server gor[2700]: 🐵🙈🙉
💡 解读:journal 里能看到完整的 HTTP 请求行、头部与请求体,两个请求之间用
🐵🙈🙉(三只猴子)分隔——这是 GoReplay 端口里 payload 记录的固定分隔符;每条记录前的1 <请求ID> <时间戳> 0行是 GoReplay 内部格式的事件头。看到这些内容即证明 systemd 托管的捕获进程工作正常。
8.3 多版本管理与升降级
GoReplay 无内置升级机制(单二进制),升降级即「换二进制文件」,多版本并存推荐按目录隔离:
# 按版本目录安装(示例:并存 1.3.3 与其他版本)
mkdir -p /opt/gor/1.3.3
tar xzf /opt/gor-dl/gor_1.3.3_x64.tar.gz -C /opt/gor/1.3.3
ln -sf /opt/gor/1.3.3/gor /usr/local/bin/gor
gor 2>&1 | head -1
💡 说明:降级同法——把软链指回旧版本目录并
systemctl restart gor即可;升级前建议先在测试服务器跑通新版本回放,再切生产。跨大版本(1.x → 2.0-rc)参数体系有变化,升级前阅读对应 release notes。
九、常见问题(FAQ)
Q1:GitHub 官方源下载太慢/超时怎么办?
三条路:① 所在网络有 HTTP 代理时给 curl 加 -x http://<代理地址>:<端口>(本文实验环境实测代理通道可用);② 用国内 GitHub 加速镜像前缀(如 https://<镜像域名>/https://github.com/buger/goreplay/releases/download/1.3.3/gor_1.3.3_x64.tar.gz),镜像可用性随时变化,下载后务必核对 SHA256;③ 走方案 C 源码编译——源码 tarball 仅 167KB,且 Go 依赖可用 GOPROXY=https://goproxy.cn,direct 全走国内模块代理。
Q2:下载 URL 用 v1.3.3 返回 404?
GoReplay 的 release tag 无 v 前缀(tag 实为 1.3.3),但 release 标题与徽章显示 v1.3.3。下载地址必须写成 releases/download/1.3.3/gor_1.3.3_x64.tar.gz。实测:https://github.com/buger/goreplay/releases/download/v1.3.3/gor_1.3.3_x64.tar.gz 返回 404 Not Found(http:404 size:9),改为 1.3.3 后 http:200。同理,用 curl -sI 探测 release 页面时会得到 HTTP/2 301(跳转到新组织路径),不影响下载。
Q3:gor --version 报 flag provided but not defined: -version?
正常现象:GoReplay 没有 --version 标志。版本看两处——无参数运行 gor 的首行日志(实测 Version:1.3.0),或帮助文本尾部 Current Version: v1.3.0。注意 1.3.3 的包程序自报 1.3.0(上游未更新版本常量),以包文件名/包管理器记录为准(dpkg -l | grep gor → 1.3.3)。
Q4:启动报 Required at least 1 input and 1 output?
GoReplay 必须同时给输入插件与输出插件(如 --input-raw :8000 --output-http …),只给一边或缺省都会报此错并退出。这不是故障,是缺少参数。
Q5:--input-raw 抓不到包(curl 有流量但 gor 无输出)?
依次排查:① 是否 root 运行(非 root 无抓包权限);② 抓的端口对不对(--input-raw :8000 抓目标端口 8000 的入站流量,注意不是 gor 自己监听的端口);③ 本机回环流量走 lo 接口,gor 1.3.3 会自动同时挂 lo 的 BPF 过滤器(见 4.3 验证 3 的日志回显),若用自定义 BPF(--input-raw-bpf-filter)需自行覆盖回环;④ HTTPS 流量需启用 TLS 捕获相关参数(明文 HTTP 开箱即用)。
Q6:dpkg -i 提示依赖错误或架构不符?
先核对架构:dpkg --print-architecture 应为 amd64(x86_64);ARM 服务器没有官方 deb,改用方案 A 或 C。依赖缺失时 apt-get install -f 修复(本实测中 gor 包无第三方依赖,正常情况不会出现)。
Q7:systemd 托管后 journal 里只有 gor 启动日志、看不到请求内容?
--output-stdout 的内容全部进 journald,用 journalctl -u gor 查看;若想同时落文件,把 ExecStart 的输出插件改为 --output-file /var/log/gor/requests.gor(目录需提前创建)。注意 stdout 版本在高流量下 journal 膨胀很快,验证完尽快切换为 file/http 输出。
十、卸载与清理
# 方案 B(deb 安装)卸载:
dpkg -r gor
# 方案 A(tar.gz)卸载:删除二进制与下载物
rm -f /usr/local/bin/gor
rm -rf /opt/gor-dl /opt/gor
# systemd 托管解除:
systemctl disable --now gor
rm -f /etc/systemd/system/gor.service
systemctl daemon-reload
# 方案 C 卸载:另删 Go 环境与源码目录
rm -rf /usr/local/go /opt/src/goreplay-1.3.3
💡 说明:GoReplay 无数据落盘(除显式
--output-file指定的录制文件),卸载后确认录制文件已按需归档再删。清理后复核:which gor应无输出、systemctl is-active gor应为inactive或单元不存在。
十一、参考链接
- 官方 Releases(安装包下载):https://github.com/buger/goreplay/releases
- 官方 Wiki Getting Started:https://github.com/buger/goreplay/wiki/Getting-Started
- 官方 Wiki Compilation(编译指南):https://github.com/buger/goreplay/wiki/Compilation
- 官网:https://goreplay.org/
- Go 国内下载镜像:https://golang.google.cn/dl/
- Go 模块代理:https://goproxy.cn
- 本专栏系列:《GoReplay v1.3.3 介绍与选型指南》(定位、架构与同类对比)、《GoReplay v1.3.3 配置参数详解》(参数体系与默认值实测)、《GoReplay v1.3.3 常用 CLI 命令与实战详解》(录制/回放/限速/过滤实测)