使用p2p实现Linux内网快速分发文件

安装opentracker

方法一:编译安装

参考如下官方文档进行操作即可,国内下载源码会比较慢
https://erdgeist.org/arts/software/opentracker/

编译完成后会生成可执行文件opentracker和opentracker.debug

可以直接./opentracker.debug进行验证

方法二:使用lednerb/opentracker-docker镜像进行部署

docker部署的方式可以参考
https://github.com/Lednerb/opentracker-docker

这里选择在kubernetes集群上部署

bash 复制代码
cat > opentracker-ingress-service-deployment.yaml << EOF
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: opentracker-ingress
spec:
  defaultBackend:
    service:
      name: opentracker-service
      port:
        number: 6969
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: opentracker-service
  name: opentracker-service
spec:
  ports:
    - name: tcp-6969
      protocol: TCP
      port: 6969
      targetPort: 6969
    - name: udp-6969
      protocol: UDP
      port: 6969
      targetPort: 6969
  selector:
    app: opentracker-pod
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: opentracker-deploy
  name: opentracker-deploy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: opentracker-pod
  strategy: {}
  template:
    metadata:
      labels:
        app: opentracker-pod
    spec:
      containers:
      - image: lednerb/opentracker-docker
        name: opentracker
        ports:
        - containerPort: 6969
EOF

kubectl apply -f opentracker-ingress-service-deployment.yaml

测试

制作torrent种子

这里使用ctorrent制作种子

假设tracker服务器IP=192.168.122.21

bash 复制代码
ctorrent -t -u "http://192.168.122.21:6969/announce" -s yourfile.tgz.torrent yourfile.tgz

启动初始上传服务

让制作的种子和文件存在于同一文件夹中,执行如下命令就会自动做种

bash 复制代码
ctorrent yourfile.tgz.torrent

下载

下载可以使用支持BitTorrent协议的任意客户端,这里使用aria2进行测试

假设把上面的种子文件已经放到了tracker服务器的httpd根目录下

bash 复制代码
aria2c  http://192.168.122.21/yourfile.tgz.torrent

下载完成后会自动做种一段时间,最后自动退出

参考:

使用BT协议构建软件快速分发系统(可用于Linux内网快速分发文件)

来自 https://blog.csdn.net/Jailman/article/details/86231517

opentracker 搭建自己的 BT Tracker 服务器

来自 https://blog.wudinaonao.com/2020/12/24/opentracker搭建自己的BT-Tracker服务器/

相关推荐
程序员JerrySUN1 分钟前
驱动开发硬核特训 · Day 19:字符设备驱动实战(控制 LED)
linux·驱动开发
小灰灰__17 分钟前
Linux安装ffmpeg7.1操作说明
linux·运维·服务器
猿周LV21 分钟前
网络原理 - 应用层, 传输层(UDP 和 TCP) 进阶, 网络层, 数据链路层 [Java EE]
服务器·网络·网络协议·tcp/ip·udp·java-ee
互联网搬砖老肖24 分钟前
运维打铁:Centos 7 安装 redis_exporter 1.3.5
运维·redis·centos
Zz_waiting.26 分钟前
网络原理 - 9
linux·服务器·网络·网络协议·tcp/ip
你又食言了哦41 分钟前
linux下使用wireshark捕捉snmp报文
linux·网络·wireshark
BXCQ_xuan1 小时前
Typecho博客网站头部SEO优化完整指南
运维·服务器·数据库·php·web
fyr897572 小时前
Ubuntu 下编译goldfish内核并使用模拟器运行
android·linux
鱼饼6号3 小时前
Jenkins Pipeline 构建 CI/CD 流程
linux·运维·服务器·ci/cd·容器·jenkins
努力做小白3 小时前
Linux扩展
linux·c语言·笔记