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

docker-compose.yml

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
version: 2
services:
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服务访问端口,可自行切换

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#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内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://www.cnblogs.com/yloved/p/12649569.html

声明: 猿站网有关资源均来自网络搜集与网友提供,任何涉及商业盈利目的的均不得使用,否则产生的一切后果将由您自己承担! 本平台资源仅供个人学习交流、测试使用 所有内容请在下载后24小时内删除,制止非法恶意传播,不对任何下载或转载者造成的危害负任何法律责任!也请大家支持、购置正版! 。本站一律禁止以任何方式发布或转载任何违法的相关信息访客发现请向站长举报,会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。本网站的资源部分来源于网络,如有侵权烦请发送邮件至:2697268773@qq.com进行处理。
建站知识

小知识:如何使用 docker-compose 搭建 fastDFS文件服务器

2023-3-15 10:26:00

建站知识

小知识:VMware虚拟机没有网络的解决

2023-3-15 10:40:41

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索