广告
返回顶部
首页 > 资讯 > 服务器 >使用docker compose安装FastDfs文件服务器的实例详解
  • 424
分享到

使用docker compose安装FastDfs文件服务器的实例详解

2024-04-02 19:04:59 424人浏览 薄情痞子
摘要

Docker-compose.yml version: '2' services: fastdfs-tracker: hostname: fastdfs-

Docker-compose.yml


version: '2'
services:
    fastdfs-tracker:
        hostname: fastdfs-tracker
        container_name: fastdfs-tracker
        image: season/fastdfs:1.2
        network_mode: "host"
        command: tracker
        volumes:
          - ./tracker_data:/fastdfs/tracker/data
    fastdfs-storage:
        hostname: fastdfs-storage
        container_name: fastdfs-storage
        image: season/fastdfs:1.2
        network_mode: "host"
        volumes:
          - ./storage_data:/fastdfs/storage/data
          - ./store_path:/fastdfs/store_path
        environment:
          - TRACKER_SERVER=xxx.xxx.xxx.xxx:22122
        command: storage
        depends_on:
          - fastdfs-tracker
    fastdfs-Nginx:
        hostname: fastdfs-nginx
        container_name: fastdfs-nginx
        image: season/fastdfs:1.2
        network_mode: "host"
        volumes:
          - ./nginx.conf:/etc/nginx/conf/nginx.conf
          - ./store_path:/fastdfs/store_path
        environment:
          - TRACKER_SERVER=xxx.xxx.xxx.xxx:22122
        command: nginx

需要注意:
network_mode 必须是host, 原因是当上传文件时,tracker会把storage的IP和端口发给client,如果是bridge模式,则发送的是内网IP,client无法访问到。
image采用season/fastdfs:1.2 不要用lastest, 因为lastest不包含nginx服务,其他fasdfs镜像均没有season的精简。

nginx.conf(用于提供Http的方式下载文件)

listen 7003是ngingx服务访问端口,可自行切换


#user  nobody;
worker_processes  1;
 
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
 
#pid        logs/nginx.pid;
 
 
events {
    worker_connections  1024;
}
 
 
http {
    include       mime.types;
    default_type  application/octet-stream;
 
    #log_fORMat  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
 
    #access_log  logs/access.log  main;
 
    sendfile        on;
    #tcp_nopush     on;
 
    #keepalive_timeout  0;
    keepalive_timeout  65;
 
    #gzip  on;
 
    server {
        listen       7003;
        server_name  localhost;
 
        #charset koi8-r;
 
        #access_log  logs/host.access.log  main;
 
        location /group1/M00 {
            root /fastdfs/storage/data;
            ngx_fastdfs_module;
        }
 
        #error_page  404              /404.html;
 
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
 }
}

到此这篇关于使用docker-compose安装FastDfs文件服务器的文章就介绍到这了,更多相关docker-compose安装FastDfs内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!

--结束END--

本文标题: 使用docker compose安装FastDfs文件服务器的实例详解

本文链接: https://www.lsjlt.com/news/154524.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作