一、fastdfs国产分布式文件存储。FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等。
二、搭建
version: "2" services: fastdfs-tracker: image: season/fastdfs:1.2 container_name: fastdfs-tracker restart: always privileged: true ports: - 22122:22122 environment: - TZ=Asia/Shanghai volumes: - /fastdfs/tracker:/fastdfs/tracker command: "tracker" fastdfs-storage: image: season/fastdfs:1.2 container_name: fastdfs-storage restart: always privileged: true ports: - 23000:23000 environment: - TZ=Asia/Shanghai - GROUP_NAME=group1 - TRACKER_SERVER=172.17.230.10:22122 volumes: - /fastdfs/storage/data:/fastdfs/storage/data - /fastdfs/store_path:/fastdfs/store_path command: "storage" depends_on: - fastdfs-tracker fastdfs-nginx: image: season/fastdfs:1.2 container_name: fastdfs-nginx restart: always privileged: true ports: - 8888:8888 environment: - TZ=Asia/Shanghai - TRACKER_SERVER=172.17.230.10:22122 volumes: - ./nginx.conf:/etc/nginx/conf/nginx.conf - /fastdfs/store_path:/fastdfs/store_path command: "nginx" depends_on: - fastdfs-tracker
nginx.conf
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8888; server_name localhost; location / { ngx_fastdfs_module; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
三、问题
1、TRACKER_SERVER,不能配置docker域名,nginx有IP跳转,不能识别docker内部的IP,也可以改变网络形式network_mode: host,但是IP还是得配置成物理IP。这里网上说需要改成host的网络类型,实际可以通过bridge模式。
2、nginx的配置不能配置组名,亲测运行时/etc/fdsf/mod_fastdfs.conf被修改的很奇怪。
3、nginx代理通过ngx_fastdfs_module模块进行,所以需要代理实际的文件路径,比如:/fastdfs/store_path。主要是通过该路径进行文件查询。
标签:文件,fastdfs,nginx,tracker,path,docker,store,搭建 From: https://www.cnblogs.com/ll409546297/p/17445965.html